List of usage examples for org.apache.cordova Config init
public static void init(Activity action)
From source file:com.AlcaldiaSucre.App.CordovaActivity.java
License:Apache License
/** * Called when the activity is first created. * * @param savedInstanceState// www .ja v a2 s . c o m */ @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { checkIntents(); Config.init(this); LOG.d(TAG, "CordovaActivity.onCreate()"); super.onCreate(savedInstanceState); if (savedInstanceState != null) { initCallbackClass = savedInstanceState.getString("callbackClass"); } if (!this.getBooleanProperty("ShowTitle", false)) { getWindow().requestFeature(Window.FEATURE_NO_TITLE); } if (this.getBooleanProperty("SetFullscreen", false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } // This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket! Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); root = new LinearLayoutSoftKeyboardDetect(this, width, height); root.setOrientation(LinearLayout.VERTICAL); root.setBackgroundColor(this.backgroundColor); root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0F)); // Setup the hardware volume controls to handle volume control setVolumeControlStream(AudioManager.STREAM_MUSIC); }
From source file:com.AlcaldiaSucre.App.CordovaActivity.java
License:Apache License
@Override /**/* ww w . j a v a 2s . co m*/ * Called when the activity will start interacting with the user. */ protected void onResume() { super.onResume(); //Reload the configuration Config.init(this); LOG.d(TAG, "Resuming the App"); //Code to test CB-3064 String errorUrl = this.getStringProperty("ErrorUrl", null); LOG.d(TAG, "CB-3064: The errorUrl is " + errorUrl); if (this.activityState == ACTIVITY_STARTING) { this.activityState = ACTIVITY_RUNNING; return; } if (this.appView == null) { return; } this.appView.handleResume(this.keepRunning, this.activityResultKeepRunning); // If app doesn't want to run in background if (!this.keepRunning || this.activityResultKeepRunning) { // Restore multitasking state if (this.activityResultKeepRunning) { this.keepRunning = this.activityResultKeepRunning; this.activityResultKeepRunning = false; } } }
From source file:com.arjinmc.phonegapdemo.TestDemo.java
License:Apache License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //this is the default sample to load the config url from local //super.loadUrl(Config.getStartUrl()); //now we use customer layout to get the request statues setContentView(R.layout.main);//from w w w.j av a 2 s. c om webView = (CordovaWebView) findViewById(R.id.tutorialView); //init cordovaInterface CordovaInterface cordovaInterface = (CordovaInterface) this; CordovaWebViewClient cordovaWebViewClient = new CordovaWebViewClient(cordovaInterface, webView) { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { //we use CordovaWebView postMessage() to CordovaInterface //like handle to get what CordovaWebView has sent //post format like message_id,content webView.postMessage("onPageStarted ", url); super.onPageStarted(view, url, favicon); } @Override public void onPageFinished(WebView view, String url) { webView.postMessage("onPageFinished ", url); super.onPageFinished(view, url); } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { webView.postMessage("onReceivedError ", failingUrl); super.onReceivedError(view, errorCode, description, failingUrl); } }; //remember to init config if you don't use the default Config.getStartUrl() //or the url cannot be loaded Config.init(this); webView.loadUrl("http://arjinmc.com"); }
From source file:com.catchoom.craftar.CraftARActivityAR.java
License:Apache License
@Override public void onPostCreate() { // Initialize the UI FakeR fakeR = new FakeR(this); int layoutId = fakeR.getId("layout", "craftar_camera"); View layout = (View) getLayoutInflater().inflate(layoutId, null); int previewId = fakeR.getId("id", "craftar_preview"); CraftARCameraView cameraView = (CraftARCameraView) layout.findViewById(previewId); super.setCameraView(cameraView); if (!TextUtils.isEmpty(hint)) { int hintId = fakeR.getId("id", "craftar_hint"); TextView hintView = (TextView) layout.findViewById(hintId); hintView.setText(hint);// www . jav a2 s . c o m hintView.setVisibility(View.VISIBLE); } int cwvId = fakeR.getId("id", "OverlayView"); cwv = new CordovaWebView(this); CordovaWebViewClient cwvc; if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { cwvc = new CordovaWebViewClient(this, cwv); } else { cwvc = new IceCreamCordovaWebViewClient(this, cwv); } cwv.setWebViewClient(cwvc); cwv.setWebChromeClient(new CordovaChromeClient(this, cwv)); FrameLayout wvLayout = (FrameLayout) layout.findViewById(cwvId); wvLayout.addView(cwv); Config.init(this); cwv.loadUrl("file:///android_asset/www/ar_overlay.html"); cwv.setBackgroundColor(Color.TRANSPARENT); setContentView(layout); // Initialize the Cloud Image Recognition service cloudRecognition = CraftARSDK.getCloudRecognition(); cloudRecognition.setResponseHandler(this); cloudRecognition.setCollectionToken(token); if (!TextUtils.isEmpty(connectUrl)) { cloudRecognition.setConnectUrl(connectUrl); } if (!TextUtils.isEmpty(searchUrl)) { cloudRecognition.setSearchUrl(searchUrl); } // Obtain camera mcamera = CraftARSDK.getCamera(); mcamera.setImageHandler(this); // Obtain the Tracking module tracking = CraftARSDK.getTracking(); // Start finder mode cloudRecognition.startFinding(); }
From source file:com.google.cordova.WeatherApp.WeatherApp.java
License:Apache License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Config.init(this); // Set by <content src="index.html" /> in config.xml super.loadUrl(Config.getStartUrl()); //super.loadUrl("file:///android_asset/www/index.html") }
From source file:com.moodstocks.phonegap.plugin.CordovaFragment.java
License:Open Source License
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutInflater localInflater = inflater.cloneInContext(new CordovaContext(getActivity(), this)); View rootView = localInflater.inflate(R.layout.fragment_cordova, container, false); myWebView = (CordovaWebView) rootView.findViewById(R.id.myWebView); myWebView.setBackgroundColor(Color.argb(1, 0, 0, 0)); // fixes a bug in android 3.0 - 4.0.3 that causes an issue with transparent webviews. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB && android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { myWebView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); }//from w ww . j av a2 s . co m Config.init(getActivity()); myWebView.loadUrl(Config.getStartUrl()); return rootView; }
From source file:com.phonegap.noobaa.NoobaaMain.java
License:Apache License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = getApplicationContext();/*from w ww. ja va 2 s .c o m*/ am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); // BroadcastNotification bn = new BroadcastNotification(); // bn.onReceive(context, new Intent(this, BroadcastNotification.class)); setContentView(R.layout.main); cwv = (CordovaWebView) findViewById(R.id.tutorialView); Config.init(this); cwv.loadUrl(Config.getStartUrl()); }
From source file:idv.funnybrain.redmind.MainActivity.java
License:Apache License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set by <content src="index.html" /> in config.xml // loadUrl(launchUrl); setContentView(R.layout.main);//from w w w. j ava 2 s. c o m CordovaWebView cwv = (CordovaWebView) findViewById(R.id.webView); Config.init(this); cwv.loadUrl("http://zhenhai.no-ip.org"); }
From source file:io.syng.fragment.WebViewFragment.java
License:Mozilla Public License
@SuppressWarnings("deprecation") protected void loadConfig() { ConfigXmlParser parser = new ConfigXmlParser(); parser.parse(getActivity());// w ww . j a va 2 s . co m preferences = parser.getPreferences(); preferences.setPreferencesBundle(getActivity().getIntent().getExtras()); //preferences.set("webview", "io.syng.cordova.plugin.WebViewEngine"); pluginEntries = parser.getPluginEntries(); Config.init(getActivity()); }
From source file:org.rti.olutindo_app.Olutindo.java
License:Apache License
@Override public void onCreate(Bundle savedInstanceState) { Config.init(this); // Show the title bar, or else the ActionBar will be null on Android 4.x //setBooleanProperty("showTitle", true); super.onCreate(savedInstanceState); //ActionBarSherlockMenuPlugin.setOnInitListener(this); // Set by <content src="index.html" /> in config.xml //super.loadUrl(Config.getStartUrl()); //super.loadUrl("file:///android_asset/www/index.html") // load html page via jsHybugger content provider //super.loadUrl("content://jsHybugger.org/" + Config.getStartUrl()); // requestWindowFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.main);// w w w.j a va 2s.com appView = (CordovaWebView) findViewById(R.id.uBridgeView); //getActionBar(); //getSupportActionBar(); appView.loadUrl(Config.getStartUrl()); }