Android Open Source - Text-Edit-for-Android Clear Recent File List Preference






From Project

Back to project page Text-Edit-for-Android.

License

The source code is released under:

GNU General Public License

If you think the Android project Text-Edit-for-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.paulmach.textedit;
/*  w w w . j a v  a  2s  .  c  o  m*/
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.widget.Toast;

/* ClearListPreference
 *     The Special clear recent file list preference
 *     Needs it's own special class so you can just click on it */
public class ClearRecentFileListPreference extends Preference
{
  // This is the constructor called by the inflater
  public ClearRecentFileListPreference(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  @Override
  protected void onClick() {
      // Data has changed, notify so UI can be refreshed!
    SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
    editor.putInt("rf_numfiles", 0);
    editor.commit();
    
    Toast.makeText(getContext(), R.string.onListCleared, Toast.LENGTH_SHORT).show();
        notifyChanged();
    }
  
} // end class ClearListPreference





Java Source Code List

org.paulmach.textedit.ClearRecentFileListPreference.java
org.paulmach.textedit.ClearSearchSuggestions.java
org.paulmach.textedit.ColorPreference.java
org.paulmach.textedit.DefaultDirPreference.java
org.paulmach.textedit.EditPreferences.java
org.paulmach.textedit.FileAutoCompleteArrayAdapter.java
org.paulmach.textedit.FileBrowser.java
org.paulmach.textedit.FileViewArrayAdapter.java
org.paulmach.textedit.FontSizePreference.java
org.paulmach.textedit.FontTypePreference.java
org.paulmach.textedit.SearchSuggestions.java
org.paulmach.textedit.WarrantyPreference.java
org.paulmach.textedit.pmTextEdit.java