1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 09:17:29 +01:00

Go to previous PreferenceScreen on back actionbar option

Fixes #2692
This commit is contained in:
José Rebelo 2022-06-03 23:07:36 +01:00
parent 4d0bfb452b
commit 621e731d63

View File

@ -17,6 +17,7 @@
package nodomain.freeyourgadget.gadgetbridge.activities.devicesettings; package nodomain.freeyourgadget.gadgetbridge.activities.devicesettings;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
@ -72,4 +73,17 @@ public class DeviceSettingsActivity extends AbstractGBActivity implements
.commit(); .commit();
return true; return true;
} }
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// Simulate a back press, so that we don't actually exit the activity when
// in a nested PreferenceScreen
this.onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
} }