Esempio n. 1
0
        public void RefreshExplorerFragmentData()
        {
            ExplorerFragment explorerFragment = GetLastOpenedExplorerFragment();

            if (explorerFragment != null)
            {
                explorerFragment.RefreshData();
            }
        }
Esempio n. 2
0
        protected override void OnResume()
        {
            base.OnResume();
            ExplorerFragment explorerFragment = GetLastOpenedExplorerFragment();

            if (explorerFragment != null && !explorerFragment.favoriteFolderOpened && SplashActivity.intentData == null)
            {
                explorerFragment.RefreshData();
            }
        }
Esempio n. 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;
        }
Esempio n. 4
0
		async void ListView_OnItemClick (object sender, AdapterView.ItemClickEventArgs e)
		{
			ResetUIToBeginState(false);


			SslValidator.CertificateErrorRaised = false;

			//Set selected local box
			Waardes.Instance.GeselecteerdeBox = foundLocalBoxes[e.Position].Id;

			//Reset certificate validation check to default behavior
			/*
			ServicePointManager.ServerCertificateValidationCallback = null;

			if (foundLocalBoxes[e.Position].OriginalSslCertificate != null) { //Selected localbox does have a ssl certificate
				//Set ssl validator for selected LocalBox
				SslValidator sslValidator = new SslValidator ();
				ServicePointManager.ServerCertificateValidationCallback = sslValidator.ValidateServerCertficate;
			}*/

			//Change action bar color to color of selected localbox
			if (DataLayer.Instance.GetSelectedOrDefaultBox ().BackColor != null && 
				DataLayer.Instance.GetSelectedOrDefaultBox ().BackColor.StartsWith("#")) {
				HomeActivity.colorOfSelectedLocalBox = DataLayer.Instance.GetSelectedOrDefaultBox ().BackColor;
			} else {
				HomeActivity.colorOfSelectedLocalBox = Constants.lightblue;
			}
			SetCustomActionBarColor ();

			//Change logo image to logo of selected local box
			if (DataLayer.Instance.GetSelectedOrDefaultBox ().LogoUrl != null) {

				string logoUrl = DataLayer.Instance.GetSelectedOrDefaultBox ().LogoUrl;

				string documentsPath = DocumentConstants.DocumentsPath;
				string pathToLogo =  System.IO.Path.Combine(documentsPath, logoUrl.Substring(logoUrl.LastIndexOf("/") + 1));

				if (File.Exists (pathToLogo)) 
				{ //Verander logo
					Android.Net.Uri uriLogo = Android.Net.Uri.Parse (pathToLogo);
					//imageViewLogo.SetImageURI (uriLogo);
				} 
				else //Default logo
				{
					//imageViewLogo.SetImageResource (Resource.Drawable.beeldmerk_belastingdienst);
				}
			}

			//Update fragment data
			Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction ();
			fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

			//Show progress dialog while loading
			ShowProgressDialog (Activity, null);

			try {
				HomeActivity homeActivity = (HomeActivity)Activity;

				ExplorerFragment explorerFragment = new ExplorerFragment (await DataLayer.Instance.GetFolder ("/"), homeActivity);

				HomeActivity.openedExplorerFragments = new List<ExplorerFragment>();
				HomeActivity.openedExplorerFragments.Add(explorerFragment);

				//Add new directory to opened directories list
				ExplorerFragment.openedDirectories = new List<string>();
				ExplorerFragment.openedDirectories.Add("/");

				fragmentTransaction.Replace (Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

				//Clear fragment back stack
				int entryCount = Activity.SupportFragmentManager.BackStackEntryCount; 

				while (entryCount > 0) {
					Activity.SupportFragmentManager.PopBackStackImmediate();
					entryCount = Activity.SupportFragmentManager.BackStackEntryCount; 
				}
					
				//Add fragment to stack - needed for back button functionality
				fragmentTransaction.AddToBackStack (null);

				// Start the animated transition.
				fragmentTransaction.Commit ();

				//Show hidden buttons
				RelativeLayout fragmentContainerExplorerBottom = Activity.FindViewById<RelativeLayout> (Resource.Id.fragment_container_explorer_blank);
				fragmentContainerExplorerBottom.Visibility = ViewStates.Visible;

				//Show shadow
				View shadowContainerExplorer = Activity.FindViewById<View> (Resource.Id.shadow_container_explorer);
				shadowContainerExplorer.Visibility = ViewStates.Visible;

				//Hide back button
				ImageButton buttonBackExplorer = Activity.FindViewById<ImageButton> (Resource.Id.button_back_explorer);
				buttonBackExplorer.Visibility = ViewStates.Invisible;

				HideProgressDialog();
			} 
			catch (Exception ex){
				Insights.Report(ex);
				HideProgressDialog ();
				Toast.MakeText (Activity, "Er is iets fout gegaan", ToastLength.Short).Show ();
			}
		}
		async void ListView_OnItemClick (object sender, AdapterView.ItemClickEventArgs e)
		{
			try {
				TreeNode clickedItem = foundTreeNodeChildren [e.Position];

				//Hide bottom menu for favorite file

				if (favoriteFolderOpened) {
					parentActivity.HideBottomExplorerMenuItems ();
				} else {
					parentActivity.ShowBottomExplorerMenuItems ();
				}

				//Show progress dialog while loading
				parentActivity.ShowProgressDialog (null);


				if (clickedItem.IsDirectory == true)  //Folder aangeklikt (NIET "Lokale favorieten")
				{
					Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction ();
					fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

					ExplorerFragment explorerFragment = new ExplorerFragment (await DataLayer.Instance.GetFolder (clickedItem.Path), parentActivity);
					HomeActivity.openedExplorerFragments.Add(explorerFragment);
					fragmentTransaction.Replace (Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

					//Add new directory to opened directories list
					ExplorerFragment.openedDirectories.Add (clickedItem.Path);

					//Used to determine custom context menu
					if(ExplorerFragment.openedDirectories.Count == 2){
						if(clickedItem.IsShare){
							openedFolderIsShare = true;
						}else{
							openedFolderIsShare = false;
						}
					}

					//Used to determine upload action and icon in listview item (encrypted or unencrypted folder)
					if(ExplorerFragment.openedDirectories.Count == 2){
						if(clickedItem.HasKeys){
							openedFolderIsUnencrypted = false;
						}else{
							openedFolderIsUnencrypted = true;
						}
					}
						
					//Add fragment to stack - needed for back button functionality
					fragmentTransaction.AddToBackStack (null);

					// Start the animated transition.
					fragmentTransaction.Commit ();

					//Show hidden buttons
					ImageButton buttonBackExplorer = Activity.FindViewById<ImageButton> (Resource.Id.button_back_explorer);
					buttonBackExplorer.Visibility = ViewStates.Visible;
				} 
				else if (clickedItem.Type.Equals ("favorite"))  //List item "Lokale favorieten" aangeklikt
				{
					//Hide bottom menu for favorite folder
					parentActivity.HideBottomExplorerMenuItems ();

					Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction ();
					fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

					List<TreeNode> favorites = DataLayer.Instance.GetFavorites ();

					ExplorerFragment explorerFragment = new ExplorerFragment (favorites, parentActivity);
					HomeActivity.openedExplorerFragments.Add(explorerFragment);
					fragmentTransaction.Replace (Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

					//Add new directory to opened directories list
					ExplorerFragment.openedDirectories.Add (clickedItem.Path);

					//Add fragment to stack - needed for back button functionality
					fragmentTransaction.AddToBackStack (null);

					// Start the animated transition.
					fragmentTransaction.Commit ();

					//Show hidden buttons
					ImageButton buttonBackExplorer = Activity.FindViewById<ImageButton> (Resource.Id.button_back_explorer);
					buttonBackExplorer.Visibility = ViewStates.Visible;

				} 
				else { 	//Bestand aangeklikt
						//Afbeeldingen openen in webview - andere typen bestanden openen middels content provider

					string mimeTypeOfClickedItem = MimeTypeHelper.GetMimeType(clickedItem.Path);
					clickedItem.Type = mimeTypeOfClickedItem;

					if (mimeTypeOfClickedItem.Equals ("image/jpeg") ||
						mimeTypeOfClickedItem.Equals ("image/png") ||
						mimeTypeOfClickedItem.Equals ("application/pdf") ||
						mimeTypeOfClickedItem.Equals ("application/vnd.oasis.opendocument.text") ||
						mimeTypeOfClickedItem.Equals ("text/html")) {
						lastShownTreeNodeId = clickedItem.Id;

						Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction ();
						fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

						DocumentFragment documentFragment = new DocumentFragment (await DataLayer.Instance.GetFilePath (clickedItem.Path), clickedItem.Name);
						fragmentTransaction.Replace (Resource.Id.fragment_container_document, documentFragment, "documentFragment");

						// Start the animated transition.
						fragmentTransaction.Commit ();
					}
					else if(mimeTypeOfClickedItem.Equals("video/mp4"))
					{
						var videoPlayerActivity = new Intent (Activity, typeof(VideoPlayerActivity));
						string pathToVideo = await DataLayer.Instance.GetFilePath (clickedItem.Path);
						videoPlayerActivity.PutExtra ("PathToVideo", pathToVideo);

						StartActivity (videoPlayerActivity);
					}

					//Disabled - reason: no license for PDFTron
					/*else if(mimeTypeOfClickedItem.Equals("application/pdf")){

						var pdfIntent = new Intent (Activity, typeof(PdfActivity));

						string absolutePathOfPDF = await DataLayer.Instance.GetFilePath (clickedItem.Path);
						pdfIntent.PutExtra ("absolutePathOfPDF", absolutePathOfPDF);
						pdfIntent.PutExtra ("relativePathOfPDF", clickedItem.Path);
						pdfIntent.PutExtra ("fileName", clickedItem.Name);

						StartActivity (pdfIntent);   
					}*/

					else {
						//Open bestand in andere app
						OpenFileIn (clickedItem);
					}
				}
			} catch (Exception ex){
				Insights.Report(ex);
				parentActivity.HideProgressDialog ();
				Toast.MakeText (Activity, "Het openen is mislukt. Probeer het a.u.b. opnieuw", ToastLength.Short).Show ();
			}
			parentActivity.HideProgressDialog ();
		}
Esempio n. 6
0
        async void ListView_OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            ResetUIToBeginState(false);


            SslValidator.CertificateErrorRaised = false;

            //Set selected local box
            Waardes.Instance.GeselecteerdeBox = foundLocalBoxes[e.Position].Id;

            //Reset certificate validation check to default behavior

            /*
             * ServicePointManager.ServerCertificateValidationCallback = null;
             *
             * if (foundLocalBoxes[e.Position].OriginalSslCertificate != null) { //Selected localbox does have a ssl certificate
             *      //Set ssl validator for selected LocalBox
             *      SslValidator sslValidator = new SslValidator ();
             *      ServicePointManager.ServerCertificateValidationCallback = sslValidator.ValidateServerCertficate;
             * }*/

            //Change action bar color to color of selected localbox
            if (DataLayer.Instance.GetSelectedOrDefaultBox().BackColor != null &&
                DataLayer.Instance.GetSelectedOrDefaultBox().BackColor.StartsWith("#"))
            {
                HomeActivity.colorOfSelectedLocalBox = DataLayer.Instance.GetSelectedOrDefaultBox().BackColor;
            }
            else
            {
                HomeActivity.colorOfSelectedLocalBox = Constants.lightblue;
            }
            SetCustomActionBarColor();

            //Change logo image to logo of selected local box
            if (DataLayer.Instance.GetSelectedOrDefaultBox().LogoUrl != null)
            {
                string logoUrl = DataLayer.Instance.GetSelectedOrDefaultBox().LogoUrl;

                string documentsPath = DocumentConstants.DocumentsPath;
                string pathToLogo    = System.IO.Path.Combine(documentsPath, logoUrl.Substring(logoUrl.LastIndexOf("/") + 1));

                if (File.Exists(pathToLogo))
                {                 //Verander logo
                    Android.Net.Uri uriLogo = Android.Net.Uri.Parse(pathToLogo);
                    //imageViewLogo.SetImageURI (uriLogo);
                }
                else                 //Default logo
                {
                    //imageViewLogo.SetImageResource (Resource.Drawable.beeldmerk_belastingdienst);
                }
            }

            //Update fragment data
            Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
            fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

            //Show progress dialog while loading
            ShowProgressDialog(Activity, null);

            try {
                HomeActivity homeActivity = (HomeActivity)Activity;

                ExplorerFragment explorerFragment = new ExplorerFragment(await DataLayer.Instance.GetFolder("/"), homeActivity);

                HomeActivity.openedExplorerFragments = new List <ExplorerFragment>();
                HomeActivity.openedExplorerFragments.Add(explorerFragment);

                //Add new directory to opened directories list
                ExplorerFragment.openedDirectories = new List <string>();
                ExplorerFragment.openedDirectories.Add("/");

                fragmentTransaction.Replace(Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

                //Clear fragment back stack
                int entryCount = Activity.SupportFragmentManager.BackStackEntryCount;

                while (entryCount > 0)
                {
                    Activity.SupportFragmentManager.PopBackStackImmediate();
                    entryCount = Activity.SupportFragmentManager.BackStackEntryCount;
                }

                //Add fragment to stack - needed for back button functionality
                fragmentTransaction.AddToBackStack(null);

                // Start the animated transition.
                fragmentTransaction.Commit();

                //Show hidden buttons
                RelativeLayout fragmentContainerExplorerBottom = Activity.FindViewById <RelativeLayout> (Resource.Id.fragment_container_explorer_blank);
                fragmentContainerExplorerBottom.Visibility = ViewStates.Visible;

                //Show shadow
                View shadowContainerExplorer = Activity.FindViewById <View> (Resource.Id.shadow_container_explorer);
                shadowContainerExplorer.Visibility = ViewStates.Visible;

                //Hide back button
                ImageButton buttonBackExplorer = Activity.FindViewById <ImageButton> (Resource.Id.button_back_explorer);
                buttonBackExplorer.Visibility = ViewStates.Invisible;

                HideProgressDialog();
            }
            catch (Exception ex) {
                Insights.Report(ex);
                HideProgressDialog();
                Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
            }
        }
        async void ListView_OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            try {
                TreeNode clickedItem = foundTreeNodeChildren [e.Position];

                //Hide bottom menu for favorite file

                if (favoriteFolderOpened)
                {
                    parentActivity.HideBottomExplorerMenuItems();
                }
                else
                {
                    parentActivity.ShowBottomExplorerMenuItems();
                }

                //Show progress dialog while loading
                parentActivity.ShowProgressDialog(null);


                if (clickedItem.IsDirectory == true)                  //Folder aangeklikt (NIET "Lokale favorieten")
                {
                    Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                    fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

                    ExplorerFragment explorerFragment = new ExplorerFragment(await DataLayer.Instance.GetFolder(clickedItem.Path), parentActivity);
                    HomeActivity.openedExplorerFragments.Add(explorerFragment);
                    fragmentTransaction.Replace(Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

                    //Add new directory to opened directories list
                    ExplorerFragment.openedDirectories.Add(clickedItem.Path);

                    //Used to determine custom context menu
                    if (ExplorerFragment.openedDirectories.Count == 2)
                    {
                        if (clickedItem.IsShare)
                        {
                            openedFolderIsShare = true;
                        }
                        else
                        {
                            openedFolderIsShare = false;
                        }
                    }

                    //Used to determine upload action and icon in listview item (encrypted or unencrypted folder)
                    if (ExplorerFragment.openedDirectories.Count == 2)
                    {
                        if (clickedItem.HasKeys)
                        {
                            openedFolderIsUnencrypted = false;
                        }
                        else
                        {
                            openedFolderIsUnencrypted = true;
                        }
                    }

                    //Add fragment to stack - needed for back button functionality
                    fragmentTransaction.AddToBackStack(null);

                    // Start the animated transition.
                    fragmentTransaction.Commit();

                    //Show hidden buttons
                    ImageButton buttonBackExplorer = Activity.FindViewById <ImageButton> (Resource.Id.button_back_explorer);
                    buttonBackExplorer.Visibility = ViewStates.Visible;
                }
                else if (clickedItem.Type.Equals("favorite"))                   //List item "Lokale favorieten" aangeklikt
                {
                    //Hide bottom menu for favorite folder
                    parentActivity.HideBottomExplorerMenuItems();

                    Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                    fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

                    List <TreeNode> favorites = DataLayer.Instance.GetFavorites();

                    ExplorerFragment explorerFragment = new ExplorerFragment(favorites, parentActivity);
                    HomeActivity.openedExplorerFragments.Add(explorerFragment);
                    fragmentTransaction.Replace(Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

                    //Add new directory to opened directories list
                    ExplorerFragment.openedDirectories.Add(clickedItem.Path);

                    //Add fragment to stack - needed for back button functionality
                    fragmentTransaction.AddToBackStack(null);

                    // Start the animated transition.
                    fragmentTransaction.Commit();

                    //Show hidden buttons
                    ImageButton buttonBackExplorer = Activity.FindViewById <ImageButton> (Resource.Id.button_back_explorer);
                    buttonBackExplorer.Visibility = ViewStates.Visible;
                }
                else                    //Bestand aangeklikt
                //Afbeeldingen openen in webview - andere typen bestanden openen middels content provider

                {
                    string mimeTypeOfClickedItem = MimeTypeHelper.GetMimeType(clickedItem.Path);
                    clickedItem.Type = mimeTypeOfClickedItem;

                    if (mimeTypeOfClickedItem.Equals("image/jpeg") ||
                        mimeTypeOfClickedItem.Equals("image/png") ||
                        mimeTypeOfClickedItem.Equals("application/pdf") ||
                        mimeTypeOfClickedItem.Equals("application/vnd.oasis.opendocument.text") ||
                        mimeTypeOfClickedItem.Equals("text/html"))
                    {
                        lastShownTreeNodeId = clickedItem.Id;

                        Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                        fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

                        DocumentFragment documentFragment = new DocumentFragment(await DataLayer.Instance.GetFilePath(clickedItem.Path), clickedItem.Name);
                        fragmentTransaction.Replace(Resource.Id.fragment_container_document, documentFragment, "documentFragment");

                        // Start the animated transition.
                        fragmentTransaction.Commit();
                    }
                    else if (mimeTypeOfClickedItem.Equals("video/mp4"))
                    {
                        var    videoPlayerActivity = new Intent(Activity, typeof(VideoPlayerActivity));
                        string pathToVideo         = await DataLayer.Instance.GetFilePath(clickedItem.Path);

                        videoPlayerActivity.PutExtra("PathToVideo", pathToVideo);

                        StartActivity(videoPlayerActivity);
                    }

                    //Disabled - reason: no license for PDFTron

                    /*else if(mimeTypeOfClickedItem.Equals("application/pdf")){
                     *
                     *      var pdfIntent = new Intent (Activity, typeof(PdfActivity));
                     *
                     *      string absolutePathOfPDF = await DataLayer.Instance.GetFilePath (clickedItem.Path);
                     *      pdfIntent.PutExtra ("absolutePathOfPDF", absolutePathOfPDF);
                     *      pdfIntent.PutExtra ("relativePathOfPDF", clickedItem.Path);
                     *      pdfIntent.PutExtra ("fileName", clickedItem.Name);
                     *
                     *      StartActivity (pdfIntent);
                     * }*/

                    else
                    {
                        //Open bestand in andere app
                        OpenFileIn(clickedItem);
                    }
                }
            } catch (Exception ex) {
                Insights.Report(ex);
                parentActivity.HideProgressDialog();
                Toast.MakeText(Activity, "Het openen is mislukt. Probeer het a.u.b. opnieuw", ToastLength.Short).Show();
            }
            parentActivity.HideProgressDialog();
        }