Search in sources :

Example 1 with HelpDialogFragment

use of ru.playsoftware.j2meloader.info.HelpDialogFragment in project J2ME-Loader by nikita36078.

the class AppsListFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    FragmentActivity activity = requireActivity();
    int itemId = item.getItemId();
    if (itemId == R.id.action_about) {
        AboutDialogFragment aboutDialogFragment = new AboutDialogFragment();
        aboutDialogFragment.show(getChildFragmentManager(), "about");
    } else if (itemId == R.id.action_profiles) {
        Intent intentProfiles = new Intent(activity, ProfilesActivity.class);
        startActivity(intentProfiles);
    } else if (item.getItemId() == R.id.action_settings) {
        startActivity(new Intent(activity, SettingsActivity.class));
        return true;
    } else if (itemId == R.id.action_help) {
        HelpDialogFragment helpDialogFragment = new HelpDialogFragment();
        helpDialogFragment.show(getChildFragmentManager(), "help");
    } else if (itemId == R.id.action_donate) {
        Intent donationsIntent = new Intent(activity, DonationsActivity.class);
        startActivity(donationsIntent);
    } else if (itemId == R.id.action_save_log) {
        try {
            LogUtils.writeLog();
            Toast.makeText(activity, R.string.log_saved, Toast.LENGTH_SHORT).show();
        } catch (IOException e) {
            e.printStackTrace();
            Toast.makeText(activity, R.string.error, Toast.LENGTH_SHORT).show();
        }
    } else if (itemId == R.id.action_exit_app) {
        activity.finish();
    } else if (itemId == R.id.action_sort) {
        showSortDialog();
    }
    return false;
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) ProfilesActivity(ru.playsoftware.j2meloader.config.ProfilesActivity) Intent(android.content.Intent) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) IOException(java.io.IOException) AboutDialogFragment(ru.playsoftware.j2meloader.info.AboutDialogFragment) HelpDialogFragment(ru.playsoftware.j2meloader.info.HelpDialogFragment) SettingsActivity(ru.playsoftware.j2meloader.settings.SettingsActivity)

Aggregations

Intent (android.content.Intent)1 SQLiteDiskIOException (android.database.sqlite.SQLiteDiskIOException)1 FragmentActivity (androidx.fragment.app.FragmentActivity)1 IOException (java.io.IOException)1 ProfilesActivity (ru.playsoftware.j2meloader.config.ProfilesActivity)1 AboutDialogFragment (ru.playsoftware.j2meloader.info.AboutDialogFragment)1 HelpDialogFragment (ru.playsoftware.j2meloader.info.HelpDialogFragment)1 SettingsActivity (ru.playsoftware.j2meloader.settings.SettingsActivity)1