Пример #1
0
        private void changedMode(bool isNight, int position)
        {
            SharedPreferencesUtil.getInstance().putBoolean(Constant.ISNIGHT, isNight);
            AppCompatDelegate.DefaultNightMode = (isNight ? AppCompatDelegate.ModeNightYes
                    : AppCompatDelegate.ModeNightNo);

            if (position >= 0)
            {
                curTheme = position;
            }
            else
            {
                curTheme = Settings.ReadTheme;
            }
            gvAdapter.select(curTheme);

            mPageWidget.setTheme(isNight ? ThemeManager.NIGHT : curTheme);
            mPageWidget.setTextColor(ContextCompat.GetColor(mContext, isNight ? Resource.Color.chapter_content_night : Resource.Color.chapter_content_day),
                                     ContextCompat.GetColor(mContext, isNight ? Resource.Color.chapter_title_night : Resource.Color.chapter_title_day));

            mTvBookReadMode.Text = (GetString(isNight ? Resource.String.book_read_mode_day_manual_setting
                    : Resource.String.book_read_mode_night_manual_setting));
            Drawable drawable = ContextCompat.GetDrawable(this, isNight ? Resource.Drawable.ic_menu_mode_day_manual
                    : Resource.Drawable.ic_menu_mode_night_manual);

            drawable.SetBounds(0, 0, drawable.MinimumWidth, drawable.MinimumHeight);
            mTvBookReadMode.SetCompoundDrawables(null, drawable, null, null);

            ThemeManager.setReaderTheme(curTheme, mRlBookReadRoot);
        }
Пример #2
0
        private CustomDialog dialog;//进度条

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(getLayoutId());
            if (statusBarColor == 0)
            {
                statusBarView = StatusBarCompat.compat(this, ContextCompat.GetColor(this, Resource.Color.colorPrimaryDark));
            }
            else if (statusBarColor != -1)
            {
                statusBarView = StatusBarCompat.compat(this, statusBarColor);
            }
            transparent19and20();
            mContext = this;
            bindViews();
            mCommonToolbar = FindViewById <Toolbar>(Resource.Id.common_toolbar);
            if (mCommonToolbar != null)
            {
                initToolBar();
                SetSupportActionBar(mCommonToolbar);
            }
            initDatas();
            configViews();
            mNowMode = SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT);
        }
Пример #3
0
        /***************Bottom Bar*****************/

        public void onClickChangeMode(object sender, EventArgs e)
        { // 日/夜间模式切换
            gone(rlReadAaSet, rlReadMark);

            bool isNight = !SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT, false);

            changedMode(isNight, -1);
        }
        protected void initNightMode()
        {
            bool isNight = SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT, false);

            LogUtils.d("isNight=" + isNight);
            if (isNight)
            {
                AppCompatDelegate.DefaultNightMode = (AppCompatDelegate.ModeNightYes);
            }
            else
            {
                AppCompatDelegate.DefaultNightMode = (AppCompatDelegate.ModeNightNo);
            }
        }
Пример #5
0
 public override void initDatas()
 {
     Task.Factory.StartNew(() =>
     {
         String cachesize = CacheManager.GetCacheSize();
         RunOnUiThread(() =>
         {
             mTvCacheSize.Text = (cachesize);
         });
     });
     mTvSort.Text = (Resources.GetStringArray(Resource.Array.setting_dialog_sort_choice)[
                         SharedPreferencesUtil.getInstance().getBoolean(Constant.ISBYUPDATESORT, true) ? 0 : 1]);
     mTvFlipStyle.Text = (Resources.GetStringArray(Resource.Array.setting_dialog_style_choice)[
                              SharedPreferencesUtil.getInstance().getInt(Constant.FLIP_STYLE, 0)]);
 }
Пример #6
0
 protected override void OnResume()
 {
     base.OnResume();
     if (SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT, false) != mNowMode)
     {
         if (SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT, false))
         {
             AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightYes;
         }
         else
         {
             AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
         }
         Recreate();
     }
 }
Пример #7
0
 public void onClickFlipStyle()
 {
     new AlertDialog.Builder(mContext)
     .SetTitle("阅读页翻页效果")
     .SetSingleChoiceItems(Resources.GetStringArray(Resource.Array.setting_dialog_style_choice),
                           SharedPreferencesUtil.getInstance().getInt(Constant.FLIP_STYLE, 0),
                           (sender, e) =>
     {
         var which         = e.Which;
         var dialog        = sender as AlertDialog;
         mTvFlipStyle.Text = (Resources.GetStringArray(Resource.Array.setting_dialog_style_choice)[which]);
         SharedPreferencesUtil.getInstance().putInt(Constant.FLIP_STYLE, which);
         dialog.Dismiss();
     })
     .Create().Show();
 }
Пример #8
0
 public void onClickBookShelfSort()
 {
     new AlertDialog.Builder(mContext)
     .SetTitle("书架排序方式")
     .SetSingleChoiceItems(Resources.GetStringArray(Resource.Array.setting_dialog_sort_choice),
                           SharedPreferencesUtil.getInstance().getBoolean(Constant.ISBYUPDATESORT, true) ? 0 : 1,
                           (sender, e) =>
     {
         var which    = e.Which;
         var dialog   = sender as AlertDialog;
         mTvSort.Text = (Resources.GetStringArray(Resource.Array.setting_dialog_sort_choice)[which]);
         SharedPreferencesUtil.getInstance().putBoolean(Constant.ISBYUPDATESORT, which == 0);
         EventManager.refreshCollectionList();
         dialog?.Dismiss();
     })
     .Create().Show();
 }
Пример #9
0
 private void initPagerWidget()
 {
     if (SharedPreferencesUtil.getInstance().getInt(Constant.FLIP_STYLE, 0) == 0)
     {
         mPageWidget = new PageWidget(this, bookId, mChapterList, new ReadListener(this));
     }
     else
     {
         mPageWidget = new OverlappedWidget(this, bookId, mChapterList, new ReadListener(this));
     }
     RegisterReceiver(receiver, intentFilter);
     if (SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT, false))
     {
         mPageWidget.setTextColor(ContextCompat.GetColor(this, Resource.Color.chapter_content_night),
                                  ContextCompat.GetColor(this, Resource.Color.chapter_title_night));
     }
     flReadWidget.RemoveAllViews();
     flReadWidget.AddView(mPageWidget);
 }
        /**
         * 按排序方式获取收藏列表
         *
         * @return
         */
        public List <Recommend.RecommendBooks> getCollectionListBySort()
        {
            List <Recommend.RecommendBooks> list = getCollectionList();

            if (list == null)
            {
                return(null);
            }
            else
            {
                if (SharedPreferencesUtil.getInstance().getBoolean(Constant.ISBYUPDATESORT, true))
                {
                    list.Sort(new LatelyUpdateTimeComparator());
                }
                else
                {
                    list.Sort(new RecentReadingTimeComparator());
                }
                return(list);
            }
        }
Пример #11
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            switch (id)
            {
            case Resource.Id.action_search:
                StartActivity(new Intent(this, typeof(SearchActivity)));
                break;

            case Resource.Id.action_login:
                if (popupWindow == null)
                {
                    popupWindow = new LoginPopupWindow(this);
                    popupWindow.setLoginTypeListener(this);
                }
                popupWindow.ShowAtLocation(mCommonToolbar, GravityFlags.Center, 0, 0);
                break;

            case Resource.Id.action_my_message:
                if (popupWindow == null)
                {
                    popupWindow = new LoginPopupWindow(this);
                    popupWindow.setLoginTypeListener(this);
                }
                popupWindow.ShowAtLocation(mCommonToolbar, GravityFlags.Center, 0, 0);
                break;

            case Resource.Id.action_sync_bookshelf:
                showDialog();
                syncBookShelf();

                /* if (popupWindow == null) {
                 *   popupWindow = new LoginPopupWindow(this);
                 *   popupWindow.setLoginTypeListener(this);
                 * }
                 * popupWindow.showAtLocation(mCommonToolbar, GravityFlags.Center, 0, 0);*/
                break;

            case Resource.Id.action_scan_local_book:
                ScanLocalBookActivity.startActivity(this);
                break;

            case Resource.Id.action_wifi_book:
                // TODO:WifiBookActivity.startActivity(this);
                ToastUtils.showSingleToast("等待开发中");
                break;

            case Resource.Id.action_feedback:
                FeedbackActivity.startActivity(this);
                break;

            case Resource.Id.action_night_mode:
                if (SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT, false))
                {
                    SharedPreferencesUtil.getInstance().putBoolean(Constant.ISNIGHT, false);
                    AppCompatDelegate.DefaultNightMode = (AppCompatDelegate.ModeNightNo);
                }
                else
                {
                    SharedPreferencesUtil.getInstance().putBoolean(Constant.ISNIGHT, true);
                    AppCompatDelegate.DefaultNightMode = (AppCompatDelegate.ModeNightYes);
                }
                Recreate();
                break;

            case Resource.Id.action_settings:
                SettingActivity.startActivity(this);
                break;

            default:
                break;
            }
            return(base.OnOptionsItemSelected(item));
        }