package info.nightscout.androidaps.activities;

import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;

import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.utils.PasswordProtection;

public class SingleFragmentActivity extends NoSplashAppCompatActivity {

    private PluginBase plugin;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_single_fragment);

        this.plugin = MainApp.getPluginsList().get(getIntent().getIntExtra("plugin", -1));
        setTitle(plugin.getName());
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,
                    Fragment.instantiate(this, plugin.pluginDescription.getFragmentClass())).commit();
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }
        else if (item.getItemId() == R.id.nav_plugin_preferences) {
            PasswordProtection.QueryPassword(this, R.string.settings_password, "settings_password", () -> {
                Intent i = new Intent(this, PreferencesActivity.class);
                i.putExtra("id", plugin.getPreferencesId());
                startActivity(i);
            }, null);
            return true;
        }
        return false;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        if (plugin.getPreferencesId() != -1)
            getMenuInflater().inflate(R.menu.menu_single_fragment, menu);
        return super.onCreateOptionsMenu(menu);
    }
}

@@ -116,68 +116,86 @@
 roid
-x.annotation.Nullable;%0Aimport androidx.fragment.app.Fragment
+.view.Menu;%0Aimport android.view.MenuItem;%0A%0Aimport androidx.annotation.Nullable
 ;%0Aim
@@ -259,48 +259,31 @@
 roid
-.view.Menu;%0Aimport android.view.MenuItem
+x.fragment.app.Fragment
 ;%0A%0Ai
@@ -527,16 +527,8 @@
 nds 
-NoSplash
 AppC

fix SingleFragmentActivity