Merge "Fix the header can't be scrolling problem in landscape mode"
This commit is contained in:
committed by
Android (Google) Code Review
commit
a44044dfe6
@@ -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);
|
||||
|
Reference in New Issue
Block a user