精简代码

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 // versionName
// .winboll/winbollBuildProps.properties stageCount=0 // .winboll/winbollBuildProps.properties stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0" // Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "1.2" versionName "1.3"
if(true) { if(true) {
versionName = genVersionName("${versionName}") versionName = genVersionName("${versionName}")
} }

View File

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

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Tue Feb 11 04:40:18 GMT 2025 #Tue Feb 11 05:09:05 GMT 2025
stageCount=5 stageCount=0
libraryProject=libappbase libraryProject=libappbase
baseVersion=1.2 baseVersion=1.3
publishVersion=1.2.4 publishVersion=1.3.0
buildCount=62 buildCount=1
baseBetaVersion=1.2.5 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; private static final int MENUITEM_RESTART = 1;
String mLog; String mLog;
int colorPrimary; int colorTittle;
int colorPrimaryDark; int colorTittleBackground;
int colorAccent;
int colorText; int colorText;
int colorTextBackground;
public static final String TAG = "GlobalCrashActivity"; public static final String TAG = "GlobalCrashActivity";
@ -42,38 +42,35 @@ public final class GlobalCrashActivity extends Activity implements MenuItem.OnMe
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
CrashHandler.AppCrashSafetyWire.getInstance().postResumeCrashSafetyWireHandler(getApplicationContext()); CrashHandler.AppCrashSafetyWire.getInstance().postResumeCrashSafetyWireHandler(getApplicationContext());
mLog = getIntent().getStringExtra(CrashHandler.EXTRA_CRASH_INFO); mLog = getIntent().getStringExtra(CrashHandler.EXTRA_CRASH_INFO);
//setTheme(android.R.style.Theme_Holo_Light_NoActionBar); //setTheme(android.R.style.Theme_Holo_Light_NoActionBar);
setTheme(R.style.APPBaseTheme); setTheme(R.style.APPBaseTheme);
setContentView(R.layout.activity_globalcrash); setContentView(R.layout.activity_globalcrash);
TypedArray a = obtainStyledAttributes(R.attr.globalCrashActivity, R.styleable.GlobalCrashActivity); TypedArray a = obtainStyledAttributes(R.styleable.GlobalCrashActivity);
colorPrimary = a.getColor(R.styleable.GlobalCrashActivity_attrPrimary, Color.WHITE); colorTittle = a.getColor(R.styleable.GlobalCrashActivity_colorTittle, Color.WHITE);
colorPrimaryDark = a.getColor(R.styleable.GlobalCrashActivity_attrPrimaryDark, Color.BLACK); colorTittleBackground = a.getColor(R.styleable.GlobalCrashActivity_colorTittleBackgound, Color.BLACK);
colorAccent = a.getColor(R.styleable.GlobalCrashActivity_attrAccent, Color.RED); colorText = a.getColor(R.styleable.GlobalCrashActivity_colorText, Color.RED);
colorText = a.getColor(R.styleable.GlobalCrashActivity_attrText, Color.RED); colorTextBackground = a.getColor(R.styleable.GlobalCrashActivity_colorTextBackgound, Color.RED);
// 返回一个绑定资源结束的信号给资源 // 返回一个绑定资源结束的信号给资源
a.recycle(); a.recycle();
LinearLayout llMain = findViewById(R.id.activityglobalcrashLinearLayout1); LinearLayout llMain = findViewById(R.id.activityglobalcrashLinearLayout1);
llMain.setBackgroundColor(colorPrimaryDark); llMain.setBackgroundColor(colorTextBackground);
Toolbar toolbar = findViewById(R.id.activityglobalcrashToolbar1); Toolbar toolbar = findViewById(R.id.activityglobalcrashToolbar1);
toolbar.setBackgroundColor(colorPrimary); toolbar.setBackgroundColor(colorTittleBackground);
toolbar.setTitleTextColor(colorAccent); toolbar.setTitleTextColor(colorTittle);
toolbar.setSubtitleTextColor(colorAccent); toolbar.setSubtitleTextColor(colorTittle);
setActionBar(toolbar); setActionBar(toolbar);
TextView tvLog = findViewById(R.id.activityglobalcrashTextView1); TextView tvLog = findViewById(R.id.activityglobalcrashTextView1);
tvLog.setText(mLog); tvLog.setText(mLog);
tvLog.setTextColor(colorPrimary); tvLog.setTextColor(colorText);
tvLog.setBackgroundColor(colorPrimaryDark); tvLog.setBackgroundColor(colorTextBackground);
getActionBar().setTitle(CrashHandler.TITTLE); getActionBar().setTitle(CrashHandler.TITTLE);
getActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext())); getActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext()));
} }
@Override @Override
public void onBackPressed() { public void onBackPressed() {
restart(); restart();
@ -122,7 +119,7 @@ public final class GlobalCrashActivity extends Activity implements MenuItem.OnMe
for (int i = 0; i < menu.size(); i++) { for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i); MenuItem item = menu.getItem(i);
SpannableString spanString = new SpannableString(item.getTitle().toString()); 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); item.setTitle(spanString);
} }
return true; return true;

View File

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

View File

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