Back to project page WlanLogin.
The source code is released under:
GNU General Public License
If you think the Android project WlanLogin listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package jp.xii.relog.setting; //from w ww . ja v a 2s .co m import java.io.File; import android.content.Context; import android.content.SharedPreferences; import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; import android.widget.Toast; import jp.xii.relog.setting.FileListDialog; import jp.xii.relog.setting.FileListDialog.onFileListDialogListener; /** * ?????????????? * @author Iori * * ??????? * rootPath : ???????????????? */ public class FileSelectPreference extends DialogPreference implements FileListDialog.onFileListDialogListener{ private String _rootPath = "/"; //????? private String _defaultPath = ""; //?????????????????????? /** * ??????? * @param context * @param attrs */ public FileSelectPreference(Context context, AttributeSet attrs) { super(context, attrs); //?????????????? String default_value = attrs.getAttributeValue(null, "defaultValue"); if(default_value == null){ _defaultPath = "/"; }else{ _defaultPath = default_value; } } /** * ??????????????????????? */ @Override protected void onBindView(View view) { //??????????? SharedPreferences pref = getSharedPreferences(); if(pref == null){ }else{ _defaultPath = pref.getString(getKey(), _defaultPath); } //??????????????? setSummary((CharSequence) _defaultPath); //?????????????????????????????????????????????? super.onBindView(view); } /** * ?????????????????? */ @Override protected void onClick(){ //????????????onClick??????????????????????????? FileListDialog dlg = new FileListDialog(getContext()); //????????? dlg.setOnFileListDialogListener((onFileListDialogListener) this); //?????????????????? //dlg.setDirectorySelect(true); //???????????????????????? dlg.show( _rootPath, _rootPath); } /** * ????????????????????? */ @Override public void onClickFileList(File file) { if(file == null){ Toast.makeText(getContext(), "????????????????????????????????????", Toast.LENGTH_SHORT).show(); }else{ //?????????? setDialogTitle((CharSequence)"???"); setDialogMessage((CharSequence) file.getAbsolutePath()); showDialog(null); } } /** * ?????????????????????????? */ @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); if(!positiveResult){ }else{ //?????? SharedPreferences.Editor editor = getEditor(); editor.putString(getKey(), (String) getDialogMessage()); editor.commit(); //??????? notifyChanged(); } } }