Skip to content

Commit

Permalink
Android12+: use user-defined DynamicColors.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisguse committed Oct 8, 2023
1 parent 07abf50 commit 6b2e75e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/de/dennisguse/opentracks/Startup.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.os.StrictMode;
import android.util.Log;

import com.google.android.material.color.DynamicColors;

import java.lang.reflect.Method;

import de.dennisguse.opentracks.settings.PreferencesUtils;
Expand All @@ -28,19 +30,19 @@ public void onCreate() {

// Include version information into stack traces.
Log.i(TAG, BuildConfig.APPLICATION_ID + "; BuildType: " + BuildConfig.BUILD_TYPE + "; VersionName: " + BuildConfig.VERSION_NAME + "/" + BuildConfig.VERSION_NAME_FULL + " VersionCode: " + BuildConfig.VERSION_CODE);
// In debug builds: show thread and VM warnings.
if (BuildConfig.DEBUG) {
Log.d(TAG, "Enabling strict mode");
StrictMode.enableDefaults();
}

PreferencesUtils.initPreferences(this, getResources());
// Set default values of preferences on first start.
PreferencesUtils.resetPreferences(this, false);
PreferencesUtils.applyDefaultUnit();
PreferencesUtils.applyNightMode();


// In debug builds: show thread and VM warnings.
if (BuildConfig.DEBUG) {
Log.d(TAG, "Enabling strict mode");
StrictMode.enableDefaults();
}
DynamicColors.applyToActivitiesIfAvailable(this);
}

@Override
Expand Down

0 comments on commit 6b2e75e

Please sign in to comment.