Beispiel #1
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();
 }
Beispiel #2
0
        protected virtual string GetTagFromFragment(Android.Support.V4.App.Fragment fragment)
        {
            var mvxFragmentView = fragment as IMvxFragmentView;

            // ReSharper disable once PossibleNullReferenceException
            // Fragment can never be null because registered fragment has to inherit from IMvxFragmentView
            return(mvxFragmentView.UniqueImmutableCacheTag);
        }
Beispiel #3
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);
        }
        /// <summary>
        /// Adds the frament.
        /// </summary>
        /// <param name="fragment">The fragment.</param>
        /// <param name="addBackstack">if set to <c>true</c> [add backstack].</param>
        public void AddFrament(Android.Support.V4.App.Fragment fragment, bool addBackstack)
        {
            var ft = SupportFragmentManager.BeginTransaction();

            if (addBackstack)
            {
                ft.Add(Resource.Id.frame_container, fragment, fragment.Class.Name);
                ft.AddToBackStack(fragment.Class.Name);
            }
            else
            {
                ft.Replace(Resource.Id.frame_container, fragment, fragment.Class.Name);
            }
            ft.CommitAllowingStateLoss();
        }
        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);
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_home);
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            mActivity = this;

            /// Shared Preference manager
            mSharedPreferencesManager = UtilityDroid.GetInstance().
                                        GetSharedPreferenceManagerWithEncriptionEnabled(mActivity.ApplicationContext);


            // Init toolbar
            toolbar = FindViewById <Toolbar>(Resource.Id.app_bar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.inbox_title);


            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);

            SetupSideMenu();

            bool isOrderListScreen = Intent.GetBooleanExtra("addOrder", false);

            if (isOrderListScreen)
            {
                ShowScreen(0, 0);
            }
            else
            {
                Android.Support.V4.App.Fragment fragment = InboxFragment.GetInstance(WebserviceConstants.
                                                                                     INBOX_EMAIL_TYPE_ID, GetString(Resource.String.inbox_title));
                AddFrament(fragment, false);
                // mAdapter.SetSelectedPosition(0);
            }
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public void showResidents(ImageButton residents)
        {
            //Console.WriteLine("inside the show residentttttttttttttttttttttttttttttttttttttttttt");
            if (checkNetwork())
            {
                residents.Enabled = false;
                string uprn = residents.Tag.ToString();
                if (DataController.fileType == "HALAROSE")
                {
                    //Console.WriteLine ("HALAROSE now");
                    string houseID = residents.Id.ToString();
                    DataController.houseID = houseID;
                }
                else
                {
                    DataController.houseID = "houseID";
                    //Console.WriteLine ("HouseID");
                }

                DataController.uprn = uprn;
                //Console.WriteLine ("Before to the response");
                string response = NetworkCalls.getResidents(DataController.token, DataController.canvassID, uprn);
                //Console.WriteLine ("After of response");

                //			string status = "";
                TableRow tr          = (TableRow)View.FindViewWithTag(uprn);
                TextView addressView = (TextView)tr.GetVirtualChildAt(0);
                string   address     = addressView.Text.ToString();
                string   canvassID   = addressView.Tag.ToString();
                DataController.canvassID = canvassID;
                DataController.address   = address;

                DataController.propertyToChange = tr.Id;

                //Console.WriteLine ("before the note");
                //string note = "";

                /*addresses = DataController.addresses;
                 * propertyDict = addresses [tr.Id];
                 * DataController.propertyToChange = tr.Id;
                 * if (propertyDict ["notes"] != null) {
                 *      note = propertyDict ["notes"].ToString ();
                 * } else {
                 *      note = "";
                 * }
                 * DataController.note = note;
                 * Console.WriteLine (note);*/

                Android.Support.V4.App.Fragment residentsPrevFragment = null;
                residentsPrevFragment = new ResidentsPrevFragment();

                FragmentTransaction ft = FragmentManager.BeginTransaction();

                ft.Add(Resource.Id.content_frame, residentsPrevFragment, "residentsPrevFragment");
                ft.Hide(FragmentManager.FindFragmentByTag("canvassesFragment"));
                ft.AddToBackStack(null);
                ft.Commit();
            }
            else
            {
                showNetworkError();
            }
        }
        private void ShowScreen(int groupPosition, int childPosition)
        {
            Intent intent = null;

            Android.Support.V4.App.Fragment fragment = null;
            ToogleDrawer();
            switch (groupPosition)
            {
            // For Mail
            case 0:
                switch (childPosition)
                {
                case 0:
                    fragment = InboxFragment.GetInstance(
                        WebserviceConstants.INBOX_EMAIL_TYPE_ID,
                        GetString(Resource.String.inbox_title));
                    AddFrament(fragment, false);
                    break;

                case 1:
                    fragment = InboxFragment.GetInstance(
                        WebserviceConstants.DRAFT_EMAIL_TYPE_ID,
                        GetString(Resource.String.draft_title));
                    AddFrament(fragment, false);
                    break;

                case 2:
                    fragment = InboxFragment.GetInstance(
                        WebserviceConstants.SENT_EMAIL_TYPE_ID,
                        GetString(Resource.String.sent_title));
                    AddFrament(fragment, false);
                    break;

                case 3:
                    fragment = InboxFragment.GetInstance(
                        WebserviceConstants.TRASH_EMAIL_TYPE_ID,
                        GetString(Resource.String.trash_title));
                    AddFrament(fragment, false);
                    break;
                }
                break;

            // For Calendar
            case 1:
                switch (childPosition)
                {
                //For Calendar Event Detail Screen
                case 0:
                    fragment = CalendarFragment.GetInstance();
                    AddFrament(fragment, false);
                    break;

                //For Add Event Screen
                case 1:
                    intent = new Intent(mActivity, typeof(AddCalendarEventActivity));
                    intent.PutExtra("isAddEvent", true);
                    StartActivityForResult(intent, ConstantsDroid.ADD_CALENDAR_EVENT_REQUEST_CODE);
                    OverridePendingTransition(Resource.Animation.animation_enter,
                                              Resource.Animation.animation_leave);
                    break;
                }
                break;

            //For Order
            case 2:
                switch (childPosition)
                {
                //For Order list Screen
                case 0:
                    fragment = OrderListFragment.GetInstance();
                    AddFrament(fragment, false);
                    break;

                //For Order list Screen
                case 1:
                    fragment = OrderListFragment.GetInstance();
                    AddFrament(fragment, false);
                    break;

                //For Add Order Screen
                case 2:
                    intent = new Intent(mActivity, typeof(AddOrderFirstActivity));
                    StartActivityForResult(intent, ConstantsDroid.ADD_ORDER_REQUEST_CODE);
                    OverridePendingTransition(Resource.Animation.animation_enter,
                                              Resource.Animation.animation_leave);
                    break;

                //For Order list Screen
                case 3:
                    fragment = OrderListFragment.GetInstance();
                    AddFrament(fragment, false);
                    break;

                //For Order list Screen
                case 4:
                    fragment = OrderListFragment.GetInstance();
                    AddFrament(fragment, false);
                    break;
                }
                break;

            // For Notes
            case 3:
                switch (childPosition)
                {
                //For Notes list Screen
                case 0:
                    fragment = NotesListFragment.GetInstance();
                    AddFrament(fragment, false);
                    break;

                //For Notes list Screen
                case 1:
                    fragment = NotesListFragment.GetInstance();
                    AddFrament(fragment, false);

                    break;

                //For Add Notes Screen
                case 2:
                    // Show Add Notes screen
                    intent = new Intent(mActivity, typeof(AddNotesActivity));
                    intent.PutExtra("isAddNote", true);
                    StartActivityForResult(intent, ConstantsDroid.ADD_NOTES_REQUEST_CODE);
                    OverridePendingTransition(Resource.Animation.animation_enter,
                                              Resource.Animation.animation_leave);
                    break;
                    ////For Notes list Screen
                    //case 3:
                    //    fragment = NotesListFragment.GetInstance();
                    //    AddFrament(fragment, false);

                    //    break;
                }
                break;
            }


            //mAdapter.SetSelectedPosition(position);
        }