Merge "Fix the transition of the up-button." into sc-dev am: 20fa1428bc
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13432390
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I6b7d1eff6a9a97cbee2e587e553e0a0fb98b45d5
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index bb20c4c..d22a381 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -238,12 +238,10 @@
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
final MaterialSharedAxis enterTransition = new MaterialSharedAxis(
MaterialSharedAxis.X, /* forward */true);
- enterTransition.addTarget(R.id.content_parent);
getWindow().setEnterTransition(enterTransition);
final MaterialSharedAxis returnTransition = new MaterialSharedAxis(
MaterialSharedAxis.X, /* forward */false);
- returnTransition.addTarget(R.id.content_parent);
getWindow().setReturnTransition(returnTransition);
}
diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java
index 4704702..85484af 100644
--- a/src/com/android/settings/core/SettingsBaseActivity.java
+++ b/src/com/android/settings/core/SettingsBaseActivity.java
@@ -32,11 +32,13 @@
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Toolbar;
+import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import com.android.settings.R;
@@ -168,6 +170,17 @@
}
@Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ final int id = item.getItemId();
+ if (id == android.R.id.home) {
+ // Make the up button behave the same as the back button.
+ onBackPressed();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
public void setTitle(CharSequence title) {
if (mCollapsingToolbarLayout != null) {
mCollapsingToolbarLayout.setTitle(title);