diff options
Diffstat (limited to 'samples/SupportDesignDemos/res')
11 files changed, 282 insertions, 54 deletions
diff --git a/samples/SupportDesignDemos/res/layout/action_layout.xml b/samples/SupportDesignDemos/res/layout/action_layout.xml new file mode 100644 index 000000000..a266d5104 --- /dev/null +++ b/samples/SupportDesignDemos/res/layout/action_layout.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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. +--> +<android.support.v7.widget.SwitchCompat + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/toggle" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center_vertical"/> diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_scroll_with_swiperefresh.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_scroll_with_swiperefresh.xml new file mode 100644 index 000000000..d0572afac --- /dev/null +++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_collapse_scroll_with_swiperefresh.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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. +--> + +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/col" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.design.widget.AppBarLayout + android:id="@+id/app_bar" + android:layout_height="192dp" + android:layout_width="match_parent" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + + <android.support.design.widget.CollapsingToolbarLayout + android:id="@+id/collapsing_app_bar" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_height="?attr/actionBarSize" + android:layout_width="match_parent" + app:layout_collapseMode="pin"/> + + </android.support.design.widget.CollapsingToolbarLayout> + + </android.support.design.widget.AppBarLayout> + + <include layout="@layout/include_appbar_recyclerview_swiperefresh"/> + +</android.support.design.widget.CoordinatorLayout> diff --git a/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_scroll_tabs_scroll_snap.xml b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_scroll_tabs_scroll_snap.xml new file mode 100644 index 000000000..b559ca370 --- /dev/null +++ b/samples/SupportDesignDemos/res/layout/design_appbar_toolbar_scroll_tabs_scroll_snap.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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. +--> + +<android.support.design.widget.CoordinatorLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/col" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.design.widget.AppBarLayout + android:id="@+id/app_bar" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_height="?attr/actionBarSize" + android:layout_width="match_parent" + app:layout_scrollFlags="scroll|enterAlways|snap"/> + + <android.support.design.widget.TabLayout + android:id="@+id/tabs" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_scrollFlags="scroll|enterAlways|snap" + app:tabMode="scrollable"/> + + </android.support.design.widget.AppBarLayout> + + <include layout="@layout/include_appbar_scrollview"/> + +</android.support.design.widget.CoordinatorLayout> + diff --git a/samples/SupportDesignDemos/res/layout/design_bottom_sheet.xml b/samples/SupportDesignDemos/res/layout/design_bottom_sheet.xml new file mode 100644 index 000000000..56197eaec --- /dev/null +++ b/samples/SupportDesignDemos/res/layout/design_bottom_sheet.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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. +--> +<android.support.design.widget.CoordinatorLayout + android:id="@+id/coordinator" + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res/com.example.android.support.design" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <!-- + This is the bottom sheet. You can use any View as a bottom sheet by marking it with + app:layout_behavior as BottomSheetBehavior. + --> + <LinearLayout + android:id="@+id/bottom_sheet" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginLeft="@dimen/bottom_sheet_horizontal_margin" + android:layout_marginRight="@dimen/bottom_sheet_horizontal_margin" + android:background="?android:attr/windowBackground" + android:elevation="16dp" + android:minHeight="128dp" + android:orientation="vertical" + app:layout_behavior="android.support.design.widget.BottomSheetBehavior" + app:behavior_peekHeight="128dp"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/bottom_sheet" + android:paddingTop="8dp" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingBottom="8dp" + style="@style/TextAppearance.AppCompat.Title"/> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@android:color/darker_gray"/> + + <android.support.v4.widget.NestedScrollView + android:id="@+id/scroll" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/dialogue" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="16dp" + style="@style/TextAppearance.AppCompat.Body1"/> + + </android.support.v4.widget.NestedScrollView> + + </LinearLayout> + +</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/samples/SupportDesignDemos/res/layout/design_tabs.xml b/samples/SupportDesignDemos/res/layout/design_tabs.xml deleted file mode 100644 index b52d80833..000000000 --- a/samples/SupportDesignDemos/res/layout/design_tabs.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2015 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. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <android.support.v7.widget.Toolbar - android:id="@+id/toolbar" - android:layout_height="?attr/actionBarSize" - android:layout_width="match_parent" - android:background="?attr/colorPrimary" - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - app:contentInsetStart="72dp" - app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> - - <android.support.design.widget.TabLayout - android:id="@+id/tabs" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:background="?attr/colorPrimary" - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - app:tabContentStart="72dp"/> - -</LinearLayout> diff --git a/samples/SupportDesignDemos/res/layout/design_tabs_viewpager.xml b/samples/SupportDesignDemos/res/layout/design_tabs_viewpager.xml index b249155ed..11ddca639 100644 --- a/samples/SupportDesignDemos/res/layout/design_tabs_viewpager.xml +++ b/samples/SupportDesignDemos/res/layout/design_tabs_viewpager.xml @@ -54,13 +54,22 @@ android:id="@+id/btn_add_tab" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/add_tab"/> + android:text="@string/add_tab" + android:onClick="addTab"/> <Button android:id="@+id/btn_remove_tab" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/remove_tab"/> + android:text="@string/remove_tab" + android:onClick="removeTab"/> + + <Button + android:id="@+id/btn_select_first_tab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/select_first_tab" + android:onClick="selectFirstTab"/> </LinearLayout> diff --git a/samples/SupportDesignDemos/res/layout/design_text_input.xml b/samples/SupportDesignDemos/res/layout/design_text_input.xml index 4561df125..32260746f 100644 --- a/samples/SupportDesignDemos/res/layout/design_text_input.xml +++ b/samples/SupportDesignDemos/res/layout/design_text_input.xml @@ -36,6 +36,24 @@ </android.support.design.widget.TextInputLayout> + <LinearLayout android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/show_error" + android:onClick="showError"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/clear_error" + android:onClick="clearError"/> + + </LinearLayout> + <android.support.design.widget.TextInputLayout android:id="@+id/input_email" android:layout_width="match_parent" @@ -51,16 +69,20 @@ </android.support.design.widget.TextInputLayout> - <Button - android:layout_width="wrap_content" + <android.support.design.widget.TextInputLayout + android:id="@+id/input_description" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/show_error" - android:onClick="showError"/> + android:layout_marginTop="8dp" + app:counterEnabled="true" + app:counterMaxLength="30"> - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/clear_error" - android:onClick="clearError"/> + <EditText + android:id="@+id/edit_description" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="@string/form_description"/> + + </android.support.design.widget.TextInputLayout> </LinearLayout>
\ No newline at end of file diff --git a/samples/SupportDesignDemos/res/menu/navigation.xml b/samples/SupportDesignDemos/res/menu/navigation.xml index b399ef3a9..6425b1893 100644 --- a/samples/SupportDesignDemos/res/menu/navigation.xml +++ b/samples/SupportDesignDemos/res/menu/navigation.xml @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. --> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <!-- Main items --> <group android:checkableBehavior="single"> @@ -30,7 +31,8 @@ <item android:id="@+id/navigation_item_3" android:icon="@drawable/ic_android" - android:title="@string/navigation_item_3"/> + android:title="@string/navigation_item_3" + app:actionLayout="@layout/action_layout"/> <item android:id="@+id/navigation_item_disabled" android:icon="@drawable/ic_android" diff --git a/samples/SupportDesignDemos/res/values-w540dp/dimens.xml b/samples/SupportDesignDemos/res/values-w540dp/dimens.xml new file mode 100644 index 000000000..26fecbf04 --- /dev/null +++ b/samples/SupportDesignDemos/res/values-w540dp/dimens.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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. +--> +<resources> + <dimen name="bottom_sheet_horizontal_margin">64dp</dimen> +</resources> diff --git a/samples/SupportDesignDemos/res/values/dimens.xml b/samples/SupportDesignDemos/res/values/dimens.xml new file mode 100644 index 000000000..ac8777cfe --- /dev/null +++ b/samples/SupportDesignDemos/res/values/dimens.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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. +--> +<resources> + <dimen name="bottom_sheet_horizontal_margin">0dp</dimen> +</resources> diff --git a/samples/SupportDesignDemos/res/values/strings.xml b/samples/SupportDesignDemos/res/values/strings.xml index 16b17172a..c3a981a02 100644 --- a/samples/SupportDesignDemos/res/values/strings.xml +++ b/samples/SupportDesignDemos/res/values/strings.xml @@ -21,6 +21,7 @@ <string name="design_navigation">NavigationView/Usage</string> <string name="design_tabs_basic">TabLayout/Usage</string> <string name="design_text_input">Text Input</string> + <string name="design_bottomsheet">BottomSheet/Usage</string> <string name="fab_size_normal">Normal size</string> <string name="fab_size_mini">Mini size</string> @@ -48,9 +49,11 @@ <string name="add_tab">Add tab</string> <string name="remove_tab">Remove tab</string> + <string name="select_first_tab">Select tab #0</string> <string name="form_username">Username</string> <string name="form_email">Email address</string> + <string name="form_description">Description</string> <string name="show_error">Show error</string> <string name="clear_error">Clear error</string> @@ -64,11 +67,13 @@ <string name="snackbar_show_long_long_action">Show (long message + long action)</string> <string name="design_appbar_toolbar_scroll_tabs_scroll">AppBar/Toolbar Scroll + Tabs Scroll</string> + <string name="design_appbar_toolbar_scroll_tabs_scroll_snap">AppBar/Toolbar Scroll + Tabs Scroll + Snap</string> <string name="design_appbar_toolbar_scroll_tabs_pin">AppBar/Toolbar Scroll + Tabs Pin</string> <string name="design_appbar_toolbar_scroll_tabs_pin_with_swiperefresh">AppBar/Toolbar Scroll + Tabs Pin + Swipe Refresh</string> <string name="design_appbar_collapsing_toolbar_pin">AppBar/Collapsing Toolbar (pinned)</string> <string name="design_appbar_collapsing_toolbar_pin_fab">AppBar/Collapsing Toolbar (pinned with FAB)</string> <string name="design_appbar_collapsing_toolbar_scroll">AppBar/Collapsing Toolbar (scroll off)</string> + <string name="design_appbar_collapsing_toolbar_scroll_with_swiperefresh">AppBar/Collapsing Toolbar (scroll off) + Swipe Refresh</string> <string name="design_appbar_collapsing_toolbar_with_image">AppBar/Collapsing Toolbar + Parallax Image</string> <string name="design_appbar_collapsing_toolbar_with_image_insets">AppBar/Collapsing Toolbar + Parallax Image + Insets</string> <string name="design_appbar_parallax_overlap">AppBar/Parallax Overlapping content</string> @@ -77,5 +82,6 @@ <string name="menu_search">Search</string> <string name="menu_settings">Settings</string> + <string name="bottom_sheet">Bottom sheet</string> </resources> |