Commit d6a1ce42 authored by wanglei's avatar wanglei

使用功能广告

parent bc915c63
......@@ -114,11 +114,22 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC
toast("没实现")
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -126,13 +137,41 @@ class ContractCodeActivity : BaseActivity<ActivityContractCodeBinding>(ActivityC
toast("Copied to clipboard", true)
}
binding.flSearch.setOnClickListener {
try {
val intent = intentWriteContract(contractUIBean)
startActivity(intent)
} catch (e: Exception) {
toast("No application was found to handle the add contract", true)
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 {
val intent = intentWriteContract(contractUIBean)
startActivity(intent)
} catch (e: Exception) {
toast("No application was found to handle the add contract", true)
}
}
......
......@@ -96,7 +96,7 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
}
})
}
}else{
} else {
finishToMainTop()
}
binding.flBack.setOnClickListener {
......@@ -113,11 +113,22 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
toast("没实现")
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -125,12 +136,42 @@ class EmailCodeActivity : BaseActivity<ActivityEmailCodeBinding>(ActivityEmailCo
toast("Copied to clipboard", true)
}
binding.flSearch.setOnClickListener {
val intent = intentSendEmail(email)
try {
startActivity(intent)
} catch (e: Exception) {
toast("No application was found to handle the email request", true)
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)
try {
startActivity(intent)
} catch (e: Exception) {
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
toast("没实现")
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -128,14 +139,43 @@ class EventCodeActivity : BaseActivity<ActivityEventCodeBinding>(ActivityEventCo
toast("Copied to clipboard", true)
}
binding.flSearch.setOnClickListener {
val intent = intentAddCalendar(eventUIBean)
try {
startActivity(intent)
finish()
} catch (e: Exception) {
toast("No application was found to handle the calendar event request", true)
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)
try {
startActivity(intent)
finish()
} catch (e: Exception) {
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
finishToMainTop()
}
})
}else{
} else {
finishToMainTop()
}
}
......@@ -111,11 +111,22 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes
toast("没实现")
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -123,12 +134,41 @@ class MessageCodeActivity : BaseActivity<ActivityMessageCodeBinding>(ActivityMes
toast("Copied to clipboard", true)
}
binding.flSearch.setOnClickListener {
val intent = intentSendSms(messageUIBean)
try {
startActivity(intent)
finish()
} catch (e: Exception) {
toast("No application was found to handle the send message request", true)
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)
try {
startActivity(intent)
finish()
} catch (e: Exception) {
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)
}
}
}
......
......@@ -114,11 +114,22 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro
}
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(qrString).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -126,17 +137,46 @@ class ProductCodeActivity : BaseActivity<ActivityProductCodeBinding>(ActivityPro
toast("Copied to clipboard", true)
}
binding.flSearch.setOnClickListener {
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useSearch()
}
val intent = Intent(Intent.ACTION_VIEW)
intent.setData(Uri.parse("https://www.google.com/search?q=${productUIBean.content}"))
override fun failed(where: Int) {
useSearch()
}
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
toast("")
Toast.makeText(this, "No application was found to handle the search request", Toast.LENGTH_SHORT).show()
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)
intent.setData(Uri.parse("https://www.google.com/search?q=${productUIBean.content}"))
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
toast("")
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
finishToMainTop()
}
})
}else{
} else {
finishToMainTop()
}
}
......@@ -111,11 +111,22 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit
}
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -126,16 +137,49 @@ class TelephoneCodeActivity : BaseActivity<ActivityTelephoneCodeBinding>(Activit
if (!checkCallPhonePermission()) {
launcher.launch(arrayOf(Manifest.permission.CALL_PHONE)) {
if (checkCallPhonePermission()) {
callPhone()
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()
}
}
}
} else {
callPhone()
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() {
try {
val intent = intentCallPhone(telephoneUIBean.tel)
startActivity(intent)
......@@ -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
toast("没实现")
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -123,18 +134,46 @@ class TextCodeActivity : BaseActivity<ActivityTextCodeBinding>(ActivityTextCodeB
toast("Copied to clipboard", true)
}
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()
}
val intent = Intent(Intent.ACTION_VIEW)
intent.setData(Uri.parse("https://www.google.com/search?q=${textUIBean.content}"))
override fun googleFailed(where: Int) {
useSearch()
}
})
} else {
useSearch()
}
}
}
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
toast("")
Toast.makeText(this, "No application was found to handle the search request", Toast.LENGTH_SHORT).show()
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)
intent.setData(Uri.parse("https://www.google.com/search?q=${textUIBean.content}"))
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
toast("")
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
super.initListener()
onBackPressedDispatcher.addCallback {
if (AdConfigBean.adsConfigBean.functionBackShowAd) {
AdsMgr.showInsert(this@WebsiteCodeActivity, false, object : AdsShowCallBack() {
AdsMgr.showInsert(this@WebsiteCodeActivity, true, object : AdsShowCallBack() {
override fun close(where: Int) {
finishToMainTop()
}
......
......@@ -130,11 +130,22 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB
toast("没有做")
}
binding.llDownload.setOnClickListener {
kotlin.runCatching {
val newName = File(tempImagePath).name
showInputNameDialog(newName) { name ->
viewModel.copyFileToDownloads(this, name, tempImagePath)
}
if (AdConfigBean.adsConfigBean.functionUseShowAd) {
AdsMgr.showInsert(this, true, object : AdsShowCallBack() {
override fun close(where: Int) {
useDownload()
}
override fun failed(where: Int) {
useDownload()
}
override fun googleFailed(where: Int) {
useDownload()
}
})
} else {
useDownload()
}
}
binding.llCopy.setOnClickListener {
......@@ -142,9 +153,22 @@ class WifiCodeActivity : BaseActivity<ActivityWifiCodeBinding>(ActivityWifiCodeB
toast("Copied to clipboard", true)
}
binding.flSearch.setOnClickListener {
val wifiIntent = intentWifiSettings()
kotlin.runCatching {
startActivity(wifiIntent)
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()
}
}
}
......@@ -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