List of usage examples for android.view ViewGroup bringToFront
public void bringToFront()
From source file:org.apache.cordova.engine.crosswalk.XWalkCordovaWebView.java
@Override public void showCustomView(View view, CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden();/* w ww. j a v a 2 s. c o m*/ return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) webview.getParent(); parent.addView(view, COVER_SCREEN_GRAVITY_CENTER); // Hide the content view. webview.setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
From source file:com.example.administrator.mywebviewdrawsign.SysWebView.java
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 LogUtils.d("showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden();/*from w ww . j a v a2s. c o m*/ return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) this.getParent(); background = parent.getBackground(); parent.setBackground(new ColorDrawable(Color.BLACK)); parent.addView(view, COVER_SCREEN_GRAVITY_CENTER); // Hide the content view. this.setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); if (objects != null && objects.length > 0) { for (Object obj : objects) { if (obj instanceof View) { ((View) obj).setVisibility(View.GONE); } else if (obj instanceof Fragment) { ((Fragment) obj).getView().setVisibility(View.GONE); } } } ((Activity) mContext).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); ((Activity) mContext).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); }
From source file:org.apache.cordova.CordovaWebViewImpl.java
@Override @Deprecated//w w w.j av a 2 s.co m public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); // Hide the content view. engine.getView().setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
From source file:org.apache.cordova.X5CordovaWebViewImpl.java
@Override @Deprecated/*w ww. java2s . c o m*/ public void showCustomView(View view, CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 LOG.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); // Hide the content view. engine.getView().setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
From source file:org.crosswalk.engine.XWalkCordovaWebViewImpl.java
@Override @Deprecated/*from w w w.j a v a2 s . c om*/ public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 LOG.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); // Hide the content view. engine.getView().setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
From source file:com.jomendezdev.cordova.admob.AdMobAds.java
/** * Parses the show ad input parameters and runs the show ad action on the UI thread. * // w w w. ja v a 2s.com * @param inputs The JSONArray representing input parameters. This function expects the first object in the array to be a JSONObject with the input * parameters. * @return A PluginResult representing whether or not an ad was requested succcessfully. Listen for onReceiveAd() and onFailedToReceiveAd() callbacks to see * if an ad was successfully retrieved. */ private PluginResult executeShowBannerAd(final boolean show, final CallbackContext callbackContext) { if (adView == null) { return new PluginResult(Status.ERROR, "adView is null, call createBannerView first."); } cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (show == isBannerVisible) { // no change } else if (show) { if (adView.getParent() != null) { ((ViewGroup) adView.getParent()).removeView(adView); } if (isBannerOverlap) { RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); if (isOffsetStatusBar) { int titleBarHeight = 0; Rect rectangle = new Rect(); Window window = AdMobAds.this.cordova.getActivity().getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(rectangle); if (isBannerAtTop) { if (rectangle.top == 0) { int contentViewTop = window.findViewById(Window.ID_ANDROID_CONTENT).getTop(); titleBarHeight = contentViewTop - rectangle.top; } params2.topMargin = titleBarHeight; } else { if (rectangle.top > 0) { int contentViewBottom = window.findViewById(Window.ID_ANDROID_CONTENT) .getBottom(); titleBarHeight = contentViewBottom - rectangle.bottom; } params2.bottomMargin = titleBarHeight; } } else if (isBannerAtTop) { params2.addRule(RelativeLayout.ALIGN_PARENT_TOP); } else { params2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } adViewLayout.addView(adView, params2); adViewLayout.bringToFront(); } else { ViewGroup parentView = (ViewGroup) webView.getParent(); if (isBannerAtTop) { parentView.addView(adView, 0); } else { parentView.addView(adView); } parentView.bringToFront(); } adView.setVisibility(View.VISIBLE); isBannerVisible = true; } else { adView.setVisibility(View.GONE); isBannerVisible = false; } if (callbackContext != null) { callbackContext.success(); } } }); return null; }
From source file:org.apache.cordova.AndroidWebView.java
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden();//from w ww. j a va2s . co m return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) this.getParent(); parent.addView(view, COVER_SCREEN_GRAVITY_CENTER); // Hide the content view. this.setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }