精简代码

This commit is contained in:
ZhanGSKen 2025-02-11 13:09:33 +08:00
parent 6686da0e8f
commit 9642ad1966
6 changed files with 37 additions and 59 deletions

View File

@ -29,7 +29,7 @@ android {
// versionName
// .winboll/winbollBuildProps.properties stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "1.2"
versionName "1.3"
if(true) {
versionName = genVersionName("${versionName}")
}

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Feb 11 04:40:18 GMT 2025
stageCount=5
#Tue Feb 11 05:09:05 GMT 2025
stageCount=0
libraryProject=libappbase
baseVersion=1.2
publishVersion=1.2.4
buildCount=62
baseBetaVersion=1.2.5
baseVersion=1.3
publishVersion=1.3.0
buildCount=1
baseBetaVersion=1.3.1

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Feb 11 04:40:18 GMT 2025
stageCount=5
#Tue Feb 11 05:09:05 GMT 2025
stageCount=0
libraryProject=libappbase
baseVersion=1.2
publishVersion=1.2.4
buildCount=62
baseBetaVersion=1.2.5
baseVersion=1.3
publishVersion=1.3.0
buildCount=1
baseBetaVersion=1.3.1

View File

@ -30,10 +30,10 @@ public final class GlobalCrashActivity extends Activity implements MenuItem.OnMe
private static final int MENUITEM_RESTART = 1;
String mLog;
int colorPrimary;
int colorPrimaryDark;
int colorAccent;
int colorTittle;
int colorTittleBackground;
int colorText;
int colorTextBackground;
public static final String TAG = "GlobalCrashActivity";
@ -42,38 +42,35 @@ public final class GlobalCrashActivity extends Activity implements MenuItem.OnMe
super.onCreate(savedInstanceState);
CrashHandler.AppCrashSafetyWire.getInstance().postResumeCrashSafetyWireHandler(getApplicationContext());
mLog = getIntent().getStringExtra(CrashHandler.EXTRA_CRASH_INFO);
//setTheme(android.R.style.Theme_Holo_Light_NoActionBar);
setTheme(R.style.APPBaseTheme);
setContentView(R.layout.activity_globalcrash);
TypedArray a = obtainStyledAttributes(R.attr.globalCrashActivity, R.styleable.GlobalCrashActivity);
colorPrimary = a.getColor(R.styleable.GlobalCrashActivity_attrPrimary, Color.WHITE);
colorPrimaryDark = a.getColor(R.styleable.GlobalCrashActivity_attrPrimaryDark, Color.BLACK);
colorAccent = a.getColor(R.styleable.GlobalCrashActivity_attrAccent, Color.RED);
colorText = a.getColor(R.styleable.GlobalCrashActivity_attrText, Color.RED);
TypedArray a = obtainStyledAttributes(R.styleable.GlobalCrashActivity);
colorTittle = a.getColor(R.styleable.GlobalCrashActivity_colorTittle, Color.WHITE);
colorTittleBackground = a.getColor(R.styleable.GlobalCrashActivity_colorTittleBackgound, Color.BLACK);
colorText = a.getColor(R.styleable.GlobalCrashActivity_colorText, Color.RED);
colorTextBackground = a.getColor(R.styleable.GlobalCrashActivity_colorTextBackgound, Color.RED);
// 返回一个绑定资源结束的信号给资源
a.recycle();
LinearLayout llMain = findViewById(R.id.activityglobalcrashLinearLayout1);
llMain.setBackgroundColor(colorPrimaryDark);
llMain.setBackgroundColor(colorTextBackground);
Toolbar toolbar = findViewById(R.id.activityglobalcrashToolbar1);
toolbar.setBackgroundColor(colorPrimary);
toolbar.setTitleTextColor(colorAccent);
toolbar.setSubtitleTextColor(colorAccent);
toolbar.setBackgroundColor(colorTittleBackground);
toolbar.setTitleTextColor(colorTittle);
toolbar.setSubtitleTextColor(colorTittle);
setActionBar(toolbar);
TextView tvLog = findViewById(R.id.activityglobalcrashTextView1);
tvLog.setText(mLog);
tvLog.setTextColor(colorPrimary);
tvLog.setBackgroundColor(colorPrimaryDark);
tvLog.setTextColor(colorText);
tvLog.setBackgroundColor(colorTextBackground);
getActionBar().setTitle(CrashHandler.TITTLE);
getActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext()));
}
@Override
public void onBackPressed() {
restart();
@ -122,7 +119,7 @@ public final class GlobalCrashActivity extends Activity implements MenuItem.OnMe
for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i);
SpannableString spanString = new SpannableString(item.getTitle().toString());
spanString.setSpan(new ForegroundColorSpan(colorAccent), 0, spanString.length(), 0);
spanString.setSpan(new ForegroundColorSpan(colorTittle), 0, spanString.length(), 0);
item.setTitle(spanString);
}
return true;

View File

@ -1,20 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="colorPrimary" format="color" />
<attr name="colorPrimaryDark" format="color" />
<attr name="colorAccent" format="color" />
<attr name="colorText" format="color" />
<attr name="globalCrashActivity" format="reference"/>
<!--<attr name="attrPrimary" format="color" />
<attr name="attrPrimaryDark" format="color" />
<attr name="attrAccent" format="color" />-->
<declare-styleable name="GlobalCrashActivity">
<attr name="attrPrimary" format="color" />
<attr name="attrPrimaryDark" format="color" />
<attr name="attrAccent" format="color" />
<attr name="attrText" format="color" />
<attr name="colorTittle" format="color" />
<attr name="colorTittleBackgound" format="color" />
<attr name="colorText" format="color" />
<attr name="colorTextBackgound" format="color" />
</declare-styleable>
</resources>

View File

@ -1,20 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="APPBaseTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
<item name="colorPrimary">#FF3C4CE3</item>
<item name="colorPrimaryDark">#FF3C4CE3</item>
<item name="colorAccent">#FF3C4CE3</item>
<item name="attrPrimary">#FF00B322</item>
<item name="attrPrimaryDark">#FF000000</item>
<item name="attrAccent">#FFFFF600</item>
<item name="attrText">#FF00FF31</item>
<item name="globalCrashActivity">@style/GlobalCrashActivity</item>
<item name="colorTittle">#FFFFF600</item>
<item name="colorTittleBackgound">#FF00B322</item>
<item name="colorText">#FF00B322</item>
<item name="colorTextBackgound">#FF000000</item>
</style>
<style name="GlobalCrashActivity">
<item name="attrPrimary">?attr/colorPrimary</item>
<item name="attrPrimaryDark">?attr/colorPrimaryDark</item>
<item name="attrAccent">?attr/colorAccent</item>
<item name="attrText">?attr/colorText</item>
</style>
</resources>