/** * Load the item from {@link SharedPreferences}. * * @param pref * @param key */ public void load(final SharedPreferences pref, final String key) { this.enabled = pref.getBoolean(String.format(SAVE_KEY_ENABLED, key), false); this.content = pref.getString(String.format(SAVE_KEY_CONTENT, key), null); this.rawCache = pref.getString(String.format(SAVE_KEY_RAW, key), null); this.rawContent = ClipDataHelper.clipDataFromString(rawCache); }
/** * Load the item from {@link Bundle}. * * @param bundle * @param key */ public void load(final Bundle bundle, final String key) { this.enabled = bundle.getBoolean(String.format(SAVE_KEY_ENABLED, key), false); this.content = bundle.getString(String.format(SAVE_KEY_CONTENT, key), null); this.rawCache = bundle.getString(String.format(SAVE_KEY_RAW, key), null); this.rawContent = ClipDataHelper.clipDataFromString(this.rawCache); }
/** * Set the raw {@link ClipData} instance by its string form. * * @param rawContentString */ public void setRawContent(String rawContentString) { this.rawCache = rawContentString; this.rawContent = rawCache == null ? null : ClipDataHelper.clipDataFromString(rawContentString); }