mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-03 00:00:24 -04:00
android: Replace deprecated onBackPressed() and enable predictive back gestures
Doesn't really make a difference it seems.
This commit is contained in:
parent
9a92088bb4
commit
26eef1f095
@ -37,6 +37,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/ApplicationTheme"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:allowBackup="false" >
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
|
@ -22,6 +22,7 @@ import android.view.MenuItem;
|
||||
|
||||
import org.strongswan.android.data.VpnProfileDataSource;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@ -40,6 +41,16 @@ public class SelectedApplicationsActivity extends AppCompatActivity
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true)
|
||||
{
|
||||
@Override
|
||||
public void handleOnBackPressed()
|
||||
{
|
||||
prepareResult();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
mApps = (SelectedApplicationsListFragment)fm.findFragmentByTag(LIST_TAG);
|
||||
if (mApps == null)
|
||||
@ -62,13 +73,6 @@ public class SelectedApplicationsActivity extends AppCompatActivity
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
prepareResult();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void prepareResult()
|
||||
{
|
||||
Intent data = new Intent();
|
||||
|
Loading…
x
Reference in New Issue
Block a user