Skip to content

Commit c039785

Browse files
author
maskara
committed
With icons in navigation drawer
1 parent 1a1fc14 commit c039785

35 files changed

+152
-49
lines changed

app/src/main/java/fr/free/nrw/commons/hamburger/NavigationBaseFragment.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.view.View;
1111
import android.view.ViewGroup;
1212
import android.widget.ImageView;
13+
import android.widget.LinearLayout;
1314
import android.widget.RelativeLayout;
1415
import android.widget.TextView;
1516
import android.widget.Toast;
@@ -31,22 +32,22 @@ public class NavigationBaseFragment extends Fragment {
3132
ImageView pictureOfTheDay;
3233

3334
@BindView(R.id.upload_item)
34-
TextView uploadItem;
35+
LinearLayout uploadItem;
3536

3637
@BindView(R.id.nearby_item)
37-
TextView nearbyItem;
38+
LinearLayout nearbyItem;
3839

3940
@BindView(R.id.about_item)
40-
TextView aboutItem;
41+
LinearLayout aboutItem;
4142

4243
@BindView(R.id.settings_item)
43-
TextView settingsItem;
44+
LinearLayout settingsItem;
4445

4546
@BindView(R.id.feedback_item)
46-
TextView feedbackItem;
47+
LinearLayout feedbackItem;
4748

4849
@BindView(R.id.logout_item)
49-
TextView logoutItem;
50+
LinearLayout logoutItem;
5051

5152
private DrawerLayout drawerLayout;
5253
private RelativeLayout drawerPane;
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<item android:state_pressed="true">
4+
<shape android:shape="rectangle">
5+
<solid android:color="@color/hamburger_item_pressed_color" />
6+
</shape>
7+
</item>
8+
9+
<item android:state_enabled="true">
10+
<shape android:shape="rectangle">
11+
<solid android:color="@android:color/transparent" />
12+
</shape>
13+
</item>
14+
15+
</selector>
Lines changed: 128 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:orientation="vertical" android:layout_width="match_parent"
3+
android:orientation="vertical"
4+
android:layout_width="match_parent"
45
android:layout_height="match_parent">
56

67
<ScrollView
@@ -27,65 +28,149 @@
2728
android:layout_height="0.5dp"
2829
android:background="@android:color/black"/>
2930

30-
<TextView
31+
<LinearLayout
3132
android:id="@+id/upload_item"
3233
android:layout_width="match_parent"
33-
android:layout_height="wrap_content"
34-
android:layout_margin="12dp"
35-
android:textSize="20dp"
36-
android:textStyle="bold"
37-
android:textColor="@android:color/black"
38-
android:text="@string/navigation_item_upload"/>
34+
android:layout_height="52dp"
35+
android:background="@drawable/hamburger_item_bg"
36+
android:gravity="center_vertical"
37+
android:orientation="horizontal">
38+
39+
<ImageView
40+
android:layout_width="wrap_content"
41+
android:layout_height="wrap_content"
42+
android:layout_marginLeft="20dp"
43+
android:src="@drawable/ic_file_upload_black_24dp" />
44+
45+
<TextView
46+
android:layout_width="wrap_content"
47+
android:layout_height="wrap_content"
48+
android:layout_marginLeft="12dp"
49+
android:text="@string/navigation_item_upload"
50+
android:letterSpacing="0.02"
51+
android:textColor="@color/main_background_dark"
52+
android:textSize="@dimen/hamburger_menu_item" />
53+
</LinearLayout>
3954

40-
<TextView
55+
<LinearLayout
4156
android:id="@+id/nearby_item"
4257
android:layout_width="match_parent"
43-
android:layout_height="wrap_content"
44-
android:layout_margin="12dp"
45-
android:textSize="20dp"
46-
android:textStyle="bold"
47-
android:textColor="@android:color/black"
48-
android:text="@string/navigation_item_nearby"/>
58+
android:layout_height="52dp"
59+
android:background="@drawable/hamburger_item_bg"
60+
android:gravity="center_vertical"
61+
android:orientation="horizontal">
62+
63+
<ImageView
64+
android:layout_width="wrap_content"
65+
android:layout_height="wrap_content"
66+
android:layout_marginLeft="20dp"
67+
android:src="@drawable/ic_location_on_black_24dp" />
4968

50-
<TextView
69+
<TextView
70+
android:layout_width="wrap_content"
71+
android:layout_height="wrap_content"
72+
android:layout_marginLeft="12dp"
73+
android:text="@string/navigation_item_nearby"
74+
android:letterSpacing="0.02"
75+
android:textColor="@color/main_background_dark"
76+
android:textSize="@dimen/hamburger_menu_item" />
77+
</LinearLayout>
78+
79+
<LinearLayout
5180
android:id="@+id/about_item"
5281
android:layout_width="match_parent"
53-
android:layout_height="wrap_content"
54-
android:layout_margin="12dp"
55-
android:textSize="20dp"
56-
android:textStyle="bold"
57-
android:textColor="@android:color/black"
58-
android:text="@string/navigation_item_about"/>
82+
android:layout_height="52dp"
83+
android:background="@drawable/hamburger_item_bg"
84+
android:gravity="center_vertical"
85+
android:orientation="horizontal">
5986

60-
<TextView
87+
<ImageView
88+
android:layout_width="wrap_content"
89+
android:layout_height="wrap_content"
90+
android:layout_marginLeft="20dp"
91+
android:src="@drawable/ic_info_outline_black_24dp" />
92+
93+
<TextView
94+
android:layout_width="wrap_content"
95+
android:layout_height="wrap_content"
96+
android:layout_marginLeft="12dp"
97+
android:text="@string/navigation_item_about"
98+
android:letterSpacing="0.02"
99+
android:textColor="@color/main_background_dark"
100+
android:textSize="@dimen/hamburger_menu_item" />
101+
</LinearLayout>
102+
103+
<LinearLayout
61104
android:id="@+id/settings_item"
62105
android:layout_width="match_parent"
63-
android:layout_height="wrap_content"
64-
android:layout_margin="12dp"
65-
android:textSize="20dp"
66-
android:textStyle="bold"
67-
android:textColor="@android:color/black"
68-
android:text="@string/navigation_item_settings"/>
106+
android:layout_height="52dp"
107+
android:background="@drawable/hamburger_item_bg"
108+
android:gravity="center_vertical"
109+
android:orientation="horizontal">
110+
111+
<ImageView
112+
android:layout_width="wrap_content"
113+
android:layout_height="wrap_content"
114+
android:layout_marginLeft="20dp"
115+
android:src="@drawable/ic_settings_black_24dp" />
116+
117+
<TextView
118+
android:layout_width="wrap_content"
119+
android:layout_height="wrap_content"
120+
android:layout_marginLeft="12dp"
121+
android:text="@string/navigation_item_settings"
122+
android:letterSpacing="0.02"
123+
android:textColor="@color/main_background_dark"
124+
android:textSize="@dimen/hamburger_menu_item" />
125+
</LinearLayout>
69126

70-
<TextView
127+
<LinearLayout
71128
android:id="@+id/feedback_item"
72129
android:layout_width="match_parent"
73-
android:layout_height="wrap_content"
74-
android:layout_margin="12dp"
75-
android:textSize="20dp"
76-
android:textStyle="bold"
77-
android:textColor="@android:color/black"
78-
android:text="@string/navigation_item_feedback"/>
130+
android:layout_height="52dp"
131+
android:background="@drawable/hamburger_item_bg"
132+
android:gravity="center_vertical"
133+
android:orientation="horizontal">
134+
135+
<ImageView
136+
android:layout_width="wrap_content"
137+
android:layout_height="wrap_content"
138+
android:layout_marginLeft="20dp"
139+
android:src="@drawable/ic_feedback_black_24dp" />
79140

80-
<TextView
141+
<TextView
142+
android:layout_width="wrap_content"
143+
android:layout_height="wrap_content"
144+
android:layout_marginLeft="12dp"
145+
android:text="@string/navigation_item_feedback"
146+
android:letterSpacing="0.02"
147+
android:textColor="@color/main_background_dark"
148+
android:textSize="@dimen/hamburger_menu_item" />
149+
</LinearLayout>
150+
151+
<LinearLayout
81152
android:id="@+id/logout_item"
82153
android:layout_width="match_parent"
83-
android:layout_height="wrap_content"
84-
android:layout_margin="12dp"
85-
android:textSize="20dp"
86-
android:textStyle="bold"
87-
android:textColor="@android:color/black"
88-
android:text="@string/navigation_item_logout"/>
154+
android:layout_height="52dp"
155+
android:background="@drawable/hamburger_item_bg"
156+
android:gravity="center_vertical"
157+
android:orientation="horizontal">
158+
159+
<ImageView
160+
android:layout_width="wrap_content"
161+
android:layout_height="wrap_content"
162+
android:layout_marginLeft="20dp"
163+
android:src="@drawable/ic_exit_to_app_black_24dp" />
164+
165+
<TextView
166+
android:layout_width="wrap_content"
167+
android:layout_height="wrap_content"
168+
android:layout_marginLeft="12dp"
169+
android:text="@string/navigation_item_logout"
170+
android:letterSpacing="0.02"
171+
android:textColor="@color/main_background_dark"
172+
android:textSize="@dimen/hamburger_menu_item" />
173+
</LinearLayout>
89174
</LinearLayout>
90175
</ScrollView>
91176
</LinearLayout>

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
<color name="upload_overlay_background_dark">#77000000</color>
2323
<color name="upload_overlay_background_light">#44000000</color>
2424

25+
<color name="hamburger_item_pressed_color">#f5f5f5</color>
2526
</resources>

app/src/main/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<dimen name="tiny_margin">4dp</dimen>
44
<dimen name="small_margin">8dp</dimen>
55
<dimen name="bottom_peak_height">240dp</dimen>
6+
<dimen name="hamburger_menu_item">18sp</dimen>
67
</resources>

0 commit comments

Comments
 (0)