Ejemplo n.º 1
0
        private void InflateLayout(Context context)
        {
            var inflater = LayoutInflater.FromContext(context);

            inflater.Inflate(Resource.Layout.FileListViewWithDirName, this);

            _currentDir_TextView          = FindViewById <TextView>(Resource.Id.FileList_CurrentDir);
            _fileList_ListView            = FindViewById <ListView>(Resource.Id.FileList_ListView);
            _fileList_ListView.Adapter    = _fileListAdapter = new FileListAdapter(context, new FileSystemInfo[0]);
            _fileList_ListView.ItemClick += _fileList_ListView_ItemClick;
        }
        //http://stackoverflow.com/questions/10942959/how-to-show-different-layout-in-fragments
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _adapter = new FileListAdapter(Activity, new FileSystemInfo[0]);

            if (Directory.Exists (DefaultInitialDirectory + "/" + Android.OS.Environment.DirectoryDcim)) {

                DefaultInitialDirectory += "/" + Android.OS.Environment.DirectoryDcim;

                if (Directory.Exists (DefaultInitialDirectory + "/Camera")) {

                    DefaultInitialDirectory = DefaultInitialDirectory + "/Camera";

                }
            }
            //ListAdapter = _adapter;
        }
Ejemplo n.º 3
0
        private void getDir(string dir)
        {
            mPwd_textView.Text = dir;

            filePathList     = new List <string>();
            mFilelistAdapter = new FileListAdapter(this);

            File file = new File(dir);

            File[] files = file.listFiles();

            if (!dir.Equals(homeDir))
            {
                filePathList.Add(homeDir);
                filePathList.Add(file.Parent);

                mFilelistAdapter.addFile(homeDir);
                mFilelistAdapter.addFile("../");
            }

            for (int i = 0; i < files.Length; i++)
            {
                File mfile = files[i];
                filePathList.Add(mfile.Path);

                if (mfile.Directory)
                {
                    mFilelistAdapter.addFile(mfile.Path + "/");
                }
                else
                {
                    mFilelistAdapter.addFile(mfile.Name);
                }
            }
            mFileListView.Adapter = mFilelistAdapter;
        }
Ejemplo n.º 4
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate (savedInstanceState);
     _adapter = new FileListAdapter (Activity, new FileSystemInfo[0]);
     ListAdapter = _adapter;
 }
Ejemplo n.º 5
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     adapter = new FileListAdapter(Activity, new FileSystemInfo[0]);
     DirPath = Environment.ExternalStorageDirectory.AbsolutePath;
 }
Ejemplo n.º 6
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     _adapter    = new FileListAdapter(Activity, new FileSystemInfo[0]);
     ListAdapter = _adapter;
 }
Ejemplo n.º 7
0
        /// <inheritdoc />
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            System.Diagnostics.Debug.Assert(Activity != null, "Activity != null");
            var view = inflater.Inflate(Resource.Layout.filepicker_fragment, container, false);

            btnConfirm = view.FindViewById<Button>(Resource.Id.btnConfirm);
            btnCancel = view.FindViewById<Button>(Resource.Id.btnCancel);
            btnCreateFolder = view.FindViewById<ImageButton>(Resource.Id.btnCreateFolder2);
            btnLevelUp = view.FindViewById<ImageButton>(Resource.Id.btnNavUp);
            listFiles = view.FindViewById<ListView>(Resource.Id.directoryList);

            switch (filePickerMode)
            {
                case FilePickerMode.File:
                    view.FindViewById<TextView>(Resource.Id.txtvSelectedFolderLabel).Text = GetString(Resource.String.filepicker_selected_file_label);
                    break;
                case FilePickerMode.Directory:
                    view.FindViewById<TextView>(Resource.Id.txtvSelectedFolderLabel).Text = GetString(Resource.String.filepicker_selected_folder_label);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            btnConfirm.Click += (sender, args) => Confirm();
            btnCancel.Click += (sender, args) => CancelAction();
            btnCreateFolder.Click += (sender, args) => OpenNewFolderDialog();
            btnLevelUp.Click += (sender, args) => UpOneLevel();
            listFiles.ItemClick += ListFilesOnItemClick;

            if (!ShowsDialog || filePickerMode == FilePickerMode.File)
            {
                btnCreateFolder.Visibility = ViewStates.Gone;
            }

            adapter = new FileListAdapter(Activity, new FileSystemInfo[0]);
            listFiles.Adapter = adapter;

            if (!string.IsNullOrWhiteSpace(initialDirectory) && IsValidFile(initialDirectory))
            {
                selectedFile = new File(initialDirectory);
            }
            else
            {
                selectedFile = Environment.ExternalStorageDirectory;
            }

            return view;
        }
		public override void OnCreate(Bundle savedInstanceState)
		{
			base.OnCreate(savedInstanceState);
			adapter = new FileListAdapter(Activity, new FileSystemInfo[0]);
			DirPath = Environment.ExternalStorageDirectory.AbsolutePath;
		}