@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { loadConfig(); // // ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false); /* TODO: it's can be only in activity before adding content and we may need it in Cordova Dapps if(!preferences.getBoolean("ShowTitle", false)) { try { getActivity().getWindow().requestFeature(Window.FEATURE_NO_TITLE); } catch (Exception e) { System.out.print(e); } } if(preferences.getBoolean("SetFullscreen", false)) { preferences.set("Fullscreen", true); } if(preferences.getBoolean("Fullscreen", false)) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { immersiveMode = true; } else { getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } } else { getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } */ // view = inflater.inflate(R.layout.fragment_web_view, container, false); cordovaInterface = makeCordovaInterface(); if (savedInstanceState != null) { cordovaInterface.restoreInstanceState(savedInstanceState); } init(); loadUrl(); // return view; return webView.getView(); }
protected void init() { webView = makeWebView(); createViews(); if (!webView.isInitialized()) { webView.init(cordovaInterface, pluginEntries, preferences); } webView.getView().requestFocusFromTouch(); cordovaInterface.onCordovaInit(webView.getPluginManager()); // webView.clearCache(); android.webkit.CookieManager.getInstance().removeAllCookie(); // Wire the hardware volume controls to control media if desired. String volumePref = preferences.getString("DefaultVolumeStream", ""); if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) { getActivity().setVolumeControlStream(AudioManager.STREAM_MUSIC); } BaseActivity activity = (BaseActivity) getActivity(); activity.hideToolbar(2); gestureDetector = new GestureDetector(webView.getContext(), this); webView.getView().setOnTouchListener(this); }
@Override public void onSaveInstanceState(Bundle outState) { cordovaInterface.onSaveInstanceState(outState); super.onSaveInstanceState(outState); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); cordovaInterface.onActivityResult(requestCode, resultCode, intent); }
@Override public void startActivityForResult(Intent intent, int requestCode) { cordovaInterface.setActivityResultRequestCode(requestCode); super.startActivityForResult(intent, requestCode); }