Commit d6a1ce42 authored by wanglei's avatar wanglei

使用功能广告

parent bc915c63
...@@ -114,11 +114,22 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC ...@@ -114,11 +114,22 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC
toast("没实现") toast("没实现")
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(tempImagePath).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
} }
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -126,6 +137,36 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC ...@@ -126,6 +137,36 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { binding.flSearch.setOnClickListener {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useSearch()
}
override fun failed(where: Int) {
useSearch()
}
override fun googleFailed(where: Int) {
useSearch()
}
})
} else {
useSearch()
}
}
}
fun useDownload() {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
}
fun useSearch() {
try { try {
val intent = intentWriteContract(contractUIBean) val intent = intentWriteContract(contractUIBean)
startActivity(intent) startActivity(intent)
...@@ -133,8 +174,6 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC ...@@ -133,8 +174,6 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC
toast("No application was found to handle the add contract", true) toast("No application was found to handle the add contract", true)
} }
}
} }
} }
\ No newline at end of file
...@@ -96,7 +96,7 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo ...@@ -96,7 +96,7 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
} }
}) })
} }
}else{ } else {
finishToMainTop() finishToMainTop()
} }
binding.flBack.setOnClickListener { binding.flBack.setOnClickListener {
...@@ -113,11 +113,22 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo ...@@ -113,11 +113,22 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
toast("没实现") toast("没实现")
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(tempImagePath).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
} }
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -125,6 +136,36 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo ...@@ -125,6 +136,36 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { binding.flSearch.setOnClickListener {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useSearch()
}
override fun failed(where: Int) {
useSearch()
}
override fun googleFailed(where: Int) {
useSearch()
}
})
} else {
useSearch()
}
}
}
fun useDownload() {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
}
fun useSearch() {
val intent = intentSendEmail(email) val intent = intentSendEmail(email)
try { try {
startActivity(intent) startActivity(intent)
...@@ -132,5 +173,5 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo ...@@ -132,5 +173,5 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
toast("No application was found to handle the email request", true) toast("No application was found to handle the email request", true)
} }
} }
}
} }
\ No newline at end of file
...@@ -116,11 +116,22 @@ class EventCodeActivity : BaseActivity<ActivityEventCodeBinding>(ActivityEventCo ...@@ -116,11 +116,22 @@ class EventCodeActivity : BaseActivity<ActivityEventCodeBinding>(ActivityEventCo
toast("没实现") toast("没实现")
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(tempImagePath).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
} }
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -128,6 +139,36 @@ class EventCodeActivity : BaseActivity<ActivityEventCodeBinding>(ActivityEventCo ...@@ -128,6 +139,36 @@ class EventCodeActivity : BaseActivity<ActivityEventCodeBinding>(ActivityEventCo
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { binding.flSearch.setOnClickListener {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useSearch()
}
override fun failed(where: Int) {
useSearch()
}
override fun googleFailed(where: Int) {
useSearch()
}
})
} else {
useSearch()
}
}
}
fun useDownload() {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
}
fun useSearch() {
val intent = intentAddCalendar(eventUIBean) val intent = intentAddCalendar(eventUIBean)
try { try {
startActivity(intent) startActivity(intent)
...@@ -136,6 +177,5 @@ class EventCodeActivity : BaseActivity<ActivityEventCodeBinding>(ActivityEventCo ...@@ -136,6 +177,5 @@ class EventCodeActivity : BaseActivity<ActivityEventCodeBinding>(ActivityEventCo
toast("No application was found to handle the calendar event request", true) toast("No application was found to handle the calendar event request", true)
} }
} }
}
} }
\ No newline at end of file
...@@ -94,7 +94,7 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes ...@@ -94,7 +94,7 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes
finishToMainTop() finishToMainTop()
} }
}) })
}else{ } else {
finishToMainTop() finishToMainTop()
} }
} }
...@@ -111,11 +111,22 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes ...@@ -111,11 +111,22 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes
toast("没实现") toast("没实现")
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(tempImagePath).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
}
override fun failed(where: Int) {
useDownload()
} }
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -123,6 +134,27 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes ...@@ -123,6 +134,27 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { binding.flSearch.setOnClickListener {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useSearch()
}
override fun failed(where: Int) {
useSearch()
}
override fun googleFailed(where: Int) {
useSearch()
}
})
} else {
useSearch()
}
}
}
fun useSearch() {
val intent = intentSendSms(messageUIBean) val intent = intentSendSms(messageUIBean)
try { try {
startActivity(intent) startActivity(intent)
...@@ -131,6 +163,14 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes ...@@ -131,6 +163,14 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes
toast("No application was found to handle the send message request", true) toast("No application was found to handle the send message request", true)
} }
} }
fun useDownload() {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
} }
} }
\ No newline at end of file
...@@ -114,11 +114,22 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro ...@@ -114,11 +114,22 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro
} }
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(qrString).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
} }
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -126,7 +137,37 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro ...@@ -126,7 +137,37 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { binding.flSearch.setOnClickListener {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useSearch()
}
override fun failed(where: Int) {
useSearch()
}
override fun googleFailed(where: Int) {
useSearch()
}
})
} else {
useSearch()
}
}
}
fun useDownload() {
kotlin.runCatching {
val newName = File(qrString).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
}
fun useSearch(){
val intent = Intent(Intent.ACTION_VIEW) val intent = Intent(Intent.ACTION_VIEW)
intent.setData(Uri.parse("https://www.google.com/search?q=${productUIBean.content}")) intent.setData(Uri.parse("https://www.google.com/search?q=${productUIBean.content}"))
...@@ -137,6 +178,5 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro ...@@ -137,6 +178,5 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro
Toast.makeText(this, "No application was found to handle the search request", Toast.LENGTH_SHORT).show() Toast.makeText(this, "No application was found to handle the search request", Toast.LENGTH_SHORT).show()
} }
} }
}
} }
\ No newline at end of file
...@@ -97,7 +97,7 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit ...@@ -97,7 +97,7 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit
finishToMainTop() finishToMainTop()
} }
}) })
}else{ } else {
finishToMainTop() finishToMainTop()
} }
} }
...@@ -111,11 +111,22 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit ...@@ -111,11 +111,22 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit
} }
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(tempImagePath).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
} }
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -126,16 +137,49 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit ...@@ -126,16 +137,49 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit
if (!checkCallPhonePermission()) { if (!checkCallPhonePermission()) {
launcher.launch(arrayOf(Manifest.permission.CALL_PHONE)) { launcher.launch(arrayOf(Manifest.permission.CALL_PHONE)) {
if (checkCallPhonePermission()) { if (checkCallPhonePermission()) {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
callPhone() callPhone()
} }
override fun failed(where: Int) {
callPhone()
} }
override fun googleFailed(where: Int) {
callPhone()
}
})
} else { } else {
callPhone() callPhone()
} }
} }
} }
} else {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
callPhone()
}
override fun failed(where: Int) {
callPhone()
}
override fun googleFailed(where: Int) {
callPhone()
}
})
} else {
callPhone()
}
}
}
}
private fun callPhone() { private fun callPhone() {
try { try {
val intent = intentCallPhone(telephoneUIBean.tel) val intent = intentCallPhone(telephoneUIBean.tel)
startActivity(intent) startActivity(intent)
...@@ -145,4 +189,13 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit ...@@ -145,4 +189,13 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit
} }
private fun useDownload() {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
}
} }
\ No newline at end of file
...@@ -111,11 +111,22 @@ class TextCodeActivity : BaseActivity<ActivityTextCodeBinding>(ActivityTextCodeB ...@@ -111,11 +111,22 @@ class TextCodeActivity : BaseActivity<ActivityTextCodeBinding>(ActivityTextCodeB
toast("没实现") toast("没实现")
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(tempImagePath).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
} }
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -123,7 +134,36 @@ class TextCodeActivity : BaseActivity<ActivityTextCodeBinding>(ActivityTextCodeB ...@@ -123,7 +134,36 @@ class TextCodeActivity : BaseActivity<ActivityTextCodeBinding>(ActivityTextCodeB
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { binding.flSearch.setOnClickListener {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useSearch()
}
override fun failed(where: Int) {
useSearch()
}
override fun googleFailed(where: Int) {
useSearch()
}
})
} else {
useSearch()
}
}
}
fun useDownload() {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
}
fun useSearch() {
val intent = Intent(Intent.ACTION_VIEW) val intent = Intent(Intent.ACTION_VIEW)
intent.setData(Uri.parse("https://www.google.com/search?q=${textUIBean.content}")) intent.setData(Uri.parse("https://www.google.com/search?q=${textUIBean.content}"))
...@@ -134,7 +174,6 @@ class TextCodeActivity : BaseActivity<ActivityTextCodeBinding>(ActivityTextCodeB ...@@ -134,7 +174,6 @@ class TextCodeActivity : BaseActivity<ActivityTextCodeBinding>(ActivityTextCodeB
Toast.makeText(this, "No application was found to handle the search request", Toast.LENGTH_SHORT).show() Toast.makeText(this, "No application was found to handle the search request", Toast.LENGTH_SHORT).show()
} }
} }
}
} }
\ No newline at end of file
...@@ -81,7 +81,7 @@ class WebsiteCodeActivity : BaseActivity<ActivityWebsiteCodeBinding>(ActivityWeb ...@@ -81,7 +81,7 @@ class WebsiteCodeActivity : BaseActivity<ActivityWebsiteCodeBinding>(ActivityWeb
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
if (AdConfigBean.adsConfigBean.functionBackShowAd) { if (AdConfigBean.adsConfigBean.functionBackShowAd) {
AdsMgr.showInsert(this@WebsiteCodeActivity, false, object : AdsShowCallBack() { AdsMgr.showInsert(this@WebsiteCodeActivity, true, object : AdsShowCallBack() {
override fun close(where: Int) { override fun close(where: Int) {
finishToMainTop() finishToMainTop()
} }
......
...@@ -130,11 +130,22 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB ...@@ -130,11 +130,22 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB
toast("没有做") toast("没有做")
} }
binding.llDownload.setOnClickListener { binding.llDownload.setOnClickListener {
kotlin.runCatching { if (AdConfigBean.adsConfigBean.functionUseShowAd) {
val newName = File(tempImagePath).name AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
showInputNameDialog(newName) { name -> override fun close(where: Int) {
viewModel.copyFileToDownloads(this, name, tempImagePath) useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
} }
})
} else {
useDownload()
} }
} }
binding.llCopy.setOnClickListener { binding.llCopy.setOnClickListener {
...@@ -142,9 +153,22 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB ...@@ -142,9 +153,22 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB
toast("Copied to clipboard", true) toast("Copied to clipboard", true)
} }
binding.flSearch.setOnClickListener { binding.flSearch.setOnClickListener {
val wifiIntent = intentWifiSettings() if (AdConfigBean.adsConfigBean.functionUseShowAd){
kotlin.runCatching { AdsMgr.showInsert(this,true,object :AdsShowCallBack(){
startActivity(wifiIntent) override fun close(where: Int) {
useSearch()
}
override fun failed(where: Int) {
useSearch()
}
override fun googleFailed(where: Int) {
useSearch()
}
})
}else{
useSearch()
} }
} }
} }
...@@ -156,4 +180,20 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB ...@@ -156,4 +180,20 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB
} }
} }
fun useDownload() {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
}
}
fun useSearch() {
val wifiIntent = intentWifiSettings()
kotlin.runCatching {
startActivity(wifiIntent)
}
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment