夜间模式UI调整
This commit is contained in:
@@ -222,6 +222,11 @@
|
||||
android:name="com.ckkj.water.mine.ResetPsdActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
|
||||
<activity
|
||||
android:name="com.ckkj.water.mine.AppThemActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -38,9 +38,11 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.esafirm.imagepicker.features.ImagePicker;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.XXPermissions;
|
||||
@@ -104,6 +106,7 @@ public abstract class BaseActivity<T extends ViewBinding, P extends IPresenter>
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
applyTheme();
|
||||
super.onCreate(savedInstanceState);
|
||||
try {
|
||||
EventBus.getDefault().register(this);
|
||||
@@ -134,6 +137,13 @@ public abstract class BaseActivity<T extends ViewBinding, P extends IPresenter>
|
||||
initData(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有Activity主题一致
|
||||
*/
|
||||
protected void applyTheme() {
|
||||
int nightMode = ThemeManager.getCurrentTheme(this);
|
||||
AppCompatDelegate.setDefaultNightMode(nightMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化窗口
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.ckkj.water.device.mvp.DeviceContract;
|
||||
import com.ckkj.water.device.mvp.DeviceImpl;
|
||||
import com.ckkj.water.device.mvp.DevicePresenter;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.ckkj.water.utils.show.ToastUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.maning.mlkitscanner.scan.MNScanManager;
|
||||
@@ -49,8 +50,8 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
ImmersionBar.with(this)
|
||||
.statusBarColor(R.color.color_F9F9F9) // 设置状态栏颜色
|
||||
.statusBarDarkFont(true) // 设置状态栏字体为黑色
|
||||
.statusBarColor(R.color.mainBackgroundColor) // 设置状态栏颜色
|
||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext)) // 设置状态栏字体为黑色
|
||||
.titleBar(viewBinding.rlTitle)
|
||||
.init();
|
||||
viewBinding.includedTitle.tvTitle.setText(R.string.add_device_title);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
||||
mTimeList.add("3h");
|
||||
mTimeList.add("4h");
|
||||
ImmersionBar.with(this)
|
||||
.statusBarColor(R.color.color_F9F9F9) // 设置状态栏颜色
|
||||
.statusBarColor(R.color.mainBackgroundColor) // 设置状态栏颜色
|
||||
.statusBarDarkFont(true) // 设置状态栏字体为黑色
|
||||
.titleBar(viewBinding.rlTitle)
|
||||
.init();
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.ckkj.water.device.mvp.DeviceContract;
|
||||
import com.ckkj.water.device.mvp.DeviceImpl;
|
||||
import com.ckkj.water.device.mvp.DevicePresenter;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.ckkj.water.utils.show.ToastUtil;
|
||||
import com.ckkj.water.utils.text.TextUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
@@ -78,8 +79,8 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
||||
}
|
||||
|
||||
ImmersionBar.with(this)
|
||||
.statusBarColor(R.color.color_F9F9F9)
|
||||
.statusBarDarkFont(true)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext))
|
||||
.titleBar(viewBinding.rlTitle)
|
||||
.init();
|
||||
if(WITCH_FROM_CODE == 200){
|
||||
|
||||
@@ -41,6 +41,7 @@ public class LaunchActivity extends BaseActivity<GuideLayoutBinding, MainPresent
|
||||
super.initData(savedInstanceState);
|
||||
viewBinding.includeTitle.imgBack.setVisibility(View.GONE);
|
||||
viewBinding.includeTitle.tvTitle.setVisibility(View.GONE);
|
||||
viewBinding.includeTitle.relativeTitle.setBackgroundColor(mContext.getColor(R.color.white));
|
||||
ImmersionBar.with(this)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarDarkFont(true)
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.plan.BindDeviceFragment;
|
||||
import com.ckkj.water.plan.WaterConfigFragment;
|
||||
import com.ckkj.water.plate.adapter.ViewPagerAdapter;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -31,8 +32,8 @@ public class HistoryFragment extends BaseFragment<HistoryFragmentLayoutBinding,
|
||||
@Override
|
||||
public void initData(Bundle state) {
|
||||
ImmersionBar.with(mContext)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarDarkFont(true)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext))
|
||||
.titleBar(viewBinding.rlTitle)
|
||||
.init();
|
||||
viewBinding.includedTitle.imgBack.setVisibility(INVISIBLE);
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ckkj.water.history.HistoryFragment;
|
||||
import com.ckkj.water.index.IndexFragment;
|
||||
import com.ckkj.water.mine.MineCenterFragment;
|
||||
import com.ckkj.water.plan.WaterPlanFragment;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.ckkj.water.AppConfig;
|
||||
import com.ckkj.water.ConstantUtil;
|
||||
@@ -152,26 +153,21 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
|
||||
case 1:
|
||||
viewBinding.navView.getMenu().getItem(position).setChecked(true);
|
||||
viewBinding.navView.setSelectedItemId(R.id.navigation_plan);
|
||||
// 其他页面恢复白色状态栏
|
||||
ImmersionBar.with(MainActivity.this)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarDarkFont(true)
|
||||
.init();
|
||||
break;
|
||||
case 2:
|
||||
viewBinding.navView.getMenu().getItem(position).setChecked(true);
|
||||
viewBinding.navView.setSelectedItemId(R.id.navigation_history);
|
||||
ImmersionBar.with(MainActivity.this)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarDarkFont(true)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext))
|
||||
.init();
|
||||
break;
|
||||
case 3:
|
||||
viewBinding.navView.getMenu().getItem(position).setChecked(true);
|
||||
viewBinding.navView.setSelectedItemId(R.id.navigation_mine);
|
||||
ImmersionBar.with(MainActivity.this)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarDarkFont(true)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext))
|
||||
.init();
|
||||
break;
|
||||
}
|
||||
@@ -192,13 +188,12 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
|
||||
|
||||
case R.id.navigation_plan:
|
||||
viewBinding.navViewpage2.setCurrentItem(1);
|
||||
|
||||
return true;
|
||||
|
||||
case R.id.navigation_history:
|
||||
viewBinding.navViewpage2.setCurrentItem(2);
|
||||
ImmersionBar.with(MainActivity.this)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(true)
|
||||
.init();
|
||||
return true;
|
||||
@@ -206,7 +201,7 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
|
||||
case R.id.navigation_mine:
|
||||
viewBinding.navViewpage2.setCurrentItem(3);
|
||||
ImmersionBar.with(MainActivity.this)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(true)
|
||||
.init();
|
||||
return true;
|
||||
|
||||
95
app/src/main/java/com/ckkj/water/mine/AppThemActivity.java
Normal file
95
app/src/main/java/com/ckkj/water/mine/AppThemActivity.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package com.ckkj.water.mine;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.ckkj.water.R;
|
||||
import com.ckkj.water.base.BaseActivity;
|
||||
import com.ckkj.water.databinding.AppThemeChangeLayoutBinding;
|
||||
import com.ckkj.water.mine.mvp.MineContract;
|
||||
import com.ckkj.water.mine.mvp.MineImpl;
|
||||
import com.ckkj.water.mine.mvp.MinePresenter;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
/**
|
||||
* @author fengxiaoyang
|
||||
* @date 2026/5/17
|
||||
* @description TODO: 切换主题
|
||||
*/
|
||||
public class AppThemActivity extends BaseActivity<AppThemeChangeLayoutBinding, MinePresenter>
|
||||
implements MineContract.MineView {
|
||||
|
||||
@Override
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
|
||||
ImmersionBar.with(this)
|
||||
.statusBarColor(R.color.transparent) // 设置状态栏颜色
|
||||
.statusBarDarkFont(true) // 设置状态栏字体为黑色
|
||||
.titleBar(viewBinding.rlTitle)
|
||||
.init();
|
||||
viewBinding.includedTitle.tvTitle.setText(R.string.register_title);
|
||||
initListener();
|
||||
int currentTheme = ThemeManager.getCurrentTheme(mContext);
|
||||
if(currentTheme == ThemeManager.MODE_LIGHT){
|
||||
viewBinding.checkNight.setChecked(false);
|
||||
viewBinding.checkLight.setChecked(true);
|
||||
}else{
|
||||
viewBinding.checkNight.setChecked(true);
|
||||
viewBinding.checkLight.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
setClick(viewBinding.includedTitle.imgBack);
|
||||
setClick(viewBinding.linearLight);
|
||||
setClick(viewBinding.linearNight);
|
||||
}
|
||||
|
||||
private void setClick(View view) {
|
||||
view.setOnClickListener(this::onClick);
|
||||
}
|
||||
|
||||
public void onClick(View v){
|
||||
switch (v.getId()){
|
||||
case R.id.linear_light:
|
||||
switchTheme(ThemeManager.MODE_LIGHT);
|
||||
viewBinding.checkNight.setChecked(false);
|
||||
viewBinding.checkLight.setChecked(true);
|
||||
break;
|
||||
case R.id.linear_night:
|
||||
switchTheme(ThemeManager.MODE_DARK);
|
||||
viewBinding.checkNight.setChecked(true);
|
||||
viewBinding.checkLight.setChecked(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void switchTheme(int themeMode) {
|
||||
ThemeManager.setCurrentTheme(this, themeMode);
|
||||
ThemeManager.applyTheme(themeMode);
|
||||
recreate(); // 需要重新创建Activity使主题生效
|
||||
}
|
||||
|
||||
@Override
|
||||
public MinePresenter createPresenter() {
|
||||
return new MinePresenter(new MineImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResId(Bundle savedInstanceState) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logOut(BaseBean bean) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.ckkj.water.mine.mvp.MineContract;
|
||||
import com.ckkj.water.mine.mvp.MineImpl;
|
||||
import com.ckkj.water.mine.mvp.MinePresenter;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.ckkj.water.utils.show.ToastUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
@@ -33,8 +34,8 @@ public class MineCenterFragment extends BaseFragment<MineFragmentLayoutBinding,
|
||||
@Override
|
||||
public void initData(Bundle state) {
|
||||
ImmersionBar.with(mContext)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarDarkFont(true)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext))
|
||||
.titleBar(viewBinding.rlTitle)
|
||||
.init();
|
||||
viewBinding.includedTitle.imgBack.setVisibility(INVISIBLE);
|
||||
@@ -46,6 +47,7 @@ public class MineCenterFragment extends BaseFragment<MineFragmentLayoutBinding,
|
||||
setClick(viewBinding.imgAvatar);
|
||||
setClick(viewBinding.linearLanguage);
|
||||
setClick(viewBinding.linearPsdManage);
|
||||
setClick(viewBinding.linearTheme);
|
||||
}
|
||||
|
||||
private void setClick(View view) {
|
||||
@@ -58,6 +60,10 @@ public class MineCenterFragment extends BaseFragment<MineFragmentLayoutBinding,
|
||||
goTo(mContext, MineInfomationActivity.class,null);
|
||||
break;
|
||||
|
||||
case R.id.linear_theme:
|
||||
goTo(mContext, AppThemActivity.class,null);
|
||||
break;
|
||||
|
||||
case R.id.linear_language:
|
||||
new XPopup.Builder(mContext).asBottomList(
|
||||
"选择语言",
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
||||
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
||||
import com.ckkj.water.plan.mvp.WaterPlanPresenter;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.google.gson.Gson;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
@@ -34,8 +35,8 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
||||
mDevList = entity.getDeviceList();
|
||||
|
||||
ImmersionBar.with(mContext)
|
||||
.statusBarColor(R.color.white)
|
||||
.statusBarDarkFont(true)
|
||||
.statusBarColor(R.color.mainBackgroundColor)
|
||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext))
|
||||
.titleBar(viewBinding.rlTitle)
|
||||
.init();
|
||||
viewBinding.includedTitle.imgBack.setVisibility(INVISIBLE);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ckkj.water.utils.manager;
|
||||
|
||||
/**
|
||||
* @author fengxiaoyang
|
||||
* @date 2026/5/17
|
||||
* @description TODO: 描述该类的作用
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
public class ThemeManager {
|
||||
public static final String PREF_NAME = "theme_preferences";
|
||||
public static final String KEY_THEME_MODE = "theme_mode";
|
||||
|
||||
public static final int MODE_FOLLOW_SYSTEM = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
public static final int MODE_LIGHT = AppCompatDelegate.MODE_NIGHT_NO;
|
||||
public static final int MODE_DARK = AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public static void setCurrentTheme(Context context, int themeMode) {
|
||||
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||
pref.edit().putInt(KEY_THEME_MODE, themeMode).apply();
|
||||
}
|
||||
|
||||
public static int getCurrentTheme(Context context) {
|
||||
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||
return pref.getInt(KEY_THEME_MODE, MODE_FOLLOW_SYSTEM);
|
||||
}
|
||||
|
||||
public static boolean isAppThemeLight(Context context){
|
||||
boolean isLight = false;
|
||||
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||
int code = pref.getInt(KEY_THEME_MODE, MODE_FOLLOW_SYSTEM);
|
||||
if(code == AppCompatDelegate.MODE_NIGHT_NO){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void applyTheme(int themeMode) {
|
||||
AppCompatDelegate.setDefaultNightMode(themeMode);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/black" android:state_checked="true" />
|
||||
<item android:color="@color/textPrimaryColor" android:state_checked="true" />
|
||||
<item android:color="#999999" android:state_checked="false" />
|
||||
</selector>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/dp_8"/>
|
||||
<solid android:color="@color/white"/>
|
||||
<solid android:color="@color/mainBackgroundColor"/>
|
||||
</shape>
|
||||
@@ -3,7 +3,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_F9F9F9">
|
||||
android:background="@color/mainBackgroundColor">
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title"
|
||||
android:layout_width="match_parent"
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/included_title"
|
||||
layout="@layout/include_activity_back_layout" />
|
||||
layout="@layout/include_activity_back_whitebg_layout" />
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -26,7 +26,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="@string/scan_nearby_dev_title"
|
||||
android:textStyle="bold"/>
|
||||
<TextView
|
||||
|
||||
99
app/src/main/res/layout/app_theme_change_layout.xml
Normal file
99
app/src/main/res/layout/app_theme_change_layout.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/img_theme_bg">
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_48">
|
||||
|
||||
<include
|
||||
android:id="@+id/included_title"
|
||||
layout="@layout/include_activity_back_transparent_layout" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/img_theme_light"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/dp_5">
|
||||
<CheckBox
|
||||
android:id="@+id/check_light"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:enabled="false"
|
||||
android:background="@drawable/select_radio"
|
||||
android:checked="true"
|
||||
android:button="@null"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:text="浅色"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/img_theme_night"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_night"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/dp_5">
|
||||
<CheckBox
|
||||
android:id="@+id/check_night"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:enabled="false"
|
||||
android:background="@drawable/select_radio"
|
||||
android:checked="false"
|
||||
android:button="@null"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_night"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:text="深色"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -5,7 +5,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_F9F9F9"
|
||||
android:background="@color/mainBackgroundColor"
|
||||
android:gravity="center_horizontal">
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title"
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/included_title"
|
||||
layout="@layout/include_activity_back_layout" />
|
||||
layout="@layout/include_activity_back_whitebg_layout" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/tv_device_status"
|
||||
@@ -109,7 +109,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="@string/device_work_progress_title"
|
||||
android:layout_marginLeft="@dimen/dp_30"/>
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="@string/device_work_times_title"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_F9F9F9">
|
||||
android:background="@color/mainBackgroundColor">
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title"
|
||||
android:layout_width="match_parent"
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/included_title"
|
||||
layout="@layout/include_activity_back_layout" />
|
||||
layout="@layout/include_activity_back_whitebg_layout" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
@@ -21,7 +21,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="@string/select_wifi_tip"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:background="@null"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:textColorHint="@color/textPrimaryColor"
|
||||
android:hint="@string/input_wifi_name_tip"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_select_wifi"
|
||||
@@ -89,7 +90,8 @@
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:background="@null"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColorHint="@color/textPrimaryColor"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:hint="@string/input_wifi_psd_tip"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5">
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/mainBackgroundColor">
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title"
|
||||
android:layout_width="match_parent"
|
||||
@@ -10,7 +11,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/included_title"
|
||||
layout="@layout/include_activity_back_layout" />
|
||||
layout="@layout/include_activity_back_whitebg_layout" />
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
android:id="@+id/relative_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:background="@color/transparent">
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/img_back_black"
|
||||
android:layout_marginLeft="@dimen/dp_10"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textStyle="bold"
|
||||
android:text="标题名称"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_title_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@+id/tv_title"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/color_2E2E2E"
|
||||
android:text="(剩余时间)"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_title_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:text=""
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:visibility="visible"/>
|
||||
<ImageView
|
||||
android:id="@+id/img_setting"
|
||||
android:layout_width="@dimen/dp_21"
|
||||
android:layout_height="@dimen/dp_21"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@mipmap/device_ctrl_setting"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:visibility="gone"/>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
@@ -6,7 +6,7 @@
|
||||
android:id="@+id/relative_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:background="@color/white">
|
||||
android:background="@color/mainBackgroundColor">
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
android:layout_width="22dp"
|
||||
@@ -20,7 +20,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:textStyle="bold"
|
||||
android:text="标题名称"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="智能浇水设备A1"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
app:itemTextAppearanceInactive="@style/BottomNavTextInactive"
|
||||
app:menu="@menu/bottom_nav_menu"
|
||||
app:itemTextColor="@color/nav_bottom_text_select"
|
||||
android:background="@color/color_white"
|
||||
android:background="@color/mainBackgroundColor"
|
||||
app:itemBackground="@android:color/transparent"
|
||||
app:labelVisibilityMode="labeled"
|
||||
app:itemIconTint="@null"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="昵称"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -51,7 +51,7 @@
|
||||
android:paddingVertical="@dimen/dp_1"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:textSize="10sp"
|
||||
android:textColor="@color/white"
|
||||
android:textColor="@color/mainBackgroundColor"
|
||||
android:text="管理员"
|
||||
android:background="@drawable/shape_green_50"/>
|
||||
|
||||
@@ -62,13 +62,14 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="13988886666"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_theme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
@@ -88,7 +89,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_18"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="背景主题"/>
|
||||
|
||||
<ImageView
|
||||
@@ -118,7 +119,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_18"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="语言选择"/>
|
||||
|
||||
<ImageView
|
||||
@@ -148,7 +149,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_18"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="密码管理"/>
|
||||
|
||||
<ImageView
|
||||
@@ -173,7 +174,7 @@
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:gravity="center"
|
||||
android:text="@string/button_logout"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="@string/tab_filter_time"/>
|
||||
<ImageView
|
||||
android:id="@+id/img_time_filter"
|
||||
@@ -46,7 +46,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:text="@string/tab_filter_type"/>
|
||||
<ImageView
|
||||
android:id="@+id/img_type_filter"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="智能浇水设备A1"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold" />
|
||||
<ImageView
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
android:background="@color/mainBackgroundColor">
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="智能浇水设备A1"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColor="@color/textPrimaryColor"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
BIN
app/src/main/res/mipmap-xhdpi/img_theme_bg.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/img_theme_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 513 KiB |
BIN
app/src/main/res/mipmap-xhdpi/img_theme_light.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/img_theme_light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/img_theme_night.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/img_theme_night.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
8
app/src/main/res/values-night/colors.xml
Normal file
8
app/src/main/res/values-night/colors.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#1A237E</color>
|
||||
<color name="colorPrimaryDark">#000063</color>
|
||||
<color name="colorAccent">#FF80AB</color>
|
||||
<color name="mainBackgroundColor">#303030</color>
|
||||
<color name="textPrimaryColor">#E0E0E0</color>
|
||||
</resources>
|
||||
@@ -1,16 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.TranscendWare" parent="Theme.AppCompat.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<!-- <item name="colorPrimary">@color/purple_200</item>-->
|
||||
<!-- <item name="colorPrimaryVariant">@color/purple_700</item>-->
|
||||
<!-- <item name="colorOnPrimary">@color/black</item>-->
|
||||
<!-- <!– Secondary brand color. –>-->
|
||||
<!-- <item name="colorSecondary">@color/teal_200</item>-->
|
||||
<!-- <item name="colorSecondaryVariant">@color/teal_200</item>-->
|
||||
<!-- <item name="colorOnSecondary">@color/black</item>-->
|
||||
<!-- Status bar color. -->
|
||||
<!-- <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>-->
|
||||
<!-- Customize your theme here. -->
|
||||
<resources>
|
||||
<style name="custom_app_theme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -3,6 +3,9 @@
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="mainBackgroundColor">#FFFFFF</color>
|
||||
<color name="textPrimaryColor">#222222</color>
|
||||
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="color_white">#FFFFFF</color>
|
||||
|
||||
@@ -110,4 +113,5 @@
|
||||
<!--黑色透明度-->
|
||||
<color name="translucent_black_95">#0d000000</color>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<item name="colorAccent">@color/color_zhu</item>
|
||||
</style>
|
||||
|
||||
<style name="custom_app_theme" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||
<style name="custom_app_theme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
@@ -18,6 +18,9 @@
|
||||
<item name="android:textCursorDrawable">@drawable/edittext_cursor</item>
|
||||
</style>
|
||||
|
||||
<attr name="mainBackgroundColor" format="reference|color" />
|
||||
<attr name="textPrimaryColor" format="reference|color" />
|
||||
|
||||
<!-- my loading dialog -->
|
||||
<style name="MyDialogStyle" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
|
||||
Reference in New Issue
Block a user