Exemplo n.º 1
0
  private static String initGeckoEnvironment() {
    final Context context = GeckoAppShell.getApplicationContext();
    GeckoLoader.loadMozGlue(context);
    setState(State.MOZGLUE_READY);

    final Locale locale = Locale.getDefault();
    final Resources res = context.getResources();
    if (locale.toString().equalsIgnoreCase("zh_hk")) {
      final Locale mappedLocale = Locale.TRADITIONAL_CHINESE;
      Locale.setDefault(mappedLocale);
      Configuration config = res.getConfiguration();
      config.locale = mappedLocale;
      res.updateConfiguration(config, null);
    }

    String[] pluginDirs = null;
    try {
      pluginDirs = GeckoAppShell.getPluginDirectories();
    } catch (Exception e) {
      Log.w(LOGTAG, "Caught exception getting plugin dirs.", e);
    }

    final String resourcePath = context.getPackageResourcePath();
    GeckoLoader.setupGeckoEnvironment(context, pluginDirs, context.getFilesDir().getPath());

    GeckoLoader.loadSQLiteLibs(context, resourcePath);
    GeckoLoader.loadNSSLibs(context, resourcePath);
    GeckoLoader.loadGeckoLibs(context, resourcePath);
    setState(State.LIBS_READY);

    return resourcePath;
  }