private void OnResultItemClick(int pageNum, PageSearchItem searchItem)
        {
            var record = DataCache.INSTATNCE.Toc.GetNavigationItem() as ContentBrowserRecord;

            if (record == null ||
                !NavigationManagerHelper.CompareActualTocId(record.TOCID, searchItem.TOCID) ||
                record.PageNum != pageNum)
            {
                NavigationManager.Instance.AddRecord(
                    new ContentBrowserRecord(
                        NavigationManagerHelper.GetCurrentBookId(),
                        searchItem.TOCID,
                        pageNum,
                        0));
                //WebViewManager.Instance.ClearWebViewStatus(WebViewManager.WebViewType.Content);
            }
            else
            {
                NavigationManagerHelper.MoveForthAndSetCurrentIndex(record.RecordID);
                WebViewManager.Instance.ClearWebViewStatus(WebViewManager.WebViewType.Content);
                DataCache.INSTATNCE.Toc.ResetNavigationItem();
            }

            ((ContentActivity)Activity).GetMainFragment().SwitchLogicalMainTab(ContentMainFragment.TabContents);
            ((ContentActivity)Activity).GetMainFragment().Refresh();

            Dismiss();
        }
        private void OnPageNumChanged()
        {
            Arguments.PutString(PageNumKey, tvPageNum.Text);
            if (string.IsNullOrEmpty(tvPageNum.Text))
            {
                hrcAdaptor.ResultList  = null;
                tvNoResultMessage.Text = MainApp.ThisApp.Resources.GetString(
                    Resource.String.ContentPboGoTo_EmptyInputMessage);
                tvNoResultMessage.Visibility = ViewStates.Visible;
                return;
            }

            var bookId  = NavigationManagerHelper.GetCurrentBookId();
            var pageNum = Int32.Parse(tvPageNum.Text);

            hrcAdaptor.ResultList = new Tuple <int, List <PageSearchItem> >(
                pageNum,
                AsyncHelpers.RunSync <List <PageSearchItem> >(
                    () => PageSearchUtil.Instance.SeachByPageNum(bookId, pageNum)));

            if (hrcAdaptor.ItemCount == 0)
            {
                tvNoResultMessage.Text = MainApp.ThisApp.Resources.GetString(
                    Resource.String.ContentPboGoTo_NotFoundMessage);
                tvNoResultMessage.Visibility = ViewStates.Visible;
            }
            else
            {
                tvNoResultMessage.Visibility = ViewStates.Gone;
            }
        }
Ejemplo n.º 3
0
 public void UpdatePublicationDownloadingProgress(int bookId)
 {
     // We can't get current Publication of ContentActivity, after NavigationManager is cleared;
     // So we just get current book id from NavigationManager directly.
     // Releated bug: http://wiki.lexiscn.com/issues/15647
     if (NavigationManagerHelper.GetCurrentBookId() != bookId)
     {
         return;
     }
 }
Ejemplo n.º 4
0
        public override void OnHiddenChanged(bool hidden)
        {
            base.OnHiddenChanged(hidden);

            if (!hidden
                &&
                (DataCache.INSTATNCE.IndexList == null ||
                 DataCache.INSTATNCE.IndexList.IndexList == null ||
                 DataCache.INSTATNCE.IndexList.Publication == null ||
                 DataCache.INSTATNCE.IndexList.Publication.Value.BookId != NavigationManagerHelper.GetCurrentBookId()))
            {
                GetIndexList();
            }
        }
Ejemplo n.º 5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var v = inflater.Inflate(Resource.Layout.contentpage_content_fragment, container, false);

            if (((ContentActivity)Activity).Publication == null)
            {
                return(v);
            }

            ivExpand        = v.FindViewById <ImageView>(Resource.Id.ivExpand);
            ivExpand.Click += OnIvExpandClick;

            ivPreviousPage = v.FindViewById <ImageView>(Resource.Id.ivPreviousPage);
            ivNextPage     = v.FindViewById <ImageView>(Resource.Id.ivNextPage);

            tvGoToPage        = v.FindViewById <TextView>(Resource.Id.tvGoToPage);
            tvPboPageNumLabel = v.FindViewById <TextView>(Resource.Id.tvPboPageNumLabel);
            tvPboPageNum      = v.FindViewById <TextView>(Resource.Id.tvPboPageNum);

            bflContentContainer = v.FindViewById <BoundedFrameLayout>(Resource.Id.bflContentContainer);
            bflContentContainer.SetBackgroundResource(Resource.Drawable.miscinfo_frame_background);

            flWebViewContainer = v.FindViewById <FrameLayout>(Resource.Id.flWebViewContainer);

            llTopLoadingIndicator    = v.FindViewById <LinearLayout>(Resource.Id.llTopLoadingIndicator);
            tvTopLoadingTocTitle     = v.FindViewById <TextView>(Resource.Id.tvTopLoadingTocTitle);
            llBottomLoadingIndicator = v.FindViewById <LinearLayout>(Resource.Id.llBottomLoadingIndicator);
            tvBottomLoadingTocTitle  = v.FindViewById <TextView>(Resource.Id.tvBottomLoadingTocTitle);

            tvPboPageNumLabel.Text = tvPboPageNumLabel.Text + " ";

            llTopLoadingIndicator.Visibility    = ViewStates.Gone;
            llBottomLoadingIndicator.Visibility = ViewStates.Gone;

            ivPreviousPage.Click += delegate
            {
                var mainFragmentStatus = ((ContentActivity)Activity).GetMainFragment().MainFragmentStatus;
                if (!NavigationManagerHelper.CanBack(mainFragmentStatus))
                {
                    return;
                }

                // ToDo: Use DataCache.INSTATNCE.Toc.GetNavigationItem to find ContentBrowserRecord
                var record = NavigationManager.Instance.CurrentRecord as ContentBrowserRecord;
                if (record != null)
                {
                    record.WebViewScrollPosition = wvContent.ScrollY;
                }

                var fromBookId = NavigationManagerHelper.GetCurrentBookId();
                NavigationManagerHelper.Back(mainFragmentStatus);
                ((ContentActivity)Activity).GetMainFragment().NavigateTo(fromBookId);
            };

            ivNextPage.Click += delegate
            {
                var mainFragmentStatus = ((ContentActivity)Activity).GetMainFragment().MainFragmentStatus;
                if (!NavigationManagerHelper.CanForth(mainFragmentStatus))
                {
                    return;
                }

                var record = NavigationManager.Instance.CurrentRecord as ContentBrowserRecord;
                if (record != null)
                {
                    record.WebViewScrollPosition = wvContent.ScrollY;
                }

                var fromBookId = NavigationManagerHelper.GetCurrentBookId();
                NavigationManagerHelper.Forth(mainFragmentStatus);
                ((ContentActivity)Activity).GetMainFragment().NavigateTo(fromBookId);
            };

            tvGoToPage.Click += delegate
            {
                var goToPageDialogFragment = GoToPageDialogFragment.NewInstance();
                goToPageDialogFragment.Show(FragmentManager.BeginTransaction(), "goToPageDialogFragment");
            };

            //UpdatePboPage();
            //((ContentActivity)Activity).GetMainFragment().SetLeftPanelStatus();

            return(v);
        }