mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge branch '2.10-release'
This commit is contained in:
commit
b698d14172
5 changed files with 76 additions and 57 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package fr.free.nrw.commons.mwapi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class UploadResult {
|
||||
|
|
@ -34,12 +36,13 @@ public class UploadResult {
|
|||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UploadResult{" +
|
||||
"errorCode='" + errorCode + '\'' +
|
||||
", resultStatus='" + resultStatus + '\'' +
|
||||
", dateUploaded='" + dateUploaded.toString() + '\'' +
|
||||
", dateUploaded='" + (dateUploaded == null ? "" : dateUploaded.toString()) + '\'' +
|
||||
", imageUrl='" + imageUrl + '\'' +
|
||||
", canonicalFilename='" + canonicalFilename + '\'' +
|
||||
'}';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import android.widget.ProgressBar;
|
|||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
import com.pedrogomez.renderers.RVRendererAdapter;
|
||||
|
||||
|
|
@ -52,10 +51,9 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
RelativeLayout relativeLayout;
|
||||
@BindView(R.id.no_notification_background)
|
||||
RelativeLayout no_notification;
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
/* @BindView(R.id.swipe_bg)
|
||||
TextView swipe_bg;*/
|
||||
@BindView(R.id.no_notification_text)
|
||||
TextView noNotificationText;
|
||||
|
||||
@Inject
|
||||
NotificationController controller;
|
||||
|
||||
|
|
@ -63,8 +61,7 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
private NotificationWorkerFragment mNotificationWorkerFragment;
|
||||
private RVRendererAdapter<Notification> adapter;
|
||||
private List<Notification> notificationList;
|
||||
MenuItem notificationmenuitem;
|
||||
TextView nonotificationtext;
|
||||
MenuItem notificationMenuItem;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -75,7 +72,6 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
.findFragmentByTag(TAG_NOTIFICATION_WORKER_FRAGMENT);
|
||||
initListView();
|
||||
initDrawer();
|
||||
nonotificationtext = (TextView)this.findViewById(R.id.no_notification_text);
|
||||
setPageTitle();
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +156,7 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
no_notification.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
setAdapter(notificationList);
|
||||
} if (notificationmenuitem != null) {
|
||||
} if (notificationMenuItem != null) {
|
||||
}
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}, throwable -> {
|
||||
|
|
@ -178,7 +174,7 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_notifications, menu);
|
||||
notificationmenuitem = menu.findItem(R.id.archived);
|
||||
notificationMenuItem = menu.findItem(R.id.archived);
|
||||
setMenuItemTitle();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -262,18 +258,18 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
|
||||
private void setEmptyView() {
|
||||
if (getIntent().getStringExtra("title").equals("read")) {
|
||||
nonotificationtext.setText(R.string.no_archived_notification);
|
||||
noNotificationText.setText(R.string.no_archived_notification);
|
||||
}else {
|
||||
nonotificationtext.setText(R.string.no_notification);
|
||||
noNotificationText.setText(R.string.no_notification);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMenuItemTitle() {
|
||||
if (getIntent().getStringExtra("title").equals("read")) {
|
||||
notificationmenuitem.setTitle(R.string.menu_option_unread);
|
||||
notificationMenuItem.setTitle(R.string.menu_option_unread);
|
||||
|
||||
}else {
|
||||
notificationmenuitem.setTitle(R.string.menu_option_archived);
|
||||
notificationMenuItem.setTitle(R.string.menu_option_archived);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.daimajia.swipe.SwipeLayout;
|
||||
import com.nineoldandroids.view.ViewHelper;
|
||||
import com.pedrogomez.renderers.Renderer;
|
||||
import com.daimajia.swipe.SwipeLayout;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
|
@ -33,6 +35,8 @@ public class NotificationRenderer extends Renderer<Notification> {
|
|||
SwipeLayout swipeLayout;
|
||||
@BindView(R.id.bottom)
|
||||
LinearLayout bottomLayout;
|
||||
@BindView(R.id.notification_view)
|
||||
RelativeLayout notificationView;
|
||||
|
||||
private NotificationClicked listener;
|
||||
private boolean isarchivedvisible = false;
|
||||
|
|
@ -42,19 +46,27 @@ public class NotificationRenderer extends Renderer<Notification> {
|
|||
this.listener = listener;
|
||||
this.isarchivedvisible = isarchivedvisible;
|
||||
}
|
||||
|
||||
@OnClick(R.id.notification_view)
|
||||
void onNotificationClicked() {
|
||||
listener.notificationClicked(getContent());
|
||||
}
|
||||
|
||||
@OnClick(R.id.bottom)
|
||||
void onBottomLayoutClicked(){
|
||||
Notification notification = getContent();
|
||||
Timber.d("NotificationID: %s", notification.notificationId);
|
||||
listener.markNotificationAsRead(notification);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUpView(View rootView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void hookListeners(View rootView) {
|
||||
rootView.setOnClickListener(v -> listener.notificationClicked(getContent()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ public class ImageProcessingService {
|
|||
|
||||
/**
|
||||
* Checks for image geolocation
|
||||
* returns IMAGE_OK if the place is null or if the file doesn't contain a geolocation
|
||||
* @param filePath file to be checked
|
||||
* @return IMAGE_GEOLOCATION_DIFFERENT or IMAGE_OK
|
||||
*/
|
||||
|
|
@ -127,6 +128,11 @@ public class ImageProcessingService {
|
|||
}
|
||||
return Single.fromCallable(() -> filePath)
|
||||
.map(fileUtilsWrapper::getGeolocationOfFile)
|
||||
.flatMap(geoLocation -> imageUtilsWrapper.checkImageGeolocationIsDifferent(geoLocation, place.getLocation()));
|
||||
.flatMap(geoLocation -> {
|
||||
if (StringUtils.isNullOrWhiteSpace(geoLocation)) {
|
||||
return Single.just(ImageUtils.IMAGE_OK);
|
||||
}
|
||||
return imageUtilsWrapper.checkImageGeolocationIsDifferent(geoLocation, place.getLocation());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:foreground="?selectableItemBackground"
|
||||
android:minHeight="72dp">
|
||||
<com.daimajia.swipe.SwipeLayout android:layout_height="match_parent"
|
||||
|
|
@ -27,52 +28,53 @@
|
|||
android:layout_height="20dp" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/notification_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_message_black_24dp"
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_message_black_24dp"
|
||||
/>
|
||||
|
||||
/>
|
||||
<!--app:tint="@color/primaryDarkColor"-->
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
tools:text="2 June" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/time"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_toEndOf="@id/icon"
|
||||
android:layout_toLeftOf="@id/time"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:layout_toStartOf="@id/time"
|
||||
android:ellipsize="end"
|
||||
android:layout_alignParentTop="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:padding="12dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/time"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toStartOf="@id/time"
|
||||
android:layout_toLeftOf="@id/time"
|
||||
android:layout_toEndOf="@id/icon"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:ellipsize="end"
|
||||
android:padding="12dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
tools:text="You just made your tenth edit" />
|
||||
</RelativeLayout>
|
||||
</com.daimajia.swipe.SwipeLayout>
|
||||
</RelativeLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue