跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

MobileTheme.java

34 行 · 1.4 KB历史下载
1package io.github.leexeo.cage.mobile;
2
3import android.app.Activity;
4import android.content.res.Configuration;
5import android.view.View;
6
7final class MobileTheme {
8 final boolean dark;
9 final int bg, panel, ink, muted, line, soft, action, onAction;
10
11 private MobileTheme(boolean dark) {
12 this.dark = dark;
13 bg = dark ? 0xff191a18 : 0xfffaf9f6;
14 panel = dark ? 0xff252623 : 0xffffffff;
15 ink = dark ? 0xfff6f5ef : 0xff292a27;
16 muted = dark ? 0xffb5b6af : 0xff62645e;
17 line = dark ? 0xff44463f : 0xffdeded6;
18 soft = dark ? 0xff32342f : 0xffeeeee8;
19 action = ink;
20 onAction = bg;
21 }
22
23 static MobileTheme apply(Activity activity, String mode) {
24 int night = activity.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
25 boolean dark = "dark".equals(mode) || (!"light".equals(mode) && night == Configuration.UI_MODE_NIGHT_YES);
26 activity.setTheme(dark ? android.R.style.Theme_Material_NoActionBar : android.R.style.Theme_Material_Light_NoActionBar);
27 MobileTheme theme = new MobileTheme(dark);
28 activity.getWindow().setStatusBarColor(theme.bg);
29 activity.getWindow().setNavigationBarColor(theme.bg);
30 activity.getWindow().getDecorView().setSystemUiVisibility(dark ? 0 :
31 View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
32 return theme;
33 }
34}