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

This commit is contained in:
TreeHugger Robot
2022-08-12 07:30:22 +00:00
committed by Android (Google) Code Review
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;
@@ -433,7 +434,7 @@ public class ManageApplications extends InstrumentedFragment
mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
mAppBarLayout = getActivity().findViewById(R.id.app_bar);
disableToolBarScrollableBehavior();
autoSetCollapsingToolbarLayoutScrolling();
return mRootView;
}
@@ -906,7 +907,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();
@@ -914,7 +915,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);