diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SettingPlayerActivity.java b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SettingPlayerActivity.java
index 071ead4d..9cd66f30 100644
--- a/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SettingPlayerActivity.java
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SettingPlayerActivity.java
@@ -59,28 +59,6 @@ public class SettingPlayerActivity extends BaseActivity implements UaCallback, B
mBinding.renderText.setText((render = ResUtil.getStringArray(R.array.select_render))[Setting.getRender()]);
mBinding.captionText.setText((caption = ResUtil.getStringArray(R.array.select_caption))[Setting.isCaption() ? 1 : 0]);
mBinding.backgroundText.setText((background = ResUtil.getStringArray(R.array.select_background))[Setting.getBackground()]);
-
- // 设置开关的颜色为黄色
- int accentColor = getResources().getColor(R.color.accent);
- android.content.res.ColorStateList colorStateList = new android.content.res.ColorStateList(
- new int[][]{
- new int[]{-android.R.attr.state_checked},
- new int[]{android.R.attr.state_checked}
- },
- new int[]{
- 0x66FFFFFF, // 未选中时的颜色
- accentColor // 选中时的颜色
- }
- );
-
- mBinding.tunnelSwitch.setThumbTintList(android.content.res.ColorStateList.valueOf(android.graphics.Color.WHITE));
- mBinding.tunnelSwitch.setTrackTintList(colorStateList);
- mBinding.audioDecodeSwitch.setThumbTintList(android.content.res.ColorStateList.valueOf(android.graphics.Color.WHITE));
- mBinding.audioDecodeSwitch.setTrackTintList(colorStateList);
- mBinding.aacSwitch.setThumbTintList(android.content.res.ColorStateList.valueOf(android.graphics.Color.WHITE));
- mBinding.aacSwitch.setTrackTintList(colorStateList);
- mBinding.danmakuLoadSwitch.setThumbTintList(android.content.res.ColorStateList.valueOf(android.graphics.Color.WHITE));
- mBinding.danmakuLoadSwitch.setTrackTintList(colorStateList);
}
@Override
diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/custom/CustomSwitch.java b/app/src/mobile/java/com/fongmi/android/tv/ui/custom/CustomSwitch.java
new file mode 100644
index 00000000..a6d8cd9a
--- /dev/null
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/custom/CustomSwitch.java
@@ -0,0 +1,137 @@
+package com.fongmi.android.tv.ui.custom;
+
+import android.animation.ArgbEvaluator;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.view.View;
+
+import androidx.appcompat.widget.AppCompatCheckBox;
+
+public class CustomSwitch extends AppCompatCheckBox {
+
+ private Paint trackPaint;
+ private Paint thumbPaint;
+ private RectF trackRect;
+ private RectF thumbRect;
+
+ private float thumbPosition = 0f; // 0 = 左边, 1 = 右边
+ private int currentTrackColor;
+ private int currentThumbColor;
+
+ private static final int TRACK_COLOR_OFF = 0xFF555555; // 灰色
+ private static final int TRACK_COLOR_ON = 0xFFFFEB3B; // 黄色
+ private static final int THUMB_COLOR_OFF = 0xFFFFFFFF; // 白色
+ private static final int THUMB_COLOR_ON = 0xFF000000; // 黑色
+
+ private ValueAnimator animator;
+
+ public CustomSwitch(Context context) {
+ super(context);
+ init();
+ }
+
+ public CustomSwitch(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public CustomSwitch(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ private void init() {
+ // 隐藏默认的checkbox样式
+ setButtonDrawable(null);
+
+ trackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ thumbPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+
+ trackRect = new RectF();
+ thumbRect = new RectF();
+
+ currentTrackColor = TRACK_COLOR_OFF;
+ currentThumbColor = THUMB_COLOR_OFF;
+
+ // 监听状态变化
+ setOnCheckedChangeListener((buttonView, isChecked) -> animateSwitch(isChecked));
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ // 固定尺寸:50dp × 30dp
+ int width = (int) (50 * getResources().getDisplayMetrics().density);
+ int height = (int) (30 * getResources().getDisplayMetrics().density);
+ setMeasuredDimension(width, height);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ int width = getWidth();
+ int height = getHeight();
+ float radius = height / 2f;
+
+ // 绘制轨道
+ trackRect.set(0, 0, width, height);
+ trackPaint.setColor(currentTrackColor);
+ canvas.drawRoundRect(trackRect, radius, radius, trackPaint);
+
+ // 计算小圆位置
+ float thumbSize = height - 8 * getResources().getDisplayMetrics().density; // 22dp
+ float padding = 4 * getResources().getDisplayMetrics().density;
+ float thumbLeft = padding + thumbPosition * (width - thumbSize - 2 * padding);
+ float thumbTop = padding;
+
+ // 绘制小圆
+ thumbRect.set(thumbLeft, thumbTop, thumbLeft + thumbSize, thumbTop + thumbSize);
+ thumbPaint.setColor(currentThumbColor);
+ canvas.drawOval(thumbRect, thumbPaint);
+ }
+
+ private void animateSwitch(boolean isChecked) {
+ if (animator != null && animator.isRunning()) {
+ animator.cancel();
+ }
+
+ float targetPosition = isChecked ? 1f : 0f;
+ int targetTrackColor = isChecked ? TRACK_COLOR_ON : TRACK_COLOR_OFF;
+ int targetThumbColor = isChecked ? THUMB_COLOR_ON : THUMB_COLOR_OFF;
+
+ animator = ValueAnimator.ofFloat(thumbPosition, targetPosition);
+ animator.setDuration(250); // 250ms动画时长
+
+ final ArgbEvaluator colorEvaluator = new ArgbEvaluator();
+
+ animator.addUpdateListener(animation -> {
+ thumbPosition = (float) animation.getAnimatedValue();
+
+ // 颜色渐变
+ currentTrackColor = (int) colorEvaluator.evaluate(
+ thumbPosition, TRACK_COLOR_OFF, TRACK_COLOR_ON
+ );
+ currentThumbColor = (int) colorEvaluator.evaluate(
+ thumbPosition, THUMB_COLOR_OFF, THUMB_COLOR_ON
+ );
+
+ invalidate();
+ });
+
+ animator.start();
+ }
+
+ @Override
+ public void setChecked(boolean checked) {
+ super.setChecked(checked);
+ // 初始化时不播放动画
+ if (!isAttachedToWindow()) {
+ thumbPosition = checked ? 1f : 0f;
+ currentTrackColor = checked ? TRACK_COLOR_ON : TRACK_COLOR_OFF;
+ currentThumbColor = checked ? THUMB_COLOR_ON : THUMB_COLOR_OFF;
+ }
+ }
+}
+
diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingFragment.java b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingFragment.java
index 3eeec282..ecec6356 100644
--- a/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingFragment.java
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingFragment.java
@@ -104,21 +104,6 @@ public class SettingFragment extends BaseFragment implements ConfigCallback, Sit
setSourceHintText(mBinding.wallUrl, WallConfig.getDesc(), R.string.source_hint_wall);
mBinding.versionText.setText(getString(R.string.setting_version) + " " + BuildConfig.VERSION_NAME);
- // 设置开关的颜色为黄色
- int accentColor = getResources().getColor(R.color.accent);
- android.content.res.ColorStateList colorStateList = new android.content.res.ColorStateList(
- new int[][]{
- new int[]{-android.R.attr.state_checked},
- new int[]{android.R.attr.state_checked}
- },
- new int[]{
- 0x66FFFFFF, // 未选中时的颜色
- accentColor // 选中时的颜色
- }
- );
- mBinding.incognitoSwitch.setThumbTintList(android.content.res.ColorStateList.valueOf(android.graphics.Color.WHITE));
- mBinding.incognitoSwitch.setTrackTintList(colorStateList);
-
setOtherText();
setCacheText();
String[] quotes = getResources().getStringArray(R.array.motivational_quotes);
diff --git a/app/src/mobile/res/drawable/custom_switch_bg.xml b/app/src/mobile/res/drawable/custom_switch_bg.xml
new file mode 100644
index 00000000..735626f9
--- /dev/null
+++ b/app/src/mobile/res/drawable/custom_switch_bg.xml
@@ -0,0 +1,41 @@
+
+
+
+ -
+
+
+
-
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
-
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
diff --git a/app/src/mobile/res/layout/activity_setting_player.xml b/app/src/mobile/res/layout/activity_setting_player.xml
index 8c355991..3688e081 100644
--- a/app/src/mobile/res/layout/activity_setting_player.xml
+++ b/app/src/mobile/res/layout/activity_setting_player.xml
@@ -222,11 +222,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
@@ -249,11 +248,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
@@ -276,11 +274,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
@@ -303,11 +300,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
diff --git a/app/src/mobile/res/layout/fragment_setting.xml b/app/src/mobile/res/layout/fragment_setting.xml
index 27c2a0d7..c26c4f75 100644
--- a/app/src/mobile/res/layout/fragment_setting.xml
+++ b/app/src/mobile/res/layout/fragment_setting.xml
@@ -333,11 +333,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
diff --git a/app/src/mobile/res/layout/fragment_setting_player.xml b/app/src/mobile/res/layout/fragment_setting_player.xml
index cda936fc..b61a1ec5 100644
--- a/app/src/mobile/res/layout/fragment_setting_player.xml
+++ b/app/src/mobile/res/layout/fragment_setting_player.xml
@@ -354,11 +354,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
@@ -387,11 +386,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
@@ -420,11 +418,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
@@ -453,11 +450,10 @@
android:textColor="@color/white"
android:textSize="16sp" />
-
+ android:layout_height="wrap_content" />
diff --git a/app/src/mobile/res/layout/view_control_vod.xml b/app/src/mobile/res/layout/view_control_vod.xml
index b6bf3efd..8cb541cc 100644
--- a/app/src/mobile/res/layout/view_control_vod.xml
+++ b/app/src/mobile/res/layout/view_control_vod.xml
@@ -64,7 +64,7 @@
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="2dp"
android:src="@drawable/ic_charging_bolt"
android:visibility="gone"
tools:visibility="visible" />
@@ -76,7 +76,7 @@
android:layout_gravity="center_vertical"
android:paddingEnd="8dp"
android:textColor="@color/white"
- android:textSize="14sp"
+ android:textSize="16sp"
android:visibility="gone"
tools:text="85%"
tools:visibility="visible" />
diff --git a/app/src/mobile/res/values/styles.xml b/app/src/mobile/res/values/styles.xml
index 3b77ce03..539a0d13 100644
--- a/app/src/mobile/res/values/styles.xml
+++ b/app/src/mobile/res/values/styles.xml
@@ -78,14 +78,12 @@
- @null
-
-
diff --git a/release_builds/latest/mobile-arm64_v8a.apk b/release_builds/latest/mobile-arm64_v8a.apk
index e79415e7..0744f1c1 100644
Binary files a/release_builds/latest/mobile-arm64_v8a.apk and b/release_builds/latest/mobile-arm64_v8a.apk differ