Update Support7Demos for L appcompat
New Toolbar samples along with some improvements for the other Action Bar activities. Change-Id: I28dca1bd86ea4c269b711f4d10283e71384a33ac
This commit is contained in:
85
samples/Support7Demos/res/layout/toolbar_display_options.xml
Normal file
85
samples/Support7Demos/res/layout/toolbar_display_options.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<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="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/toggle_home_as_up"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toggle_home_as_up"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/toggle_show_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toggle_show_home"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/toggle_use_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toggle_use_logo"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/toggle_show_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toggle_show_title"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/toggle_show_custom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toggle_show_custom"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/cycle_custom_gravity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cycle_custom_gravity"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/toggle_visibility"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toggle_visibility"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
34
samples/Support7Demos/res/layout/toolbar_fragment_pager.xml
Normal file
34
samples/Support7Demos/res/layout/toolbar_fragment_pager.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?actionBarSize"
|
||||
android:background="?attr/colorPrimaryDark" />
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
40
samples/Support7Demos/res/layout/toolbar_usage.xml
Normal file
40
samples/Support7Demos/res/layout/toolbar_usage.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimaryDark"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Your content"
|
||||
android:gravity="center"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -16,9 +16,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/action_search"
|
||||
android:icon="@android:drawable/ic_menu_search"
|
||||
android:title="@string/action_bar_search"
|
||||
app:showAsAction="ifRoom"
|
||||
android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
|
||||
app:showAsAction="ifRoom|collapseActionView"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView" />
|
||||
<item android:id="@+id/action_add"
|
||||
android:icon="@android:drawable/ic_menu_add"
|
||||
@@ -30,6 +30,7 @@
|
||||
<item android:id="@+id/action_share"
|
||||
android:icon="@android:drawable/ic_menu_share"
|
||||
android:title="@string/action_bar_share"
|
||||
android:enabled="false"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item android:id="@+id/action_sort"
|
||||
android:icon="@android:drawable/ic_menu_sort_by_size"
|
||||
@@ -38,12 +39,10 @@
|
||||
<menu>
|
||||
<item android:id="@+id/action_sort_size"
|
||||
android:icon="@android:drawable/ic_menu_sort_by_size"
|
||||
android:title="@string/action_bar_sort_size"
|
||||
android:onClick="onSort" />
|
||||
android:title="@string/action_bar_sort_size" />
|
||||
<item android:id="@+id/action_sort_alpha"
|
||||
android:icon="@android:drawable/ic_menu_sort_alphabetically"
|
||||
android:title="@string/action_bar_sort_alpha"
|
||||
android:onClick="onSort" />
|
||||
android:title="@string/action_bar_sort_alpha" />
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
@@ -121,6 +121,9 @@
|
||||
necessary.
|
||||
</string>
|
||||
|
||||
<string name="toolbar_usage">AppCompat/Toolbar/Toolbar as Action Bar</string>
|
||||
<string name="toolbar_display_options">AppCompat/Toolbar/Toolbar Display Options</string>
|
||||
<string name="toolbar_fragment_pager">AppCompat/Toolbar/Toolbar Fragment ViewPager</string>
|
||||
|
||||
<string name="sample_media_route_provider_remote">Remote Playback (Simulated)</string>
|
||||
<string name="sample_media_route_activity_local">Local Playback</string>
|
||||
@@ -156,5 +159,6 @@
|
||||
|
||||
<string name="palette">Palette</string>
|
||||
<string name="palette_all_colors">Full color palette</string>
|
||||
<string name="search_hint">Search...</string>
|
||||
|
||||
</resources>
|
||||
|
||||
32
samples/Support7Demos/res/values/styles.xml
Normal file
32
samples/Support7Demos/res/values/styles.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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>
|
||||
|
||||
<style name="Theme.Custom" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="colorPrimary">#ff00bcd4</item>
|
||||
<item name="colorPrimaryDark">#00838f</item>
|
||||
<item name="colorAccent">#ffff00</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Custom.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimary">#ff00bcd4</item>
|
||||
<item name="colorPrimaryDark">#00838f</item>
|
||||
<item name="colorAccent">#ffff00</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
22
samples/Support7Demos/res/xml/searchable.xml
Normal file
22
samples/Support7Demos/res/xml/searchable.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:label="@string/activity_sample_code"
|
||||
android:hint="@string/search_hint"
|
||||
android:searchSuggestAuthority="com.example.android.supportv7.RecentSuggestionsProvider"
|
||||
android:searchSuggestSelection=" ?" />
|
||||
Reference in New Issue
Block a user