mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +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()); | ||||
|                 }); | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Josephine Lim
						Josephine Lim