Example #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            CustomizedPopoverHisoryTableViewCell cell = tableView.DequeueReusableCell(CustomizedPopoverHisoryTableViewCell.Key) as CustomizedPopoverHisoryTableViewCell;

            if (cell == null)
            {
                cell = CustomizedPopoverHisoryTableViewCell.Create();
            }

            RecentHistoryItem item = HistoryList [indexPath.Row];

            cell.TitleLabel.Text         = item.PublicationTitle;
            cell.GuideCardNameLabel.Text = item.TOCTitle;

            cell.TimeLabel.Text = ((DateTime)item.LastReadDate).ToString("hh:mm t\\M, dd MMM yyyy");

            if (cell.TitleLabel.Constraints.Length > 0)
            {
                CGSize expectedTitleLabelSize = TextDisplayUtil.GetStringBoundRect(item.PublicationTitle, UIFont.BoldSystemFontOfSize(14), new CGSize(295, 600));
                for (int i = 0; i < cell.TitleLabel.Constraints.Length; i++)
                {
                    if (cell.TitleLabel.Constraints [i].FirstAttribute == NSLayoutAttribute.Height && expectedTitleLabelSize.Height > 20)
                    {
                        cell.TitleLabel.Constraints [i].Constant = expectedTitleLabelSize.Height;
                    }
                }
            }

            cell.CellColorHintView.BackgroundColor = ColorUtil.ConvertFromHexColorCode(item.ColorPrimary);

            return(cell);
        }
 private void OnRecentHistoryItemClick(RecentHistoryItem historyItem)
 {
     ((MyPublicationsActivity)Activity).OpenPublication(
         historyItem.BookId,
         AsyncHelpers.RunSync <int>(
             () => PublicationContentUtil.Instance.GetTOCIDByDocId(
                 historyItem.BookId,
                 historyItem.DOCID)));
 }
        public void Update(RecentHistoryItem recentHistory, int position)
        {
            RecentHistory = recentHistory;

            flDivider.Visibility = position == 0 ? ViewStates.Gone : ViewStates.Visible;
            flPublicationBar.SetBackgroundColor(Color.ParseColor(RecentHistory.ColorPrimary));
            tvPublicationTitle.Text = RecentHistory.PublicationTitle;
            tvTOCTitle.Text         = RecentHistory.TOCTitle;
            tvLastReadDate.Text     = FormateLastReadDate();
        }
Example #4
0
 private void OnRecentHistoryItemClick(RecentHistoryItem historyItem)
 {
     OpenPublication(
         historyItem.BookId,
         AsyncHelpers.RunSync <int>(
             () => PublicationContentUtil.Instance.GetTOCIDByDocId(
                 historyItem.BookId,
                 historyItem.DOCID)));
     dlRightDrawer.CloseDrawer(flRightDrawerPanelContainer);
 }
Example #5
0
        public async Task OpenPublicationContentAtHistory(RecentHistoryItem recentHistoryItem)
        {
            parentPopover.Close();

            int bookID = recentHistoryItem.BookId;
            var docID  = recentHistoryItem.DOCID;
            int tocID  = await PublicationContentUtil.Instance.GetTOCIDByDocId(bookID, docID);

            var winController = Utility.GetMainWindowConroller();
            await winController.UpdateContentView(bookID, tocID);
        }
Example #6
0
        private void OnRecentHistoryItemClick(RecentHistoryItem historyItem)
        {
            //dlRightDrawer.CloseDrawer(flRightDrawerPanelContainer);
            //var tocId = AsyncHelpers.RunSync<int>(
            //    () => PublicationContentUtil.Instance.GetTOCIDByDocId(
            //        historyItem.BookId,
            //        historyItem.DOCID));

            //if (historyItem.BookId != Publication.Value.BookId)
            //{

            //    NavigationManager.Instance.AddRecord(
            //        new ContentBrowserRecord(
            //            historyItem.BookId,
            //            tocId,
            //            0));
            //    GetMainFragment().SwitchLogicalMainTab(ContentMainFragment.TabContents);

            //    ShowPleaseWaitDialog();

            //    Task.Run(() =>
            //    {
            //        // Wait the "PleaseWaitDialog" pop up
            //        Thread.Sleep(100);
            //        Application.SynchronizationContext.Post(_ =>
            //        {
            //            SwitchPublication();
            //            GetMainFragment().Refresh();
            //        }, null);
            //    });

            //    return;
            //}

            //var record = DataCache.INSTATNCE.Toc.GetNavigationItem();
            //if (record == null
            //    || !NavigationManagerHelper.CompareActualTocId(NavigationManagerHelper.ContentsTabGetTocId(record), tocId))
            //{
            //    NavigationManager.Instance.AddRecord(
            //        new ContentBrowserRecord(
            //            historyItem.BookId,
            //            tocId,
            //            0));
            //}
            //else
            //{
            //    NavigationManagerHelper.MoveForthAndSetCurrentIndex(record.RecordID);
            //}

            //GetMainFragment().SwitchLogicalMainTab(ContentMainFragment.TabContents);

            //GetMainFragment().Refresh();
        }
Example #7
0
        public async Task RecentHistoryToTOC(RecentHistoryItem recentHistoryItem)
        {
            int TOCId = await PublicationContentUtil.Instance.GetTOCIDByDocId(recentHistoryItem.BookId, recentHistoryItem.DOCID);

            var record = new NavigationRecord
            {
                BookId = recentHistoryItem.BookId,
                TOCId  = TOCId,
                Type   = NavigationType.History
            };

            await RestoreToc(record, TOCAccessMode.All);
        }
Example #8
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            RecentHistoryItem item = HistoryList [indexPath.Row];

            CustomizedHistoryTableViewCell cell = tableView.DequeueReusableCell(CustomizedHistoryTableViewCell.Key) as CustomizedHistoryTableViewCell;

            if (cell == null)
            {
                cell = CustomizedHistoryTableViewCell.Create();
            }

            cell.TitleLabel.Text                   = item.PublicationTitle;
            cell.TitleLabel.LineBreakMode          = UILineBreakMode.MiddleTruncation;
            cell.GuideCardNameLabel.Text           = item.TOCTitle;
            cell.TimeLabel.Text                    = ((DateTime)item.LastReadDate).ToString("hh:mm t\\M, dd MMM yyyy");
            cell.CellColorHintView.BackgroundColor = ColorUtil.ConvertFromHexColorCode(item.ColorPrimary);

            return(cell);
        }
Example #9
0
        public async override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            RecentHistoryItem  item = HistoryList [indexPath.Row];
            List <Publication> cachedPublicationList = PublicationUtil.Instance.GetPublicationOffline();

            var publication = cachedPublicationList.FirstOrDefault(o => o.BookId == item.BookId);


            if (await PageSearchUtil.Instance.IsPBO(publication.BookId))
            {
                NSNotificationCenter.DefaultCenter.PostNotificationName("JudgePBOBook", this, new NSDictionary("PBOBook", "YES"));
            }
            else
            {
                NSNotificationCenter.DefaultCenter.PostNotificationName("JudgePBOBook", this, new NSDictionary("PBOBook", "NO"));
            }

            if (publication != null)
            {
                AppDataUtil.Instance.SetCurrentPublication(publication);
                var tocId = await PublicationContentUtil.Instance.GetTOCIDByDocId(publication.BookId, item.DOCID);

                AppDataUtil.Instance.SetOpendTOC(AppDataUtil.Instance.GetTOCNodeByID(tocId));
                AppDataUtil.Instance.SetHighlightedTOCNode(AppDataUtil.Instance.GetTOCNodeByID(tocId));

                AppDisplayUtil.Instance.DismissPopoverView();
                tableView.CellAt(indexPath).Selected = false;

                AppDataUtil.Instance.AddBrowserRecord(new ContentBrowserRecord(AppDataUtil.Instance.GetCurrentPublication().BookId, tocId, 0));                 //add browser record

                if (IsInContentVC)
                {
                    NSNotificationCenter.DefaultCenter.PostNotificationName("RemoveContentSearchResultViewInTOC", this);
                    NSNotificationCenter.DefaultCenter.PostNotificationName("RemoveContentSearchResultViewInIndex", this);
                    NSNotificationCenter.DefaultCenter.PostNotificationName("RemoveContentSearchResultViewInAnnotation", this);
                }
                else
                {
                    AppDisplayUtil.Instance.GotoPublicationDetailViewController();
                }
            }
        }
Example #10
0
        public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            RecentHistoryItem item = HistoryList [indexPath.Row];
            CGSize            expectedTitleLabelSize = TextDisplayUtil.GetStringBoundRect(item.PublicationTitle, UIFont.BoldSystemFontOfSize(14), new CGSize(295, 600));

            CGSize expectedTOCTitleLabelSize = TextDisplayUtil.GetStringBoundRect(item.TOCTitle, UIFont.SystemFontOfSize(14), new CGSize(295, 600));

            float expectedTOCTitleHeight = (float)expectedTOCTitleLabelSize.Height;

            if (expectedTOCTitleHeight < 20)
            {
                expectedTOCTitleHeight = 20;
            }
            else if (expectedTOCTitleHeight > 50)
            {
                expectedTOCTitleHeight = 50;
            }

            return((expectedTitleLabelSize.Height > 20 ? expectedTitleLabelSize.Height : 20) + expectedTOCTitleHeight + 32);
        }
Example #11
0
        public async override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            RecentHistoryItem  item = HistoryList [indexPath.Row];
            List <Publication> cachedPublicationList = PublicationUtil.Instance.GetPublicationOffline();

            var publication = cachedPublicationList.FirstOrDefault(o => o.BookId == item.BookId);

            if (publication != null)
            {
                AppDataUtil.Instance.SetCurrentPublication(publication);
                var tocId = await PublicationContentUtil.Instance.GetTOCIDByDocId(publication.BookId, item.DOCID);

                AppDataUtil.Instance.SetOpendTOC(AppDataUtil.Instance.GetTOCNodeByID(tocId));
                AppDataUtil.Instance.SetHighlightedTOCNode(AppDataUtil.Instance.GetTOCNodeByID(tocId));

                AppDisplayUtil.Instance.GotoPublicationDetailViewController();
                AppDataUtil.Instance.AddBrowserRecord(new ContentBrowserRecord(AppDataUtil.Instance.GetCurrentPublication().BookId, tocId, 0));                 //add browser record

                HistoryList = PublicationContentUtil.Instance.GetRecentHistory();
                tableView.ReloadData();
            }
        }