package sttnf.app.nfkita.utils;

import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

import sttnf.app.nfkita.NFKitaApplication;

/**
 * Created by isfaaghyth on 7/13/17.
 */

public class CacheManager {
    private static final String TAG = "CacheManager";

    private static SharedPreferences getPref() {
        return PreferenceManager.getDefaultSharedPreferences(NFKitaApplication.getContext());
    }

    public static void save(String key, String value) {
        Log.d(TAG, "saveCache: " + value);
        getPref().edit().putString(key, value).apply();
    }

    public static void save(String key, Boolean value) {
        Log.d(TAG, "saveCache: " + value);
        getPref().edit().putBoolean(key, value).apply();
    }

    public static Boolean checkExist(String key) {
        return getPref().contains(key);
    }

    public static String grabString(String key) {
        return getPref().getString(key, null);
    }

    public static Boolean grabBoolean(String key) {
        return getPref().getBoolean(key, false);
    }
}

package sttnf.app.nfkita.utils;

import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

import sttnf.app.nfkita.NFKitaApplication;

/**
 * Created by isfaaghyth on 7/13/17.
 */

public class CacheManager {
    private static final String TAG = "CacheManager";

    private static SharedPreferences getPref() {
        return PreferenceManager.getDefaultSharedPreferences(NFKitaApplication.getContext());
    }

    public static void save(String key, String value) {
        getPref().edit().putString(key, value).apply();
    }

    public static void save(String key, Boolean value) {
        getPref().edit().putBoolean(key, value).apply();
    }

    public static Boolean checkExist(String key) {
        return getPref().contains(key);
    }

    public static String grabString(String key) {
        return getPref().getString(key, null);
    }

    public static Boolean grabBoolean(String key) {
        return getPref().getBoolean(key, false);
    }
}

remove logcat for local storage