Skip to content

Commit aec6282

Browse files
Merge pull request commons-app#613 from maskaravivek/navigationBeautify
With icons in navigation drawer
2 parents 8aa14e7 + c039785 commit aec6282

35 files changed

+152
-49
lines changed

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.view.View;
1313
import android.view.ViewGroup;
1414
import android.widget.ImageView;
15+
import android.widget.LinearLayout;
1516
import android.widget.RelativeLayout;
1617
import android.widget.TextView;
1718
import android.widget.Toast;
@@ -34,22 +35,22 @@ public class NavigationBaseFragment extends Fragment {
3435
ImageView pictureOfTheDay;
3536

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

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

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

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

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

5152
@BindView(R.id.logout_item)
52-
TextView logoutItem;
53+
LinearLayout logoutItem;
5354

5455
private DrawerLayout drawerLayout;
5556
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
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>
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

+1
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

+1
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)