예제 #1
0
 /**
  * Set the raw {@link ClipData} instance
  *
  * @param rawContent the raw {@link ClipData} instance
  */
 public void setRawContent(ClipData rawContent) {
   this.rawContent = rawContent;
   this.rawCache =
       rawContent == null ? null : ClipDataHelper.stringFromClipData(rawContent).toString();
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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);
 }
예제 #4
0
 /**
  * Return the types in integer flag. If coerce to text, -1 will be returned.
  *
  * @return the types in integer
  */
 public int getTypesFlag() {
   return this.isCoerceText() ? 0 : ClipDataHelper.getItemTypes(this.getRawContent().getItemAt(0));
 }
예제 #5
0
 /**
  * Return the types in string.
  *
  * @return the types
  */
 public String getTypes() {
   return this.isCoerceText()
       ? TYPE_COERCE_TEXT
       : ClipDataHelper.getTypeString(
           ClipDataHelper.getItemTypes(this.getRawContent().getItemAt(0)));
 }
예제 #6
0
 /**
  * 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);
 }