Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0849ff3875 | ||
|
|
ebe6df7072 |
No files matched your search
@@ -19,8 +19,8 @@ android {
|
|||||||
applicationId = "com.iptv807.tv"
|
applicationId = "com.iptv807.tv"
|
||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 944
|
versionCode = 946
|
||||||
versionName = "9.4.4"
|
versionName = "9.4.6"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|||||||
@@ -1102,35 +1102,49 @@ class MainActivity : Activity() {
|
|||||||
/** 新版本提示(自绘浮层,电视全屏主题下 AlertDialog 不可靠) */
|
/** 新版本提示(自绘浮层,电视全屏主题下 AlertDialog 不可靠) */
|
||||||
private fun showUpdateDialog(info: AuthApi.UpdateInfo) {
|
private fun showUpdateDialog(info: AuthApi.UpdateInfo) {
|
||||||
if (updateOverlay == null) {
|
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 mask = FrameLayout(this).apply { setBackgroundColor(0xCC000000u.toInt()) }
|
||||||
val card = LinearLayout(this).apply {
|
val card = LinearLayout(this).apply {
|
||||||
orientation = LinearLayout.VERTICAL
|
orientation = LinearLayout.VERTICAL
|
||||||
setBackgroundColor(Color.parseColor("#22262E"))
|
setBackgroundColor(Color.parseColor("#22262E"))
|
||||||
setPadding(64, 48, 64, 48)
|
setPadding(px(64), px(48), px(64), px(48))
|
||||||
}
|
}
|
||||||
card.addView(TextView(this).apply {
|
card.addView(TextView(this).apply {
|
||||||
text = "发现新版本"; textSize = 24f; setTextColor(Color.WHITE)
|
text = "发现新版本"; textSize = sp(24f); setTextColor(Color.WHITE)
|
||||||
gravity = Gravity.CENTER; setPadding(0, 0, 0, 12)
|
gravity = Gravity.CENTER; setPadding(0, 0, 0, px(12))
|
||||||
})
|
})
|
||||||
card.addView(TextView(this).apply {
|
card.addView(TextView(this).apply {
|
||||||
tag = "ver"; textSize = 40f; setTextColor(Color.parseColor("#4CAF50"))
|
tag = "ver"; textSize = sp(40f); setTextColor(Color.parseColor("#4CAF50"))
|
||||||
gravity = Gravity.CENTER; setPadding(0, 0, 0, 16)
|
gravity = Gravity.CENTER; setPadding(0, 0, 0, px(16))
|
||||||
})
|
})
|
||||||
card.addView(TextView(this).apply {
|
card.addView(TextView(this).apply {
|
||||||
tag = "meta"; textSize = 15f; setTextColor(Color.LTGRAY)
|
tag = "meta"; textSize = sp(15f); setTextColor(Color.LTGRAY)
|
||||||
gravity = Gravity.CENTER; setLineSpacing(0f, 1.2f); setPadding(0, 0, 0, 24)
|
gravity = Gravity.CENTER; setLineSpacing(0f, 1.2f); setPadding(0, 0, 0, px(24))
|
||||||
})
|
})
|
||||||
card.addView(TextView(this).apply {
|
card.addView(TextView(this).apply {
|
||||||
tag = "chg"; textSize = 15f; setTextColor(Color.WHITE)
|
tag = "chg"; textSize = sp(15f); setTextColor(Color.WHITE)
|
||||||
setBackgroundColor(Color.parseColor("#1C2028"))
|
setBackgroundColor(Color.parseColor("#1C2028"))
|
||||||
setPadding(24, 20, 24, 20); setLineSpacing(0f, 1.25f)
|
setPadding(px(24), px(20), px(24), px(20)); setLineSpacing(0f, 1.25f)
|
||||||
maxLines = 8; gravity = Gravity.CENTER
|
// ★ 限行 + 省略 + 高度上限:长 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 =
|
fun mkBtn(label: String, focusable: Boolean, onClick: () -> Unit): TextView =
|
||||||
TextView(this).apply {
|
TextView(this).apply {
|
||||||
text = label; textSize = 18f; setTextColor(Color.WHITE); gravity = Gravity.CENTER
|
text = label; textSize = sp(18f); setTextColor(Color.WHITE); gravity = Gravity.CENTER
|
||||||
setPadding(56, 22, 56, 22); isFocusable = focusable; isFocusableInTouchMode = focusable
|
setPadding(px(56), px(22), px(56), px(22)); isFocusable = focusable; isFocusableInTouchMode = focusable
|
||||||
if (focusable) background = android.graphics.drawable.StateListDrawable().apply {
|
if (focusable) background = android.graphics.drawable.StateListDrawable().apply {
|
||||||
addState(intArrayOf(android.R.attr.state_focused),
|
addState(intArrayOf(android.R.attr.state_focused),
|
||||||
android.graphics.drawable.ColorDrawable(Color.parseColor("#1B6EF3")))
|
android.graphics.drawable.ColorDrawable(Color.parseColor("#1B6EF3")))
|
||||||
@@ -1144,12 +1158,14 @@ class MainActivity : Activity() {
|
|||||||
pendingUpdate?.let { startUpdateDownload(it) }; hideUpdateDialog()
|
pendingUpdate?.let { startUpdateDownload(it) }; hideUpdateDialog()
|
||||||
}.apply { tag = "dl" }
|
}.apply { tag = "dl" }
|
||||||
row.addView(laterBtn, LinearLayout.LayoutParams(
|
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(
|
row.addView(dlBtn, LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
||||||
card.addView(row)
|
card.addView(row)
|
||||||
|
// ★ 卡片宽度 = 屏幕 90%(左右各留 5%),任何屏幕都不会溢出
|
||||||
|
val cardW = (dm.widthPixels * 0.90f).toInt()
|
||||||
mask.addView(card, FrameLayout.LayoutParams(
|
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(
|
root.addView(mask, FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||||
updateOverlay = mask
|
updateOverlay = mask
|
||||||
|
|||||||
@@ -197,6 +197,21 @@ class SettingsActivity : Activity() {
|
|||||||
|
|
||||||
val actBtn = mkAction("激活") { doActivate(cardInput.text.toString().trim()) }
|
val actBtn = mkAction("激活") { doActivate(cardInput.text.toString().trim()) }
|
||||||
root.addView(actBtn, LinearLayout.LayoutParams(
|
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 })
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { bottomMargin = 40 })
|
||||||
|
|
||||||
if (isVip) {
|
if (isVip) {
|
||||||
@@ -243,6 +258,18 @@ class SettingsActivity : Activity() {
|
|||||||
} catch (e: Exception) { }
|
} 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() {
|
private fun doRevoke() {
|
||||||
try {
|
try {
|
||||||
@@ -284,7 +311,7 @@ class SettingsActivity : Activity() {
|
|||||||
statusText.text = if (r.ok) {
|
statusText.text = if (r.ok) {
|
||||||
"✓ 激活成功!\n${if (r.isPermanent) "永久有效" else "有效期至:${r.expireTime}"}\n卡号:$key"
|
"✓ 激活成功!\n${if (r.isPermanent) "永久有效" else "有效期至:${r.expireTime}"}\n卡号:$key"
|
||||||
} else {
|
} else {
|
||||||
"✗ 激活失败:${r.message}\n请检查卡密是否正确 / 是否已被使用"
|
"✗ 激活失败:${r.message}\n请检查卡密是否正确 / 是否已被使用\n\n售后微信:q3970260761(可点下方橙色条复制)"
|
||||||
}
|
}
|
||||||
android.widget.Toast.makeText(this@SettingsActivity,
|
android.widget.Toast.makeText(this@SettingsActivity,
|
||||||
if (r.ok) "激活成功" else "激活失败:${r.message}",
|
if (r.ok) "激活成功" else "激活失败:${r.message}",
|
||||||
|
|||||||
Reference in new issue
Block a user