List of usage examples for android.webkit WebView setOverScrollMode
@Override public void setOverScrollMode(int mode)
From source file:org.jorge.cmp.ui.fragment.ArticleReaderFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { setHasOptionsMenu(Boolean.TRUE); final View ret = inflater.inflate(R.layout.fragment_article_reader, container, Boolean.FALSE); View mHeaderView = ret.findViewById(R.id.image); PicassoUtils.loadInto(mContext, mArticle.getImageUrl(), mDefaultImageId, (android.widget.ImageView) mHeaderView, TAG); final String title = mArticle.getTitle(); mHeaderView.setContentDescription(title); ((TextView) ret.findViewById(R.id.title)).setText(title); WebView contentView = (WebView) ret.findViewById(android.R.id.text1); WebSettings webViewSettings = contentView.getSettings(); contentView.setOverScrollMode(View.OVER_SCROLL_NEVER); webViewSettings.setJavaScriptCanOpenWindowsAutomatically(Boolean.TRUE); webViewSettings.setBuiltInZoomControls(Boolean.FALSE); contentView.setBackgroundColor(0x00000000); //I wonder why the default background is white contentView.loadData(mArticle.getPreviewText(), "text/html; charset=UTF-8", "UTF-8"); mActionBar = mActivity.getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(Boolean.TRUE); mActionBarBackgroundDrawable = new ColorDrawable( mContext.getResources().getColor(R.color.toolbar_background)); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { mActionBarBackgroundDrawable.setCallback(mDrawableCallback); }// w w w. j a v a 2 s .co m mActionBar.setBackgroundDrawable(mActionBarBackgroundDrawable); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mOriginalElevation = mActionBar.getElevation(); mActionBar.setElevation(0); //So that the shadow of the ActionBar doesn't show over // the article title } mActionBar.setTitle(mActivity.getString(R.string.section_title_article_reader)); StickyParallaxNotifyingScrollView scrollView = (StickyParallaxNotifyingScrollView) ret .findViewById(R.id.scroll_view); scrollView.setOnScrollChangedListener(mOnScrollChangedListener); scrollView.smoothScrollTo(0, 0); if (!mArticle.isRead()) { mMarkAsReadFab = (FloatingActionButton) ret.findViewById(R.id.fab_button_mark_as_read); mMarkAsReadFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { markArticleAsRead(mArticle); if (mMarkAsReadFab.isShown()) mMarkAsReadFab.hide(); } private void markArticleAsRead(FeedArticle article) { final Realm r = Realm.getInstanceByRealmId(ArticleReaderFragment.this.mAccount.getRealmEnum()); String l = PreferenceAssistant.readSharedString(mContext, PreferenceAssistant.PREF_LANG, null); if (l == null || !Arrays.asList(r.getLocales()).contains(l)) { l = r.getLocales()[0]; PreferenceAssistant.writeSharedString(mContext, PreferenceAssistant.PREF_LANG, l); } final Class newsClass = NewsListFragment.class; final Class communityClass = CommunityListFragment.class; final Class schoolClass = SchoolListFragment.class; String tableName; if (mClass == newsClass) { if (l == null || !Arrays.asList(r.getLocales()).contains(l)) { l = r.getLocales()[0]; PreferenceAssistant.writeSharedString(mContext, PreferenceAssistant.PREF_LANG, l); } tableName = SQLiteDAO.getNewsTableName(r, l); } else if (mClass == communityClass) { tableName = SQLiteDAO.getCommunityTableName(); } else if (mClass == schoolClass) { tableName = SQLiteDAO.getSchoolTableName(); } else { throw new IllegalArgumentException( "Feed list fragment class " + mClass.getCanonicalName() + " not recognized."); } new AsyncTask<Object, Void, Void>() { @Override protected Void doInBackground(Object... params) { SQLiteDAO.getInstance().markArticleAsRead((FeedArticle) params[0], (String) params[1]); return null; } }.executeOnExecutor(Executors.newSingleThreadExecutor(), article, tableName); article.markAsRead(); } }); mMarkAsReadFab.hide(); mMarkAsReadFab.setVisibility(View.VISIBLE); showMarkAsReadFabIfItProceeds(); } return ret; }