Example usage for org.apache.cordova ConfigXmlParser parse

List of usage examples for org.apache.cordova ConfigXmlParser parse

Introduction

In this page you can find the example usage for org.apache.cordova ConfigXmlParser parse.

Prototype

public void parse(XmlPullParser xml) 

Source Link

Usage

From source file:com.easycom.cordova.moodstocksScanner.CordovaFragment.java

License:Open Source License

protected void loadConfig() {
    ConfigXmlParser parser = new ConfigXmlParser();
    parser.parse(getActivity());
    preferences = parser.getPreferences();
    preferences.setPreferencesBundle(getActivity().getIntent().getExtras());
    //        preferences.copyIntoIntentExtras(getActivity());
    launchUrl = parser.getLaunchUrl();//from w w  w  .j a  v a 2s .c  om
    pluginEntries = parser.getPluginEntries();
    //         Config.parser = parser;
}

From source file:com.example.administrator.myapplication.fragment.CordovaFragment2.java

License:Apache License

@SuppressWarnings("deprecation")
protected void loadConfig() {
    ConfigXmlParser parser = new ConfigXmlParser();
    parser.parse(this.getActivity());
    preferences = parser.getPreferences();
    preferences.setPreferencesBundle(getActivity().getIntent().getExtras());
    launchUrl = parser.getLaunchUrl();// ww w.  j  a v  a  2  s .c  o m
    pluginEntries = parser.getPluginEntries();
    //        Config.parser = parser;
}

From source file:com.mobicage.rogerthat.cordova.CordovaActionScreenActivity.java

License:Apache License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();/*  w w  w .jav a2  s .com*/
    mEmbeddedApp = intent.getStringExtra(EMBEDDED_APP);
    mEmbeddedAppId = intent.getStringExtra(EMBEDDED_APP_ID);

    mBrandingType = intent.getStringExtra(ActionScreenActivity.BRANDING_TYPE);
    mBrandingKey = intent.getStringExtra(ActionScreenActivity.BRANDING_KEY);
    mServiceEmail = intent.getStringExtra(ActionScreenActivity.SERVICE_EMAIL);
    mItemTagHash = intent.getStringExtra(ActionScreenActivity.ITEM_TAG_HASH);
    mItemLabel = intent.getStringExtra(ActionScreenActivity.ITEM_LABEL);
    mItemCoords = intent.getLongArrayExtra(ActionScreenActivity.ITEM_COORDS);
    mRunInBackground = intent.getBooleanExtra(ActionScreenActivity.RUN_IN_BACKGROUND, true);
    mContext = intent.getStringExtra(ActionScreenActivity.CONTEXT);

    if (mEmbeddedAppId != null) {
        mType = CordovaAppType.DYNAMIC_EMBEDDED_APP;
    } else if (mEmbeddedApp == null) {
        mType = CordovaAppType.BRANDING;
    } else {
        mType = CordovaAppType.PACKAGED_EMBEDDED_APP;
    }

    setContentViewWithoutNavigationBar(R.layout.cordova_action_screen);

    final int configId = getCordovaConfigId();
    final ConfigXmlParser parser = new ConfigXmlParser();
    parser.parse(this.getResources().getXml(configId));

    mBranding = (SystemWebView) findViewById(R.id.branding);
    SystemWebViewEngine parentEngine = new SystemWebViewEngine(mBranding);
    mBranding.setWebChromeClient(new CordovaWebChromeClient(parentEngine));
    mWebInterface = new CordovaWebViewImpl(parentEngine);
    mWebInterface.init(mCordovaInterface, parser.getPluginEntries(), parser.getPreferences());

    setTitle(mItemLabel);
    setActivityName("click|" + mItemTagHash);
}

From source file:io.syng.activity.SettingsActivity.java

License:Mozilla Public License

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupSimplePreferencesScreen();//  w  ww. ja v a  2 s  .  co m

    Preference button = (Preference) findPreference("clearCache");
    button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            ConfigXmlParser parser = new ConfigXmlParser();
            parser.parse(SettingsActivity.this);
            CordovaPreferences preferences = parser.getPreferences();
            preferences.setPreferencesBundle(SettingsActivity.this.getIntent().getExtras());
            CordovaWebView webView = new CordovaWebViewImpl(
                    CordovaWebViewImpl.createEngine(SettingsActivity.this, preferences));
            webView.clearCache();
            return true;
        }
    });
}

From source file:io.syng.fragment.WebViewFragment.java

License:Mozilla Public License

@SuppressWarnings("deprecation")
protected void loadConfig() {
    ConfigXmlParser parser = new ConfigXmlParser();
    parser.parse(getActivity());
    preferences = parser.getPreferences();
    preferences.setPreferencesBundle(getActivity().getIntent().getExtras());
    //preferences.set("webview", "io.syng.cordova.plugin.WebViewEngine");
    pluginEntries = parser.getPluginEntries();
    Config.init(getActivity());/*from  w  w w . j  a  va 2  s  .c om*/
}

From source file:org.apache.appharness.AppHarnessUI.java

License:Apache License

private void setPluginEntries(Set<String> pluginIdWhitelist, Uri configXmlUri) {
    CordovaActivity activity = (CordovaActivity) cordova.getActivity();
    // Extract the <feature> from CADT's config.xml, and filter out unwanted plugins.
    ConfigXmlParser parser = new ConfigXmlParser();
    parser.parse(activity);
    ArrayList<PluginEntry> pluginEntries = new ArrayList<PluginEntry>(parser.getPluginEntries());
    for (int i = 0; i < pluginEntries.size();) {
        PluginEntry p = pluginEntries.get(i);
        if (!pluginIdWhitelist.contains(p.service)) {
            pluginEntries.remove(p);/*from w  w  w. ja  va2 s .  c  om*/
            continue;
        } else if (WhitelistPlugin.class.getCanonicalName().equals(p.pluginClass)) {
            pluginEntries.set(i, new PluginEntry(p.service, createWhitelistPlugin(configXmlUri)));
        }
        ++i;
    }
    slaveWebView.getPluginManager().setPluginEntries(pluginEntries);
    // This is added by cordova-android in code, so we need to re-add it likewise.
    // Note that we re-route navigator.app.exitApp() in JS to close the webview rather than close the Activity.
    slaveWebView.getPluginManager().addService("CoreAndroid", "org.apache.cordova.CoreAndroid");
}