public HistoryListAdaptorViewHolder(View v, HistoryListAdaptor adaptor) : base(v)
        {
            this.adaptor     = adaptor;
            llItemBackground = v.FindViewById <LinearLayout>(Resource.Id.llItemBackground);

            flDivider          = v.FindViewById <FrameLayout>(Resource.Id.flDivider);
            flPublicationBar   = v.FindViewById <FrameLayout>(Resource.Id.flPublicationBar);
            tvPublicationTitle = v.FindViewById <TextView>(Resource.Id.tvPublicationTitle);
            tvTOCTitle         = v.FindViewById <TextView>(Resource.Id.tvTOCTitle);

            tvLastReadDate = v.FindViewById <TextView>(Resource.Id.tvLastReadDate);

            llItemBackground.SetOnClickListener(new OnItemClickListener(this));
        }
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.");
        }