|
|
@ -1,7 +1,5 @@ |
|
|
|
package io.legado.app.ui.about |
|
|
|
package io.legado.app.ui.about |
|
|
|
|
|
|
|
|
|
|
|
import android.content.ClipData |
|
|
|
|
|
|
|
import android.content.ClipboardManager |
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.content.Intent |
|
|
|
import android.content.Intent |
|
|
|
import android.net.Uri |
|
|
|
import android.net.Uri |
|
|
@ -11,6 +9,7 @@ import androidx.preference.Preference |
|
|
|
import androidx.preference.PreferenceFragmentCompat |
|
|
|
import androidx.preference.PreferenceFragmentCompat |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.utils.ACache |
|
|
|
import io.legado.app.utils.ACache |
|
|
|
|
|
|
|
import io.legado.app.utils.sendToClip |
|
|
|
import io.legado.app.utils.toast |
|
|
|
import io.legado.app.utils.toast |
|
|
|
import org.jetbrains.anko.longToast |
|
|
|
import org.jetbrains.anko.longToast |
|
|
|
import java.net.URLEncoder |
|
|
|
import java.net.URLEncoder |
|
|
@ -39,7 +38,7 @@ class DonateFragment : PreferenceFragmentCompat() { |
|
|
|
"qqSkRwm" -> openIntent(Intent.ACTION_VIEW, qqSkRwmUrl) |
|
|
|
"qqSkRwm" -> openIntent(Intent.ACTION_VIEW, qqSkRwmUrl) |
|
|
|
"zfbSk" -> aliDonate(requireContext()) |
|
|
|
"zfbSk" -> aliDonate(requireContext()) |
|
|
|
"zfbHbSsm" -> getZfbHb(requireContext()) |
|
|
|
"zfbHbSsm" -> getZfbHb(requireContext()) |
|
|
|
"gzGzh" -> sendToClip("开源阅读软件") |
|
|
|
"gzGzh" -> requireContext().sendToClip("开源阅读软件") |
|
|
|
} |
|
|
|
} |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
} |
|
|
|
} |
|
|
@ -55,18 +54,8 @@ class DonateFragment : PreferenceFragmentCompat() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun sendToClip(text: String) { |
|
|
|
|
|
|
|
val clipboard = |
|
|
|
|
|
|
|
requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager |
|
|
|
|
|
|
|
val clipData = ClipData.newPlainText(null, text) |
|
|
|
|
|
|
|
clipboard?.let { |
|
|
|
|
|
|
|
clipboard.setPrimaryClip(clipData) |
|
|
|
|
|
|
|
toast(R.string.copy_complete) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun getZfbHb(context: Context) { |
|
|
|
private fun getZfbHb(context: Context) { |
|
|
|
sendToClip("537954522") |
|
|
|
requireContext().sendToClip("537954522") |
|
|
|
context.longToast("高级功能已开启\n红包码已复制\n支付宝首页搜索“537954522” 立即领红包") |
|
|
|
context.longToast("高级功能已开启\n红包码已复制\n支付宝首页搜索“537954522” 立即领红包") |
|
|
|
try { |
|
|
|
try { |
|
|
|
val packageManager = context.applicationContext.packageManager |
|
|
|
val packageManager = context.applicationContext.packageManager |
|
|
|