Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            StatusBarTintHelper.SetStatusBarColor(this);

            if (savedInstanceState != null)
            {
                asyncTaskActivityGUID = savedInstanceState.GetString(
                    AsyncUIOperationRepeater.ASYNC_ACTIVITY_GUID);
                //if (NavigationManager.Instance.Records.Count == 0)
                //{
                //    // We need not restore data while navigation manager has valid record list.
                //    var navigationCache = FileCacheHelper.ReadCacheFile(
                //        CacheCatagory, string.Format(NavigationCacheFile, asyncTaskActivityGUID));
                //    if (navigationCache != null)
                //    {
                //        NavigationManager.Instance.RestoreRecords(navigationCache);
                //    }

                //    var indexCache = FileCacheHelper.ReadCacheFile(
                //        CacheCatagory, string.Format(IndexCacheFile, asyncTaskActivityGUID));
                //    if (indexCache != null)
                //    {
                //        DataCache.INSTATNCE.IndexList =
                //            JsonConvert.DeserializeObject<PublicationIndexStatus>(indexCache);
                //    }
                //}
            }

            if (string.IsNullOrEmpty(asyncTaskActivityGUID))
            {
                asyncTaskActivityGUID = Guid.NewGuid().ToString();
            }

            SetContentView(Resource.Layout.content_activity);

            //legalDefinePopup = new LegalDefinePopup(this, OnUserDismissLegalDefinePopup);

            FindViewById <LinearLayout>(Resource.Id.llStatusBarStub).LayoutParameters =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, StatusBarTintHelper.GetStatusBarHeight());

            // Fake Update
            //publication.Value.UpdateCount = 3;

            if (Publication == null)
            {
                CloseContent();
                return;
            }


            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar_actionbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.Title = Publication.Value.Name;

            dlRightDrawer = FindViewById <DrawerLayout>(Resource.Id.dlRightDrawer);
            flRightDrawerPanelContainer = FindViewById <FrameLayout>(Resource.Id.flRightDrawerPanelContainer);
            llHeader = FindViewById <LinearLayout>(Resource.Id.llHeader);
            tvNoHistoryMessageInDrawer = FindViewById <TextView>(Resource.Id.tvNoHistoryMessageInDrawer);

            // Set the shadow layer of drawer layout to totally transparent
            dlRightDrawer.SetScrimColor(Color.Transparent);
            dlRightDrawer.DrawerStateChanged += (object sender, DrawerLayout.DrawerStateChangedEventArgs e) =>
            {
                if (e.NewState == 1)
                {
                    // STATE_DRAGGING
                    // Indicates that a drawer is currently being dragged by the user.
                    hrcAdaptor.RefreshHisoryList();
                    tvNoHistoryMessageInDrawer.Visibility = hrcAdaptor.ItemCount == 0 ? ViewStates.Visible : ViewStates.Gone;
                }
            };

            //rcHistoryList = FindViewById<RecyclerView>(Resource.Id.rcHistoryList);
            //historylistLayoutManager = new LinearLayoutManager(this);
            //historylistLayoutManager.Orientation = LinearLayoutManager.Vertical;
            //rcHistoryList.SetLayoutManager(historylistLayoutManager);
            //hrcAdaptor = new HistoryListAdaptor(
            //    this,
            //    Resource.Layout.content_historylist_item,
            //    OnRecentHistoryItemClick);
            //rcHistoryList.SetAdapter(hrcAdaptor);

            frgContainer = FindViewById <FrameLayout>(Resource.Id.frgContainer);
            var mainFragment = SupportFragmentManager.FindFragmentById(Resource.Id.frgContainer) as ContentMainFragment;

            if (mainFragment == null)
            {
                mainFragment = new ContentMainFragment();
                SupportFragmentManager.BeginTransaction().Add(Resource.Id.frgContainer, mainFragment).Commit();
            }

            SetResult(Result.Canceled);

            AsyncUIOperationRepeater.INSTATNCE.RegisterAsyncTaskActivity(this);
            Android.Util.Log.Info("DBG", "ContentActivity[" + asyncTaskActivityGUID + "] Created.");
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //RegisterRecentHistoryChangeCallback();

            StatusBarTintHelper.SetStatusBarColor(this);

            Android.Util.Log.Info("DBG", "Set MyPublicationsActivity[" + asyncTaskActivityGUID + "].");

            // Create your application here
            SetContentView(Resource.Layout.mypublications_activity);

            FindViewById <LinearLayout>(Resource.Id.llStatusBarStub).LayoutParameters =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, StatusBarTintHelper.GetStatusBarHeight());

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar_actionbar);
            SetSupportActionBar(toolbar);

            dlRightDrawer = FindViewById <DrawerLayout>(Resource.Id.dlRightDrawer);
            flRightDrawerPanelContainer = FindViewById <FrameLayout>(Resource.Id.flRightDrawerPanelContainer);
            llHeader = FindViewById <LinearLayout>(Resource.Id.llHeader);
            tvNoHistoryMessageInDrawer = FindViewById <TextView>(Resource.Id.tvNoHistoryMessageInDrawer);

            // Set the shadow layer of drawer layout to totally transparent
            dlRightDrawer.SetScrimColor(Color.Transparent);
            dlRightDrawer.DrawerStateChanged += (object sender, DrawerLayout.DrawerStateChangedEventArgs e) =>
            {
                if (e.NewState == 1)
                {
                    // STATE_DRAGGING
                    // Indicates that a drawer is currently being dragged by the user.
                    hrcAdaptor.RefreshHisoryList();
                    tvNoHistoryMessageInDrawer.Visibility = hrcAdaptor.ItemCount == 0 ? ViewStates.Visible : ViewStates.Gone;
                }
            };

            rcHistoryList                        = FindViewById <RecyclerView>(Resource.Id.rcHistoryList);
            historylistLayoutManager             = new LinearLayoutManager(this);
            historylistLayoutManager.Orientation = LinearLayoutManager.Vertical;
            rcHistoryList.SetLayoutManager(historylistLayoutManager);
            hrcAdaptor = new HistoryListAdaptor(
                this,
                Resource.Layout.content_historylist_item,
                OnRecentHistoryItemClick);
            rcHistoryList.SetAdapter(hrcAdaptor);
            rcHistoryList.Visibility = ViewStates.Invisible;

            var frgContainer = SupportFragmentManager.FindFragmentById(Resource.Id.frgContainer);

            if (frgContainer == null)
            {
                var publicationsMainFragment = new PublicationsMainFragment();
                SupportFragmentManager.BeginTransaction().Add(Resource.Id.frgContainer, publicationsMainFragment).Commit();
            }

            if (savedInstanceState != null)
            {
                asyncTaskActivityGUID = savedInstanceState.GetString(
                    AsyncUIOperationRepeater.ASYNC_ACTIVITY_GUID);
                if (savedInstanceState.GetBoolean(IsPublicationFilterShowingDropDown))
                {
                    Task.Run(delegate
                    {
                        Thread.Sleep(100);
                        Application.SynchronizationContext.Post(_ =>
                        {
                            if (PublicationListFragment != null)
                            {
                                PublicationListFragment.ForceShowPublicationFilterDropDown();
                            }
                        }, null);
                    });
                }
            }

            if (string.IsNullOrEmpty(asyncTaskActivityGUID))
            {
                asyncTaskActivityGUID = Guid.NewGuid().ToString();
            }

            AsyncUIOperationRepeater.INSTATNCE.RegisterAsyncTaskActivity(this);
            Android.Util.Log.Info("DBG", "MyPublicationsActivity[" + asyncTaskActivityGUID + "] Created.");
        }