protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.action_bar_display_options);

            FindViewById(Resource.Id.toggle_home_as_up).SetOnClickListener(this);
            FindViewById(Resource.Id.toggle_show_home).SetOnClickListener(this);
            FindViewById(Resource.Id.toggle_use_logo).SetOnClickListener(this);
            FindViewById(Resource.Id.toggle_show_title).SetOnClickListener(this);
            FindViewById(Resource.Id.toggle_show_custom).SetOnClickListener(this);
            FindViewById(Resource.Id.toggle_navigation).SetOnClickListener(this);
            FindViewById(Resource.Id.cycle_custom_gravity).SetOnClickListener(this);
            FindViewById(Resource.Id.toggle_visibility).SetOnClickListener(this);

            // Configure several action bar elements that will be toggled by display options.
            mCustomView             = LayoutInflater.Inflate(Resource.Layout.action_bar_display_options_custom, null);
            mCustomViewLayoutParams = new Android.Support.V7.App.ActionBar.LayoutParams(
                Android.Support.V7.App.ActionBar.LayoutParams.WrapContent,
                Android.Support.V7.App.ActionBar.LayoutParams.WrapContent);

            ActionBar bar = SupportActionBar;

            bar.SetCustomView(mCustomView, mCustomViewLayoutParams);
            bar.AddTab(bar.NewTab().SetText("Tab 1").SetTabListener(this));
            bar.AddTab(bar.NewTab().SetText("Tab 2").SetTabListener(this));
            bar.AddTab(bar.NewTab().SetText("Tab 3").SetTabListener(this));
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView(Resource.Layout.action_bar_display_options);

			FindViewById(Resource.Id.toggle_home_as_up).SetOnClickListener(this);
			FindViewById(Resource.Id.toggle_show_home).SetOnClickListener(this);
			FindViewById(Resource.Id.toggle_use_logo).SetOnClickListener(this);
			FindViewById(Resource.Id.toggle_show_title).SetOnClickListener(this);
			FindViewById(Resource.Id.toggle_show_custom).SetOnClickListener(this);
			FindViewById(Resource.Id.toggle_navigation).SetOnClickListener(this);
			FindViewById(Resource.Id.cycle_custom_gravity).SetOnClickListener(this);
			FindViewById(Resource.Id.toggle_visibility).SetOnClickListener(this);

			// Configure several action bar elements that will be toggled by display options.
			mCustomView = LayoutInflater.Inflate(Resource.Layout.action_bar_display_options_custom, null);
			mCustomViewLayoutParams = new Android.Support.V7.App.ActionBar.LayoutParams(
				Android.Support.V7.App.ActionBar.LayoutParams.WrapContent, 
				Android.Support.V7.App.ActionBar.LayoutParams.WrapContent);

			ActionBar bar = SupportActionBar;
			bar.SetCustomView(mCustomView, mCustomViewLayoutParams);
			bar.AddTab(bar.NewTab().SetText("Tab 1").SetTabListener(this));
			bar.AddTab(bar.NewTab().SetText("Tab 2").SetTabListener(this));
			bar.AddTab(bar.NewTab().SetText("Tab 3").SetTabListener(this));
		}
Beispiel #3
0
        protected override void OnCreateActivity(Bundle state)
        {
            base.OnCreateActivity(state);

            SetContentView(Resource.Layout.MainDrawerActivity);

            MainToolbar    = FindViewById <Toolbar> (Resource.Id.MainToolbar);
            DrawerListView = FindViewById <ListView> (Resource.Id.DrawerListView);
            DrawerUserView = LayoutInflater.Inflate(Resource.Layout.MainDrawerListHeader, null);
            DrawerUserName = DrawerUserView.FindViewById <TextView> (Resource.Id.TitleTextView);
            DrawerImage    = DrawerUserView.FindViewById <ProfileImageView> (Resource.Id.IconProfileImageView);
            DrawerListView.AddHeaderView(DrawerUserView);
            DrawerListView.Adapter    = drawerAdapter = new DrawerListAdapter();
            DrawerListView.ItemClick += OnDrawerListViewItemClick;

            var authManager = ServiceContainer.Resolve <AuthManager> ();

            authManager.PropertyChanged += OnUserChangedEvent;

            DrawerLayout = FindViewById <DrawerLayout> (Resource.Id.DrawerLayout);
            DrawerToggle = new ActionBarDrawerToggle(this, DrawerLayout, MainToolbar, Resource.String.EntryName, Resource.String.EntryName);

            DrawerLayout.SetDrawerShadow(Resource.Drawable.drawershadow, (int)GravityFlags.Start);
            DrawerLayout.SetDrawerListener(DrawerToggle);

            var drawerFrameLayout = FindViewById <FrameLayout> (Resource.Id.DrawerFrameLayout);

            drawerFrameLayout.Touch += (sender, e) => {
                // Do nothing, just absorb the event
                // TODO: Improve this dirty solution?
            };

            Timer.OnCreate(this);

            var lp = new Android.Support.V7.App.ActionBar.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, (int)GravityFlags.Right);

            MainToolbar.SetNavigationIcon(Resource.Drawable.ic_menu_black_24dp);
            SetSupportActionBar(MainToolbar);
            SupportActionBar.SetTitle(Resource.String.MainDrawerTimer);
            SupportActionBar.SetCustomView(Timer.Root, lp);
            SupportActionBar.SetDisplayShowCustomEnabled(true);

            if (state == null)
            {
                OpenPage(DrawerListAdapter.TimerPageId);
            }
            else
            {
                // Restore page stack
                pageStack.Clear();
                var arr = state.GetIntArray(PageStackExtra);
                if (arr != null)
                {
                    pageStack.AddRange(arr);
                }
            }

            // Make sure that the user will see newest data when they start the activity
            ServiceContainer.Resolve <ISyncManager> ().Run();
        }
        /// Called when [create].
        /// </summary>
        /// <param name="bundle">The bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var actionbar = this.BindingInflate(Resource.Layout.custom_action_bar, null);

            Android.Support.V7.App.ActionBar.LayoutParams lp = new Android.Support.V7.App.ActionBar.LayoutParams(Android.Support.V7.App.ActionBar.LayoutParams.MatchParent, Android.Support.V7.App.ActionBar.LayoutParams.MatchParent);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.SetCustomView(actionbar, lp);
        }
Beispiel #5
0
        protected void InitializeActionBar(Android.Support.V7.App.ActionBar ab)
        {
            mActionBar = ab;

            LayoutInflater mInflater   = LayoutInflater.From(this);
            View           mCustomView = mInflater.Inflate(Resource.Layout.ActionBar, null);

            ActionBarTitle  = mCustomView.FindViewById <TextView> (Resource.Id.title);
            ActionBarBack   = mCustomView.FindViewById <ImageButton> (Resource.Id.backButton);
            ActionBarAdd    = mCustomView.FindViewById <ImageButton> (Resource.Id.addButton);
            ActionBarSearch = mCustomView.FindViewById <ImageButton> (Resource.Id.searchButton);
            ActionBarClose  = mCustomView.FindViewById <ImageButton> (Resource.Id.closeButton);
            ActionBarDelete = mCustomView.FindViewById <ImageButton> (Resource.Id.deleteButton);
            ActionBarQuery  = mCustomView.FindViewById <EditText>(Resource.Id.query);

            ActionBarBack.Click += (sender, e) => OnBackPressed();

            var layout = new Android.Support.V7.App.ActionBar.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            mActionBar.SetCustomView(mCustomView, layout);
            mActionBar.SetDisplayShowCustomEnabled(true);
        }
Beispiel #6
0
        protected void InitializeActionBar(Android.Support.V7.App.ActionBar ab)
        {
            mActionBar = ab;

            LayoutInflater mInflater = LayoutInflater.From (this);
            View mCustomView = mInflater.Inflate (Resource.Layout.ActionBar, null);

            ActionBarTitle = mCustomView.FindViewById<TextView> (Resource.Id.title);
            ActionBarBack = mCustomView.FindViewById<ImageButton> (Resource.Id.backButton);
            ActionBarAdd = mCustomView.FindViewById<ImageButton> (Resource.Id.addButton);
            ActionBarSearch = mCustomView.FindViewById<ImageButton> (Resource.Id.searchButton);
            ActionBarClose = mCustomView.FindViewById<ImageButton> (Resource.Id.closeButton);
            ActionBarDelete = mCustomView.FindViewById<ImageButton> (Resource.Id.deleteButton);
            ActionBarQuery = mCustomView.FindViewById<EditText>(Resource.Id.query);

            ActionBarBack.Click += (sender, e) => OnBackPressed ();

            var layout = new Android.Support.V7.App.ActionBar.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            mActionBar.SetCustomView (mCustomView, layout);
            mActionBar.SetDisplayShowCustomEnabled (true);
        }
        protected override void OnCreateActivity (Bundle state)
        {
            base.OnCreateActivity (state);

            SetContentView (Resource.Layout.MainDrawerActivity);

            MainToolbar = FindViewById<Toolbar> (Resource.Id.MainToolbar);
            DrawerListView = FindViewById<ListView> (Resource.Id.DrawerListView);
            DrawerUserView = LayoutInflater.Inflate (Resource.Layout.MainDrawerListHeader, null);
            DrawerUserName = DrawerUserView.FindViewById<TextView> (Resource.Id.TitleTextView);
            DrawerImage = DrawerUserView.FindViewById<ProfileImageView> (Resource.Id.IconProfileImageView);
            DrawerListView.AddHeaderView (DrawerUserView);
            DrawerListView.Adapter = drawerAdapter = new DrawerListAdapter ();
            DrawerListView.ItemClick += OnDrawerListViewItemClick;

            var authManager = ServiceContainer.Resolve<AuthManager> ();
            authManager.PropertyChanged += OnUserChangedEvent;

            DrawerLayout = FindViewById<DrawerLayout> (Resource.Id.DrawerLayout);
            DrawerToggle = new ActionBarDrawerToggle (this, DrawerLayout, MainToolbar, Resource.String.EntryName, Resource.String.EntryName);

            DrawerLayout.SetDrawerShadow (Resource.Drawable.drawershadow, (int)GravityFlags.Start);
            DrawerLayout.SetDrawerListener (DrawerToggle);

            Timer.OnCreate (this);

            var lp = new Android.Support.V7.App.ActionBar.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, (int)GravityFlags.Right);

            MainToolbar.SetNavigationIcon (Resource.Drawable.ic_menu_black_24dp);
            SetSupportActionBar (MainToolbar);
            SupportActionBar.SetTitle (Resource.String.MainDrawerTimer);
            SupportActionBar.SetCustomView (Timer.Root, lp);
            SupportActionBar.SetDisplayShowCustomEnabled (true);

            var bus = ServiceContainer.Resolve<MessageBus> ();
            drawerSyncStarted = bus.Subscribe<SyncStartedMessage> (SyncStarted);
            drawerSyncFinished = bus.Subscribe<SyncFinishedMessage> (SyncFinished);

            DrawerSyncView = FindViewById<FrameLayout> (Resource.Id.DrawerSyncStatus);

            syncRetryButton = DrawerSyncView.FindViewById<ImageButton> (Resource.Id.SyncRetryButton);
            syncRetryButton.Click += OnSyncRetryClick;

            syncStatusText = DrawerSyncView.FindViewById<TextView> (Resource.Id.SyncStatusText);

            if (state == null) {
                OpenPage (DrawerListAdapter.TimerPageId);
            } else {
                // Restore page stack
                pageStack.Clear ();
                var arr = state.GetIntArray (PageStackExtra);
                if (arr != null) {
                    pageStack.AddRange (arr);
                }
            }

            // Make sure that the user will see newest data when they start the activity
            ServiceContainer.Resolve<ISyncManager> ().Run ();
        }
        protected override void OnCreateActivity (Bundle state)
        {
            base.OnCreateActivity (state);

            SetContentView (Resource.Layout.MainDrawerActivity);

            MainToolbar = FindViewById<Toolbar> (Resource.Id.MainToolbar);
            DrawerListView = FindViewById<ListView> (Resource.Id.DrawerListView);
            DrawerUserView = LayoutInflater.Inflate (Resource.Layout.MainDrawerListHeader, null);
            DrawerUserName = DrawerUserView.FindViewById<TextView> (Resource.Id.TitleTextView);
            DrawerEmail = DrawerUserView.FindViewById<TextView> (Resource.Id.EmailTextView);
            DrawerImage = DrawerUserView.FindViewById<ProfileImageView> (Resource.Id.IconProfileImageView);
            if (!ServiceContainer.Resolve<AuthManager>().OfflineMode) {
                DrawerListView.AddHeaderView (DrawerUserView);
            }
            DrawerListView.Adapter = drawerAdapter = new DrawerListAdapter ();
            DrawerListView.ItemClick += OnDrawerListViewItemClick;

            authManager = ServiceContainer.Resolve<AuthManager> ();
            authManager.PropertyChanged += OnUserChangedEvent;

            DrawerLayout = FindViewById<DrawerLayout> (Resource.Id.DrawerLayout);
            DrawerToggle = new ActionBarDrawerToggle (this, DrawerLayout, MainToolbar, Resource.String.EntryName, Resource.String.EntryName);

            DrawerLayout.SetDrawerShadow (Resource.Drawable.drawershadow, (int)GravityFlags.Start);
            DrawerLayout.SetDrawerListener (DrawerToggle);

            var drawerFrameLayout = FindViewById<FrameLayout> (Resource.Id.DrawerFrameLayout);
            drawerFrameLayout.Touch += (sender, e) => {
                // Do nothing, just absorb the event
                // TODO: Improve this dirty solution?
            };

            Timer.OnCreate (this);

            var lp = new Android.Support.V7.App.ActionBar.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, (int)GravityFlags.Right);

            MainToolbar.SetNavigationIcon (Resource.Drawable.ic_menu_black_24dp);
            SetSupportActionBar (MainToolbar);
            SupportActionBar.SetTitle (Resource.String.MainDrawerTimer);
            SupportActionBar.SetCustomView (Timer.Root, lp);
            SupportActionBar.SetDisplayShowCustomEnabled (true);

            if (state == null) {
                OpenPage (DrawerListAdapter.TimerPageId);
            } else {
                // Restore page stack
                pageStack.Clear ();
                var arr = state.GetIntArray (PageStackExtra);
                if (arr != null) {
                    pageStack.AddRange (arr);
                }
            }

            // Make sure that the user will see newest data when they start the activity
            ServiceContainer.Resolve<ISyncManager> ().Run ();
        }