keyboard chooser (bugfixes)

This commit is contained in:
Yuriy Liskov
2018-03-20 22:31:30 +02:00
parent 1c65d017fb
commit f948ba3bd4
11 changed files with 204 additions and 9 deletions

View File

@@ -0,0 +1,33 @@
package com.liskovsoft.inputchooser;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public final class LeanKeyPreferences {
private static final String APP_RUN_ONCE = "appRunOnce";
private static LeanKeyPreferences sInstance;
private final Context mContext;
private SharedPreferences mPrefs;
public static LeanKeyPreferences instance(Context ctx) {
if (sInstance == null)
sInstance = new LeanKeyPreferences(ctx);
return sInstance;
}
public LeanKeyPreferences(Context context) {
mContext = context.getApplicationContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
}
public boolean isRunOnce() {
return mPrefs.getBoolean(APP_RUN_ONCE, false);
}
public void setRunOnce(boolean runOnce) {
mPrefs.edit()
.putBoolean(APP_RUN_ONCE, runOnce)
.apply();
}
}