Skip to content

Commit 4488849

Browse files
adampAndroid Git Automerger
authored andcommitted
am 4f48d97: resolved conflicts for merge of b105894 to jb-mr2-dev
* commit '4f48d974410137961fc06139aa44ae038269705b': Add Support4Demos examples for DrawerLayout and SlidingPaneLayout
2 parents f67c9b3 + 4f48d97 commit 4488849

File tree

12 files changed

+601
-1
lines changed

12 files changed

+601
-1
lines changed

samples/Support4Demos/AndroidManifest.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<uses-permission android:name="android.permission.READ_CONTACTS" />
2626
<uses-permission android:name="android.permission.WAKE_LOCK" />
2727

28-
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
28+
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
2929

3030
<!-- The smallest screen this app works on is a phone. The app will
3131
scale its UI to larger screens but doesn't make good use of them
@@ -296,6 +296,22 @@
296296
</intent-filter>
297297
</activity>
298298

299+
<activity android:name=".widget.DrawerLayoutActivity"
300+
android:label="@string/drawer_layout_support">
301+
<intent-filter>
302+
<action android:name="android.intent.action.MAIN" />
303+
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
304+
</intent-filter>
305+
</activity>
306+
307+
<activity android:name=".widget.SlidingPaneLayoutActivity"
308+
android:label="@string/sliding_pane_layout_support">
309+
<intent-filter>
310+
<action android:name="android.intent.action.MAIN" />
311+
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
312+
</intent-filter>
313+
</activity>
314+
299315
<provider android:authorities="com.example.supportv4.content.sharingsupportprovider"
300316
android:name=".content.SharingSupportProvider" />
301317

171 Bytes
Loading
2.78 KB
Loading
158 Bytes
Loading
2.77 KB
Loading
182 Bytes
Loading
1.03 KB
Loading
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2013 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<!--
18+
A DrawerLayout is indended to be used as the top-level content view
19+
using match_parent for both width and height to consume the full space available.
20+
-->
21+
<android.support.v4.widget.DrawerLayout
22+
xmlns:android="http://schemas.android.com/apk/res/android"
23+
android:id="@+id/drawer_layout"
24+
android:layout_width="match_parent"
25+
android:layout_height="match_parent">
26+
<!-- As the main content view, the view below consumes the entire
27+
space available using match_parent in both dimensions. -->
28+
<ScrollView
29+
android:layout_width="match_parent"
30+
android:layout_height="match_parent"
31+
android:paddingLeft="16dp"
32+
android:paddingRight="16dp"
33+
android:scrollbarStyle="outsideOverlay">
34+
<TextView android:id="@+id/content_text"
35+
android:layout_width="match_parent"
36+
android:layout_height="match_parent"
37+
android:text="@string/drawer_layout_summary"
38+
android:textAppearance="?android:attr/textAppearanceMedium"/>
39+
</ScrollView>
40+
<!-- android:layout_gravity="left" tells DrawerLayout to treat
41+
this as a sliding drawer on the left side. The drawer is
42+
given a fixed width in dp and extends the full height of
43+
the container. A solid background is used for contrast
44+
with the content view. -->
45+
<ListView android:id="@+id/left_drawer"
46+
android:layout_width="300dp"
47+
android:layout_height="match_parent"
48+
android:layout_gravity="left"
49+
android:background="#ff333333"/>
50+
</android.support.v4.widget.DrawerLayout>
51+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2013 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<!--
18+
A SlidingPaneLayout is indended to be used as the top-level content view
19+
using match_parent for both width and height to consume the full space available.
20+
-->
21+
<android.support.v4.widget.SlidingPaneLayout
22+
xmlns:android="http://schemas.android.com/apk/res/android"
23+
android:id="@+id/sliding_pane_layout"
24+
android:layout_width="match_parent"
25+
android:layout_height="match_parent">
26+
<!-- The first child view becomes the left pane. When the combined
27+
desired width (expressed using android:layout_width) would
28+
not fit on-screen at once, the right pane is permitted to
29+
overlap the left. -->
30+
<ListView android:id="@+id/left_pane"
31+
android:layout_width="280dp"
32+
android:layout_height="match_parent"
33+
android:layout_gravity="left"/>
34+
<!-- The second child becomes the right (content) pane. In this
35+
example, android:layout_weight is used to express that this
36+
pane should grow to consume leftover available space when the
37+
window is wide enough. This allows the content pane to
38+
responsively grow in width on larger screens while still
39+
requiring at least the minimum width expressed by
40+
android:layout_width. -->
41+
<ScrollView
42+
android:layout_width="300dp"
43+
android:layout_height="match_parent"
44+
android:layout_weight="1"
45+
android:paddingLeft="16dp"
46+
android:paddingRight="16dp"
47+
android:scrollbarStyle="outsideOverlay"
48+
android:background="#ff333333">
49+
<TextView android:id="@+id/content_text"
50+
android:layout_width="match_parent"
51+
android:layout_height="match_parent"
52+
android:text="@string/sliding_pane_layout_summary"
53+
android:textAppearance="?android:attr/textAppearanceMedium"/>
54+
</ScrollView>
55+
</android.support.v4.widget.SlidingPaneLayout>
56+

samples/Support4Demos/res/values/strings.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,15 @@
155155

156156
<string name="sample_transport_controller_activity">Media/TransportController</string>
157157

158+
<string name="drawer_layout_support">Widget/Drawer layout</string>
159+
160+
<string name="drawer_layout_summary">This activity illustrates the use of sliding drawers. The drawer may be pulled out from the left edge with an edge swipe. If this demo is running on Ice Cream Sandwich or newer you may tap the icon at the left side of the action bar to open the drawer as well.</string>
161+
162+
<string name="drawer_open">Open navigation drawer</string>
163+
<string name="drawer_close">Close navigation drawer</string>
164+
165+
<string name="sliding_pane_layout_support">Widget/Sliding pane layout</string>
166+
167+
<string name="sliding_pane_layout_summary">This activity illustrates the use of sliding panes. The content pane may be slid to one side on narrow devices to reveal the left pane used to select content. Sliding panes can be used to fit a UI intended for wider screens in a smaller space. Tapping the Action Bar\'s Up button at the left side of the bar will navigate up in the hierarchy, represented by the left pane. If you rotate the device to landscape mode, on most devices you will see that both panes fit together side by side with no sliding necessary.</string>
168+
158169
</resources>

0 commit comments

Comments
 (0)