Java Code Examples for android.webkit.WebView#setFocusableInTouchMode()
The following examples show how to use
android.webkit.WebView#setFocusableInTouchMode() .
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: FunctionUtils.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("static-access") public static void handleContentTV(final WebView contentTV, final MessageArticlePageInfo row, int bgColor, int fgColor, Context context) { final WebViewClient client = new WebViewClientEx((FragmentActivity) context); contentTV.setBackgroundColor(0); contentTV.setFocusableInTouchMode(false); contentTV.setFocusable(false); contentTV.setLongClickable(false); WebSettings setting = contentTV.getSettings(); setting.setUserAgentString(context.getString(R.string.clientua) + BuildConfig.VERSION_CODE); setting.setDefaultFontSize(PhoneConfiguration.getInstance() .getWebSize()); setting.setJavaScriptEnabled(false); contentTV.setWebViewClient(client); contentTV.setTag(row.getLou()); contentTV.loadDataWithBaseURL(null, row.getFormated_html_data(), "text/html", "utf-8", null); }
Example 2
Source File: GraphView.java From commcare-android with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.KITKAT) public WebView getView(String html) { if (BuildConfig.DEBUG) { WebView.setWebContentsDebuggingEnabled(true); } WebView webView = new GraphWebView(mContext); WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); webView.setClickable(true); webView.setFocusable(false); webView.setFocusableInTouchMode(false); settings.setBuiltInZoomControls(mIsFullScreen); settings.setSupportZoom(mIsFullScreen); settings.setDisplayZoomControls(mIsFullScreen); // Improve performance settings.setCacheMode(WebSettings.LOAD_NO_CACHE); this.myHTML = html; webView.loadDataWithBaseURL("file:///android_asset/", html, "text/html", "utf-8", null); return webView; }
Example 3
Source File: AboutActivity.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about); String url = DEFAULT_PAGE; Intent it = getIntent(); if ( it != null ){ Bundle extras = it.getExtras(); if ( extras !=null ){ String iturl = extras.getString(EXTRA_URL); if ( iturl !=null ){ url = iturl; } String ittitle = extras.getString(EXTRA_TITLE); if ( ittitle !=null ){ setTitle( ittitle ); } }else{ url = getString(R.string.about_url); setTitle( R.string.about_title ); } } WebView webview = (WebView)findViewById(R.id.WebView01); webview.loadUrl( url ); mjsobj = new JsCallbackObj(); webview.addJavascriptInterface(mjsobj, "jscallback"); webview.getSettings().setJavaScriptEnabled(true); webview.setFocusable(true); webview.setFocusableInTouchMode(true); }
Example 4
Source File: AboutActivity.java From JotaTextEditor with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about); String url = DEFAULT_PAGE; Intent it = getIntent(); if ( it != null ){ Bundle extras = it.getExtras(); if ( extras !=null ){ String iturl = extras.getString(EXTRA_URL); if ( iturl !=null ){ url = iturl; } String ittitle = extras.getString(EXTRA_TITLE); if ( ittitle !=null ){ setTitle( ittitle ); } }else{ url = getString(R.string.about_url); setTitle( R.string.about_title ); } } WebView webview = (WebView)findViewById(R.id.WebView01); webview.loadUrl( url ); mjsobj = new JsCallbackObj(); webview.addJavascriptInterface(mjsobj, "jscallback"); webview.getSettings().setJavaScriptEnabled(true); webview.setFocusable(true); webview.setFocusableInTouchMode(true); }
Example 5
Source File: WebInitCompat.java From Android_Skin_2.0 with Apache License 2.0 | 5 votes |
@Override public void setDefaultAttr(WebView view) { // 去除滚动条白色背景,必须在代码里面添加才有效 view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); view.setScrollbarFadingEnabled(true); view.setDrawingCacheEnabled(true); view.setLongClickable(true); view.setBackgroundResource(android.R.color.transparent); view.setBackgroundColor(Color.TRANSPARENT); view.getBackground().setAlpha(0); view.setFocusable(true); view.setFocusableInTouchMode(true); }
Example 6
Source File: WebDialog.java From kognitivo with Apache License 2.0 | 4 votes |
@SuppressLint("SetJavaScriptEnabled") private void setUpWebView(int margin) { LinearLayout webViewContainer = new LinearLayout(getContext()); webView = new WebView(getContext().getApplicationContext()) { /* Prevent NPE on Motorola 2.2 devices * See https://groups.google.com/forum/?fromgroups=#!topic/android-developers/ktbwY2gtLKQ */ @Override public void onWindowFocusChanged(boolean hasWindowFocus) { try { super.onWindowFocusChanged(hasWindowFocus); } catch (NullPointerException e) { } } }; webView.setVerticalScrollBarEnabled(false); webView.setHorizontalScrollBarEnabled(false); webView.setWebViewClient(new DialogWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(url); webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); webView.setVisibility(View.INVISIBLE); webView.getSettings().setSavePassword(false); webView.getSettings().setSaveFormData(false); webView.setFocusable(true); webView.setFocusableInTouchMode(true); webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (!v.hasFocus()) { v.requestFocus(); } return false; } }); webViewContainer.setPadding(margin, margin, margin, margin); webViewContainer.addView(webView); webViewContainer.setBackgroundColor(BACKGROUND_GRAY); contentFrameLayout.addView(webViewContainer); }
Example 7
Source File: LightningView.java From Xndroid with GNU General Public License v3.0 | 4 votes |
public LightningView(@NonNull Activity activity, @Nullable String url, boolean isIncognito) { BrowserApp.getAppComponent().inject(this); mActivity = activity; mUIController = (UIController) activity; mWebView = new WebView(activity); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { mWebView.setId(View.generateViewId()); } mIsIncognitoTab = isIncognito; mTitle = new LightningViewTitle(activity); sMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity(); mWebView.setDrawingCacheBackgroundColor(Color.WHITE); mWebView.setFocusableInTouchMode(true); mWebView.setFocusable(true); mWebView.setDrawingCacheEnabled(false); mWebView.setWillNotCacheDrawing(true); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { //noinspection deprecation mWebView.setAnimationCacheEnabled(false); //noinspection deprecation mWebView.setAlwaysDrawnWithCacheEnabled(false); } mWebView.setBackgroundColor(Color.WHITE); mWebView.setScrollbarFadingEnabled(true); mWebView.setSaveEnabled(true); mWebView.setNetworkAvailable(true); mWebView.setWebChromeClient(new LightningChromeClient(activity, this)); mWebView.setWebViewClient(new LightningWebClient(activity, this)); mWebView.setDownloadListener(new LightningDownloadListener(activity)); mGestureDetector = new GestureDetector(activity, new CustomGestureListener()); mWebView.setOnTouchListener(new TouchListener()); sDefaultUserAgent = mWebView.getSettings().getUserAgentString(); initializeSettings(); initializePreferences(activity); if (url != null) { if (!url.trim().isEmpty()) { mWebView.loadUrl(url, mRequestHeaders); } else { // don't load anything, the user is looking for a blank tab } } else { loadHomepage(); } }
Example 8
Source File: LightningView.java From JumpGo with Mozilla Public License 2.0 | 4 votes |
public LightningView(@NonNull Activity activity, @Nullable String url, boolean isIncognito) { BrowserApp.getAppComponent().inject(this); mActivity = activity; mUIController = (UIController) activity; mWebView = new WebView(activity); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { mWebView.setId(View.generateViewId()); } mIsIncognitoTab = isIncognito; mTitle = new LightningViewTitle(activity); sMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity(); mWebView.setDrawingCacheBackgroundColor(Color.WHITE); mWebView.setFocusableInTouchMode(true); mWebView.setFocusable(true); mWebView.setDrawingCacheEnabled(false); mWebView.setWillNotCacheDrawing(true); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { //noinspection deprecation mWebView.setAnimationCacheEnabled(false); //noinspection deprecation mWebView.setAlwaysDrawnWithCacheEnabled(false); } mWebView.setBackgroundColor(Color.WHITE); mWebView.setScrollbarFadingEnabled(true); mWebView.setSaveEnabled(true); mWebView.setNetworkAvailable(true); mWebView.setWebChromeClient(new LightningChromeClient(activity, this)); mLightningWebClient = new LightningWebClient(activity, this); mWebView.setWebViewClient(mLightningWebClient); mWebView.setDownloadListener(new LightningDownloadListener(activity)); mGestureDetector = new GestureDetector(activity, new CustomGestureListener()); mWebView.setOnTouchListener(new TouchListener()); sDefaultUserAgent = mWebView.getSettings().getUserAgentString(); initializeSettings(); initializePreferences(activity); if (url != null) { if (!url.trim().isEmpty()) { mWebView.loadUrl(url, mRequestHeaders); } else { // don't load anything, the user is looking for a blank tab } } else { loadHomepage(); } }