Skip to content

Commit

Permalink
[Catalog] Update catalog preferences menu to a nested scroll view.
Browse files Browse the repository at this point in the history
This change allows all preference options to be accessible in landscape mode.

PiperOrigin-RevId: 423915710
  • Loading branch information
josefigueroa168 authored and dsn5ft committed Jan 25, 2022
1 parent 96fa85e commit 9a5ec35
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
Expand Up @@ -68,11 +68,11 @@ public View onCreateView(
@NonNull LayoutInflater layoutInflater,
@Nullable ViewGroup viewGroup,
@Nullable Bundle bundle) {
LinearLayout container =
(LinearLayout) layoutInflater.inflate(
R.layout.mtrl_preferences_dialog, viewGroup, false);
View container = layoutInflater.inflate(R.layout.mtrl_preferences_dialog, viewGroup, false);
LinearLayout preferencesLayout = container.findViewById(R.id.preferences_layout);
for (CatalogPreference catalogPreference : preferences.getPreferences()) {
container.addView(createPreferenceView(layoutInflater, container, catalogPreference));
preferencesLayout.addView(
createPreferenceView(layoutInflater, preferencesLayout, catalogPreference));
}
return container;
}
Expand Down
Expand Up @@ -13,20 +13,25 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp">

<TextView
android:paddingRight="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="always">
<LinearLayout
android:id="@+id/preferences_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="8dp"
android:text="@string/preferences_screen_title"
android:textAppearance="?attr/textAppearanceHeadline3"/>
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="8dp"
android:text="@string/preferences_screen_title"
android:textAppearance="?attr/textAppearanceHeadline3"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

</LinearLayout>

0 comments on commit 9a5ec35

Please sign in to comment.