mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-30 01:31:44 -05:00
Fix custom theme not applying to main screen correctly
We were using the SplashScreen incorrectly. While it isn't consistently documented, I managed to find a small note on https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen#usage-of-the-core-splashscreen-library: which states that installSplashScreen has to be called BEFORE onCreate. Doing this fixing some theming bugs and allows deleting a hacky and buggy workaround.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## Unreleased - 110
|
||||
|
||||
- Fix custom theme not applying to main screen correctly
|
||||
|
||||
## v2.17.1 - 109
|
||||
|
||||
- Fix incorrect text colour on "No barcode" button
|
||||
|
||||
@@ -19,10 +19,7 @@ public class CatimaAppCompatActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// XXX splash screen activity has to do this after installing splash screen before view inflate
|
||||
if (!this.getClass().getSimpleName().equals(MainActivity.class.getSimpleName())) {
|
||||
Utils.patchColors(this);
|
||||
}
|
||||
Utils.patchColors(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -218,8 +218,8 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
@Override
|
||||
protected void onCreate(Bundle inputSavedInstanceState) {
|
||||
extractIntentFields(getIntent());
|
||||
super.onCreate(inputSavedInstanceState);
|
||||
SplashScreen.installSplashScreen(this);
|
||||
super.onCreate(inputSavedInstanceState);
|
||||
if(!mArchiveMode) {
|
||||
setTitle(R.string.app_name);
|
||||
setContentView(R.layout.main_activity);
|
||||
@@ -228,8 +228,7 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
setTitle(R.string.archiveList);
|
||||
setContentView(R.layout.archive_activity);
|
||||
}
|
||||
// XXX color patching has to be done again after setting splash screen
|
||||
Utils.patchColors(this);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
@@ -242,8 +241,6 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
|
||||
mDatabase = new DBHelper(this).getWritableDatabase();
|
||||
|
||||
|
||||
|
||||
TabLayout groupsTabLayout = findViewById(R.id.groups);
|
||||
groupsTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user