package com.daftshady.superandroidkit.sharedpreferences;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Wraps `android.content.SharedPreferences` for fastest use of
 * `SharedPreferences`.
 * @author parkilsu
 *
 */
public class SuperSharedPreferences {
	
	private SharedPreferences mPreferences;
	
	public SuperSharedPreferences(Activity activity, String fileName) {
		mPreferences = activity.getSharedPreferences(fileName, Context.MODE_PRIVATE);
	}
	
	public String get(String key) {
		return mPreferences.getString(key, null);
	}
	
	public boolean set(String key, String value) {
		SharedPreferences.Editor editor = mPreferences.edit();
		editor.putString(key, value);
		return editor.commit();
	}
	
	public boolean remove(String key) {
		SharedPreferences.Editor editor = mPreferences.edit();
		editor.remove(key);
		return editor.commit();
	}
	
	public boolean flush() {
		SharedPreferences.Editor editor = mPreferences.edit();
		editor.clear();
		return editor.commit();
	}
}

@@ -516,88 +516,279 @@
 %0A%09%0A%09
-public String get(String key) %7B%0A%09%09return mPreferences.getString(key, null);%0A%09%7D%0A%09
+/**%0A%09 * Get matched value for key.%0A%09 * @param key%0A%09 * @return%0A%09 * %09%09%60String%60 value%0A%09 */%0A%09public String get(String key) %7B%0A%09%09return mPreferences.getString(key, null);%0A%09%7D%0A%09%0A%09/**%0A%09 * Set (key, value) pair to %60SharedPreference%60%0A%09 * @param key%0A%09 * @param value%0A%09 * @return%0A%09 */
 %0A%09pu
@@ -944,32 +944,159 @@
 .commit();%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Remove matched value for %60key%60%0A%09 * @param key%0A%09 * @return%0A%09 * %09%09Returns true if removing is success, else false.%0A%09 */%0A
 %09public boolean 
@@ -1226,16 +1226,137 @@
 );%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Remove all data from %60SharedPreference%60%0A%09 * @return%0A%09 * %09%09Returns true if removing is success, else false.%0A%09 */%0A
 %09public 

comment on sharedpreference