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 .j av a 2 s . c o m*/ import java.io.File; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.view.*; /** * ??????????????? * @author Iori * */ public class FileListDialog extends Activity implements View.OnClickListener , DialogInterface.OnClickListener { private Context _parent = null; //? private File[] _dialog_file_list; //????????????????????????? private int _select_count = -1; //???????????????? private onFileListDialogListener _listener = null; //???? private boolean _is_directory_select = false; //??????????????????? /** * ??????????????????? * @param is */ public void setDirectorySelect(boolean is){ _is_directory_select = is; } public boolean isDirectorySelect(){ return _is_directory_select; } /** * ?????????????????????? * @return */ public String getSelectedFileName(){ String ret = ""; if(_select_count < 0){ }else{ ret = _dialog_file_list[_select_count].getName(); } return ret; } /** * ????????????? * @param context ? */ public FileListDialog(Context context){ _parent = context; } @Override public void onClick(View v) { // ?????????? } /** * ???????????????? */ @Override public void onClick(DialogInterface dialog, int which) { //???????????????????????? _select_count = which; if((_dialog_file_list == null) || (_listener == null)){ }else{ File file = _dialog_file_list[which]; // Util.outputDebugLog("getAbsolutePath : " + file.getAbsolutePath()); // Util.outputDebugLog("getPath : " + file.getPath()); // Util.outputDebugLog("getName : " + file.getName()); // Util.outputDebugLog("getParent : " + file.getParent()); if(file.isDirectory() && !isDirectorySelect()){ //??????????????????????????????????????????????????????????????? show(file.getAbsolutePath(), file.getPath()); }else{ //????????????????????????????????????? _listener.onClickFileList(file); } } } /** * ??????? * @param context ? * @param path ????????????????? * @param title ???????????? */ public void show(String path, String title){ try{ _dialog_file_list = new File(path).listFiles(); if(_dialog_file_list == null){ //NG if(_listener != null){ //???????????????????????????????? _listener.onClickFileList(null); } }else{ String[] list = new String[_dialog_file_list.length]; int count = 0; String name = ""; //???????????????? for (File file : _dialog_file_list) { if(file.isDirectory()){ //????????????? name = file.getName() + "/"; }else{ //????????? name = file.getName(); } list[count] = name; count++; } //??????? new AlertDialog.Builder(_parent).setTitle(title).setItems(list, this).show(); } }catch(SecurityException se){ //Util.outputDebugLog(se.getMessage()); }catch(Exception e){ //Util.outputDebugLog(e.getMessage()); } } /** * ?????????? * @param listener */ public void setOnFileListDialogListener(onFileListDialogListener listener){ _listener = listener; } /** * ?????????????????????? * @author Iori * */ public interface onFileListDialogListener{ public void onClickFileList(File file); } }