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:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.datetime.timezone;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@@ -97,7 +98,7 @@ public abstract class BaseTimeZonePicker extends InstrumentedFragment
|
||||
LinearLayoutManager.VERTICAL, /* reverseLayout */ false));
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mAppBarLayout = getActivity().findViewById(R.id.app_bar);
|
||||
disableToolBarScrollableBehavior();
|
||||
autoSetCollapsingToolbarLayoutScrolling();
|
||||
|
||||
// Initialize TimeZoneDataLoader only when mRecyclerView is ready to avoid race
|
||||
// during onDateLoaderReady callback.
|
||||
@@ -193,7 +194,7 @@ public abstract class BaseTimeZonePicker extends InstrumentedFragment
|
||||
void onListItemClick(T item);
|
||||
}
|
||||
|
||||
private void disableToolBarScrollableBehavior() {
|
||||
private void autoSetCollapsingToolbarLayoutScrolling() {
|
||||
CoordinatorLayout.LayoutParams params =
|
||||
(CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
|
||||
AppBarLayout.Behavior behavior = new AppBarLayout.Behavior();
|
||||
@@ -201,7 +202,8 @@ public abstract class BaseTimeZonePicker 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