Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit ce318d1

Browse files
committed
Add Nav Drawer w/ Account Spinner and 5 menu items
1 parent 9aa5d78 commit ce318d1

File tree

15 files changed

+232
-197
lines changed

15 files changed

+232
-197
lines changed

AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
android:theme="@android:style/Theme.Dialog" />
5656
<activity
5757
android:name=".AndlyticsPreferenceActivity"
58+
android:theme="@style/Theme.Andlytics.ColoredStatusBar"
5859
android:label="@string/preferences" >
5960
<meta-data android:name="android.support.PARENT_ACTIVITY"
6061
android:value=".Main" />
@@ -66,6 +67,7 @@
6667
</activity>
6768
<activity
6869
android:name=".NotificationPreferenceActivity"
70+
android:theme="@style/Theme.Andlytics.ColoredStatusBar"
6971
android:label="@string/notifications" >
7072
<meta-data android:name="android.support.PARENT_ACTIVITY"
7173
android:value=".AndlyticsPreferenceActivity" />
@@ -75,6 +77,7 @@
7577
</activity>
7678
<activity
7779
android:name=".AccountSpecificPreferenceActivity"
80+
android:theme="@style/Theme.Andlytics.ColoredStatusBar"
7881
android:label="@string/notifications" >
7982
<meta-data android:name="android.support.PARENT_ACTIVITY"
8083
android:value=".AndlyticsPreferenceActivity" />

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ repositories {
1717
}
1818

1919
dependencies {
20-
compile "com.android.support:support-v4:22.2.1"
21-
compile "com.android.support:appcompat-v7:22.2.1"
20+
compile "com.android.support:design:22.2.1"
2221
compile "org.achartengine:achartengine:1.1.0"
2322
compile "ch.acra:acra:4.6.1"
2423
compile 'com.google.android.gms:play-services:4.0.30'

res/layout-land/account_selector_item.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
4+
**
5+
** Copyright 2008, The Android Open Source Project
6+
**
7+
** Licensed under the Apache License, Version 2.0 (the "License");
8+
** you may not use this file except in compliance with the License.
9+
** You may obtain a copy of the License at
10+
**
11+
** http://www.apache.org/licenses/LICENSE-2.0
12+
**
13+
** Unless required by applicable law or agreed to in writing, software
14+
** distributed under the License is distributed on an "AS IS" BASIS,
15+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
** See the License for the specific language governing permissions and
17+
** limitations under the License.
18+
*/
19+
-->
20+
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
21+
android:id="@android:id/text1"
22+
style="@android:style/Widget.Material.Light.DropDownItem.Spinner"
23+
android:singleLine="true"
24+
android:layout_width="match_parent"
25+
android:layout_height="@dimen/account_selector_height"
26+
android:ellipsize="marquee" />

res/layout/account_selector_item.xml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@android:id/text1"
34
android:layout_width="wrap_content"
45
android:layout_height="wrap_content"
5-
android:orientation="vertical" >
6-
7-
<TextView
8-
android:id="@+id/abs__action_bar_title"
9-
android:layout_width="wrap_content"
10-
android:layout_height="wrap_content"
11-
android:text="@string/app_name"
12-
android:textColor="@android:color/white"
13-
android:ellipsize="end"
14-
android:singleLine="true" />
15-
16-
<TextView
17-
android:id="@android:id/text1"
18-
android:layout_width="wrap_content"
19-
android:layout_height="wrap_content"
20-
android:layout_marginBottom="5dp"
21-
android:layout_marginTop="-3dp"
22-
android:textSize="14sp"
23-
android:ellipsize="end"
24-
android:singleLine="true"/>
25-
26-
</LinearLayout>
6+
android:textColor="@color/primary_text_default_material_dark"
7+
android:textSize="15sp"
8+
android:ellipsize="end"
9+
android:singleLine="true"
10+
android:paddingLeft="@dimen/spacing_small"
11+
android:paddingRight="@dimen/spacing_small"/>

res/layout/drawer_header.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="172dp"
5+
android:background="@color/lightBlue">
6+
7+
<Spinner
8+
android:id="@+id/account_selector"
9+
android:layout_width="match_parent"
10+
android:layout_height="@dimen/account_selector_height"
11+
android:paddingLeft="@dimen/spacing_large"
12+
android:paddingRight="@dimen/spacing_large"
13+
android:spinnerMode="dropdown"
14+
android:dropDownVerticalOffset="@dimen/account_selector_height"
15+
android:layout_alignParentBottom="true"/>
16+
17+
<ImageView
18+
android:id="@+id/manage_accounts"
19+
android:layout_width="48dp"
20+
android:layout_height="48dp"
21+
android:src="@drawable/icon_logout"
22+
android:layout_marginTop="@dimen/status_bar_height"
23+
android:padding="@dimen/spacing_medium"
24+
android:layout_alignParentTop="true"
25+
android:layout_alignParentRight="true"
26+
android:layout_alignParentEnd="true" />
27+
28+
</RelativeLayout>

res/layout/main.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
android:id="@+id/drawer_layout"
55
android:layout_width="match_parent"
6-
android:layout_height="match_parent">
6+
android:layout_height="match_parent"
7+
android:fitsSystemWindows="true">
78

89
<RelativeLayout
910
android:layout_width="fill_parent"
@@ -57,11 +58,13 @@
5758

5859
</RelativeLayout>
5960

60-
<FrameLayout
61-
android:id="@+id/leftDrawerHolder"
62-
android:layout_width="@dimen/nav_drawer_max_width"
61+
<android.support.design.widget.NavigationView
62+
android:id="@+id/navigation_view"
6363
android:layout_height="match_parent"
64+
android:layout_width="wrap_content"
6465
android:layout_gravity="start"
65-
android:background="@color/andBackground"/>
66+
android:maxWidth="@dimen/nav_drawer_max_width"
67+
app:headerLayout="@layout/drawer_header"
68+
app:menu="@menu/drawer"/>
6669

6770
</android.support.v4.widget.DrawerLayout>

res/menu/drawer.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<menu xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<item
5+
android:id="@+id/itemMainmenuImport"
6+
android:icon="@drawable/icon_import"
7+
android:title="@string/import_">
8+
</item>
9+
<item
10+
android:id="@+id/itemMainmenuExport"
11+
android:icon="@drawable/icon_export"
12+
android:title="@string/export_">
13+
</item>
14+
<item
15+
android:id="@+id/itemMainmenuAbout"
16+
android:icon="@drawable/icon_about"
17+
android:title="@string/about_title">
18+
</item>
19+
<item
20+
android:id="@+id/itemMainmenuPreferences"
21+
android:icon="@drawable/icon_about"
22+
android:title="@string/preferences">
23+
</item>
24+
25+
</menu>

res/menu/main_menu.xml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@
44
xmlns:app="http://schemas.android.com/apk/res-auto"
55
tools:ignore="AlwaysShowAction">
66

7-
<item
8-
android:id="@+id/itemMainmenuImport"
9-
android:icon="@drawable/icon_import"
10-
app:showAsAction="ifRoom|withText"
11-
android:title="@string/import_">
12-
</item>
13-
<item
14-
android:id="@+id/itemMainmenuExport"
15-
android:icon="@drawable/icon_export"
16-
app:showAsAction="ifRoom|withText"
17-
android:title="@string/export_">
18-
</item>
197
<item
208
android:id="@+id/itemMainmenuStatsMode"
219
android:icon="@drawable/icon_plusminus"
@@ -28,21 +16,5 @@
2816
app:showAsAction="always"
2917
android:title="@string/refresh">
3018
</item>
31-
<item
32-
android:id="@+id/itemMainmenuAbout"
33-
android:icon="@drawable/icon_about"
34-
app:showAsAction="never"
35-
android:title="@string/about_title">
36-
</item>
37-
<item
38-
android:id="@+id/itemMainmenuAccounts"
39-
app:showAsAction="never"
40-
android:title="@string/manage_accounts">
41-
</item>
42-
<item
43-
android:id="@+id/itemMainmenuPreferences"
44-
app:showAsAction="never"
45-
android:title="@string/preferences">
46-
</item>
4719

4820
</menu>

res/values-v19/dimens.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<dimen name="status_bar_height">24dp</dimen>
4+
</resources>

0 commit comments

Comments
 (0)