Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0eac07f authored by Alexander Martinz's avatar Alexander Martinz Committed by Michael W
Browse files

PreferenceUtils: remove usage of AsyncTask



We are already using #apply(), which applies changes to the
in-memory storage immediately and async write it to disk.

Change-Id: Ifbd60e68ef518f940da0ff6f5b25c90327351afb
Signed-off-by: Alexander Martinz's avatarAlexander Martinz <amartinz@shiftphones.com>
parent c904c2ca
Loading
Loading
Loading
Loading
+6 −22
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.preference.PreferenceManager;

import org.lineageos.eleven.ui.fragments.AlbumFragment;
@@ -106,16 +105,9 @@ public final class PreferenceUtils {
     *              in {@link MusicBrowserPhoneFragment}.
     */
    public void setStartPage(final int value) {
        ElevenUtils.execute(false, new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(final Void... unused) {
        final SharedPreferences.Editor editor = mPreferences.edit();
        editor.putInt(START_PAGE, value);
        editor.apply();

                return null;
            }
        }, (Void[]) null);
    }

    /**
@@ -132,7 +124,6 @@ public final class PreferenceUtils {
        mPreferences.unregisterOnSharedPreferenceChangeListener(listener);
    }


    /**
     * Returns the last page the user was on when the app was exited.
     *
@@ -149,16 +140,9 @@ public final class PreferenceUtils {
     * @param value The new sort order
     */
    private void setSortOrder(final String key, final String value) {
        ElevenUtils.execute(false, new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(final Void... unused) {
        final SharedPreferences.Editor editor = mPreferences.edit();
        editor.putString(key, value);
        editor.apply();

                return null;
            }
        }, (Void[]) null);
    }

    /**