Skip to content

Commit b698d14

Browse files
committed
Merge branch '2.10-release'
2 parents 6bedf54 + 083a7a8 commit b698d14

File tree

5 files changed

+76
-57
lines changed

5 files changed

+76
-57
lines changed

app/src/main/java/fr/free/nrw/commons/mwapi/UploadResult.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package fr.free.nrw.commons.mwapi;
22

3+
import org.jetbrains.annotations.NotNull;
4+
35
import java.util.Date;
46

57
public class UploadResult {
@@ -34,12 +36,13 @@ public class UploadResult {
3436
this.imageUrl = imageUrl;
3537
}
3638

39+
@NotNull
3740
@Override
3841
public String toString() {
3942
return "UploadResult{" +
4043
"errorCode='" + errorCode + '\'' +
4144
", resultStatus='" + resultStatus + '\'' +
42-
", dateUploaded='" + dateUploaded.toString() + '\'' +
45+
", dateUploaded='" + (dateUploaded == null ? "" : dateUploaded.toString()) + '\'' +
4346
", imageUrl='" + imageUrl + '\'' +
4447
", canonicalFilename='" + canonicalFilename + '\'' +
4548
'}';

app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import android.widget.RelativeLayout;
1818
import android.widget.TextView;
1919
import android.widget.Toast;
20-
import android.support.v7.widget.Toolbar;
2120

2221
import com.pedrogomez.renderers.RVRendererAdapter;
2322

@@ -52,19 +51,17 @@ public class NotificationActivity extends NavigationBaseActivity {
5251
RelativeLayout relativeLayout;
5352
@BindView(R.id.no_notification_background)
5453
RelativeLayout no_notification;
55-
@BindView(R.id.toolbar)
56-
Toolbar toolbar;
57-
/* @BindView(R.id.swipe_bg)
58-
TextView swipe_bg;*/
54+
@BindView(R.id.no_notification_text)
55+
TextView noNotificationText;
56+
5957
@Inject
6058
NotificationController controller;
6159

6260
private static final String TAG_NOTIFICATION_WORKER_FRAGMENT = "NotificationWorkerFragment";
6361
private NotificationWorkerFragment mNotificationWorkerFragment;
6462
private RVRendererAdapter<Notification> adapter;
6563
private List<Notification> notificationList;
66-
MenuItem notificationmenuitem;
67-
TextView nonotificationtext;
64+
MenuItem notificationMenuItem;
6865

6966
@Override
7067
protected void onCreate(Bundle savedInstanceState) {
@@ -75,7 +72,6 @@ protected void onCreate(Bundle savedInstanceState) {
7572
.findFragmentByTag(TAG_NOTIFICATION_WORKER_FRAGMENT);
7673
initListView();
7774
initDrawer();
78-
nonotificationtext = (TextView)this.findViewById(R.id.no_notification_text);
7975
setPageTitle();
8076
}
8177

@@ -160,7 +156,7 @@ private void addNotifications(boolean archived) {
160156
no_notification.setVisibility(View.VISIBLE);
161157
} else {
162158
setAdapter(notificationList);
163-
} if (notificationmenuitem != null) {
159+
} if (notificationMenuItem != null) {
164160
}
165161
progressBar.setVisibility(View.GONE);
166162
}, throwable -> {
@@ -178,7 +174,7 @@ private void addNotifications(boolean archived) {
178174
public boolean onCreateOptionsMenu(Menu menu) {
179175
MenuInflater inflater = getMenuInflater();
180176
inflater.inflate(R.menu.menu_notifications, menu);
181-
notificationmenuitem = menu.findItem(R.id.archived);
177+
notificationMenuItem = menu.findItem(R.id.archived);
182178
setMenuItemTitle();
183179
return true;
184180
}
@@ -262,18 +258,18 @@ private void setPageTitle() {
262258

263259
private void setEmptyView() {
264260
if (getIntent().getStringExtra("title").equals("read")) {
265-
nonotificationtext.setText(R.string.no_archived_notification);
261+
noNotificationText.setText(R.string.no_archived_notification);
266262
}else {
267-
nonotificationtext.setText(R.string.no_notification);
263+
noNotificationText.setText(R.string.no_notification);
268264
}
269265
}
270266

271267
private void setMenuItemTitle() {
272268
if (getIntent().getStringExtra("title").equals("read")) {
273-
notificationmenuitem.setTitle(R.string.menu_option_unread);
269+
notificationMenuItem.setTitle(R.string.menu_option_unread);
274270

275271
}else {
276-
notificationmenuitem.setTitle(R.string.menu_option_archived);
272+
notificationMenuItem.setTitle(R.string.menu_option_archived);
277273

278274
}
279275
}

app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import android.view.ViewGroup;
88
import android.widget.ImageView;
99
import android.widget.LinearLayout;
10+
import android.widget.RelativeLayout;
1011
import android.widget.TextView;
1112

13+
import com.daimajia.swipe.SwipeLayout;
1214
import com.nineoldandroids.view.ViewHelper;
1315
import com.pedrogomez.renderers.Renderer;
14-
import com.daimajia.swipe.SwipeLayout;
16+
1517
import butterknife.BindView;
1618
import butterknife.ButterKnife;
1719
import butterknife.OnClick;
@@ -33,6 +35,8 @@ public class NotificationRenderer extends Renderer<Notification> {
3335
SwipeLayout swipeLayout;
3436
@BindView(R.id.bottom)
3537
LinearLayout bottomLayout;
38+
@BindView(R.id.notification_view)
39+
RelativeLayout notificationView;
3640

3741
private NotificationClicked listener;
3842
private boolean isarchivedvisible = false;
@@ -42,19 +46,27 @@ public class NotificationRenderer extends Renderer<Notification> {
4246
this.listener = listener;
4347
this.isarchivedvisible = isarchivedvisible;
4448
}
49+
50+
@OnClick(R.id.notification_view)
51+
void onNotificationClicked() {
52+
listener.notificationClicked(getContent());
53+
}
54+
4555
@OnClick(R.id.bottom)
4656
void onBottomLayoutClicked(){
4757
Notification notification = getContent();
4858
Timber.d("NotificationID: %s", notification.notificationId);
4959
listener.markNotificationAsRead(notification);
5060
}
61+
5162
@Override
5263
protected void setUpView(View rootView) {
5364

5465
}
66+
5567
@Override
5668
protected void hookListeners(View rootView) {
57-
rootView.setOnClickListener(v -> listener.notificationClicked(getContent()));
69+
5870
}
5971

6072
@Override

app/src/main/java/fr/free/nrw/commons/upload/ImageProcessingService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ private Single<Integer> checkDarkImage(String filePath) {
117117

118118
/**
119119
* Checks for image geolocation
120+
* returns IMAGE_OK if the place is null or if the file doesn't contain a geolocation
120121
* @param filePath file to be checked
121122
* @return IMAGE_GEOLOCATION_DIFFERENT or IMAGE_OK
122123
*/
@@ -127,6 +128,11 @@ private Single<Integer> checkImageGeoLocation(Place place, String filePath) {
127128
}
128129
return Single.fromCallable(() -> filePath)
129130
.map(fileUtilsWrapper::getGeolocationOfFile)
130-
.flatMap(geoLocation -> imageUtilsWrapper.checkImageGeolocationIsDifferent(geoLocation, place.getLocation()));
131+
.flatMap(geoLocation -> {
132+
if (StringUtils.isNullOrWhiteSpace(geoLocation)) {
133+
return Single.just(ImageUtils.IMAGE_OK);
134+
}
135+
return imageUtilsWrapper.checkImageGeolocationIsDifferent(geoLocation, place.getLocation());
136+
});
131137
}
132138
}

app/src/main/res/layout/item_notification.xml

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
android:layout_width="match_parent"
33
android:layout_height="wrap_content"
44
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
56
android:foreground="?selectableItemBackground"
67
android:minHeight="72dp">
78
<com.daimajia.swipe.SwipeLayout android:layout_height="match_parent"
@@ -27,52 +28,53 @@
2728
android:layout_height="20dp" />
2829
</RelativeLayout>
2930
</LinearLayout>
31+
3032
<RelativeLayout
33+
android:id="@+id/notification_view"
3134
android:layout_width="match_parent"
3235
android:layout_height="match_parent">
3336

37+
<android.support.v7.widget.AppCompatImageView
38+
android:id="@+id/icon"
39+
android:layout_width="40dp"
40+
android:layout_height="40dp"
41+
android:layout_marginStart="16dp"
42+
android:layout_marginLeft="16dp"
43+
android:layout_marginTop="16dp"
44+
android:background="@android:color/white"
45+
android:scaleType="centerCrop"
46+
app:srcCompat="@drawable/ic_message_black_24dp"
3447

35-
<android.support.v7.widget.AppCompatImageView
36-
android:id="@+id/icon"
37-
android:layout_width="40dp"
38-
android:layout_height="40dp"
39-
android:layout_marginLeft="16dp"
40-
android:layout_marginStart="16dp"
41-
android:layout_marginTop="16dp"
42-
android:background="@android:color/white"
43-
android:scaleType="centerCrop"
44-
app:srcCompat="@drawable/ic_message_black_24dp"
48+
/>
4549

46-
/>
47-
<!--app:tint="@color/primaryDarkColor"-->
48-
<TextView
49-
android:id="@+id/time"
50-
android:layout_width="wrap_content"
51-
android:layout_height="wrap_content"
52-
android:layout_alignParentEnd="true"
53-
android:layout_alignParentRight="true"
54-
android:layout_marginLeft="16dp"
55-
android:layout_marginRight="16dp"
56-
android:layout_marginTop="16dp"
57-
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
58-
/>
50+
<TextView
51+
android:id="@+id/time"
52+
android:layout_width="wrap_content"
53+
android:layout_height="wrap_content"
54+
android:layout_alignParentEnd="true"
55+
android:layout_alignParentRight="true"
56+
android:layout_marginLeft="16dp"
57+
android:layout_marginTop="16dp"
58+
android:layout_marginRight="16dp"
59+
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
60+
tools:text="2 June" />
5961

60-
<TextView
61-
android:id="@+id/title"
62-
android:layout_width="match_parent"
63-
android:layout_height="wrap_content"
64-
android:layout_alignTop="@id/time"
65-
android:layout_marginLeft="16dp"
66-
android:layout_marginStart="16dp"
67-
android:layout_toEndOf="@id/icon"
68-
android:layout_toLeftOf="@id/time"
69-
android:layout_toRightOf="@id/icon"
70-
android:layout_toStartOf="@id/time"
71-
android:ellipsize="end"
72-
android:layout_alignParentTop="true"
73-
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
74-
android:padding="12dp"
75-
/>
62+
<TextView
63+
android:id="@+id/title"
64+
android:layout_width="match_parent"
65+
android:layout_height="wrap_content"
66+
android:layout_alignTop="@id/time"
67+
android:layout_alignParentTop="true"
68+
android:layout_marginStart="16dp"
69+
android:layout_marginLeft="16dp"
70+
android:layout_toStartOf="@id/time"
71+
android:layout_toLeftOf="@id/time"
72+
android:layout_toEndOf="@id/icon"
73+
android:layout_toRightOf="@id/icon"
74+
android:ellipsize="end"
75+
android:padding="12dp"
76+
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
77+
tools:text="You just made your tenth edit" />
7678
</RelativeLayout>
7779
</com.daimajia.swipe.SwipeLayout>
7880
</RelativeLayout>

0 commit comments

Comments
 (0)