Exemplo n.º 1
0
 private void InitializeTabs(Bundle savedInstanceState)
 {
     mlam    = new LocalActivityManager(this, true);
     tabHost = FindViewById <TabHost> (Resource.Id.tabHost);
     mlam.DispatchCreate(savedInstanceState);
     tabHost.Setup(mlam);
 }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.AssignmentsTabsLayout);

            tabHost = FindViewById <TabHost> (Resource.Id.assingmentTabHost);
            //In order to use tabs outside of a TabActivity I have to use this local activity manager and dispatch create the savedInstanceState
            localManger = new LocalActivityManager(this, true);
            localManger.DispatchCreate(savedInstanceState);
            tabHost.Setup(localManger);

            TabHost.TabSpec assignmentsSpec  = tabHost.NewTabSpec("list");
            Intent          assignmentIntent = new Intent(this, typeof(AssignmentsActivity));

            assignmentsSpec.SetContent(assignmentIntent);
            assignmentsSpec.SetIndicator("list");

            TabHost.TabSpec mapViewSpec   = tabHost.NewTabSpec("map");
            Intent          mapViewIntent = new Intent(this, typeof(MapViewActivity));

            mapViewSpec.SetContent(mapViewIntent);
            mapViewSpec.SetIndicator("map");

            tabHost.AddTab(assignmentsSpec);
            tabHost.AddTab(mapViewSpec);

            tabHost.TabChanged += (sender, e) => {
                if (tabHost.CurrentTab == 0)
                {
                    MapData = null;
                }
            };

            try {
                if (savedInstanceState != null)
                {
                    if (savedInstanceState.ContainsKey(Constants.CurrentTab))
                    {
                        var currentTab = savedInstanceState.GetInt(Constants.CurrentTab, 0);
                        tabHost.CurrentTab = currentTab;
                    }
                    else
                    {
                        tabHost.CurrentTab = 0;
                    }

                    MapData = savedInstanceState.ContainsKey("mapData") ?
                              (MapDataWrapper)savedInstanceState.GetSerializable("mapData") : null;
                }
                else
                {
                    MapData            = null;
                    tabHost.CurrentTab = 0;
                }
            } catch (Exception) {
                tabHost.CurrentTab = 0;
            }
        }
Exemplo n.º 3
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //Like the tabs issue, we have to create a local activity manager to enable us to use a mapview outside of mapactivity.
            //credits go to BahaiResearch.com on stackoverflow http://stackoverflow.com/questions/5109336/mapview-in-a-fragment-honeycomb
            localManager = new LocalActivityManager(Activity, true);
            localManager.DispatchCreate(savedInstanceState);
        }
        public override void OnBackPressed()
        {
            var length = _idList.Count;

            if (length > 1)
            {
                var current = LocalActivityManager.GetActivity(_idList[length - 1]);
                FinishActivityFromChild(current, 0);
            }
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            Bundle Extras = Intent.Extras;

            byte[] BackgroundByteArray = Extras.GetByteArray("BackgroundByteArray");
            TripInfo = Extras.GetStringArrayList("TripData").ToArray();
            Me       = new TripClient(Utilizator_Main.INPUT, Utilizator_Main.OUTPUT, new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Login.Username), this);
            TripId   = new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Trip.TipId);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Utilizator_Trip);

            InitiateView();
            CheckIfNewInTrip();

            test = this;

            LocalActivityManager LAM = new LocalActivityManager(this, false);

            LAM.DispatchCreate(savedInstanceState);
            LAM.DispatchResume();
            LAM.DispatchPause(IsFinishing);
            tabHost.Setup(LAM);

            int[] Layouturi = new int[] {
                Resource.Layout.Utilizator_Trip_ChatView,
                Resource.Layout.Utilizator_Trip_MaskB,
                Resource.Layout.Utilizator_Trip_MaskC,
            };

            Background.Background = DrawableConverter.ByteArrayToDrawable(BackgroundByteArray, this);

            SetTypeface.Normal.SetTypeFace(this, UserNume);
            LeftDrawerListView.Adapter = new Utilizator_Trip_LeftDrawerAdapter(this, Background.Background, new string[] { "Galerie", "Modificare Cont", "As vrea sa cumpar", "Informatii excursie", "Setari", "Iesire Excursie", "Logut" });

            //	OrganizatorProfilePic.SetImageDrawable(RoundedUserProfile);
            //	OrganizatorNume.Text = "Nume Prenume";
            //	SetTypeface.Normal.SetTypeFace (this,OrganizatorNume);

            Pager.Adapter = new Utilizator_Trip_ViewPagerAdapter(SupportFragmentManager, this);

            for (int i = 0; i < 3; i++)
            {
                CreateTab(typeof(Utilizator_Trip_MaskA), Tags[i], string.Empty, TabsIcon[i], tabHost);
            }

            tabHost.TabChanged += TabHost_TabChanged;
            Pager.PageSelected += Pager_PageSelected;
            ClientGetMessage   += Utilizator_Trip_ClientGetMessage;
        }
        public void StartChildActivity(string id, Intent intent)
        {
            intent.AddFlags(ActivityFlags.ClearTop);
            var window = LocalActivityManager.StartActivity(id, intent);

            if (window != null)
            {
                _idList.Add(id);
                SetContentView(window.DecorView);
            }
        }
Exemplo n.º 7
0
        private void CreateColorChooserTab()
        {
            CreateTab(typeof(ColorChooserView), "cc", null, Resource.Drawable.ic_palette_white_36dp, true);
            ColorChooserView ccv = (ColorChooserView)LocalActivityManager.GetActivity("cc");

            ViewModel.ColorChooser = ccv.ViewModel;
            ccv.ColorChanged      += (s, newColor) => {
                RGBPi.Core.Model.DataTypes.Color c = new RGBPi.Core.Model.DataTypes.Color(newColor);

                RGBPi.Core.Model.Message msg = new RGBPi.Core.Model.Message();
                CC fade = new CC(c);
                msg.commands = new List <RGBPi.Core.Model.Commands.Command> {
                    fade
                };
                ViewModel.SendMessage(msg);
            };
        }
Exemplo n.º 8
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == Result.Canceled)
            {
                News activityNews = LocalActivityManager.GetActivity("TabNews") as News;
                if (activityNews != null)
                {
                    Toast.MakeText(activityNews, "Die Newsfeeds werden aktualisiert.", Android.Widget.ToastLength.Short).Show();
                    new FeedHelper().UpdateBGFeeds(activityNews);

                    AlarmManager  alarmManager  = (AlarmManager)GetSystemService(Context.AlarmService);
                    PendingIntent pendingIntent = PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(NewsAppAlarmService)), 0);
                    alarmManager.SetInexactRepeating(AlarmType.ElapsedRealtimeWakeup, SystemClock.ElapsedRealtime() + 60, AlarmManager.IntervalHalfDay, pendingIntent);
                }
            }
        }
Exemplo n.º 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.TabbedPage);

            localActivityManager = new LocalActivityManager(this, false);

            localActivityManager.DispatchCreate(savedInstanceState);

            TabHost tabHost = FindViewById <TabHost>(Resource.Id.tabsHost);   // create the TabHost that will contain the Tabs

            tabHost.Setup(localActivityManager);

            CreateTab(typeof(CocktailListview), "COCKTAIL", "COCKTAIL", tabHost);

            CreateTab(typeof(EditPage), "", "", tabHost);
        }
Exemplo n.º 10
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            historyViewModel = ServiceContainer.Resolve <HistoryViewModel> ();
            menuViewModel    = ServiceContainer.Resolve <MenuViewModel> ();

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

            searchText              = view.FindViewById <EditText> (Resource.Id.historySearchText);
            searchText.TextChanged += (sender, e) => {
                if (historySearchAdapter != null)
                {
                    historySearchAdapter.FilterItems(searchText.Text);
                    historySearchAdapter.NotifyDataSetChanged();
                }
            };
            var clearSearch = view.FindViewById <ImageButton> (Resource.Id.historyClearSearch);

            clearSearch.Click += (sender, e) => searchText.Text = string.Empty;

            tabHost         = view.FindViewById <TabHost> (Resource.Id.historyTabHost);
            historyListView = view.FindViewById <ListView> (Resource.Id.historyListView);

            localManger = new LocalActivityManager(Activity, true);
            localManger.DispatchCreate(savedInstanceState);
            tabHost.Setup(localManger);

            var dateIndicator = CreateTab("DATE");

            TabHost.TabSpec dateTab = tabHost.NewTabSpec("Date");
            dateTab.SetIndicator(dateIndicator);
            dateTab.SetContent(new TabContent(new TextView(tabHost.Context)));

            var callsIndicator = CreateTab("CALLS");

            TabHost.TabSpec callsTab = tabHost.NewTabSpec("Calls");
            callsTab.SetIndicator(callsIndicator);
            callsTab.SetContent(new TabContent(new TextView(tabHost.Context)));

            var assignmentIndicator = CreateTab("ASSIGNMENTS");

            TabHost.TabSpec assignments = tabHost.NewTabSpec("Assignments");
            assignments.SetIndicator(assignmentIndicator);
            assignments.SetContent(new TabContent(new TextView(tabHost.Context)));

            tabHost.AddTab(dateTab);
            tabHost.AddTab(callsTab);
            tabHost.AddTab(assignments);

            tabHost.TabChanged += (sender, e) => {
                if (History != null)
                {
                    switch (tabHost.CurrentTab)
                    {
                    case 0:
                        historySearchAdapter = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.OrderBy(h => h.Date).ToList());
                        break;

                    case 1:
                        historySearchAdapter = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.Where(h => h.Type == AssignmentHistoryType.PhoneCall).ToList());
                        break;

                    default:
                        historySearchAdapter = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.Where(h => h.Type == AssignmentHistoryType.Assignment).ToList());
                        break;
                    }
                    historySearchAdapter.Assignment = Assignment;
                    historyListView.Adapter         = historySearchAdapter;
                }
            };
            if (History != null)
            {
                historySearchAdapter            = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.OrderBy(a => a.Date).ToList());
                historySearchAdapter.Assignment = Assignment;
                historyListView.Adapter         = historySearchAdapter;
            }

            historyListView.ItemClick += (sender, e) => {
                var intent = new Intent(Activity, typeof(SummaryHistoryActivity));
                historyViewModel.SelectedAssignmentHistory = History.ElementAtOrDefault(e.Position);
                menuViewModel.MenuIndex = 0;
                StartActivity(intent);
            };

            return(view);
        }