From 6dc55051fc1de876efd62cd5f72b3da3b4fcca38 Mon Sep 17 00:00:00 2001 From: Yuichi Araki Date: Wed, 13 Jan 2016 14:23:39 +0900 Subject: [PATCH] Use of bottom sheet with ScrollView in background Bug: 26237244 Change-Id: I79d500ce1262021368aeb4693246bbc6bba8c6e7 --- .../SupportDesignDemos/AndroidManifest.xml | 9 +++ .../res/layout/design_bottom_sheet_scroll.xml | 72 +++++++++++++++++++ .../SupportDesignDemos/res/values/strings.xml | 2 + .../design/widget/BottomSheetScrollView.java | 41 +++++++++++ 4 files changed, 124 insertions(+) create mode 100644 samples/SupportDesignDemos/res/layout/design_bottom_sheet_scroll.xml create mode 100644 samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomSheetScrollView.java diff --git a/samples/SupportDesignDemos/AndroidManifest.xml b/samples/SupportDesignDemos/AndroidManifest.xml index 026d090b8..920fd228d 100644 --- a/samples/SupportDesignDemos/AndroidManifest.xml +++ b/samples/SupportDesignDemos/AndroidManifest.xml @@ -235,6 +235,15 @@ + + + + + + + diff --git a/samples/SupportDesignDemos/res/layout/design_bottom_sheet_scroll.xml b/samples/SupportDesignDemos/res/layout/design_bottom_sheet_scroll.xml new file mode 100644 index 000000000..7b3da9f5b --- /dev/null +++ b/samples/SupportDesignDemos/res/layout/design_bottom_sheet_scroll.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/SupportDesignDemos/res/values/strings.xml b/samples/SupportDesignDemos/res/values/strings.xml index 3903499e7..505dec0a0 100644 --- a/samples/SupportDesignDemos/res/values/strings.xml +++ b/samples/SupportDesignDemos/res/values/strings.xml @@ -24,6 +24,7 @@ Text Input BottomSheet/Persistent BottomSheet/Hideable + BottomSheet/With ScrollView in background BottomSheet/Modal Normal size @@ -89,6 +90,7 @@ Bottom sheet Persistent Hideable + With ScrollView Modal Hide Show diff --git a/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomSheetScrollView.java b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomSheetScrollView.java new file mode 100644 index 000000000..64eb5b575 --- /dev/null +++ b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomSheetScrollView.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.support.design.widget; + +import com.example.android.support.design.R; +import com.example.android.support.design.Shakespeare; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.text.TextUtils; +import android.widget.TextView; + +public class BottomSheetScrollView extends BottomSheetUsageBase { + + @Override + protected int getLayoutId() { + return R.layout.design_bottom_sheet_scroll; + } + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ((TextView) findViewById(R.id.dialogue_background)) + .setText(TextUtils.concat(Shakespeare.DIALOGUE)); + } + +}