Compare commits
6 Commits
winboll-v1
...
winboll
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f2170a7a1 | |||
| 6308df8f36 | |||
| 5f24c2d351 | |||
| 882016454f | |||
| c6c290dcd2 | |||
| e64f3a3e97 |
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue May 12 10:47:54 CST 2026
|
||||
stageCount=3
|
||||
#Tue May 12 13:11:28 HKT 2026
|
||||
stageCount=4
|
||||
libraryProject=libaes
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.2
|
||||
buildCount=14
|
||||
baseBetaVersion=15.20.3
|
||||
publishVersion=15.20.3
|
||||
buildCount=0
|
||||
baseBetaVersion=15.20.4
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue May 12 10:47:54 CST 2026
|
||||
stageCount=3
|
||||
#Tue May 12 13:11:09 HKT 2026
|
||||
stageCount=4
|
||||
libraryProject=libaes
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.2
|
||||
buildCount=14
|
||||
baseBetaVersion=15.20.3
|
||||
publishVersion=15.20.3
|
||||
buildCount=0
|
||||
baseBetaVersion=15.20.4
|
||||
|
||||
@@ -31,7 +31,6 @@ import cc.winboll.studio.libaes.utils.DevelopUtils;
|
||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.libaes.views.ADrawerMenuListView;
|
||||
import cc.winboll.studio.libaes.views.ADsBannerView;
|
||||
import cc.winboll.studio.libaes.views.ASupportToolbar;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import com.baoyz.widget.PullRefreshLayout;
|
||||
@@ -175,9 +174,6 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (AESThemeUtil.onAppThemeItemSelected(this, item)) {
|
||||
if (mToolbar instanceof ASupportToolbar) {
|
||||
((ASupportToolbar) mToolbar).refreshFromTheme();
|
||||
}
|
||||
recreate();
|
||||
} if (DevelopUtils.onDevelopItemSelected(this, item)) {
|
||||
LogUtils.d(TAG, String.format("onOptionsItemSelected item.getItemId() %d ", item.getItemId()));
|
||||
|
||||
@@ -7,12 +7,15 @@ package cc.winboll.studio.libaes.views;
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import cc.winboll.studio.libaes.R;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.graphics.PorterDuff;
|
||||
|
||||
public class ASupportToolbar extends Toolbar {
|
||||
|
||||
@@ -22,120 +25,65 @@ public class ASupportToolbar extends Toolbar {
|
||||
int mStartColor;
|
||||
int mCenterColor;
|
||||
int mEndColor;
|
||||
GradientDrawable[] array = new GradientDrawable[3];
|
||||
LayerDrawable ld;
|
||||
GradientDrawable[] array = new GradientDrawable[3];
|
||||
//private GradientDrawable gradientDrawable;
|
||||
|
||||
public ASupportToolbar(Context context) {
|
||||
super(context);
|
||||
LogUtils.d(TAG, "ASupportToolbar() constructor");
|
||||
}
|
||||
|
||||
public ASupportToolbar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LogUtils.d(TAG, "ASupportToolbar() attrs constructor");
|
||||
initStyledAttributes(attrs, R.attr.aSupportToolbar);
|
||||
}
|
||||
|
||||
public ASupportToolbar(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
LogUtils.d(TAG, "ASupportToolbar() attrs defStyleAttr constructor");
|
||||
initStyledAttributes(attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
void initStyledAttributes(AttributeSet attrs, int defStyleAttr) {
|
||||
LogUtils.d(TAG, "initStyledAttributes() start");
|
||||
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ASupportToolbar, defStyleAttr, 0);
|
||||
mTitleTextColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarTitleTextColor, 0xFF00FF00);
|
||||
mStartColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarStartColor, 0xFF03AB4E);
|
||||
mCenterColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarCenterColor, 0xFF03AB4E);
|
||||
mEndColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarEndColor, 0xFF3DDC84);
|
||||
LogUtils.d(TAG, String.format("initStyledAttributes() colors: title=0x%x, start=0x%x, center=0x%x, end=0x%x", mTitleTextColor, mStartColor, mCenterColor, mEndColor));
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ASupportToolbar, R.attr.aSupportToolbar, 0);
|
||||
mTitleTextColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarTitleTextColor, Color.GREEN);
|
||||
mStartColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarStartColor, Color.BLUE);
|
||||
mCenterColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarCenterColor, Color.RED);
|
||||
mEndColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarEndColor, Color.YELLOW);
|
||||
// 返回一个绑定资源结束的信号给资源
|
||||
a.recycle();
|
||||
setTitleTextColor(mTitleTextColor);
|
||||
LogUtils.d(TAG, "initStyledAttributes() end");
|
||||
notifyColorChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
LogUtils.d(TAG, "onAttachedToWindow() start");
|
||||
refreshFromTheme();
|
||||
LogUtils.d(TAG, "onAttachedToWindow() end");
|
||||
}
|
||||
|
||||
public void refreshFromTheme() {
|
||||
LogUtils.d(TAG, "refreshFromTheme() start");
|
||||
TypedArray a = getContext().obtainStyledAttributes(R.styleable.ASupportToolbar);
|
||||
try {
|
||||
mTitleTextColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarTitleTextColor, 0xFF00FF00);
|
||||
mStartColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarStartColor, 0xFF03AB4E);
|
||||
mCenterColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarCenterColor, 0xFF03AB4E);
|
||||
mEndColor = a.getColor(R.styleable.ASupportToolbar_attrASupportToolbarEndColor, 0xFF3DDC84);
|
||||
LogUtils.d(TAG, String.format("refreshFromTheme() colors: title=0x%x, start=0x%x, center=0x%x, end=0x%x", mTitleTextColor, mStartColor, mCenterColor, mEndColor));
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
postNotifyColorChange();
|
||||
LogUtils.d(TAG, "refreshFromTheme() end");
|
||||
}
|
||||
|
||||
void postNotifyColorChange() {
|
||||
LogUtils.d(TAG, "postNotifyColorChange()");
|
||||
removeCallbacks(mRefreshRunnable);
|
||||
post(mRefreshRunnable);
|
||||
}
|
||||
|
||||
Runnable mRefreshRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LogUtils.d(TAG, "mRefreshRunnable.run() start");
|
||||
notifyColorChange();
|
||||
LogUtils.d(TAG, "mRefreshRunnable.run() end");
|
||||
}
|
||||
};
|
||||
|
||||
void notifyColorChange() {
|
||||
LogUtils.d(TAG, "notifyColorChange() start");
|
||||
LogUtils.d(TAG, String.format("notifyColorChange() size: width=%d, height=%d", getWidth(), getHeight()));
|
||||
|
||||
int nWidth = getWidth();
|
||||
int nHeight = getHeight();
|
||||
if (nWidth == 0 || nHeight == 0) {
|
||||
LogUtils.d(TAG, "notifyColorChange() skipped: width or height is 0");
|
||||
return;
|
||||
}
|
||||
|
||||
// 工具栏描边
|
||||
int nStroke = 5;
|
||||
|
||||
int colors0[] = { mEndColor , mCenterColor, mStartColor };
|
||||
//分别为开始颜色,中间夜色,结束颜色
|
||||
int colors0[] = { mEndColor , mCenterColor, mStartColor};
|
||||
GradientDrawable gradientDrawable0;
|
||||
array[2] = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors0);
|
||||
array[2].setShape(GradientDrawable.RECTANGLE);
|
||||
array[2].setColors(colors0);
|
||||
array[2].setGradientType(GradientDrawable.LINEAR_GRADIENT);
|
||||
array[2].setCornerRadius(20);
|
||||
gradientDrawable0 = array[2];
|
||||
gradientDrawable0.setShape(GradientDrawable.RECTANGLE);
|
||||
gradientDrawable0.setColors(colors0); //添加颜色组
|
||||
gradientDrawable0.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
|
||||
gradientDrawable0.setCornerRadius(20);
|
||||
|
||||
int colors1[] = { mCenterColor, mCenterColor, mCenterColor };
|
||||
int colors1[] = { mCenterColor , mCenterColor, mCenterColor };
|
||||
GradientDrawable gradientDrawable1;
|
||||
array[1] = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors1);
|
||||
array[1].setShape(GradientDrawable.RECTANGLE);
|
||||
array[1].setColors(colors1);
|
||||
array[1].setGradientType(GradientDrawable.LINEAR_GRADIENT);
|
||||
array[1].setCornerRadius(20);
|
||||
gradientDrawable1 = array[1];
|
||||
gradientDrawable1.setShape(GradientDrawable.RECTANGLE);
|
||||
gradientDrawable1.setColors(colors1); //添加颜色组
|
||||
gradientDrawable1.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
|
||||
gradientDrawable1.setCornerRadius(20);
|
||||
|
||||
int colors2[] = { mEndColor, mCenterColor, mStartColor };
|
||||
int colors2[] = { mEndColor, mCenterColor, mStartColor };
|
||||
GradientDrawable gradientDrawable2;
|
||||
array[0] = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors2);
|
||||
array[0].setShape(GradientDrawable.RECTANGLE);
|
||||
array[0].setColors(colors2);
|
||||
array[0].setGradientType(GradientDrawable.LINEAR_GRADIENT);
|
||||
array[0].setCornerRadius(20);
|
||||
gradientDrawable2 = array[0];
|
||||
gradientDrawable2.setShape(GradientDrawable.RECTANGLE);
|
||||
gradientDrawable2.setColors(colors2); //添加颜色组
|
||||
gradientDrawable2.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
|
||||
gradientDrawable2.setCornerRadius(20);
|
||||
|
||||
ld = new LayerDrawable(array);
|
||||
ld.setLayerInset(2, nStroke * 2, nStroke * 2, nWidth + nStroke * 2, nHeight + nStroke * 2);
|
||||
ld.setLayerInset(1, nStroke, nStroke, nWidth + nStroke, nHeight + nStroke);
|
||||
ld.setLayerInset(0, 0, 0, nWidth, nHeight);
|
||||
ld = new LayerDrawable(array); //参数为上面的Drawable数组
|
||||
ld.setLayerInset(2, nStroke * 2, nStroke * 2, getWidth() + nStroke * 2, getHeight() + nStroke * 2);
|
||||
ld.setLayerInset(1, nStroke, nStroke, getWidth() + nStroke, getHeight() + nStroke);
|
||||
ld.setLayerInset(0, 0, 0, getWidth(), getHeight());
|
||||
|
||||
setBackgroundDrawable(ld);
|
||||
setTitleTextColor(mTitleTextColor);
|
||||
setSubtitleTextColor(mTitleTextColor);
|
||||
LogUtils.d(TAG, "notifyColorChange() end");
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
api 'com.jcraft:jsch:0.1.54'
|
||||
|
||||
// WinBoLL库 nexus.winboll.cc 地址
|
||||
api 'cc.winboll.studio:libaes:15.20.2'
|
||||
api 'cc.winboll.studio:libaes:15.20.3'
|
||||
api 'cc.winboll.studio:libappbase:15.20.9'
|
||||
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue May 12 12:16:45 HKT 2026
|
||||
#Tue May 12 07:34:49 GMT 2026
|
||||
stageCount=1
|
||||
libraryProject=libwinboll
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.0
|
||||
buildCount=0
|
||||
buildCount=2
|
||||
baseBetaVersion=15.20.1
|
||||
|
||||
@@ -51,7 +51,6 @@ android {
|
||||
|
||||
dependencies {
|
||||
api project(':libwinboll')
|
||||
|
||||
api 'com.google.code.gson:gson:2.10.1'
|
||||
|
||||
// 下拉控件
|
||||
@@ -108,13 +107,5 @@ dependencies {
|
||||
implementation 'com.termux:terminal-view:0.118.0'
|
||||
implementation 'com.termux:termux-shared:0.118.0'
|
||||
|
||||
// WinBoLL库 nexus.winboll.cc 地址
|
||||
api 'cc.winboll.studio:libaes:15.20.2'
|
||||
api 'cc.winboll.studio:libappbase:15.20.9'
|
||||
|
||||
// WinBoLL备用库 jitpack.io 地址
|
||||
//api 'com.github.ZhanGSKen:AES:aes-v15.15.7'
|
||||
//api 'com.github.ZhanGSKen:APPBase:appbase-v15.15.4'
|
||||
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue May 12 12:16:45 HKT 2026
|
||||
#Tue May 12 07:34:49 GMT 2026
|
||||
stageCount=1
|
||||
libraryProject=libwinboll
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.0
|
||||
buildCount=0
|
||||
buildCount=2
|
||||
baseBetaVersion=15.20.1
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity;
|
||||
import cc.winboll.studio.libaes.models.DrawerMenuBean;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.winboll.R;
|
||||
@@ -36,19 +37,17 @@ public class MainActivity extends DrawerFragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(cc.winboll.studio.winboll.theme.WinBoLLThemeUtil.getThemeTypeID(this));
|
||||
super.onCreate(savedInstanceState);
|
||||
// ------------------- 新增:初始化MainActivity的Handler(关键) -------------------
|
||||
initMainHandler();
|
||||
|
||||
if (mBrowserFragment == null) {
|
||||
LogUtils.d(TAG, "The code in this line is not fix yet.");
|
||||
// String externalUrl = extractExternalUrl(getIntent());
|
||||
// if (externalUrl != null) {
|
||||
// mBrowserFragment = BrowserFragment.newInstance(externalUrl);
|
||||
// } else {
|
||||
// mBrowserFragment = new BrowserFragment();
|
||||
// }
|
||||
// addFragment(mBrowserFragment);
|
||||
String externalUrl = extractExternalUrl(getIntent());
|
||||
if (externalUrl != null) {
|
||||
mBrowserFragment = BrowserFragment.newInstance(externalUrl);
|
||||
} else {
|
||||
mBrowserFragment = BrowserFragment.newInstance();
|
||||
}
|
||||
addFragment(mBrowserFragment);
|
||||
}
|
||||
showFragment(mBrowserFragment);
|
||||
}
|
||||
@@ -171,36 +170,35 @@ public class MainActivity extends DrawerFragmentActivity {
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int nItemId = item.getItemId();
|
||||
if (nItemId == R.id.item_home) {
|
||||
// 发送MSG_HOMEPAGE消息给BrowserFragment
|
||||
if (mBrowserFragment != null && mBrowserFragment.getBrowserHandler() != null) {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = BrowserFragment.MSG_HOMEPAGE;
|
||||
mBrowserFragment.getBrowserHandler().sendMessage(msg);
|
||||
}
|
||||
} else if (nItemId == R.id.item_settings) {
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), SettingsActivity.class);
|
||||
} else if (nItemId == R.id.item_about) {
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), intent, AboutActivity.class);
|
||||
} else if (nItemId == R.id.item_mytermux) {
|
||||
Intent intent = new Intent(getApplicationContext(), MyTermuxActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
} else if (nItemId == R.id.item_termux_env_test) {
|
||||
Intent intent = new Intent(getApplicationContext(), TermuxEnvTestActivity.class);
|
||||
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), intent, AboutActivity.class);
|
||||
} else if (nItemId == R.id.item_library_activity) {
|
||||
Intent intent = new Intent(getApplicationContext(), cc.winboll.studio.libwinboll.WinBoLLLibraryActivity.class);
|
||||
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), intent, AboutActivity.class);
|
||||
if (AESThemeUtil.onWinBoLLThemeItemSelected(this, item)) {
|
||||
recreate();
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
int nItemId = item.getItemId();
|
||||
if (nItemId == R.id.item_home) {
|
||||
if (mBrowserFragment != null && mBrowserFragment.getBrowserHandler() != null) {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = BrowserFragment.MSG_HOMEPAGE;
|
||||
mBrowserFragment.getBrowserHandler().sendMessage(msg);
|
||||
}
|
||||
} else if (nItemId == R.id.item_settings) {
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), SettingsActivity.class);
|
||||
} else if (nItemId == R.id.item_about) {
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), intent, AboutActivity.class);
|
||||
} else if (nItemId == R.id.item_mytermux) {
|
||||
Intent intent = new Intent(getApplicationContext(), MyTermuxActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
} else if (nItemId == R.id.item_termux_env_test) {
|
||||
Intent intent = new Intent(getApplicationContext(), TermuxEnvTestActivity.class);
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), intent, AboutActivity.class);
|
||||
} else if (nItemId == R.id.item_library_activity) {
|
||||
Intent intent = new Intent(getApplicationContext(), cc.winboll.studio.libwinboll.WinBoLLLibraryActivity.class);
|
||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), intent, AboutActivity.class);
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
|
||||
import cc.winboll.studio.libaes.models.AESThemeBean;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.winboll.theme.WinBoLLThemeUtil;
|
||||
|
||||
/**
|
||||
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
|
||||
@@ -29,16 +29,11 @@ public abstract class BaseWinBoLLActivity extends AppCompatActivity implements I
|
||||
}
|
||||
|
||||
AESThemeBean.ThemeType getThemeType() {
|
||||
/*SharedPreferences sharedPreferences = getSharedPreferences(
|
||||
SHAREDPREFERENCES_NAME, MODE_PRIVATE);
|
||||
return AESThemeBean.ThemeType.values()[((sharedPreferences.getInt(DRAWER_THEME_TYPE, AESThemeBean.ThemeType.DEFAULT.ordinal())))];
|
||||
*/
|
||||
return AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||
return WinBoLLThemeUtil.getThemeStyleType(WinBoLLThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||
}
|
||||
|
||||
void setThemeStyle() {
|
||||
//setTheme(AESThemeBean.getThemeStyle(getThemeType()));
|
||||
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||
setTheme(WinBoLLThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package cc.winboll.studio.winboll.theme;
|
||||
|
||||
import cc.winboll.studio.libaes.models.AESThemeBean;
|
||||
import cc.winboll.studio.winboll.R;
|
||||
|
||||
public class WinBoLLThemeBean {
|
||||
|
||||
public static final String TAG = "WinBoLLThemeBean";
|
||||
|
||||
public static int getDefaultThemeStyleID() {
|
||||
return R.style.MyAppTheme;
|
||||
}
|
||||
|
||||
public static int getThemeStyleID(AESThemeBean.ThemeType themeType) {
|
||||
int themeStyleID = getDefaultThemeStyleID();
|
||||
if (AESThemeBean.ThemeType.DEPTH == themeType) {
|
||||
themeStyleID = R.style.MyDepthAppTheme;
|
||||
} else if (AESThemeBean.ThemeType.SKY == themeType) {
|
||||
themeStyleID = R.style.MySkyAppTheme;
|
||||
} else if (AESThemeBean.ThemeType.GOLDEN == themeType) {
|
||||
themeStyleID = R.style.MyGoldenAppTheme;
|
||||
} else if (AESThemeBean.ThemeType.BEARING == themeType) {
|
||||
themeStyleID = R.style.MyBearingAppTheme;
|
||||
} else if (AESThemeBean.ThemeType.MEMOR == themeType) {
|
||||
themeStyleID = R.style.MyMemorAppTheme;
|
||||
} else if (AESThemeBean.ThemeType.TAO == themeType) {
|
||||
themeStyleID = R.style.MyTaoAppTheme;
|
||||
}
|
||||
return themeStyleID;
|
||||
}
|
||||
|
||||
public static AESThemeBean.ThemeType getThemeStyleType(int nThemeStyleID) {
|
||||
AESThemeBean.ThemeType themeStyle = AESThemeBean.ThemeType.AES;
|
||||
if (R.style.MyDepthAppTheme == nThemeStyleID) {
|
||||
themeStyle = AESThemeBean.ThemeType.DEPTH;
|
||||
} else if (R.style.MySkyAppTheme == nThemeStyleID) {
|
||||
themeStyle = AESThemeBean.ThemeType.SKY;
|
||||
} else if (R.style.MyGoldenAppTheme == nThemeStyleID) {
|
||||
themeStyle = AESThemeBean.ThemeType.GOLDEN;
|
||||
} else if (R.style.MyBearingAppTheme == nThemeStyleID) {
|
||||
themeStyle = AESThemeBean.ThemeType.BEARING;
|
||||
} else if (R.style.MyMemorAppTheme == nThemeStyleID) {
|
||||
themeStyle = AESThemeBean.ThemeType.MEMOR;
|
||||
} else if (R.style.MyTaoAppTheme == nThemeStyleID) {
|
||||
themeStyle = AESThemeBean.ThemeType.TAO;
|
||||
}
|
||||
return themeStyle;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cc.winboll.studio.winboll.theme;
|
||||
|
||||
import android.content.Context;
|
||||
import cc.winboll.studio.libaes.models.AESThemeBean;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
|
||||
public class WinBoLLThemeUtil {
|
||||
|
||||
public static final String TAG = "WinBoLLThemeUtil";
|
||||
|
||||
public static int getThemeTypeID(Context context) {
|
||||
AESThemeBean bean = AESThemeBean.loadBean(context, AESThemeBean.class);
|
||||
int themeTypeID;
|
||||
if (bean == null) {
|
||||
themeTypeID = WinBoLLThemeBean.getDefaultThemeStyleID();
|
||||
} else {
|
||||
int aesStyleID = bean.getCurrentThemeTypeID();
|
||||
AESThemeBean.ThemeType themeType = WinBoLLThemeBean.getThemeStyleType(aesStyleID);
|
||||
themeTypeID = WinBoLLThemeBean.getThemeStyleID(themeType);
|
||||
}
|
||||
return themeTypeID;
|
||||
}
|
||||
|
||||
public static void saveThemeStyleID(Context context, int nThemeTypeID) {
|
||||
AESThemeBean bean = new AESThemeBean(nThemeTypeID);
|
||||
AESThemeBean.saveBean(context, bean);
|
||||
}
|
||||
|
||||
public static AESThemeBean.ThemeType getThemeStyleType(int nThemeStyleID) {
|
||||
return WinBoLLThemeBean.getThemeStyleType(nThemeStyleID);
|
||||
}
|
||||
|
||||
public static int getThemeStyleID(AESThemeBean.ThemeType themeType) {
|
||||
return WinBoLLThemeBean.getThemeStyleID(themeType);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,50 @@
|
||||
<resources>
|
||||
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<style name="MyAppTheme" parent="AESTheme">
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aboutViewBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="aboutViewTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="aboutViewTitleColor">@color/mainWindowTextColor</item>
|
||||
<item name="aboutViewDividerColor">@color/mainWindowTextColor</item>
|
||||
<item name="dialogBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="dialogTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="toolbarBackgroundColor">@color/toolbarBackgroundColor</item>
|
||||
<item name="toolbarTextColor">@color/toolbarTextColor</item>
|
||||
<item name="textViewBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="textViewTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="editTextBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="editTextTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="scrollViewBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="activityBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="activityTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="mainWindowBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
|
||||
<item name="aToolbar">@style/MyAESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyDepthAppTheme" parent="DepthAESTheme">
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aToolbar">@style/MyAESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MySkyAppTheme" parent="SkyAESTheme">
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aToolbar">@style/MyAESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyGoldenAppTheme" parent="GoldenAESTheme">
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aToolbar">@style/MyAESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyBearingAppTheme" parent="BearingAESTheme">
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aToolbar">@style/MyAESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyMemorAppTheme" parent="MemorAESTheme">
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aToolbar">@style/MyAESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTaoAppTheme" parent="TaoAESTheme">
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aToolbar">@style/MyAESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyAESAToolbar" parent="AESAToolbar" />
|
||||
|
||||
<style name="MyAESASupportToolbar" parent="AESASupportToolbar" />
|
||||
|
||||
<style name="MyDebugActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
|
||||
<item name="colorTittle">@color/mainWindowTextColor</item>
|
||||
|
||||
Reference in New Issue
Block a user