Browse Source

navigation drawer fixes

tags/v1.0.0
Robin Thoni 7 years ago
parent
commit
0b5bc5dac9

+ 4
- 0
app/src/main/java/com/rthoni/stssaguenay/ui/activities/MainActivity.java View File

@@ -59,6 +59,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
59 59
 
60 60
     private TextView _textUserEmail;
61 61
 
62
+    private TextView _textHelpMessage;
63
+
62 64
     private CallbackManager _callbackManager;
63 65
 
64 66
     @Override
@@ -91,6 +93,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
91 93
         View headerView = _navigationView.getHeaderView(0);
92 94
         _textUserName = ButterKnife.findById(headerView, R.id.textUserName);
93 95
         _textUserEmail = ButterKnife.findById(headerView, R.id.textUserEmail);
96
+        _textHelpMessage = ButterKnife.findById(headerView, R.id.text_help_message);
94 97
 
95 98
         _fab.setOnClickListener(new View.OnClickListener() {
96 99
             @Override
@@ -213,6 +216,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
213 216
         _textUserName.setVisibility(user == null ? View.GONE : View.VISIBLE);
214 217
         _textUserEmail.setText(user == null ? "" : user.getEmail());
215 218
         _textUserEmail.setVisibility(user == null ? View.GONE : View.VISIBLE);
219
+        _textHelpMessage.setVisibility(user == null ? View.VISIBLE : View.GONE);
216 220
     }
217 221
 
218 222
     public void onUserLogged(UserDbo userDbo)

+ 9
- 0
app/src/main/res/drawable/ic_archive_black_24dp.xml View File

@@ -0,0 +1,9 @@
1
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+        android:width="24dp"
3
+        android:height="24dp"
4
+        android:viewportWidth="24.0"
5
+        android:viewportHeight="24.0">
6
+    <path
7
+        android:fillColor="#FF000000"
8
+        android:pathData="M20.54,5.23l-1.39,-1.68C18.88,3.21 18.47,3 18,3H6c-0.47,0 -0.88,0.21 -1.16,0.55L3.46,5.23C3.17,5.57 3,6.02 3,6.5V19c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V6.5c0,-0.48 -0.17,-0.93 -0.46,-1.27zM12,17.5L6.5,12H10v-2h4v2h3.5L12,17.5zM5.12,5l0.81,-1h12l0.94,1H5.12z"/>
9
+</vector>

+ 9
- 0
app/src/main/res/drawable/ic_open_in_new_black_24dp.xml View File

@@ -0,0 +1,9 @@
1
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+        android:width="24dp"
3
+        android:height="24dp"
4
+        android:viewportWidth="24.0"
5
+        android:viewportHeight="24.0">
6
+    <path
7
+        android:fillColor="#FF000000"
8
+        android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z"/>
9
+</vector>

+ 9
- 0
app/src/main/res/drawable/ic_unarchive_black_24dp.xml View File

@@ -0,0 +1,9 @@
1
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+        android:width="24dp"
3
+        android:height="24dp"
4
+        android:viewportWidth="24.0"
5
+        android:viewportHeight="24.0">
6
+    <path
7
+        android:fillColor="#FF000000"
8
+        android:pathData="M20.55,5.22l-1.39,-1.68C18.88,3.21 18.47,3 18,3H6c-0.47,0 -0.88,0.21 -1.15,0.55L3.46,5.22C3.17,5.57 3,6.01 3,6.5V19c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V6.5c0,-0.49 -0.17,-0.93 -0.45,-1.28zM12,9.5l5.5,5.5H14v2h-4v-2H6.5L12,9.5zM5.12,5l0.82,-1h12l0.93,1H5.12z"/>
9
+</vector>

+ 31
- 9
app/src/main/res/layout/nav_header_main.xml View File

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
               android:layout_width="match_parent"
4 4
               android:layout_height="@dimen/nav_header_height"
5 5
               android:background="@drawable/side_nav_bar"
@@ -16,30 +16,52 @@
16 16
         android:id="@+id/imageView"
17 17
         android:layout_width="wrap_content"
18 18
         android:layout_height="wrap_content"
19
-        android:layout_marginTop="@dimen/nav_header_vertical_spacing"
20
-        android:src="@mipmap/ic_launcher" />
19
+        android:src="@mipmap/ic_launcher"
20
+        android:layout_alignParentTop="true"
21
+        android:layout_alignParentLeft="true"
22
+        android:layout_alignParentStart="true"/>
21 23
 
22 24
     <TextView
23 25
         android:layout_width="match_parent"
24 26
         android:layout_height="wrap_content"
25
-        android:layout_marginTop="@dimen/nav_header_vertical_spacing"
26 27
         android:id="@+id/textUserName"
27 28
         tools:text="Android Studio"
28 29
         android:textAppearance="@style/TextAppearance.AppCompat.Body1"
29
-        android:visibility="gone"  />
30
+        android:layout_below="@+id/imageView"
31
+        android:layout_alignParentLeft="true"
32
+        android:layout_alignParentStart="true"
33
+        android:visibility="gone"/>
30 34
 
31 35
     <TextView
32 36
         android:id="@+id/textUserEmail"
33 37
         android:layout_width="wrap_content"
34 38
         android:layout_height="wrap_content"
35 39
         tools:text="android.studio@android.com"
36
-        android:visibility="gone" />
40
+        android:layout_below="@+id/textUserName"
41
+        android:layout_alignParentLeft="true"
42
+        android:layout_alignParentStart="true"
43
+        android:layout_alignParentRight="true"
44
+        android:layout_alignParentEnd="true"
45
+        android:visibility="gone"/>
46
+
37 47
 
38 48
     <com.facebook.login.widget.LoginButton
39 49
         android:id="@+id/btnLogin"
40 50
         android:layout_width="wrap_content"
41 51
         android:layout_height="wrap_content"
42
-        android:layout_marginTop="@dimen/nav_header_vertical_spacing"
43
-        android:layout_gravity="center_horizontal" />
52
+        android:layout_gravity="center_horizontal"
53
+        android:layout_below="@+id/imageView"
54
+        android:layout_centerHorizontal="true"/>
55
+
56
+    <TextView
57
+        android:id="@+id/text_help_message"
58
+        android:layout_width="match_parent"
59
+        android:layout_height="wrap_content"
60
+        android:textAppearance="?android:attr/textAppearanceListItemSmall"
61
+        android:text="@string/drawer_help_message"
62
+        android:gravity="center"
63
+        android:layout_below="@+id/btnLogin"
64
+        android:layout_alignParentLeft="true"
65
+        android:layout_alignParentStart="true"/>
44 66
 
45
-</LinearLayout>
67
+</RelativeLayout>

+ 9
- 1
app/src/main/res/menu/activity_main_drawer.xml View File

@@ -1,8 +1,16 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <menu xmlns:android="http://schemas.android.com/apk/res/android">
3 3
 
4
+        <item
5
+            android:id="@+id/nav_restore"
6
+            android:icon="@drawable/ic_archive_black_24dp"
7
+            android:title="@string/restore" />
8
+        <item
9
+            android:id="@+id/nav_backup"
10
+            android:icon="@drawable/ic_unarchive_black_24dp"
11
+            android:title="@string/backup" />
4 12
         <item
5 13
             android:id="@+id/nav_logout"
6
-            android:icon="@mipmap/ic_menu_logout"
14
+            android:icon="@drawable/ic_open_in_new_black_24dp"
7 15
             android:title="@string/logout" />
8 16
 </menu>

+ 3
- 0
app/src/main/res/values/strings.xml View File

@@ -20,5 +20,8 @@
20 20
     <string name="favourite_remove">Remove favourite</string>
21 21
     <string name="favourite_remove_confirm">Do you really want to remove %1$s?</string>
22 22
     <string name="favourite_removed">%1$s has been removed</string>
23
+    <string name="drawer_help_message">Log in to access more features</string>
23 24
     <string name="logout">Logout</string>
25
+    <string name="restore">Restore settings</string>
26
+    <string name="backup">Backup settings</string>
24 27
 </resources>

Loading…
Cancel
Save