Java Code Examples for android.webkit.WebSettings#TextSize
The following examples show how to use
android.webkit.WebSettings#TextSize .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingCache.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
public static void putFontSize(Context context, WebSettings.TextSize size) { int sizeInt = 2; if (size == WebSettings.TextSize.LARGER) { sizeInt = 3; } else if (size == WebSettings.TextSize.LARGEST) { sizeInt = 4; } else if (size == WebSettings.TextSize.NORMAL) { sizeInt = 2; } else if (size == WebSettings.TextSize.SMALLER) { sizeInt = 1; } new SpTool(context, SpTool.SP_SETTING).putInt("font_size", sizeInt); }
Example 2
Source File: SettingCache.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
public static WebSettings.TextSize getFontSize(Context context) { int size = new SpTool(context, SpTool.SP_SETTING).getInt("font_size", 2); if (size == 3) { return WebSettings.TextSize.LARGER; } else if (size == 4) { return WebSettings.TextSize.LARGEST; } else if (size == 2) { return WebSettings.TextSize.NORMAL; } else if (size == 1) { return WebSettings.TextSize.SMALLER; } return WebSettings.TextSize.NORMAL; }
Example 3
Source File: DialogFontSizeChoice.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
private void init(Context context, WebSettings.TextSize currentTextSize) { View view = LayoutInflater.from(context).inflate( R.layout.z_dialog_font_choice, null); dialog = new Dialog(context, R.style.Dialog_General); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(view); Window window = dialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); lp.gravity = Gravity.BOTTOM; lp.width = LayoutParams.MATCH_PARENT; window.setWindowAnimations(R.style.AnimUpDown); view.findViewById(R.id.btn_finish).setOnClickListener(this); mTv_normal = view.findViewById(R.id.tv_normal); mTv_normal.setOnClickListener(this); mTv_small = view.findViewById(R.id.tv_small); mTv_small.setOnClickListener(this); mTv_large = view.findViewById(R.id.tv_big); mTv_large.setOnClickListener(this); mTv_largest = view.findViewById(R.id.tv_max); mTv_largest.setOnClickListener(this); if (currentTextSize == WebSettings.TextSize.SMALLER) { mTv_small.setSelected(true); } else if (currentTextSize == WebSettings.TextSize.NORMAL) { mTv_normal.setSelected(true); } else if (currentTextSize == WebSettings.TextSize.LARGER) { mTv_large.setSelected(true); } else if (currentTextSize == WebSettings.TextSize.LARGEST) { mTv_largest.setSelected(true); } }
Example 4
Source File: FragmentDetailsCommon.java From BigApp_WordPress_Android with Apache License 2.0 | 4 votes |
@Override public void onViewClick(View v) { int vId = v.getId(); switch (vId) { case R.id.iv_right: if (dialogFontSizeChoice == null) { dialogFontSizeChoice = new DialogFontSizeChoice(mContext, mWebContent.getSettings().getTextSize(), new DialogFontSizeChoice.OnFontChangedLisener() { @Override public void onFontChanged(WebSettings.TextSize size) { mWebContent.getSettings().setTextSize(size); } }); } dialogFontSizeChoice.show(); break; case R.id.tv_edit: if (mTopicNew == null) { return; } if (mTopicNew.comment_type == 0) { ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_not_allow_commit); return; } if (BaseApplication.getUserId() == null) { if (mTopicNew.comment_type == 1 || mTopicNew.comment_type == 2) { ActivityUser.gotoFragmentCommitAnony(mContext, mTopicNew.ID, mTopicNew.comment_type); return; } ActivityLogin.gotoFragmentLogin(getActivity()); // ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_not_allow_anony_commit); return; } if (mTopicNew.comment_type == 3) { if (BaseApplication.getUserId().equals("-1")) { //TODO 考虑第三方登录的情况 ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_not_allow_3rd_party); return; } } showDialogReply(v); break; case R.id.iv_msg: if (mTopicNew == null) { return; } mScrollView.scrollTo(mLl_comment.getLeft(), mLl_comment.getTop()); break; case R.id.iv_collect: if (mTopicNew == null) { return; } if (BaseApplication.getUserId() == null) { //TODO 匿名收藏 if (v.isSelected()) { if (new DbTableAnonyCollect(mContext.getContentResolver()).delete(mTopicNew.ID)) { getActivity().setResult(Activity.RESULT_OK); ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_cancel_success); mIv_collect.setSelected(false); return; } ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_cancel_fail); } else { if (new DbTableAnonyCollect(mContext.getContentResolver()).saveOrReplace(mTopicNew)) { getActivity().setResult(Activity.RESULT_OK); ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_collect_add_success); mIv_collect.setSelected(true); return; } ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_collect_add_fail); } return; } if (v.isSelected()) { sendDelCollectRequest(); } else { sendAddCollectRequest(); } break; case R.id.iv_share: showShareDialog(); break; case R.id.tv_end: loadCommits(mCurrentPage + 1, false); break; case R.id.tv_show_orgin: //TODO if (mTopicNew != null) { ActivityDetails.gotoFragmentDetailsTopic(mContext, mTopicNew); } break; } }
Example 5
Source File: FragmentSetting.java From BigApp_WordPress_Android with Apache License 2.0 | 4 votes |
@Override public void onViewClick(View v) { int vId = v.getId(); switch (vId) { case R.id.item_clear_cache: if (mDialogSearching == null) { mDialogSearching = new DialogSearching(mContext); } mDialogSearching.setContent(R.string.v_toast_clean_cache_ing); mDialogSearching.show(); TaskExecutor.execute(new Runnable() { @Override public void run() { DataManager.clearMyCache(mContext.getApplicationContext()); mHandler.sendEmptyMessage(0); } }); break; case R.id.item_offline_download: if (!CommonUtils.checkNetworkEnable(mContext.getApplicationContext())) { return; } if (mContext != null) { mContext.startService(new Intent(mContext, ServiceOfflineDownload.class)); } break; case R.id.item_about: ActivityUserMore.gotoFragmentAbout(getActivity()); break; case R.id.item_font_size: if (mDialogFontSizeChoice == null) { mDialogFontSizeChoice = new DialogFontSizeChoice(mContext, SettingCache.getFontSize(mContext), new DialogFontSizeChoice.OnFontChangedLisener() { @Override public void onFontChanged(WebSettings.TextSize size) { SettingCache.putFontSize(mContext, size); EventBus.getDefault().post(new WebTxtChangedEvent(size)); } }); } mDialogFontSizeChoice.show(); break; case R.id.item_img_mode: if (mDialogImgMode == null) { mDialogImgMode = new DialogImgMode(mContext, new DialogImgMode.OnModeChangedLisener() { @Override public void onModeChanged(int mode) { SettingCache.putImgMode(mContext, mode); setImgMode(mode); } }); } mDialogImgMode.show(mImgMode); break; } }
Example 6
Source File: DialogFontSizeChoice.java From BigApp_WordPress_Android with Apache License 2.0 | 4 votes |
public DialogFontSizeChoice(Context context, WebSettings.TextSize currentTextSize, OnFontChangedLisener lisener) { mLisener = lisener; init(context, currentTextSize); }
Example 7
Source File: WebTxtChangedEvent.java From BigApp_WordPress_Android with Apache License 2.0 | 4 votes |
public WebTxtChangedEvent(WebSettings.TextSize textSize) { this.textSize = textSize; }
Example 8
Source File: DialogFontSizeChoice.java From BigApp_WordPress_Android with Apache License 2.0 | votes |
void onFontChanged(WebSettings.TextSize size);