diff options
Diffstat (limited to 'samples/browseable/DoneBar')
12 files changed, 137 insertions, 40 deletions
diff --git a/samples/browseable/DoneBar/AndroidManifest.xml b/samples/browseable/DoneBar/AndroidManifest.xml index 473111435..820fae590 100644 --- a/samples/browseable/DoneBar/AndroidManifest.xml +++ b/samples/browseable/DoneBar/AndroidManifest.xml @@ -22,7 +22,7 @@ android:versionCode="1" android:versionName="1.0"> - <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" /> + <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle --> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher" diff --git a/samples/browseable/DoneBar/_index.jd b/samples/browseable/DoneBar/_index.jd index 8ef219c9a..b692bb981 100644 --- a/samples/browseable/DoneBar/_index.jd +++ b/samples/browseable/DoneBar/_index.jd @@ -1,12 +1,15 @@ - - - page.tags="DoneBar" sample.group=UI @jd:body -<p>This sample demonstrates a user interface design pattern for simple data -entry from an {@link android.app.ActionBar}. The sample implements a custom -<strong>Done/Cancel</strong> bar to provide users with an easy way to directly -save or cancel their changes. This design pattern is suitable for scenarios -where no additional view details or actions are needed in the action bar.</p> +<p> + + This sample demonstrates two alternative presentations of the + action bar that are well-suited for simple data entry scenarios. + + In this presentation, a done bar replaces the action + bar entirely, providing two direct actions to persist or dismiss changes. This is + suitable for cases where no additional view details or actions are needed in the + action bar. + + </p> diff --git a/samples/browseable/DoneBar/res/drawable-xhdpi/sample_dashboard_item_background.9.png b/samples/browseable/DoneBar/res/drawable-xhdpi/sample_dashboard_item_background.9.png Binary files differdeleted file mode 100644 index 135862883..000000000 --- a/samples/browseable/DoneBar/res/drawable-xhdpi/sample_dashboard_item_background.9.png +++ /dev/null diff --git a/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml b/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml index 38987ee20..516d28989 100644 --- a/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml +++ b/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml @@ -14,19 +14,37 @@ limitations under the License. --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/Widget.SampleDashboard.Item" +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + android:layout_height="wrap_content"> + <!-- The CardView needs to be wrapped to ensure spacing is applied correctly. --> - <TextView android:id="@android:id/text1" - style="@style/Widget.SampleDashboard.Item.Title" + <android.support.v7.widget.CardView + style="@style/Widget.SampleDashboard.Card" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content"> - <TextView android:id="@android:id/text2" - style="@style/Widget.SampleDashboard.Item.Description" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> -</LinearLayout> + <LinearLayout + style="@style/Widget.SampleDashboard.Item" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@android:id/text1" + style="@style/Widget.SampleDashboard.Item.Title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Hello world" /> + + <TextView + android:id="@android:id/text2" + style="@style/Widget.SampleDashboard.Item.Description" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + </LinearLayout> + + </android.support.v7.widget.CardView> + +</FrameLayout> diff --git a/samples/browseable/DoneBar/res/values-v21/template-styles.xml b/samples/browseable/DoneBar/res/values-v21/template-styles.xml new file mode 100644 index 000000000..134fcd9d3 --- /dev/null +++ b/samples/browseable/DoneBar/res/values-v21/template-styles.xml @@ -0,0 +1,22 @@ +<!-- + Copyright 2014 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> + + <!-- Activity themes --> + <style name="Theme.Base" parent="android:Theme.Material.Light" /> + +</resources> diff --git a/samples/browseable/DoneBar/res/values/activitycards-colors.xml b/samples/browseable/DoneBar/res/values/activitycards-colors.xml new file mode 100644 index 000000000..79605c7c9 --- /dev/null +++ b/samples/browseable/DoneBar/res/values/activitycards-colors.xml @@ -0,0 +1,21 @@ +<!-- + Copyright 2014 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> + <color name="teal">#009688</color> + <color name="black_87">#DD000000</color> + <color name="black_54">#89000000</color> +</resources> diff --git a/samples/browseable/DoneBar/res/values/activitycards-dimens.xml b/samples/browseable/DoneBar/res/values/activitycards-dimens.xml new file mode 100644 index 000000000..714cb00f2 --- /dev/null +++ b/samples/browseable/DoneBar/res/values/activitycards-dimens.xml @@ -0,0 +1,22 @@ +<!-- + Copyright 2013 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="card_padding">16dp</dimen> + <dimen name="card_margin">8dp</dimen> + +</resources>
\ No newline at end of file diff --git a/samples/browseable/DoneBar/res/values/activitycards-strings.xml b/samples/browseable/DoneBar/res/values/activitycards-strings.xml index 5c2557c97..430286c31 100644 --- a/samples/browseable/DoneBar/res/values/activitycards-strings.xml +++ b/samples/browseable/DoneBar/res/values/activitycards-strings.xml @@ -15,9 +15,6 @@ limitations under the License. --> - - - <resources> <string name="donebaractivity_title">Done Bar</string> <string name="donebaractivity_description">In this presentation, a done bar replaces the action bar entirely, providing diff --git a/samples/browseable/DoneBar/res/values/base-strings.xml b/samples/browseable/DoneBar/res/values/base-strings.xml index 22a4fae9f..f7e0540ca 100644 --- a/samples/browseable/DoneBar/res/values/base-strings.xml +++ b/samples/browseable/DoneBar/res/values/base-strings.xml @@ -14,9 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - <resources> <string name="app_name">DoneBar</string> <string name="intro_message"> diff --git a/samples/browseable/DoneBar/res/values/template-attrs.xml b/samples/browseable/DoneBar/res/values/template-attrs.xml new file mode 100644 index 000000000..442ed7781 --- /dev/null +++ b/samples/browseable/DoneBar/res/values/template-attrs.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 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> +</resources>
\ No newline at end of file diff --git a/samples/browseable/DoneBar/res/values/template-styles.xml b/samples/browseable/DoneBar/res/values/template-styles.xml index cafe531a4..374dc515d 100644 --- a/samples/browseable/DoneBar/res/values/template-styles.xml +++ b/samples/browseable/DoneBar/res/values/template-styles.xml @@ -34,9 +34,10 @@ <item name="android:paddingRight">@dimen/horizontal_page_margin</item> </style> - <style name="Widget.SampleMessage"> +<style name="Widget.SampleMessage"> <item name="android:textAppearance">?android:textAppearanceMedium</item> <item name="android:lineSpacingMultiplier">1.1</item> + <item name="android:textColor">@color/black_54</item> </style> <style name="Widget.SampleDashboard.Grid" parent="Widget"> @@ -44,28 +45,32 @@ <item name="android:columnWidth">200dp</item> <item name="android:numColumns">auto_fit</item> <item name="android:drawSelectorOnTop">true</item> - <item name="android:horizontalSpacing">@dimen/margin_medium</item> - <item name="android:verticalSpacing">@dimen/margin_medium</item> + <item name="android:horizontalSpacing">0dp</item> + <item name="android:verticalSpacing">0dp</item> + </style> + + <style name="Widget.SampleDashboard.Card" parent="Widget"> + <item name="android:gravity">center</item> + <item name="android:layout_margin">@dimen/card_margin</item> + <item name="cardCornerRadius">4dp</item> + <item name="cardElevation">5dp</item> + <item name="contentPadding">@dimen/card_padding</item> </style> <style name="Widget.SampleDashboard.Item" parent="Widget"> - <item name="android:background">@drawable/sample_dashboard_item_background</item> - <item name="android:paddingTop">@dimen/margin_small</item> - <item name="android:paddingLeft">@dimen/margin_medium</item> - <item name="android:paddingRight">@dimen/margin_medium</item> - <item name="android:paddingBottom">@dimen/margin_medium</item> </style> <style name="Widget.SampleDashboard.Item.Title" parent="Widget"> <item name="android:layout_marginBottom">@dimen/margin_tiny</item> <item name="android:textAppearance">?android:textAppearanceLarge</item> - <item name="android:textColor">#09c</item> - <item name="android:textStyle">bold</item> + <item name="android:textColor">@color/teal</item> + <item name="android:fontFamily">sans-serif</item> <item name="android:textSize">24sp</item> </style> <style name="Widget.SampleDashboard.Item.Description" parent="Widget"> <item name="android:textAppearance">?android:textAppearanceSmall</item> <item name="android:fontFamily">sans-serif-light</item> + <item name="android:textColor">@color/black_87</item> </style> </resources> diff --git a/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java b/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java index 8b1e8a469..c51996c4c 100644 --- a/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java +++ b/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java @@ -14,9 +14,6 @@ * limitations under the License. */ - - - package com.example.android.donebar; import android.app.Activity; |