Back to project page Ocypode.
The source code is released under:
MIT License
If you think the Android project Ocypode listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ocypode.repository; /*from ww w . j a v a 2s . co m*/ import android.content.Context; import android.content.SharedPreferences; abstract public class AbstractRepository { private SharedPreferences mSharedPreferences; public AbstractRepository(Context context) { mSharedPreferences = context.getSharedPreferences( getSharedPreferencesName(), Context.MODE_PRIVATE); } protected SharedPreferences getSharedPreferences() { return mSharedPreferences; } protected SharedPreferences.Editor getEditor() { return mSharedPreferences.edit(); } public void delete() { SharedPreferences.Editor editor = getEditor(); editor.clear(); editor.commit(); } public void saveBoolean(String key, Boolean value) { SharedPreferences.Editor editor = getEditor(); editor.putBoolean(key, value); editor.commit(); } abstract protected String getSharedPreferencesName(); }