Fix the header can't be scrolling problem in landscape mode

- Settings header is restricted scrolling by this ag/15029686
- To void some pages can't show the contain part while heading unscrolling.
  We allow the header can be scrolling in the landscape mode.

Fixes: 207353353
Test: make RunSettingsRoboTests -j
Change-Id: Ice97c6244716d4768167feb78588807d13b06a94
This commit is contained in:
Sunny Shao
2022-08-11 15:33:45 +08:00
parent 248895db72
commit 151a088094
3 changed files with 16 additions and 9 deletions

View File

@@ -46,6 +46,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
@@ -431,7 +432,7 @@ public class ManageApplications extends InstrumentedFragment
mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
mAppBarLayout = getActivity().findViewById(R.id.app_bar);
disableToolBarScrollableBehavior();
autoSetCollapsingToolbarLayoutScrolling();
return mRootView;
}
@@ -893,7 +894,7 @@ public class ManageApplications extends InstrumentedFragment
}
}
private void disableToolBarScrollableBehavior() {
private void autoSetCollapsingToolbarLayoutScrolling() {
final CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
final AppBarLayout.Behavior behavior = new AppBarLayout.Behavior();
@@ -901,7 +902,8 @@ public class ManageApplications extends InstrumentedFragment
new AppBarLayout.Behavior.DragCallback() {
@Override
public boolean canDrag(@NonNull AppBarLayout appBarLayout) {
return false;
return appBarLayout.getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE;
}
});
params.setBehavior(behavior);