Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0849ff3875 | ||
|
|
ebe6df7072 | ||
|
|
a2b58ec078 |
No files matched your search
@@ -19,8 +19,8 @@ android {
|
||||
applicationId = "com.iptv807.tv"
|
||||
minSdk = 21
|
||||
targetSdk = 35
|
||||
versionCode = 943
|
||||
versionName = "9.4.3"
|
||||
versionCode = 946
|
||||
versionName = "9.4.6"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
@@ -96,4 +96,8 @@ class AiSettingsActivity : Activity() {
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
override fun onKeyDown(keyCode: Int, event: android.view.KeyEvent?): Boolean {
|
||||
if (keyCode == android.view.KeyEvent.KEYCODE_BACK) { finish(); return true }
|
||||
return super.onKeyDown(keyCode, event)
|
||||
}
|
||||
}
|
||||
@@ -140,4 +140,9 @@ class LoginActivity : Activity() {
|
||||
startActivity(Intent(this, MainActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
/** ★ 返回键显式处理(原来缺失 → 走系统默认,用户按返回无提示) */
|
||||
override fun onKeyDown(keyCode: Int, event: android.view.KeyEvent?): Boolean {
|
||||
if (keyCode == android.view.KeyEvent.KEYCODE_BACK) { finish(); return true }
|
||||
return super.onKeyDown(keyCode, event)
|
||||
}
|
||||
}
|
||||
@@ -1102,35 +1102,49 @@ class MainActivity : Activity() {
|
||||
/** 新版本提示(自绘浮层,电视全屏主题下 AlertDialog 不可靠) */
|
||||
private fun showUpdateDialog(info: AuthApi.UpdateInfo) {
|
||||
if (updateOverlay == null) {
|
||||
// ★ 尺寸自适应:原字号/内边距按 TV 写死且卡片宽度无约束,手机竖屏会溢出
|
||||
val dm = resources.displayMetrics
|
||||
val wDp = dm.widthPixels / dm.density
|
||||
val s = when {
|
||||
wDp < 500f -> 0.62f // 手机竖屏(约 360-430dp 宽)
|
||||
wDp < 760f -> 0.80f // 手机横屏 / 小平板
|
||||
else -> 1.00f // 电视 / 平板横屏(960dp+)保持原样
|
||||
}
|
||||
fun sp(v: Float): Float = v * s
|
||||
fun px(v: Int): Int = (v * s).toInt()
|
||||
|
||||
val mask = FrameLayout(this).apply { setBackgroundColor(0xCC000000u.toInt()) }
|
||||
val card = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setBackgroundColor(Color.parseColor("#22262E"))
|
||||
setPadding(64, 48, 64, 48)
|
||||
setPadding(px(64), px(48), px(64), px(48))
|
||||
}
|
||||
card.addView(TextView(this).apply {
|
||||
text = "发现新版本"; textSize = 24f; setTextColor(Color.WHITE)
|
||||
gravity = Gravity.CENTER; setPadding(0, 0, 0, 12)
|
||||
text = "发现新版本"; textSize = sp(24f); setTextColor(Color.WHITE)
|
||||
gravity = Gravity.CENTER; setPadding(0, 0, 0, px(12))
|
||||
})
|
||||
card.addView(TextView(this).apply {
|
||||
tag = "ver"; textSize = 40f; setTextColor(Color.parseColor("#4CAF50"))
|
||||
gravity = Gravity.CENTER; setPadding(0, 0, 0, 16)
|
||||
tag = "ver"; textSize = sp(40f); setTextColor(Color.parseColor("#4CAF50"))
|
||||
gravity = Gravity.CENTER; setPadding(0, 0, 0, px(16))
|
||||
})
|
||||
card.addView(TextView(this).apply {
|
||||
tag = "meta"; textSize = 15f; setTextColor(Color.LTGRAY)
|
||||
gravity = Gravity.CENTER; setLineSpacing(0f, 1.2f); setPadding(0, 0, 0, 24)
|
||||
tag = "meta"; textSize = sp(15f); setTextColor(Color.LTGRAY)
|
||||
gravity = Gravity.CENTER; setLineSpacing(0f, 1.2f); setPadding(0, 0, 0, px(24))
|
||||
})
|
||||
card.addView(TextView(this).apply {
|
||||
tag = "chg"; textSize = 15f; setTextColor(Color.WHITE)
|
||||
tag = "chg"; textSize = sp(15f); setTextColor(Color.WHITE)
|
||||
setBackgroundColor(Color.parseColor("#1C2028"))
|
||||
setPadding(24, 20, 24, 20); setLineSpacing(0f, 1.25f)
|
||||
maxLines = 8; gravity = Gravity.CENTER
|
||||
setPadding(px(24), px(20), px(24), px(20)); setLineSpacing(0f, 1.25f)
|
||||
// ★ 限行 + 省略 + 高度上限:长 changelog 不再把卡片撑出屏幕
|
||||
maxLines = 6; ellipsize = android.text.TextUtils.TruncateAt.END
|
||||
maxHeight = (dm.heightPixels * 0.34f).toInt()
|
||||
gravity = Gravity.CENTER
|
||||
})
|
||||
val row = LinearLayout(this).apply { orientation = LinearLayout.HORIZONTAL; gravity = Gravity.CENTER; setPadding(0, 28, 0, 0) }
|
||||
val row = LinearLayout(this).apply { orientation = LinearLayout.HORIZONTAL; gravity = Gravity.CENTER; setPadding(0, px(28), 0, 0) }
|
||||
fun mkBtn(label: String, focusable: Boolean, onClick: () -> Unit): TextView =
|
||||
TextView(this).apply {
|
||||
text = label; textSize = 18f; setTextColor(Color.WHITE); gravity = Gravity.CENTER
|
||||
setPadding(56, 22, 56, 22); isFocusable = focusable; isFocusableInTouchMode = focusable
|
||||
text = label; textSize = sp(18f); setTextColor(Color.WHITE); gravity = Gravity.CENTER
|
||||
setPadding(px(56), px(22), px(56), px(22)); isFocusable = focusable; isFocusableInTouchMode = focusable
|
||||
if (focusable) background = android.graphics.drawable.StateListDrawable().apply {
|
||||
addState(intArrayOf(android.R.attr.state_focused),
|
||||
android.graphics.drawable.ColorDrawable(Color.parseColor("#1B6EF3")))
|
||||
@@ -1144,12 +1158,14 @@ class MainActivity : Activity() {
|
||||
pendingUpdate?.let { startUpdateDownload(it) }; hideUpdateDialog()
|
||||
}.apply { tag = "dl" }
|
||||
row.addView(laterBtn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { rightMargin = 32 })
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { rightMargin = px(32) })
|
||||
row.addView(dlBtn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
||||
card.addView(row)
|
||||
// ★ 卡片宽度 = 屏幕 90%(左右各留 5%),任何屏幕都不会溢出
|
||||
val cardW = (dm.widthPixels * 0.90f).toInt()
|
||||
mask.addView(card, FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER))
|
||||
cardW, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER))
|
||||
root.addView(mask, FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
updateOverlay = mask
|
||||
|
||||
@@ -197,6 +197,21 @@ class SettingsActivity : Activity() {
|
||||
|
||||
val actBtn = mkAction("激活") { doActivate(cardInput.text.toString().trim()) }
|
||||
root.addView(actBtn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 24 })
|
||||
|
||||
// ===== ★ 售后联系方式(授权无效 / 卡密用不了时能找到人)=====
|
||||
root.addView(TextView(this).apply {
|
||||
text = "⚠ 授权无效、卡密激活不了?\n售后微信:q3970260761"
|
||||
textSize = 16f
|
||||
setTextColor(Color.parseColor("#FFC107")) // 橙色醒目
|
||||
gravity = Gravity.CENTER
|
||||
setLineSpacing(0f, 1.3f)
|
||||
setPadding(24, 18, 24, 18)
|
||||
isFocusable = true
|
||||
isFocusableInTouchMode = true
|
||||
background = focusBg(normal = 0xFF2E2510.toInt()) // 橙底,聚焦变蓝
|
||||
setOnClickListener { copyWechat() }
|
||||
}, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 40 })
|
||||
|
||||
if (isVip) {
|
||||
@@ -243,6 +258,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 +311,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}",
|
||||
|
||||
@@ -48,16 +48,40 @@ class TrialExpiredActivity : Activity() {
|
||||
gravity = android.view.Gravity.CENTER; setPadding(0, 0, 0, 56)
|
||||
})
|
||||
|
||||
root.addView(Button(this).apply {
|
||||
text = "购买套餐(OK键)"
|
||||
textSize = 19f
|
||||
setOnClickListener { startActivity(android.content.Intent(this@TrialExpiredActivity, ShopActivity::class.java)); finish() }
|
||||
})
|
||||
// ★ 可聚焦按钮 + 遥控器高亮(原来 Button 无人聚焦,遥控器按 OK 没反应)
|
||||
fun focusableBtn(label: String, size: Float, onClick: () -> Unit) =
|
||||
Button(this).apply {
|
||||
text = label; textSize = size
|
||||
isFocusable = true; isFocusableInTouchMode = true
|
||||
setTextColor(0xFFFFFFFFu.toInt())
|
||||
background = android.graphics.drawable.StateListDrawable().apply {
|
||||
addState(intArrayOf(android.R.attr.state_focused),
|
||||
android.graphics.drawable.ColorDrawable(0xFF1B6EF3.toInt()))
|
||||
addState(intArrayOf(),
|
||||
android.graphics.drawable.ColorDrawable(0xFF2A2F3A.toInt()))
|
||||
}
|
||||
setPadding(48, 26, 48, 26)
|
||||
setOnClickListener { onClick() }
|
||||
}
|
||||
|
||||
val buyBtn = focusableBtn("购买套餐(OK 键)", 19f) {
|
||||
try {
|
||||
startActivity(android.content.Intent(this@TrialExpiredActivity, ShopActivity::class.java))
|
||||
} catch (e: Exception) { }
|
||||
finish()
|
||||
}
|
||||
root.addView(buyBtn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 20 })
|
||||
|
||||
// ★ 新增:明确的关闭入口(原来只能靠按 BACK,而 BACK 走的是系统默认)
|
||||
val closeBtn = focusableBtn("关闭(返回键也可以)", 17f) { finish() }
|
||||
root.addView(closeBtn, LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 8 })
|
||||
|
||||
root.addView(TextView(this).apply {
|
||||
text = "或直接访问:http://app.88531.cn:8881/#/shop"
|
||||
textSize = 13f; setTextColor(0xFF888888u.toInt())
|
||||
gravity = android.view.Gravity.CENTER; setPadding(0, 32, 0, 0)
|
||||
gravity = android.view.Gravity.CENTER; setPadding(0, 28, 0, 0)
|
||||
})
|
||||
|
||||
root.addView(TextView(this).apply {
|
||||
@@ -65,6 +89,15 @@ class TrialExpiredActivity : Activity() {
|
||||
textSize = 14f; setTextColor(0xFF7799AAu.toInt())
|
||||
gravity = android.view.Gravity.CENTER; setPadding(0, 24, 0, 0)
|
||||
})
|
||||
|
||||
// 默认聚焦「购买套餐」,遥控器 OK 直接可按;左右/上下在两个按钮间切换
|
||||
buyBtn.post { buyBtn.requestFocus() }
|
||||
}
|
||||
|
||||
/** ★ 返回键显式处理(原来没有,走系统默认,用户不知道能关) */
|
||||
override fun onKeyDown(keyCode: Int, event: android.view.KeyEvent?): Boolean {
|
||||
if (keyCode == android.view.KeyEvent.KEYCODE_BACK) { finish(); return true }
|
||||
return super.onKeyDown(keyCode, event)
|
||||
}
|
||||
|
||||
private fun openShop() {
|
||||
|
||||
Reference in new issue
Block a user