Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/ScreenBaseFragment.java
Show All 10 Lines | |||||
import com.google.android.material.floatingactionbutton.FloatingActionButton; | import com.google.android.material.floatingactionbutton.FloatingActionButton; | ||||
import it.reyboz.bustorino.BuildConfig; | import it.reyboz.bustorino.BuildConfig; | ||||
import static android.content.Context.MODE_PRIVATE; | import static android.content.Context.MODE_PRIVATE; | ||||
public abstract class ScreenBaseFragment extends Fragment { | public abstract class ScreenBaseFragment extends Fragment { | ||||
protected String PREF_FILE= BuildConfig.APPLICATION_ID+".fragment_prefs"; | protected final String PREF_FILE= BuildConfig.APPLICATION_ID+".fragment_prefs"; | ||||
protected void setOption(String optionName, boolean value) { | protected void setOption(String optionName, boolean value) { | ||||
Context mContext = getContext(); | Context mContext = getContext(); | ||||
SharedPreferences.Editor editor = mContext.getSharedPreferences(PREF_FILE, MODE_PRIVATE).edit(); | SharedPreferences.Editor editor = mContext.getSharedPreferences(PREF_FILE, MODE_PRIVATE).edit(); | ||||
editor.putBoolean(optionName, value); | editor.putBoolean(optionName, value); | ||||
editor.commit(); | editor.commit(); | ||||
} | } | ||||
Show All 28 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register