Commit 78d5d7bc authored by wanglei's avatar wanglei

...fcm测试

parent a985083f
...@@ -3,13 +3,17 @@ package com.base.pdfviewerscannerwhite.ui.set ...@@ -3,13 +3,17 @@ package com.base.pdfviewerscannerwhite.ui.set
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.activity.addCallback import androidx.activity.addCallback
import com.base.pdfviewerscannerwhite.BuildConfig
import com.base.pdfviewerscannerwhite.R import com.base.pdfviewerscannerwhite.R
import com.base.pdfviewerscannerwhite.databinding.ActivitySetBinding import com.base.pdfviewerscannerwhite.databinding.ActivitySetBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity import com.base.pdfviewerscannerwhite.helper.BaseActivity
import com.base.pdfviewerscannerwhite.helper.ConfigHelper import com.base.pdfviewerscannerwhite.helper.ConfigHelper
import com.base.pdfviewerscannerwhite.helper.MyApplication import com.base.pdfviewerscannerwhite.helper.MyApplication
import com.base.pdfviewerscannerwhite.ui.view.RateDialog.showRateDialog import com.base.pdfviewerscannerwhite.ui.view.RateDialog.showRateDialog
import com.base.pdfviewerscannerwhite.utils.AppPreferences
import com.base.pdfviewerscannerwhite.utils.ClipboardUtils.copyText
import com.base.pdfviewerscannerwhite.utils.LogEx import com.base.pdfviewerscannerwhite.utils.LogEx
import com.base.pdfviewerscannerwhite.utils.ToastUtils.toast
class SetActivity : BaseActivity<ActivitySetBinding>() { class SetActivity : BaseActivity<ActivitySetBinding>() {
...@@ -50,11 +54,21 @@ class SetActivity : BaseActivity<ActivitySetBinding>() { ...@@ -50,11 +54,21 @@ class SetActivity : BaseActivity<ActivitySetBinding>() {
} }
binding.llTerm.setOnClickListener { binding.llTerm.setOnClickListener {
val intent = Intent( if (BuildConfig.DEBUG) {
Intent.ACTION_VIEW, val token = AppPreferences.getInstance().getString("token", "null") ?: "null"
Uri.parse(ConfigHelper.termService) if (token != "null") {
) copyText("token", token)
startActivity(intent) toast("token copy")
} else {
toast("token null")
}
} else {
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse(ConfigHelper.termService)
)
startActivity(intent)
}
} }
binding.llLanguage.setOnClickListener { binding.llLanguage.setOnClickListener {
startActivity(Intent(this, SetLanguageActivity::class.java).apply { startActivity(Intent(this, SetLanguageActivity::class.java).apply {
......
package com.base.pdfviewerscannerwhite.utils
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
object ClipboardUtils {
fun Context.copyText(label: String, text: String) {
val clipboard: ClipboardManager = getSystemService(AppCompatActivity.CLIPBOARD_SERVICE) as ClipboardManager
// 创建一个ClipData对象,其中包含要复制的文本
// val clip = ClipData.newPlainText("uuid", "uuid=$uuid gid=$gid")
val clip = ClipData.newPlainText(label, text)
// 将ClipData对象设置到剪贴板中
clipboard.setPrimaryClip(clip)
}
}
\ 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