mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-03 01:53:05 +02:00
Performance: Keep reference to sharedPreferences.
So far, we opened the SharedPreferences very often, which is very slow; also happened in the UI thread a lot. Fixes #642.
This commit is contained in:
@@ -3,6 +3,7 @@ package de.dennisguse.opentracks.util;
|
||||
import android.app.Activity;
|
||||
import android.app.SearchManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
@@ -150,7 +151,7 @@ public class ActivityUtils {
|
||||
toast.show();
|
||||
}
|
||||
|
||||
public static void applyNightMode(Context context) {
|
||||
AppCompatDelegate.setDefaultNightMode(PreferencesUtils.getDefaultNightMode(context));
|
||||
public static void applyNightMode(SharedPreferences sharedPreferences, Context context) {
|
||||
AppCompatDelegate.setDefaultNightMode(PreferencesUtils.getDefaultNightMode(sharedPreferences, context));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user