Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d0fefdecf | ||
|
|
65dd927d07 | ||
|
|
42b38f5b81 | ||
|
|
087bbf52d4 | ||
|
|
2b8e9b7923 | ||
|
|
855fa3e970 | ||
|
|
0849ff3875 |
No files matched your search
@@ -19,8 +19,8 @@ android {
|
||||
applicationId = "com.iptv807.tv"
|
||||
minSdk = 21
|
||||
targetSdk = 35
|
||||
versionCode = 945
|
||||
versionName = "9.4.5"
|
||||
versionCode = 961
|
||||
versionName = "9.6.1"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
@@ -45,6 +45,18 @@ object AuthApi {
|
||||
val installId: Long = 0
|
||||
)
|
||||
|
||||
/** 授权系统公告(AnnouncementController → GET /api/public/announcements) */
|
||||
data class Announcement(
|
||||
val id: Int = 0,
|
||||
val title: String = "",
|
||||
val content: String = "",
|
||||
val type: String = "notice", // system / update / promo / notice
|
||||
val isTop: Boolean = false,
|
||||
val isPopup: Boolean = false, // 后台「弹窗」开关
|
||||
val linkUrl: String = "",
|
||||
val createdAt: String = ""
|
||||
)
|
||||
|
||||
/** 当前应用版本号(用于 client_version 与版本比较) */
|
||||
fun clientVersion(ctx: Context): String = try {
|
||||
ctx.packageManager.getPackageInfo(ctx.packageName, 0).versionName ?: "0.0.0"
|
||||
@@ -93,6 +105,39 @@ object AuthApi {
|
||||
return info
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取授权系统公告(网络请求,必须放后台线程)
|
||||
* GET /api/public/announcements?target=client&project_id=2&limit=10
|
||||
* 无需 X-Api-Key(实测无 Key 也 200)
|
||||
* 过滤:status=1 + 生效期内 + target∈{all,client} + project_id∈{null,2}
|
||||
* 返回:data.list 全部有效公告;data.popup 里 is_popup=1 的(后台"弹窗"开关)
|
||||
*/
|
||||
fun fetchAnnouncements(projectId: Int = 2, limit: Int = 10): List<Announcement> {
|
||||
val path = "/api/public/announcements?target=client&project_id=$projectId&limit=" +
|
||||
limit.coerceIn(1, 50)
|
||||
val r = get(path)
|
||||
if (r.optInt("code", 0) != 200) {
|
||||
lastError = "公告 code=${r.optInt("code", 0)} ${r.optString("message")}"
|
||||
return emptyList()
|
||||
}
|
||||
val arr = r.optJSONObject("data")?.optJSONArray("list") ?: return emptyList()
|
||||
val out = ArrayList<Announcement>()
|
||||
for (i in 0 until arr.length()) {
|
||||
val o = arr.optJSONObject(i) ?: continue
|
||||
out.add(Announcement(
|
||||
id = o.optInt("id", 0),
|
||||
title = o.optString("title"),
|
||||
content = o.optString("content"),
|
||||
type = o.optString("type", "notice"),
|
||||
isTop = o.optInt("is_top", 0) == 1,
|
||||
isPopup = o.optInt("is_popup", 0) == 1,
|
||||
linkUrl = o.optString("link_url"),
|
||||
createdAt = o.optString("created_at")
|
||||
))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
/** 心跳:仅更新在线时间(网络请求,必须放后台线程) */
|
||||
@JvmOverloads
|
||||
fun heartbeat(machineId: String, cardKey: String = "", ctx: Context? = null): Boolean {
|
||||
@@ -107,6 +152,25 @@ object AuthApi {
|
||||
return ok
|
||||
}
|
||||
|
||||
/** GET 请求(公告接口是 GET,且不需要 X-Api-Key) */
|
||||
private fun get(path: String): JSONObject = try {
|
||||
val conn = (URL(BASE + path).openConnection() as HttpURLConnection).apply {
|
||||
requestMethod = "GET"
|
||||
connectTimeout = 10_000
|
||||
readTimeout = 15_000
|
||||
setRequestProperty("Accept", "application/json")
|
||||
setRequestProperty("User-Agent", "iptv807-tv")
|
||||
}
|
||||
val code = conn.responseCode
|
||||
val stream = if (code in 200..299) conn.inputStream else conn.errorStream
|
||||
val text = stream?.bufferedReader()?.use(BufferedReader::readText) ?: ""
|
||||
conn.disconnect()
|
||||
JSONObject(if (text.isBlank()) "{}" else text)
|
||||
} catch (e: Exception) {
|
||||
lastError = "GET ${e.javaClass.simpleName}: ${e.message}"
|
||||
JSONObject()
|
||||
}
|
||||
|
||||
private fun post(path: String, body: JSONObject): JSONObject {
|
||||
return try {
|
||||
val conn = (URL(BASE + path).openConnection() as HttpURLConnection).apply {
|
||||
|
||||
@@ -92,8 +92,33 @@ object LicenseClient {
|
||||
return code
|
||||
}
|
||||
|
||||
// ===== 免费时长控制(每天1小时)=====
|
||||
// ===== 免费时长控制 =====
|
||||
// 主方案:首 7 天完整体验(不限时)→ 第 8 天起每天 1 小时
|
||||
const val FREE_DAILY_MS = 60 * 60 * 1000L
|
||||
const val FREE_TRIAL_DAYS = 7
|
||||
|
||||
/** 首次安装时间(卸载重装会重新计时,即重新获得 7 天完整体验) */
|
||||
private fun firstInstallAt(ctx: Context): Long {
|
||||
val prefs = ctx.getSharedPreferences("iptv_license", Context.MODE_PRIVATE)
|
||||
val saved = prefs.getLong("first_install_at", 0L)
|
||||
if (saved > 0L) return saved
|
||||
val now = System.currentTimeMillis()
|
||||
prefs.edit().putLong("first_install_at", now).apply()
|
||||
return now
|
||||
}
|
||||
|
||||
/**
|
||||
* 免费试用剩余天数:>0 表示还在完整试用期,0 表示已降级为每日 1 小时
|
||||
* 试用期内:不限时长、不计用量
|
||||
*/
|
||||
fun trialDaysLeft(ctx: Context): Int {
|
||||
val start = firstInstallAt(ctx)
|
||||
val day = ((System.currentTimeMillis() - start) / (24 * 60 * 60 * 1000L)).toInt()
|
||||
return (FREE_TRIAL_DAYS - day).coerceAtLeast(0)
|
||||
}
|
||||
|
||||
/** 是否在首 7 天完整试用期 */
|
||||
fun isInTrial(ctx: Context): Boolean = trialDaysLeft(ctx) > 0
|
||||
|
||||
/** 今天已用免费毫秒数 */
|
||||
fun freeUsedTodayMs(ctx: Context): Long {
|
||||
@@ -104,14 +129,22 @@ object LicenseClient {
|
||||
}
|
||||
|
||||
fun addFreeUsedMs(ctx: Context, delta: Long) {
|
||||
if (isInTrial(ctx)) return // 试用期不计用量
|
||||
val prefs = ctx.getSharedPreferences("iptv_license", Context.MODE_PRIVATE)
|
||||
val today = todayKey()
|
||||
val used = if (prefs.getString("free_date", "") == today) prefs.getLong("free_used_ms", 0) else 0
|
||||
prefs.edit().putString("free_date", today).putLong("free_used_ms", used + delta).apply()
|
||||
}
|
||||
|
||||
fun freeRemainingMs(ctx: Context): Long =
|
||||
(FREE_DAILY_MS - freeUsedTodayMs(ctx)).coerceAtLeast(0)
|
||||
/**
|
||||
* 今日剩余免费时长
|
||||
* 试用期内返回 7 天的毫秒数(远大于每日额度 → UI 不会显示"今日已用完",
|
||||
* 同时也不会把 %s 分 %s 秒 显示成一个夸张的数字,UI 侧会用 trialDaysLeft 分支覆盖显示)
|
||||
*/
|
||||
fun freeRemainingMs(ctx: Context): Long {
|
||||
if (isInTrial(ctx)) return FREE_TRIAL_DAYS * 24 * 60 * 60 * 1000L
|
||||
return (FREE_DAILY_MS - freeUsedTodayMs(ctx)).coerceAtLeast(0)
|
||||
}
|
||||
|
||||
/** 日期键北京时间 */
|
||||
private fun todayKey(): String {
|
||||
|
||||
@@ -104,6 +104,17 @@ class MainActivity : Activity() {
|
||||
/** 首次启动简易教程遮罩 */
|
||||
private var tutorialOverlay: View? = null
|
||||
private var tutorialVisible = false
|
||||
/** 公告弹窗(授权系统 AnnouncementController 发布的) */
|
||||
private var annOverlay: View? = null
|
||||
private var annVisible = false
|
||||
private var annOkBtn: TextView? = null
|
||||
private var annTitle: TextView? = null
|
||||
private var annBody: TextView? = null
|
||||
private var annTypeTv: TextView? = null
|
||||
private var curAnnId = 0
|
||||
private var annRetry = 0
|
||||
/** 到期引导页只弹一次(防止 showTrialExpired 重复触发) */
|
||||
private var trialExpiredShown = false
|
||||
/** 更新弹窗的可聚焦按钮 + 当前焦点索引(遥控器左右切换用) */
|
||||
private var updBtns: Array<TextView?> = emptyArray()
|
||||
private var updFocusIdx = 0
|
||||
@@ -112,6 +123,13 @@ class MainActivity : Activity() {
|
||||
private var updateOverlay: View? = null
|
||||
private var pendingUpdate: AuthApi.UpdateInfo? = null
|
||||
private var downloadId = -1L
|
||||
/**
|
||||
* ★ 2026-10-15 起:暂时全面免费 —— 关闭授权限制与全部授权提示。
|
||||
* 保留不变:安装统计(check-update)、在线统计(heartbeat 心跳)、公告推送(announcements)。
|
||||
* 将来恢复授权:把这里改回 true 即可(限制与提示逻辑均原样保留在下方各分支里)。
|
||||
*/
|
||||
private val authGateEnabled = false
|
||||
|
||||
private val heartbeatTask = object : Runnable {
|
||||
override fun run() {
|
||||
Thread {
|
||||
@@ -321,6 +339,7 @@ class MainActivity : Activity() {
|
||||
window.addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
checkLicense()
|
||||
startInstallTracking() // 安装统计 + 检查新版本
|
||||
fetchAnnouncement() // ★ 拉取授权系统公告(3 秒后,避开启动高峰;更新弹窗优先)
|
||||
if (savedInstanceState == null && channels.isNotEmpty()) {
|
||||
val defIdx = channels.indexOfFirst { it.name.contains("TVB翡翠台") }.let { if (it >= 0) it else 0 }
|
||||
playChannel(defIdx)
|
||||
@@ -368,7 +387,12 @@ class MainActivity : Activity() {
|
||||
runOnUiThread {
|
||||
isVip = r.ok
|
||||
prefs.edit().putBoolean("is_vip", r.ok).apply()
|
||||
if (r.ok) {
|
||||
if (!authGateEnabled) {
|
||||
// 暂时全面免费:隐藏所有授权相关 UI,不进入任何限制模式
|
||||
trialText.visibility = View.GONE
|
||||
showAuthButton(false)
|
||||
showAuthState(false)
|
||||
} else if (r.ok) {
|
||||
trialText.visibility = View.GONE; trialText.text = "VIP"
|
||||
showAuthButton(false)
|
||||
showAuthState(true) // 右下角显示「✓ 已授权」
|
||||
@@ -524,13 +548,30 @@ class MainActivity : Activity() {
|
||||
}
|
||||
|
||||
private fun onUiTick() {
|
||||
// ★ 暂时全面免费:不显示任何倒计时/试用提示,也不触发到期引导页
|
||||
if (!authGateEnabled) { trialText.visibility = View.GONE; return }
|
||||
if (isVip) return
|
||||
// 每秒累计一次免费用量,这样右上角倒计时才会真正走动
|
||||
// 每秒累计一次免费用量(试用期内 LicenseClient 内部会跳过,不计用量)
|
||||
if (player?.isPlaying == true) LicenseClient.addFreeUsedMs(this, 1000)
|
||||
val r = freeRemainingMs()
|
||||
val days = LicenseClient.trialDaysLeft(this)
|
||||
trialText.visibility = View.VISIBLE
|
||||
trialText.text = if (r <= 0) "⏳ 今日免費已用完"
|
||||
else "⏳ 今日免費 ${r / 60000}分${((r % 60000) / 1000).toString().padStart(2, '0')}秒"
|
||||
trialText.text = when {
|
||||
// ★ 首 7 天完整试用期:显性化"还剩几天"(制造到期紧迫感)
|
||||
days > 0 -> if (days == 1) "🎁 免费试用 · 明天起每天限 1 小时"
|
||||
else "🎁 免费试用 · 还剩 $days 天"
|
||||
r <= 0 -> "⏳ 今日免費已用完"
|
||||
else -> "⏳ 今日免費 ${r / 60000}分${((r % 60000) / 1000).toString().padStart(2, '0')}秒"
|
||||
}
|
||||
|
||||
// ★ 到期钩子:试用期结束(第 8 天起)且今日额度用完 → 弹购买引导页
|
||||
// (原来 showTrialExpired 是死代码、从未被调用,用户只看到文字、画面停住,没有任何付费入口)
|
||||
if (days <= 0 && r <= 0 && !trialExpiredShown) {
|
||||
trialExpiredShown = true
|
||||
handler.removeCallbacks(uiTick)
|
||||
handler.postDelayed({ showTrialExpired() }, 1200) // 让用户看清"已用完"再跳转
|
||||
return
|
||||
}
|
||||
handler.postDelayed(uiTick, 1000)
|
||||
}
|
||||
|
||||
@@ -902,6 +943,18 @@ class MainActivity : Activity() {
|
||||
}
|
||||
}
|
||||
|
||||
// ★ 公告弹窗显示时:按键由弹窗接管(OK/返回都 = 确认关闭;吞掉数字键/菜单键)
|
||||
if (isAnnDialogVisible()) {
|
||||
when (keyCode) {
|
||||
KeyEvent.KEYCODE_BACK,
|
||||
KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER,
|
||||
KeyEvent.KEYCODE_NUMPAD_ENTER, KeyEvent.KEYCODE_SPACE -> {
|
||||
hideAnnouncement(); return true
|
||||
}
|
||||
else -> return true
|
||||
}
|
||||
}
|
||||
|
||||
// 退出确认框显示时:返回=取消,其余交给按钮焦点系统处理(左右切换,OK 确认)
|
||||
if (confirmVisible) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) { hideExitConfirm(); return true }
|
||||
@@ -1079,26 +1132,146 @@ class MainActivity : Activity() {
|
||||
}.getOrDefault(AuthApi.UpdateInfo(msg = AuthApi.lastError))
|
||||
runOnUiThread {
|
||||
if (info.ok) {
|
||||
val sb = StringBuilder("安装上报 ok #${info.installId} · v${AuthApi.clientVersion(this)}")
|
||||
if (info.updateAvailable) sb.append(" · 发现新版 v${info.latestVersion}")
|
||||
statusText.text = sb.toString()
|
||||
handler.postDelayed({
|
||||
val c = channels.getOrNull(currentChannel)
|
||||
if (c != null) statusText.text = "▶ ${c.num} ${c.name}"
|
||||
}, 8000)
|
||||
// ★ 不再把「安装上报 ok #xxx」写到左上角(用户要求去掉该提示);
|
||||
// 上报请求本身照常发出 → 安装统计 / 在线统计 / 版本检查均不受影响。
|
||||
// statusText 交回频道显示逻辑(切换频道时显示「▶ 频道号 频道名」)。
|
||||
if (info.updateAvailable) {
|
||||
pendingUpdate = info
|
||||
showUpdateDialog(info)
|
||||
}
|
||||
} else {
|
||||
statusText.text = "安装上报失败: ${info.msg}"
|
||||
}
|
||||
// 上报失败也不再提示(保持界面干净),失败信息静默丢弃
|
||||
}
|
||||
}.start()
|
||||
handler.removeCallbacks(heartbeatTask)
|
||||
handler.postDelayed(heartbeatTask, 60 * 1000L) // 1 分钟后首次心跳
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取授权系统公告,若有「弹窗」开关打开且未读过的,则弹给用户看。
|
||||
* 去重:iptv_main 的 ann_seen_id 记录最后看过的公告 id,同一条只弹一次。
|
||||
*/
|
||||
private fun fetchAnnouncement(delayMs: Long = 3000L) {
|
||||
handler.postDelayed({
|
||||
Thread {
|
||||
val list = try { AuthApi.fetchAnnouncements(projectId = 2, limit = 10) }
|
||||
catch (e: Exception) { emptyList() }
|
||||
// 只弹 is_popup=1 的;按 id 升序取最新一条未读
|
||||
val sp = getSharedPreferences("iptv_main", MODE_PRIVATE)
|
||||
val seen = sp.getInt("ann_seen_id", 0)
|
||||
val target = list.filter { it.isPopup && it.id > seen }
|
||||
.maxByOrNull { it.id }
|
||||
if (target != null) {
|
||||
runOnUiThread {
|
||||
// 更新弹窗优先:它没关掉就延迟再试(最多 15 次 x 2 秒)
|
||||
if (isUpdateDialogVisible() && annRetry < 15) {
|
||||
annRetry++
|
||||
fetchAnnouncement(2000L)
|
||||
} else if (!annVisible) {
|
||||
showAnnouncement(target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}, delayMs)
|
||||
}
|
||||
|
||||
/** 公告弹窗(自绘,和更新弹窗同一套三件套:focusable + requestFocus + onKeyDown 分支) */
|
||||
private fun showAnnouncement(a: AuthApi.Announcement) {
|
||||
if (annOverlay == null) {
|
||||
val dm = resources.displayMetrics
|
||||
val wDp = dm.widthPixels / dm.density
|
||||
val sc = when {
|
||||
wDp < 500f -> 0.62f // 手机竖屏
|
||||
wDp < 760f -> 0.80f // 手机横屏 / 小平板
|
||||
else -> 1.00f // TV
|
||||
}
|
||||
fun sp(v: Float): Float = v * sc
|
||||
fun px(v: Int): Int = (v * sc).toInt()
|
||||
|
||||
val mask = FrameLayout(this).apply { setBackgroundColor(0xCC000000u.toInt()); isClickable = true }
|
||||
val card = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setBackgroundColor(Color.parseColor("#22262E"))
|
||||
setPadding(px(56), px(40), px(56), px(40))
|
||||
}
|
||||
annTypeTv = TextView(this).apply {
|
||||
tag = "anntype"; textSize = sp(16f); setTextColor(Color.parseColor("#FFC107"))
|
||||
gravity = Gravity.CENTER; setPadding(0, 0, 0, px(14))
|
||||
}
|
||||
card.addView(annTypeTv)
|
||||
annTitle = TextView(this).apply {
|
||||
tag = "anntitle"; textSize = sp(22f); setTextColor(Color.WHITE)
|
||||
gravity = Gravity.CENTER; setLineSpacing(0f, 1.25f); setPadding(0, 0, 0, px(16))
|
||||
}
|
||||
card.addView(annTitle)
|
||||
annBody = TextView(this).apply {
|
||||
tag = "annbody"; textSize = sp(15f); setTextColor(Color.parseColor("#D8DEE9"))
|
||||
setBackgroundColor(Color.parseColor("#1C2028"))
|
||||
setPadding(px(24), px(20), px(24), px(20)); setLineSpacing(0f, 1.3f)
|
||||
maxLines = 8; ellipsize = android.text.TextUtils.TruncateAt.END
|
||||
maxHeight = (dm.heightPixels * 0.34f).toInt()
|
||||
}
|
||||
card.addView(annBody)
|
||||
annOkBtn = TextView(this).apply {
|
||||
tag = "annok"; text = "确认关闭"; textSize = sp(18f)
|
||||
setTextColor(Color.WHITE); gravity = Gravity.CENTER
|
||||
setPadding(px(64), px(22), px(64), px(22))
|
||||
isFocusable = true; isFocusableInTouchMode = true
|
||||
background = android.graphics.drawable.StateListDrawable().apply {
|
||||
addState(intArrayOf(android.R.attr.state_focused),
|
||||
android.graphics.drawable.ColorDrawable(Color.parseColor("#1B6EF3")))
|
||||
addState(intArrayOf(),
|
||||
android.graphics.drawable.ColorDrawable(Color.parseColor("#3A4150")))
|
||||
}
|
||||
setOnClickListener { hideAnnouncement() }
|
||||
}
|
||||
val rowLp = LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
).apply { gravity = Gravity.CENTER_HORIZONTAL; topMargin = px(28) }
|
||||
card.addView(annOkBtn, rowLp)
|
||||
|
||||
val cardW = (dm.widthPixels * 0.90f).toInt()
|
||||
mask.addView(card, FrameLayout.LayoutParams(
|
||||
cardW, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER))
|
||||
root.addView(mask, FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
annOverlay = mask
|
||||
}
|
||||
val typeLabel = when (a.type) {
|
||||
"system" -> "🔔 系统公告"
|
||||
"update" -> "🔄 更新公告"
|
||||
"promo" -> "🎁 活动公告"
|
||||
else -> "📢 通知公告"
|
||||
}
|
||||
curAnnId = a.id
|
||||
annTypeTv?.text = typeLabel
|
||||
annTitle?.text = a.title.ifEmpty { "公告" }
|
||||
annBody?.text = a.content.ifEmpty { "(无内容)" }
|
||||
annOverlay?.visibility = View.VISIBLE
|
||||
annVisible = true
|
||||
// ★ 三件套之二:主动聚焦(否则遥控器按 OK 不命中)
|
||||
handler.postDelayed({
|
||||
if (annVisible) annOkBtn?.requestFocus()
|
||||
}, 120)
|
||||
}
|
||||
|
||||
private fun hideAnnouncement() {
|
||||
// ★ 去重:记录已读的最大公告 id,同一条不再弹(新公告 id 更大,仍会弹)
|
||||
try {
|
||||
val sp = getSharedPreferences("iptv_main", MODE_PRIVATE)
|
||||
val seen = sp.getInt("ann_seen_id", 0)
|
||||
if (curAnnId > seen) sp.edit().putInt("ann_seen_id", curAnnId).apply()
|
||||
} catch (e: Exception) { }
|
||||
curAnnId = 0
|
||||
annOverlay?.visibility = View.GONE
|
||||
annVisible = false
|
||||
annOkBtn?.clearFocus() // 三件套之四:清焦点残留
|
||||
annRetry = 0
|
||||
}
|
||||
|
||||
private fun isAnnDialogVisible(): Boolean = annOverlay?.visibility == View.VISIBLE
|
||||
|
||||
/** 新版本提示(自绘浮层,电视全屏主题下 AlertDialog 不可靠) */
|
||||
private fun showUpdateDialog(info: AuthApi.UpdateInfo) {
|
||||
if (updateOverlay == null) {
|
||||
|
||||
@@ -87,10 +87,7 @@ class SettingsActivity : Activity() {
|
||||
} catch (e: Exception) { "1.0" }
|
||||
|
||||
val prefs = getSharedPreferences("iptv_license", MODE_PRIVATE)
|
||||
val isVip = prefs.getBoolean("is_vip", false)
|
||||
val expire = prefs.getString("vip_expire", "")
|
||||
val permanent = prefs.getBoolean("is_permanent", false)
|
||||
val cardKey = prefs.getString("card_key", "")
|
||||
// v9.6.1:暂时全面免费,本页不再读取/展示任何授权状态(isVip/expire/permanent/cardKey 已移除)
|
||||
|
||||
root.addView(TextView(this).apply {
|
||||
text = "版本信息"
|
||||
@@ -98,7 +95,8 @@ class SettingsActivity : Activity() {
|
||||
setPadding(0, 0, 0, 8)
|
||||
})
|
||||
root.addView(TextView(this).apply {
|
||||
text = "App 版本:$versionName\n授权系统:CardAuth(app.88531.cn)\n机器码:${LicenseClient.machineCode(this@SettingsActivity)}"
|
||||
// v9.6.1:暂时全面免费,不再显示授权系统 / 机器码等收费痕迹,只留版本号
|
||||
text = "App 版本:$versionName\n本软件完全免费 · 无广告 · 无第三方 SDK"
|
||||
textSize = 15f; setTextColor(Color.WHITE)
|
||||
setLineSpacing(0f, 1.15f)
|
||||
setBackgroundColor(Color.parseColor("#1C2028"))
|
||||
@@ -134,22 +132,14 @@ class SettingsActivity : Activity() {
|
||||
root.addView(bootSwitch, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 40 })
|
||||
|
||||
// ===== 会员状态 =====
|
||||
root.addView(TextView(this).apply {
|
||||
text = "会员状态"
|
||||
textSize = 15f; setTextColor(Color.parseColor("#7AA7D9"))
|
||||
setPadding(0, 0, 0, 8)
|
||||
})
|
||||
// ===== 状态提示条(切换线路等操作的结果显示在这里)=====
|
||||
// v9.6.1:原来的「会员状态」区块已移除(暂时全面免费,不暴露授权/收费信息)
|
||||
statusText = TextView(this).apply {
|
||||
textSize = 15f; setLineSpacing(0f, 1.15f)
|
||||
setTextColor(Color.WHITE)
|
||||
setBackgroundColor(Color.parseColor("#1C2028"))
|
||||
setPadding(24, 20, 24, 20)
|
||||
text = if (isVip) {
|
||||
"✓ 已是会员\n${if (permanent) "永久有效" else "有效期至:$expire"}${if (cardKey?.isNotEmpty() == true) "\n卡号:$cardKey" else ""}"
|
||||
} else {
|
||||
"当前为免费用户(每天 1 小时)\n尚未成为会员"
|
||||
}
|
||||
text = ""
|
||||
}
|
||||
root.addView(statusText, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 24 })
|
||||
@@ -165,7 +155,7 @@ class SettingsActivity : Activity() {
|
||||
textSize = 15f; setLineSpacing(0f, 1.15f)
|
||||
setTextColor(Color.WHITE); setBackgroundColor(Color.parseColor("#1C2028"))
|
||||
setPadding(24, 20, 24, 20)
|
||||
text = "点击右侧按钮检查是否有新版本\n(安装统计会在启动时自动上报)"
|
||||
text = "点击右侧按钮检查是否有新版本"
|
||||
}
|
||||
root.addView(statusText2, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 12 })
|
||||
@@ -174,48 +164,24 @@ class SettingsActivity : Activity() {
|
||||
root.addView(checkBtn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 40 })
|
||||
|
||||
// ===== 卡密激活 =====
|
||||
// ===== 卡密激活:v9.6.1 起暂时全面免费,此区块整块移除(恢复见 git 历史)=====
|
||||
|
||||
// ===== ★ 售后联系方式(安装 / 播放遇到问题时能找到人)=====
|
||||
root.addView(TextView(this).apply {
|
||||
text = "卡密激活"
|
||||
textSize = 15f; setTextColor(Color.parseColor("#7AA7D9"))
|
||||
setPadding(0, 8, 0, 8)
|
||||
})
|
||||
val cardInput = EditText(this).apply {
|
||||
hint = "请输入卡密"
|
||||
text = "💬 售后微信:q3970260761\n安装、播放有问题都可以找我"
|
||||
textSize = 16f
|
||||
setTextColor(Color.WHITE)
|
||||
setHintTextColor(Color.parseColor("#888888"))
|
||||
setPadding(24, 20, 24, 20)
|
||||
isSingleLine = true
|
||||
setTextColor(Color.parseColor("#FFC107")) // 橙色醒目
|
||||
gravity = Gravity.CENTER
|
||||
setLineSpacing(0f, 1.3f)
|
||||
setPadding(24, 18, 24, 18)
|
||||
isFocusable = true
|
||||
isFocusableInTouchMode = true
|
||||
background = focusBg(normal = 0xFF1C2028.toInt())
|
||||
inputType = android.text.InputType.TYPE_CLASS_TEXT
|
||||
}
|
||||
root.addView(cardInput, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 12 })
|
||||
|
||||
val actBtn = mkAction("激活") { doActivate(cardInput.text.toString().trim()) }
|
||||
root.addView(actBtn, LinearLayout.LayoutParams(
|
||||
background = focusBg(normal = 0xFF2E2510.toInt()) // 橙底,聚焦变蓝
|
||||
setOnClickListener { copyWechat() }
|
||||
}, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 40 })
|
||||
|
||||
if (isVip) {
|
||||
root.addView(TextView(this).apply {
|
||||
text = "✓ 已经是会员"
|
||||
textSize = 18f; setTextColor(Color.parseColor("#4CAF50"))
|
||||
gravity = Gravity.CENTER; setPadding(0, 24, 0, 12)
|
||||
})
|
||||
// ★ 新增:撤销本机授权(换机 / 换卡密前先解绑)
|
||||
val revokeBtn = mkAction("撤销本机授权(可重新激活 / 换卡密)") { doRevoke() }
|
||||
root.addView(revokeBtn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 20 })
|
||||
} else {
|
||||
val btn = mkAction("支付成为会员(月/季/年)") {
|
||||
startActivity(Intent(this@SettingsActivity, ShopActivity::class.java))
|
||||
}
|
||||
root.addView(btn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 20 })
|
||||
}
|
||||
// v9.6.1:已移除「撤销本机授权」与「支付成为会员」入口(暂时全面免费,不出现任何收费/授权入口)
|
||||
|
||||
// ===== 其它操作 =====
|
||||
root.addView(TextView(this).apply {
|
||||
@@ -243,6 +209,18 @@ class SettingsActivity : Activity() {
|
||||
} catch (e: Exception) { }
|
||||
}
|
||||
|
||||
/** 复制售后微信号(TV 上也会 Toast 出来便于手抄) */
|
||||
private fun copyWechat() {
|
||||
val wx = "q3970260761"
|
||||
try {
|
||||
val cm = getSystemService(android.content.Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager
|
||||
cm.setPrimaryClip(android.content.ClipData.newPlainText("wechat", wx))
|
||||
android.widget.Toast.makeText(this, "微信号已复制:$wx", android.widget.Toast.LENGTH_SHORT).show()
|
||||
} catch (e: Exception) {
|
||||
android.widget.Toast.makeText(this, "售后微信:$wx", android.widget.Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
/** 撤销本机授权:清除本地授权信息 → 恢复免费模式,可重新输入卡密或换机 */
|
||||
private fun doRevoke() {
|
||||
try {
|
||||
@@ -284,7 +262,7 @@ class SettingsActivity : Activity() {
|
||||
statusText.text = if (r.ok) {
|
||||
"✓ 激活成功!\n${if (r.isPermanent) "永久有效" else "有效期至:${r.expireTime}"}\n卡号:$key"
|
||||
} else {
|
||||
"✗ 激活失败:${r.message}\n请检查卡密是否正确 / 是否已被使用"
|
||||
"✗ 激活失败:${r.message}\n请检查卡密是否正确 / 是否已被使用\n\n售后微信:q3970260761(可点下方橙色条复制)"
|
||||
}
|
||||
android.widget.Toast.makeText(this@SettingsActivity,
|
||||
if (r.ok) "激活成功" else "激活失败:${r.message}",
|
||||
|
||||
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 33 KiB |