// Path: app/src/main/java/sbs20/filenotes/adapters/DirectoryArrayAdapter.java
// public class DirectoryArrayAdapter extends GenericBaseAdpater<String> {
// 
//     private IDirectoryProvider provider;
//     private String currentDirectory;
// 
//     public DirectoryArrayAdapter(Context context, IDirectoryProvider provider) {
//         super(context);
//         this.provider = provider;
//     }
// 
//     public void setCurrentDirectory(final String directory) {
//         this.currentDirectory = directory;
// 
//         AsyncTask<IDirectoryProvider, Void, List<String>> query = new AsyncTask<IDirectoryProvider, Void, List<String>>() {
//             @Override
//             protected List<String> doInBackground(IDirectoryProvider... params) {
//                 try {
//                     return params[0].getChildDirectoryPaths(directory);
//                 } catch (Exception e) {
//                     return new ArrayList<>();
//                 }
//             }
// 
//             @Override
//             protected void onPostExecute(List<String> dirs) {
//                 super.onPostExecute(dirs);
//                 updateItems(dirs);
//             }
//         };
// 
//         query.execute(this.provider);
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         String directory = this.getItem(position);
//         View row = convertView;
// 
//         if(row == null) {
//             LayoutInflater inflater = LayoutInflater.from(this.context);
//             row = inflater.inflate(R.layout.listview_folders, parent, false);
//         }
// 
//         TextView directoryItem = row.findViewById(R.id.directoryItem);
// 
//         directoryItem.setText(directory);
//         row.setTag(directory);
// 
//         return row;
//     }
// }
// 
// Path: app/src/main/java/sbs20/filenotes/storage/IDirectoryProvider.java
// public interface IDirectoryProvider {
//     List<String> getChildDirectoryPaths(String path) throws Exception;
//     String getRootDirectoryPath();
//     void createDirectory(String path) throws Exception;
// }


import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import sbs20.filenotes.adapters.DirectoryArrayAdapter;
import sbs20.filenotes.storage.IDirectoryProvider;
package sbs20.filenotes;




public abstract class FolderPicker extends DialogPreference {

    private DirectoryArrayAdapter directoryAdapter;

    protected Context context;
    protected String currentDirectory;
// Path: app/src/main/java/sbs20/filenotes/adapters/DirectoryArrayAdapter.java
// public class DirectoryArrayAdapter extends GenericBaseAdpater<String> {
// 
//     private IDirectoryProvider provider;
//     private String currentDirectory;
// 
//     public DirectoryArrayAdapter(Context context, IDirectoryProvider provider) {
//         super(context);
//         this.provider = provider;
//     }
// 
//     public void setCurrentDirectory(final String directory) {
//         this.currentDirectory = directory;
// 
//         AsyncTask<IDirectoryProvider, Void, List<String>> query = new AsyncTask<IDirectoryProvider, Void, List<String>>() {
//             @Override
//             protected List<String> doInBackground(IDirectoryProvider... params) {
//                 try {
//                     return params[0].getChildDirectoryPaths(directory);
//                 } catch (Exception e) {
//                     return new ArrayList<>();
//                 }
//             }
// 
//             @Override
//             protected void onPostExecute(List<String> dirs) {
//                 super.onPostExecute(dirs);
//                 updateItems(dirs);
//             }
//         };
// 
//         query.execute(this.provider);
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         String directory = this.getItem(position);
//         View row = convertView;
// 
//         if(row == null) {
//             LayoutInflater inflater = LayoutInflater.from(this.context);
//             row = inflater.inflate(R.layout.listview_folders, parent, false);
//         }
// 
//         TextView directoryItem = row.findViewById(R.id.directoryItem);
// 
//         directoryItem.setText(directory);
//         row.setTag(directory);
// 
//         return row;
//     }
// }
// 
// Path: app/src/main/java/sbs20/filenotes/storage/IDirectoryProvider.java
// public interface IDirectoryProvider {
//     List<String> getChildDirectoryPaths(String path) throws Exception;
//     String getRootDirectoryPath();
//     void createDirectory(String path) throws Exception;
// }


// Path: app/src/main/java/sbs20/filenotes/FolderPicker.java
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import sbs20.filenotes.adapters.DirectoryArrayAdapter;
import sbs20.filenotes.storage.IDirectoryProvider;

package sbs20.filenotes;




public abstract class FolderPicker extends DialogPreference {

    private DirectoryArrayAdapter directoryAdapter;

    protected Context context;
    protected String currentDirectory;
    protected IDirectoryProvider provider;