コード例 #1
0
 public override void OnBackPressed()
 {
     if (path.EndsWith(Environment.ExternalStorageDirectory.AbsolutePath))
     {
         Finish();
     }
     else
     {
         path         = Directory.GetParent(path).ToString();
         tvTitle.Text = path;
         adapter.UpdateAdapter(Ultilities.GetFileNames(path));
     }
 }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // init values
            list    = Ultilities.GetFileNames(path);
            adapter = new FileAdapter(list);

            // set widgets
            Cheeseknife.Inject(this);
            rvFileManager.SetLayoutManager(new LinearLayoutManager(this));
            rvFileManager.SetAdapter(adapter);
            tvTitle.Text = path;

            // add widget's listeners
            adapter.ItemClick += (sender, i) =>
            {
                var managerItem = (ManagerItem)sender;
                path = managerItem.Name;
                switch (managerItem.Image)
                {
                case Resource.Drawable.folder32:
                    tvTitle.Text = path;
                    adapter.UpdateAdapter(Ultilities.GetFileNames(path));
                    break;

                case Resource.Drawable.file32:
                    Toast.MakeText(this, path, ToastLength.Short).Show();
                    break;

                default:
                    OpenFileFromPath(managerItem);
                    break;
                }
            };
        }