예제 #1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            MyView myholder = holder as MyView;

            myholder.Task.Text          = Mitems[position].task_name;
            myholder.Create_by.Text     = Mitems[position].task_created_by;
            myholder.Deadline_date.Text = Mitems[position].deadlineDate.ToString();
            // myholder.time_left.Text = Mitems[position].mark_to;
            var local = new LocalOnClickListener();

            myholder.Linear.SetOnClickListener(local);
            local.HandleOnClick = () =>
            {
                string id = Mitems[position].task_id;

                ComplainceFrag nextFrag = new ComplainceFrag();
                Android.Support.V4.App.FragmentTransaction ft = fragment.BeginTransaction();
                //ft.Replace(Resource.Id.container, nextFrag, "ComplainceFragment");
                ft.Hide(fragment.FindFragmentByTag("MainFrag"));
                ft.Add(Resource.Id.container, nextFrag, "ComplainceFragment");
                ft.AddToBackStack("TaskInboxFrag");
                ft.SetTransition(FragmentTransaction.TransitFragmentOpen);
                ft.Commit();
                // fragment.BeginTransaction().Replace(Resource.Id.container, nextFrag).Commit();
                Bundle bundle = new Bundle();
                bundle.PutString("task_id", id);
                nextFrag.Arguments = bundle;
            };


            myholder.time_left.Text = date_difference(DateTime.Now, Mitems[position].deadlineDate);
        }
예제 #2
0
 private void NavigateToFragment(SupportFragment fragment, string tag)
 {
     fragmentTransaction = SupportFragmentManager.BeginTransaction();
     fragmentTransaction.Add(Resource.Id.fragmentContainer, fragment, tag);
     fragmentTransaction.Replace(Resource.Id.fragmentContainer, fragment, tag);
     fragmentTransaction.AddToBackStack(null);
     fragmentTransaction.Commit();
 }
예제 #3
0
 public void ReplaceFragment(Context context, Android.Support.V4.App.Fragment newFragment)
 {
     Android.Support.V4.App.FragmentManager     fragmentManager = ((FragmentActivity)context).SupportFragmentManager;
     Android.Support.V4.App.FragmentTransaction ft = fragmentManager.BeginTransaction();
     ft.Replace(Resource.Id.home_frame_layout, newFragment);
     ft.AddToBackStack(null);
     ft.Commit();
 }
예제 #4
0
 /// <summary>
 /// Switches the fragment to the selected listview item.
 /// </summary>
 /// <param name="frag">Frag.</param>
 /// <param name="resource">Resource.</param>
 /// <param name="tag">Tag.</param>
 private void switchFragment(Android.Support.V4.App.Fragment frag, int resource, string tag)
 {
     Android.Support.V4.App.FragmentTransaction fragmentTransaction = this.Activity.SupportFragmentManager.BeginTransaction(); //begin the fragment transaction
     fragmentTransaction.SetCustomAnimations(Resource.Layout.EnterAnimation, Resource.Layout.ExitAnimation);                   //add animation to slide new fragment to the left
     fragmentTransaction.AddToBackStack("UserActivity");
     fragmentTransaction.Replace(resource, frag, tag);
     fragmentTransaction.Commit(); //commit the transaction
 }
예제 #5
0
 public void RemoveFragment(Context context, Fragment newFragment, string TAG)
 {
     Android.Support.V4.App.FragmentManager     fragmentManager = ((FragmentActivity)context).SupportFragmentManager;
     Android.Support.V4.App.FragmentTransaction ft = fragmentManager.BeginTransaction();
     ft.Remove(newFragment);
     ft.AddToBackStack(TAG);
     ft.Commit();
 }
예제 #6
0
        void ShowEmbeddedPageFragment(Fragment fragment)
        {
            FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

            ft.AddToBackStack(null);
            ft.Replace(Resource.Id.fragment_frame_layout, fragment, "hello");

            ft.Commit();
        }
예제 #7
0
        private void CallAutorisationFragment()
        {
            var autorisationFragment = new AutorisationFragment(DAO);
            v4FragmentTransaction fragmentTransaction = SupportFragmentManager.BeginTransaction();

            fragmentTransaction.Replace(Resource.Id.mainFrameLayout, autorisationFragment);
            fragmentTransaction.AddToBackStack(null);
            fragmentTransaction.Commit();
        }
예제 #8
0
                public bool OnMenuItemClick(IMenuItem item)
                {
                    Android.Support.V4.App.Fragment fragment = new AddCoHostFragment();
                    var fragmentManager = activity.SupportFragmentManager;

                    Android.Support.V4.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
                    fragmentTransaction.Replace(Resource.Id.content_frame, fragment);
                    MainActivity.myBundle.PutLong("EventID", eventID);
                    fragmentTransaction.AddToBackStack("AddCoHostFragment");
                    fragmentTransaction.Commit();
                    return(true);
                }
예제 #9
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     if (item.ItemId == Resource.Id.addPeople)
     {
         var newFragment = new ContactListFragment();
         Android.Support.V4.App.FragmentTransaction transaction = Activity.SupportFragmentManager.BeginTransaction();
         transaction.Replace(Resource.Id.content_frame, newFragment);
         transaction.AddToBackStack(null);
         transaction.Commit();
     }
     return(base.OnOptionsItemSelected(item));
 }
예제 #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            v4App.FragmentTransaction ft       = SupportFragmentManager.BeginTransaction();
            v4App.Fragment            fragment = new JournalCreateView();

            ft.Add(Resource.Id.fragment_container, fragment);
            ft.AddToBackStack(null);
            ft.Commit();
        }
예제 #11
0
        public void startDialogFragment(v4App.DialogFragment dialogFragment)
        {
            v4App.FragmentTransaction ft = SupportFragmentManager.BeginTransaction();
            //Remove fragment else it will crash as it is already added to backstack
            v4App.Fragment prev = SupportFragmentManager.FindFragmentByTag("dialog");
            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);

            dialogFragment.Show(ft, "dialog");
        }
예제 #12
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            v4.FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

            int?titleId = null;

            v4.Fragment fragment = null;

            if (id == Resource.Id.nav_camera)
            {
                // Handle the camera action
            }
            else if (id == Resource.Id.nav_gallery)
            {
                titleId  = Resource.String.gallery_title;
                fragment = new Fragment1();
            }
            else if (id == Resource.Id.nav_slideshow)
            {
            }
            else if (id == Resource.Id.nav_manage)
            {
                titleId  = Resource.String.manage_title;
                fragment = new Fragment2();
            }
            else if (id == Resource.Id.nav_share)
            {
            }
            else if (id == Resource.Id.nav_send)
            {
            }

            if (titleId != null)
            {
                SupportActionBar.SetTitle((int)titleId);
            }

            if (fragment != null)
            {
                ft.Replace(Resource.Id.fragment_container, fragment);
                ft.AddToBackStack(null);
                ft.Commit();
            }

            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
예제 #13
0
        public void addITR(TableLayout tl)
        {
            TableRow notes = new TableRow(this.Activity);

            notes.Tag = "notes";
            note      = new EditText(this.Activity);
            note.Hint = "Notes";
            if (DataController.note != "")
            {
                note.Text = DataController.note;
            }
            note.Gravity = GravityFlags.Center;

            TableRow.LayoutParams stretchRow = new TableRow.LayoutParams();
            stretchRow.Span = 6;

            notes.AddView(note, stretchRow);
            tl.AddView(notes);

            TableRow btnRow = new TableRow(this.Activity);

            btnRow.Tag = "btnRow";

            Button requestITR = new Button(this.Activity);

            requestITR.Text   = "ITR";
            requestITR.Click += (object sender, EventArgs e) => {
                if (checkNetwork())
                {
                    Android.Support.V4.App.Fragment residentsFragment = null;
                    residentsFragment = new ResidentsFragment();
                    ((ResidentsFragment)residentsFragment).SetResidentUpdate(residents);
                    ((ResidentsFragment)residentsFragment).SetNotePrev(note.Text);
                    Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();

                    ft.Add(Resource.Id.content_frame, residentsFragment, "residentsFragment");
                    ft.Hide(FragmentManager.FindFragmentByTag("residentsPrevFragment"));
                    ft.AddToBackStack(null);
                    ft.Commit();
                }
                else
                {
                    showNetworkError();
                }
            };



            btnRow.AddView(requestITR, stretchRow);
            tl.AddView(btnRow);
        }
예제 #14
0
        public override async void OnListItemClick(ListView listView, View view, int position, long id)
        {
            FileSystemInfo fileSystemInfo = fileListadapter.GetItem(position);

            if (fileSystemInfo.IsFile())
            {
                CustomProgressDialog progressDialog = new CustomProgressDialog();
                progressDialog.Show(Activity, "Bestand uploaden. Een ogenblik geduld a.u.b.");

                try {
                    //get current folder path to add file to
                    int    numberOfDirectoriesOpened   = ExplorerFragment.openedDirectories.Count;
                    string directoryNameToUploadFileTo = ExplorerFragment.openedDirectories [numberOfDirectoriesOpened - 1];

                    string fullDestinationPath = System.IO.Path.Combine(directoryNameToUploadFileTo, fileSystemInfo.Name);
                    bool   uploadedSucceeded   = await DataLayer.Instance.UploadFile(fullDestinationPath, fileSystemInfo.FullName);

                    if (!uploadedSucceeded)
                    {
                        Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
                    }
                    else
                    {
                        Toast.MakeText(Activity, "Bestand succesvol geupload", ToastLength.Short).Show();

                        Activity.Finish();
                    }
                } catch (Exception ex) {
                    Insights.Report(ex);
                    Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
                }
                progressDialog.Hide();
            }
            else
            {
                // Dig into this directory, and display it's contents
                Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                //fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

                FileListFragment fileListFragment = new FileListFragment(fileSystemInfo.FullName);
                fragmentTransaction.Replace(Resource.Id.fragment_container_filepicker, fileListFragment, "fileListFragment");

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

                // Start the animated transition.
                fragmentTransaction.Commit();
            }
            base.OnListItemClick(listView, view, position, id);
        }
예제 #15
0
 public void Show(V4FragmentManager manager)
 {
     if (!dismissed || manager.IsDestroyed)
     {
         return;
     }
     dismissed = false;
     new Handler().Post(() => {
         V4FragmentTransaction ft = manager.BeginTransaction();
         ft.Add(this, "actionSheet");
         ft.AddToBackStack(null);
         ft.CommitAllowingStateLoss();
     });
 }
예제 #16
0
        private void CallTextFragment(string title, string text)
        {
            var textFragment = new TextFragment(title, text);
            v4FragmentTransaction fragmentTransaction = SupportFragmentManager.BeginTransaction();

            fragmentTransaction.Replace(Resource.Id.mainFrameLayout, textFragment);

            bool qwerty = SupportFragmentManager.PopBackStackImmediate("TextFragment", 0) ||
                          (SupportFragmentManager.FindFragmentByTag("TextFragment") == null);

            if (qwerty)
            {
                Log.Info(tag, "true");
                SupportFragmentManager.PopBackStack();
                fragmentTransaction.AddToBackStack("TextFragment");
            }
            else
            {
                Log.Info(tag, "false");
                fragmentTransaction.AddToBackStack("TextFragment");
            }

            fragmentTransaction.Commit();
        }
예제 #17
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            Android.Support.V4.App.Fragment residentsFragment     = null;
            Android.Support.V4.App.Fragment residentsPrevFragment = null;

            residentsFragment     = FragmentManager.FindFragmentByTag("residentsFragment");
            residentsPrevFragment = FragmentManager.FindFragmentByTag("residentsPrevFragment");


            if (residentsFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft1 = FragmentManager.BeginTransaction();
                ft1.Remove(residentsFragment);
                ft1.AddToBackStack(null);
                ft1.Commit();
            }

            if (residentsPrevFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft2 = FragmentManager.BeginTransaction();
                ft2.Remove(residentsPrevFragment);
                ft2.AddToBackStack(null);
                ft2.Commit();
            }

            Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
            ft.Commit();


            var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            var view    = inflater.Inflate(Resource.Layout.fragment_canvass, null);

            cm = (ConnectivityManager)Activity.GetSystemService(Context.ConnectivityService);


            if (checkNetwork())
            {
                drawTable(view);
            }
            else
            {
                showNetworkError();
            }

            return(view);
        }
예제 #18
0
 public static void AddFragment(Context context, Android.Support.V4.App.Fragment newFragment, string TAG)
 {
     Android.Support.V4.App.Fragment            myFragment      = null;
     Android.Support.V4.App.FragmentManager     fragmentManager = ((FragmentActivity)context).SupportFragmentManager;
     Android.Support.V4.App.FragmentTransaction ft = fragmentManager.BeginTransaction();
     myFragment = fragmentManager.FindFragmentByTag(TAG);
     if (myFragment == null)
     {
         ft.Add(Resource.Id.home_frame_layout, newFragment, TAG);
         ft.AddToBackStack(null);
         ft.Commit();
     }
     else
     {
         ft.Detach(myFragment).Attach(myFragment);
         ft.Commit();
     }
 }
예제 #19
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_notification:
                Android.Support.V4.App.Fragment fragment = new NotificationFragment();
                var fragmentManager = Activity.SupportFragmentManager;
                Android.Support.V4.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
                fragmentTransaction.Replace(Resource.Id.content_frame, fragment);
                fragmentTransaction.AddToBackStack("HomeFragment");
                fragmentTransaction.Commit();
                return(true);

            case Resource.Id.action_search:
                Activity.StartActivity(typeof(SearchActivity));
                return(true);
            }
            return(false);
        }
예제 #20
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            Android.Support.V4.App.Fragment residentsFragment     = null;
            Android.Support.V4.App.Fragment residentsPrevFragment = null;

            residentsFragment     = FragmentManager.FindFragmentByTag("residentsFragment");
            residentsPrevFragment = FragmentManager.FindFragmentByTag("residentsPrevFragment");


            if (residentsFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft1 = FragmentManager.BeginTransaction();
                ft1.Remove(residentsFragment);
                ft1.AddToBackStack(null);
                ft1.Commit();
            }

            if (residentsPrevFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft2 = FragmentManager.BeginTransaction();
                ft2.Remove(residentsPrevFragment);
                ft2.AddToBackStack(null);
                ft2.Commit();
            }

            var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            var view    = inflater.Inflate(Resource.Layout.fragment_register, null);

            cm = (ConnectivityManager)Activity.GetSystemService(Context.ConnectivityService);

            if (checkNetwork())
            {
                WebView localWebView = view.FindViewById <WebView>(Resource.Id.webView1);
                localWebView.SetWebViewClient(new WebViewClient());           // stops request going to Web Browser
                localWebView.LoadUrl("https://www.registertovote.service.gov.uk/register-to-vote/country-of-residence?_ga=1.24772217.255160918.1436270892");
            }
            else
            {
                showNetworkError();
            }

            return(view);
        }
예제 #21
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            Android.Support.V4.App.Fragment residentsFragment     = null;
            Android.Support.V4.App.Fragment residentsPrevFragment = null;

            residentsFragment     = FragmentManager.FindFragmentByTag("residentsFragment");
            residentsPrevFragment = FragmentManager.FindFragmentByTag("residentsPrevFragment");


            if (residentsFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft1 = FragmentManager.BeginTransaction();
                ft1.Remove(residentsFragment);
                ft1.AddToBackStack(null);
                ft1.Commit();
            }

            if (residentsPrevFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft2 = FragmentManager.BeginTransaction();
                ft2.Remove(residentsPrevFragment);
                ft2.AddToBackStack(null);
                ft2.Commit();
            }

            var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            var view    = inflater.Inflate(Resource.Layout.fragment_settings, null);

            cm = (ConnectivityManager)Activity.GetSystemService(Context.ConnectivityService);

            oldPass    = (EditText)view.FindViewById(Resource.Id.oldPassword);
            newPass    = (EditText)view.FindViewById(Resource.Id.newPassword);
            changePass = (Button)view.FindViewById(Resource.Id.changePassword);

            changePass.Click += (object sender, EventArgs e) =>
            {
                changePassword();
            };

            return(view);
        }
예제 #22
0
                public bool OnMenuItemClick(IMenuItem item)
                {
                    if (item.ItemId == Resource.Id.popup_Add_CoHost)
                    {
                        Android.Support.V4.App.Fragment fragment = new AddCoHostFragment();
                        var fragmentManager = activity.SupportFragmentManager;
                        Android.Support.V4.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
                        fragmentTransaction.Replace(Resource.Id.content_frame, fragment);
                        MainActivity.myBundle.PutLong("EventID", eventID);
                        fragmentTransaction.AddToBackStack("AddCoHostFragment");
                        fragmentTransaction.Commit();
                        return(true);
                    }

                    if (item.ItemId == Resource.Id.popup_Add_EventPhoto)
                    {
                        Intent intent = new Intent(activity, typeof(UploadEventProfilePic));
                        intent.PutExtra("strCapture", eventID);
                        intent.PutExtra("strCreatorId", creatorId);
                        activity.StartActivity(intent);
                        return(true);
                    }
                    return(false);
                }
예제 #23
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();
            }
        }
예제 #24
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            Android.Support.V4.App.Fragment residentsFragment     = null;
            Android.Support.V4.App.Fragment residentsPrevFragment = null;

            residentsFragment     = FragmentManager.FindFragmentByTag("residentsFragment");
            residentsPrevFragment = FragmentManager.FindFragmentByTag("residentsPrevFragment");


            if (residentsFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft1 = FragmentManager.BeginTransaction();
                ft1.Remove(residentsFragment);
                ft1.AddToBackStack(null);
                ft1.Commit();
            }

            if (residentsPrevFragment != null)
            {
                Android.Support.V4.App.FragmentTransaction ft2 = FragmentManager.BeginTransaction();
                ft2.Remove(residentsPrevFragment);
                ft2.AddToBackStack(null);
                ft2.Commit();
            }



            var ignored = base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.fragment_map, null);

            //MapsInitializer.initialize(getActivity());
            mapFrag = (SupportMapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
            //Console.WriteLine ("before maps");
            GoogleMap map = mapFrag.Map;

            //Console.WriteLine ("after maps");

            if (DataController.lat != null && DataController.lng != null)
            {
                //Console.WriteLine ("inside map if");
                LatLng location = new LatLng(Convert.ToDouble(DataController.lat), Convert.ToDouble(DataController.lng));
                //Console.WriteLine ("after getting locations");
                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                //Console.WriteLine ("After the camera");
                builder.Target(location);
                builder.Zoom(15);
                builder.Bearing(0);
                builder.Tilt(0);

                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                map.AnimateCamera(cameraUpdate);
            }

            if (map != null)
            {
//				MarkerOptions markerOpt1 = new MarkerOptions();
//				markerOpt1.SetPosition(new LatLng(Convert.ToDouble(DataController.lat), Convert.ToDouble(DataController.lng)));
//				markerOpt1.SetTitle("My Location");
//				markerOpt1.SetIcon (BitmapDescriptorFactory.DefaultMarker (BitmapDescriptorFactory.HueAzure));
//				map.AddMarker(markerOpt1);

                coords    = DataController.coords;
                addresses = DataController.addresses;

                if (coords != null)
                {
                    for (int i = 0; i < coords.Count; i++)
                    {
                        MarkerOptions markerOpt1 = new MarkerOptions();
                        propertyDict = addresses [i];
                        markerOpt1.SetPosition(coords [i]);
                        //if (propertyDict ["status"].ToString() != "NV") {
                        markerOpt1.SetTitle(propertyDict ["fullAddress"].ToString());
                        //markerOpt1.SetIcon (BitmapDescriptorFactory.DefaultMarker (BitmapDescriptorFactory.HueAzure));
                        //} else {
                        //	markerOpt1.SetTitle (propertyDict ["fullAddress"].ToString ());
                        //}
                        map.AddMarker(markerOpt1);
                    }
                    //map.MoveCamera (cameraUpdate);
                }
                map.MyLocationEnabled = true;
            }

            return(view);
        }
예제 #25
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_contact_list, container, false);

            try
            {
                _contactListView = view.FindViewById <Android.Widget.ListView>(Resource.Id.contact_list);

                searchText = view.FindViewById <EditText>(Resource.Id.contact_list_searchview);

                _noEntryText = view.FindViewById <TextView>(Resource.Id.no_friends_textview);
                _noEntryText.TextFormatted = Html.FromHtml("To add friends you can type their name in the search bar and if they have enabled </br>\"Public Name\" they will appear here");

                searchText.TextChanged += (s, e) =>
                {
                    _adapter.Collection.SetSearch(searchText.Text);
                };

                _adapter = new FindFriendAdapter(this.Activity, _noEntryText, new UIHelper.FindContactObservableCollection(ChadderApp.UIHelper.Source));
                _contactListView.Adapter    = _adapter;
                _contactListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                {
                    var contact = _adapter[e.Position];
                    if (contact == null)
                    {
                        return;
                    }
                    if (contact.IsTemporary)
                    {
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(contact))
                        .AddToBackStack(null)
                        .Commit();
                    }
                    else
                    {
                        SupportFragmentManager.PopBackStack();
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, ChatFragment.OpenChat(contact))
                        .AddToBackStack(null)
                        .Commit();
                    }
                };

                _menuManager = new ContextMenuManager <ChadderContact>(this, _contactListView);

                _menuManager.InsertItem("View profile", (ChadderContact contact) =>
                {
                    Android.Support.V4.App.FragmentTransaction transaction = this.Activity.SupportFragmentManager.BeginTransaction();
                    transaction.Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(contact));
                    transaction.AddToBackStack(null);
                    transaction.Commit();
                });

                _menuManager.InsertItem(c => c.Type == Chadder.Data.RelationshipType.BLOCKED ? "Unblock" : "Block",
                                        (ChadderContact contact) => ChadderUI.ToggleBlock(contact));

                _menuManager.InsertItem("Report",
                                        (ChadderContact contact) => ChadderUI.ReportContact(contact));
            }
            catch (Exception e)
            {
                Insight.Report(e);
            }

            return(view);
        }
예제 #26
0
        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();
        }
예제 #27
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            DataBase.db = DataBase.getDataBase();
            DataBase.db.createDataBase();

            string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

            Log.Info("DB_PATH", folder);

            long elementId;
            var  view = inflater.Inflate(Resource.Layout.SecondFragmentLayout, container, false);

            lstData = view.FindViewById <ListView>(Resource.Id.listView);
            //Задаем текст для пустого списка
            var emptyView = inflater.Inflate(Resource.Layout.emptyList, container, false);

            lstData.EmptyView = emptyView.FindViewById <TextView>(Resource.Id.empty);

            var btnAdd       = view.FindViewById <FloatingActionButton>(Resource.Id.btnAdd);
            var btnRefresh   = view.FindViewById <Button>(Resource.Id.btnRefresh);
            var btnDeleteAll = view.FindViewById <Button>(Resource.Id.btnDeleteAll);

            //Загружаем данные из бд и обновляем список задач
            LoadData();
            //Добавить новую задачу
            btnAdd.Click += delegate
            {
                //Создаем пустую запись в бд


                Resources.Model.Task task = new Resources.Model.Task()
                {
                    Name        = "",
                    Date        = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
                    Time        = new DateTime(1, 1, 1, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second),
                    Description = "",
                    Category    = "Спорт",
                    Priority    = "0",
                    Done        = false
                };
                var t = System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    DataBase.db.insertIntoTableTask(task);
                });
                t.Wait();
                t.Dispose();
                //Создаем окно для добавления новой задачи
                Android.Support.V4.App.FragmentTransaction ft   = FragmentManager.BeginTransaction();
                Android.Support.V4.App.Fragment            prev = FragmentManager.FindFragmentByTag("dialog");
                //Передаем id новой заметки для корректной записи в бд
                Bundle frag_bundle = new Bundle();
                frag_bundle.PutLong("Id", task.Id);

                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);

                _activity._taskWindow = DialogWindow.NewInstance(frag_bundle);
                var act = _activity._taskWindow.Activity;
                //Показываем окно
                _activity._taskWindow.SetActivity(_activity);
                _activity._taskWindow.Show(ft, "dialog");
            };

            btnRefresh.Click += delegate
            {
                LoadData();
            };

            // Эта кнопка удаляет все выполненные задачи
            btnDeleteAll.Click += delegate
            {
                Android.App.AlertDialog.Builder delDoneDialog = new Android.App.AlertDialog.Builder(_activity);
                delDoneDialog.SetTitle("Удалить все выполненные задачи");
                delDoneDialog.SetMessage("Вы уверены?");
                delDoneDialog.SetPositiveButton("Да", (senderAlert, args) =>
                {
                    DataBase.db.delAllDoneTask();
                    _activity._fragment2.LoadData();
                });
                delDoneDialog.SetNegativeButton("Нет", (senderAlert, args) =>
                {
                    return;
                });
                Dialog dialog = delDoneDialog.Create();
                dialog.Show();

                //delDoneWindow.Show;
            };
            //Просмотр/ редактирование существующей задачи
            lstData.ItemClick += (s, e) =>
            {
                for (int i = 0; i < lstData.Count; i++)
                {
                    if (e.Position == i)
                    {
                        //Получаем id выбранного в списке элемента
                        var t = System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            elementId = DataBase.db.selectQuery(lstData.Adapter.GetItemId(e.Position));

                            return(elementId);
                        });
                        t.Wait();

                        Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
                        //Remove fragment else it will crash as it is already added to backstack
                        Android.Support.V4.App.Fragment prev = FragmentManager.FindFragmentByTag("dialog");
                        Bundle frag_bundle = new Bundle();
                        frag_bundle.PutLong("Id", t.Result);

                        t.Dispose();

                        if (prev != null)
                        {
                            ft.Remove(prev);
                        }
                        ft.AddToBackStack(null);
                        _activity._taskWindow = DialogWindow.NewInstance(frag_bundle);
                        _activity._taskWindow.SetActivity(_activity);
                        _activity._taskWindow.Show(ft, "dialog");
                    }
                }

                //Заполняем поля данными
                var txtName    = e.View.FindViewById <TextView>(Resource.Id.textView1);
                var checkedBox = e.View.FindViewById <CheckBox>(Resource.Id.chkBox);
                //var txtDone = e.View.FindViewById<TextView>(Resource.Id.textView5);
                checkedBox.SetOnCheckedChangeListener(null);
            };
            //Удержание на элементе
            lstData.ItemLongClick += (s, e) =>
            {
                if (DataBase.db.getSettings()[0].fastDel == true || DataBase.db.getSettings()[0].fastDel == null)
                {
                    Android.App.AlertDialog.Builder delDialog = new Android.App.AlertDialog.Builder(_activity);
                    delDialog.SetTitle("Удалить задачу");
                    delDialog.SetMessage("Вы уверены?");
                    delDialog.SetPositiveButton("Да", (senderAlert, args) =>
                    {
                        for (int i = 0; i < lstData.Count; i++)
                        {
                            if (e.Position == i)
                            {
                                var selected_Element = DataBase.db.get_Element(lstData.Adapter.GetItemId(e.Position))[0];
                                DataBase.db.delTask(selected_Element.Id);
                                _activity._fragment2.LoadData();
                                Toast.MakeText(_activity, "Задача удалена", ToastLength.Long).Show();
                            }
                        }
                    });
                    delDialog.SetNegativeButton("Нет", (senderAlert, args) =>
                    {
                        return;
                    });
                    Dialog dialog = delDialog.Create();
                    dialog.Show();
                }
            };
            return(view);
        }