Пример #1
0
        public void RefreshExplorerFragmentData()
        {
            ExplorerFragment explorerFragment = GetLastOpenedExplorerFragment();

            if (explorerFragment != null)
            {
                explorerFragment.RefreshData();
            }
        }
Пример #2
0
        protected override void OnResume()
        {
            base.OnResume();
            ExplorerFragment explorerFragment = GetLastOpenedExplorerFragment();

            if (explorerFragment != null && !explorerFragment.favoriteFolderOpened && SplashActivity.intentData == null)
            {
                explorerFragment.RefreshData();
            }
        }
Пример #3
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activity_home);

            openedExplorerFragments = new List <ExplorerFragment>();
            dialogHelper            = new DialogHelperForHomeActivity(this);

            this.ActionBar.Hide();

            //////////////////////////////////////////////////////
            //Menu part of layout
            //////////////////////////////////////////////////////

            //Initialize menu fragment
            menuFragment = new MenuFragment();
            SupportFragmentManager.BeginTransaction().Add(Resource.Id.fragment_container_menu, menuFragment).Commit();

            //Initialize bottom menu fragment
            BottomMenuFragment bottomMenuFragment = new BottomMenuFragment();

            SupportFragmentManager.BeginTransaction().Add(Resource.Id.fragment_container_menu_bottom, bottomMenuFragment).Commit();


            //Controleer of introduction dialog getoond moet worden (alleen wanneer geen local boxen geregistreerd zijn)
            List <LocalBox> registeredLocalBoxes = await DataLayer.Instance.GetLocalBoxes();

            if (registeredLocalBoxes.Count == 0)
            {
                if (SplashActivity.intentData == null)
                {
                    ShowLoginDialog();
                }
            }


            //////////////////////////////////////////////////////
            //Explorer part of layout
            //////////////////////////////////////////////////////
            buttonBackExplorer       = FindViewById <ImageButton> (Resource.Id.button_back_explorer);
            buttonAddFolderExplorer  = FindViewById <ImageButton> (Resource.Id.button_add_folder_explorer);
            buttonUploadFileExplorer = FindViewById <ImageButton> (Resource.Id.button_upload_file_explorer);
            buttonRefreshExplorer    = FindViewById <ImageButton> (Resource.Id.button_refresh_explorer);

            fragmentContainerExplorerBottom            = FindViewById <RelativeLayout> (Resource.Id.fragment_container_explorer_blank);
            fragmentContainerExplorerBottom.Visibility = ViewStates.Invisible;

            shadowContainerExplorer            = FindViewById <View> (Resource.Id.shadow_container_explorer);
            shadowContainerExplorer.Visibility = ViewStates.Invisible;

            buttonBackExplorer.Visibility = ViewStates.Invisible;
            buttonBackExplorer.Click     += delegate {
                //Verwijder fragment van stack
                SupportFragmentManager.PopBackStack();

                //Remove last opened directory from opened directory list
                int numberOfDirectoriesOpened = ExplorerFragment.openedDirectories.Count;
                if (numberOfDirectoriesOpened > 0)
                {
                    ExplorerFragment.openedDirectories.RemoveAt(numberOfDirectoriesOpened - 1);
                    RemoveLastOpenedExplorerFragment();
                    ShowBottomExplorerMenuItems();
                }
                CheckToHideButtons();
            };

            buttonAddFolderExplorer.Click += delegate {
                ShowNewFolderDialog();
            };

            //Hide upload file button on root level
            buttonUploadFileExplorer.Visibility = ViewStates.Invisible;
            buttonUploadFileExplorer.Click     += delegate {
                //Show menu to make a choice between new folder or upload file
                PopupMenu popupMenu = new PopupMenu(this, buttonUploadFileExplorer);
                popupMenu.Inflate(Resource.Menu.menu_add);
                popupMenu.MenuItemClick += (s1, arg1) => {
                    if (arg1.Item.ItemId.Equals(Resource.Id.menu_explorer_upload_photo))                       //Upload foto of video geselecteerd
                    {
                        var imageIntent = new Intent();
                        imageIntent.SetType("image/*");
                        imageIntent.SetAction(Intent.ActionGetContent);
                        StartActivityForResult(Intent.CreateChooser(imageIntent, "Select photo"), 0);
                    }
                    else if (arg1.Item.ItemId.Equals(Resource.Id.menu_explorer_upload_file))                         //Upload ander bestandstype geselecteerd
                    {
                        var filePickerIntent = new Intent(this, typeof(FilePickerActivity));
                        StartActivity(filePickerIntent);
                    }
                };
                popupMenu.Show();
            };

            buttonRefreshExplorer.Click += delegate {
                ExplorerFragment fragment = GetLastOpenedExplorerFragment();
                fragment.RefreshData();
            };


            //////////////////////////////////////////////////////
            //Document part of layout
            //////////////////////////////////////////////////////
            buttonFullscreenDocument = FindViewById <ImageButton> (Resource.Id.button_fullscreen_document);
            textviewFilename         = FindViewById <TextView> (Resource.Id.textview_filename);
            buttonCloseDocument      = FindViewById <ImageButton> (Resource.Id.button_close_document);

            buttonFullscreenDocument.Visibility = ViewStates.Invisible;
            textviewFilename.Visibility         = ViewStates.Invisible;
            buttonCloseDocument.Visibility      = ViewStates.Invisible;

            //Open file fullscreen in new activity
            buttonFullscreenDocument.Click += delegate {
                var documentFullscreenIntent = new Intent(this, typeof(DocumentFullscreenActivity));
                StartActivity(documentFullscreenIntent);
            };

            //Determine to save PDF annotations
            if (SplashActivity.intentData != null)
            {
                Android.Net.Uri data   = SplashActivity.intentData;
                String          scheme = data.Scheme;
                if (scheme.Equals("file"))                    //Save annotations
                //UpdatePdfFile (data.Path);
                {
                }
            }
            else if (SplashActivity.clipData != null)
            {
                Android.Net.Uri uri = SplashActivity.clipData.GetItemAt(0).Uri;
                //UpdatePdfFile (uri.ToString ());
            }
            HideProgressDialog();

            SslValidator.CertificateMismatchFound += HandleInvalidCertificate;
        }