mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Add PrefManager code
This commit is contained in:
parent
c982e50a6b
commit
2390a137b2
1 changed files with 38 additions and 0 deletions
38
app/src/main/java/net/foucry/pilldroid/PrefManager.java
Normal file
38
app/src/main/java/net/foucry/pilldroid/PrefManager.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package net.foucry.pilldroid;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
/**
|
||||
* Created by Lincoln on 05/05/16.
|
||||
*/
|
||||
public class PrefManager {
|
||||
SharedPreferences pref;
|
||||
SharedPreferences.Editor editor;
|
||||
Context _context;
|
||||
|
||||
// shared pref mode
|
||||
int PRIVATE_MODE = 0;
|
||||
|
||||
// Shared preferences file name
|
||||
private static final String PREF_NAME = "androidhive-welcome";
|
||||
|
||||
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
|
||||
|
||||
public PrefManager(Context context) {
|
||||
this._context = context;
|
||||
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
|
||||
editor = pref.edit();
|
||||
}
|
||||
|
||||
public void setFirstTimeLaunch(boolean isFirstTime) {
|
||||
editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public boolean isFirstTimeLaunch() {
|
||||
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue