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

    Globals.checkLocale(this);

    currentPlugin = "(none)";

    String filename = MenuActivity.mupen64plus_cfg.get("UI-Console", "AudioPlugin");
    if (filename == null
        || filename.length() < 1
        || filename.equals("\"\"")
        || filename.equals("\"dummy\""))
      filename = MenuActivity.gui_cfg.get("AUDIO_PLUGIN", "last_choice");
    if (filename != null) {
      MenuActivity.gui_cfg.put("AUDIO_PLUGIN", "last_choice", filename);
      filename = filename.replace("\"", "");
      int x = filename.lastIndexOf("/");
      if (x > -1 && x < (filename.length() - 1)) {
        currentPlugin = filename.substring(x + 1, filename.length());
        if (currentPlugin == null || currentPlugin.length() < 1) currentPlugin = "(none)";
      }
    }

    // Load preferences from XML
    addPreferencesFromResource(R.layout.preferences_audio);

    final Preference settingsAudioChange = findPreference("menuSettingsAudioChange");
    settingsAudioChange.setSummary(currentPlugin);
    settingsAudioChange.setOnPreferenceClickListener(
        new OnPreferenceClickListener() {

          public boolean onPreferenceClick(Preference preference) {
            Intent intent = new Intent(mInstance, MenuSettingsAudioChangeActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startActivity(intent);
            return true;
          }
        });

    // Enable Plugin setting
    final CheckBoxPreference settingsEnableAudio =
        (CheckBoxPreference) findPreference("menuSettingsAudioEnabled");
    settingsEnableAudio.setOnPreferenceClickListener(
        new OnPreferenceClickListener() {

          public boolean onPreferenceClick(Preference preference) {
            MenuActivity.gui_cfg.put(
                "AUDIO_PLUGIN", "enabled", (settingsEnableAudio.isChecked() ? "1" : "0"));
            MenuActivity.mupen64plus_cfg.put(
                "UI-Console",
                "AudioPlugin",
                (settingsEnableAudio.isChecked()
                    ? MenuActivity.gui_cfg.get("AUDIO_PLUGIN", "last_choice")
                    : "\"dummy\""));
            return true;
          }
        });
  }
Example #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mInstance = this;
    // fullscreen mode
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    if (Globals.InhibitSuspend)
      getWindow()
          .setFlags(
              WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
              WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    Globals.checkLocale(this);

    _layout = new LinearLayout(this);
    _layout.setOrientation(LinearLayout.VERTICAL);
    _layout.setLayoutParams(
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    _layout2 = new LinearLayout(this);
    _layout2.setLayoutParams(
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    _layout.addView(_layout2);
    _img = new ImageView(this);
    _img.setScaleType(ImageView.ScaleType.FIT_CENTER); // FIT_XY
    try {
      _img.setImageDrawable(Drawable.createFromStream(getAssets().open("logo.png"), "logo.png"));
    } catch (Exception e) {
      _img.setImageResource(R.drawable.publisherlogo);
    }
    _img.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    _layout.addView(_img);
    _videoLayout = new FrameLayout(this);
    _videoLayout.addView(_layout);
    setContentView(_videoLayout);

    class Callback implements Runnable {
      MainActivity p;

      Callback(MainActivity _p) {
        p = _p;
      }

      public void run() {
        p.startDownloader();
      }
    };

    Thread downloaderThread = null;
    downloaderThread = new Thread(new Callback(this));
    downloaderThread.start();
  }