Example usage for org.apache.cordova ConfigXmlParser ConfigXmlParser

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

Introduction

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

Prototype

ConfigXmlParser

Source Link

Usage

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();/*from  ww  w .  j a va 2 s  .c  om*/
    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();/*from   ww w . j  av a 2  s . c o  m*/
    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:com.phonegap.bossbolo.plugin.BoloPlugin.java

License:Apache License

/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 *//*from   ww w. j  a  v a 2  s.co  m*/
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
    Log.v(TAG, "StatusBar: initialization");
    super.initialize(cordova, webView);
    this.webView = webView;
    this.activity = cordova.getActivity();
    this.window = this.activity.getWindow();
    this.mContext = this.webView.getContext();

    ConfigXmlParser parser = new ConfigXmlParser();
    CustomGlobal.getInstance().setLaunchUrl(parser.getLaunchUrl());

    UmengUpdateAgent.setUpdateOnlyWifi(false);
    UmengUpdateAgent.setUpdateAutoPopup(false);
    UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
        @Override
        public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {
            if (updateStatus == UpdateStatus.Yes) {
                haveUpdate = true;
                UmengUpdateAgent.showUpdateDialog(activity.getApplicationContext(), updateInfo);
            }
            updateIsCallback = true;
        }
    });

    /*this.cordova.getActivity().runOnUiThread(new Runnable() {
    @Override
    public void run() {
        // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially
        // by the Cordova.
    }
    });*/
}

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

License:Mozilla Public License

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupSimplePreferencesScreen();//from  w ww  .  j a v  a 2s . c  om

    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());//from w w  w .  j  av a  2 s . c o 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.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);/*from ww  w  .ja  v a 2  s  .  c om*/
    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);
            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");
}