mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Compare commits
	
		
			10 commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | d950f72193 | ||
|   | d97d40fbb9 | ||
|   | 741746892a | ||
|   | bff923135e | ||
|   | 63018fcbd5 | ||
|   | 461249fc30 | ||
|   | d7c2480174 | ||
|   | 05a9aa8575 | ||
|   | c961099013 | ||
|   | cf73e28623 | 
					 27 changed files with 353 additions and 358 deletions
				
			
		|  | @ -1,5 +1,11 @@ | ||||||
| # Wikimedia Commons for Android | # Wikimedia Commons for Android | ||||||
| 
 | 
 | ||||||
|  | ## v2.13 | ||||||
|  | - New media details UI, ability to zoom and pan around image | ||||||
|  | - Added suggestions for a place that needs photos if user uploads a photo that is near one of them | ||||||
|  | - Modifications and fixes to Nearby filters based on user feedback | ||||||
|  | - Multiple crash and bug fixes | ||||||
|  | 
 | ||||||
| ## v2.12.3 | ## v2.12.3 | ||||||
| - Fixed issue with EXIF data, including coords, being removed from uploads | - Fixed issue with EXIF data, including coords, being removed from uploads | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -125,8 +125,8 @@ android { | ||||||
| 
 | 
 | ||||||
|     defaultConfig { |     defaultConfig { | ||||||
|         //applicationId 'fr.free.nrw.commons' |         //applicationId 'fr.free.nrw.commons' | ||||||
|         versionCode 561 |         versionCode 709 | ||||||
|         versionName '2.12.3' |         versionName '2.13' | ||||||
|         setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName()) |         setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName()) | ||||||
| 
 | 
 | ||||||
|         minSdkVersion 19 |         minSdkVersion 19 | ||||||
|  |  | ||||||
|  | @ -123,9 +123,8 @@ public class CategoriesModel{ | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         //otherwise, search API for matching categories |         //otherwise, search API for matching categories | ||||||
|         //term passed as lower case to make search case-insensitive(taking only lower case for everything) |  | ||||||
|         return categoryClient |         return categoryClient | ||||||
|                 .searchCategoriesForPrefix(term.toLowerCase(), SEARCH_CATS_LIMIT) |                 .searchCategoriesForPrefix(term, SEARCH_CATS_LIMIT) | ||||||
|                 .map(name -> new CategoryItem(name, false)); |                 .map(name -> new CategoryItem(name, false)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -184,12 +183,11 @@ public class CategoriesModel{ | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Return category for single title |      * Return category for single title | ||||||
|      * title is converted to lower case to make search case-insensitive |  | ||||||
|      * @param title |      * @param title | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     private Observable<CategoryItem> getTitleCategories(String title) { |     private Observable<CategoryItem> getTitleCategories(String title) { | ||||||
|         return categoryClient.searchCategories(title.toLowerCase(), SEARCH_CATS_LIMIT) |         return categoryClient.searchCategories(title, SEARCH_CATS_LIMIT) | ||||||
|                 .map(name -> new CategoryItem(name, false)); |                 .map(name -> new CategoryItem(name, false)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,6 +3,10 @@ package fr.free.nrw.commons.category; | ||||||
| import android.os.Parcel; | import android.os.Parcel; | ||||||
| import android.os.Parcelable; | import android.os.Parcelable; | ||||||
| 
 | 
 | ||||||
|  | /** | ||||||
|  |  * Represents a Category Item. | ||||||
|  |  * Implemented as Parcelable so that its object could be parsed between activity components. | ||||||
|  |  */ | ||||||
| public class CategoryItem implements Parcelable { | public class CategoryItem implements Parcelable { | ||||||
|     private final String name; |     private final String name; | ||||||
|     private boolean selected; |     private boolean selected; | ||||||
|  | @ -24,28 +28,53 @@ public class CategoryItem implements Parcelable { | ||||||
|         this.selected = selected; |         this.selected = selected; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Reads from the received Parcel | ||||||
|  |      * @param in | ||||||
|  |      */ | ||||||
|     private CategoryItem(Parcel in) { |     private CategoryItem(Parcel in) { | ||||||
|         name = in.readString(); |         name = in.readString(); | ||||||
|         selected = in.readInt() == 1; |         selected = in.readInt() == 1; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets Name | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|     public String getName() { |     public String getName() { | ||||||
|         return name; |         return name; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Checks if that Category Item has been selected. | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|     public boolean isSelected() { |     public boolean isSelected() { | ||||||
|         return selected; |         return selected; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Selects the Category Item. | ||||||
|  |      * @param selected | ||||||
|  |      */ | ||||||
|     public void setSelected(boolean selected) { |     public void setSelected(boolean selected) { | ||||||
|         this.selected = selected; |         this.selected = selected; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Used by Parcelable | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|     @Override |     @Override | ||||||
|     public int describeContents() { |     public int describeContents() { | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Writes to the received Parcel | ||||||
|  |      * @param parcel | ||||||
|  |      * @param flags | ||||||
|  |      */ | ||||||
|     @Override |     @Override | ||||||
|     public void writeToParcel(Parcel parcel, int flags) { |     public void writeToParcel(Parcel parcel, int flags) { | ||||||
|         parcel.writeString(name); |         parcel.writeString(name); | ||||||
|  | @ -67,11 +96,17 @@ public class CategoryItem implements Parcelable { | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Returns hash code for current object | ||||||
|  |      */ | ||||||
|     @Override |     @Override | ||||||
|     public int hashCode() { |     public int hashCode() { | ||||||
|         return name.hashCode(); |         return name.hashCode(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Return String form of current object | ||||||
|  |      */ | ||||||
|     @Override |     @Override | ||||||
|     public String toString() { |     public String toString() { | ||||||
|         return "CategoryItem: '" + name + '\''; |         return "CategoryItem: '" + name + '\''; | ||||||
|  |  | ||||||
|  | @ -166,7 +166,7 @@ public class FilePicker implements Constants { | ||||||
|     public static List<UploadableFile> handleExternalImagesPicked(Intent data, Activity activity) { |     public static List<UploadableFile> handleExternalImagesPicked(Intent data, Activity activity) { | ||||||
|         try { |         try { | ||||||
|             return getFilesFromGalleryPictures(data, activity); |             return getFilesFromGalleryPictures(data, activity); | ||||||
|         } catch (IOException e) { |         } catch (IOException | SecurityException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|         } |         } | ||||||
|         return new ArrayList<>(); |         return new ArrayList<>(); | ||||||
|  | @ -207,7 +207,7 @@ public class FilePicker implements Constants { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private static List<UploadableFile> getFilesFromGalleryPictures(Intent data, Activity activity) throws IOException { |     private static List<UploadableFile> getFilesFromGalleryPictures(Intent data, Activity activity) throws IOException, SecurityException { | ||||||
|         List<UploadableFile> files = new ArrayList<>(); |         List<UploadableFile> files = new ArrayList<>(); | ||||||
|         ClipData clipData = data.getClipData(); |         ClipData clipData = data.getClipData(); | ||||||
|         if (clipData == null) { |         if (clipData == null) { | ||||||
|  |  | ||||||
|  | @ -104,12 +104,15 @@ class PickedFiles implements Constants { | ||||||
|                 }); |                 }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     static UploadableFile pickedExistingPicture(@NonNull Context context, Uri photoUri) throws IOException { |     static UploadableFile pickedExistingPicture(@NonNull Context context, Uri photoUri) throws IOException, SecurityException {// SecurityException for those file providers who share URI but forget to grant necessary permissions | ||||||
|         InputStream pictureInputStream = context.getContentResolver().openInputStream(photoUri); |         InputStream pictureInputStream = context.getContentResolver().openInputStream(photoUri); | ||||||
|         File directory = tempImageDirectory(context); |         File directory = tempImageDirectory(context); | ||||||
|         File photoFile = new File(directory, UUID.randomUUID().toString() + "." + getMimeType(context, photoUri)); |         File photoFile = new File(directory, UUID.randomUUID().toString() + "." + getMimeType(context, photoUri)); | ||||||
|         photoFile.createNewFile(); |         if (photoFile.createNewFile()) { | ||||||
|             writeToFile(pictureInputStream, photoFile); |             writeToFile(pictureInputStream, photoFile); | ||||||
|  |         } else { | ||||||
|  |             throw new IOException("could not create photoFile to write upon"); | ||||||
|  |         } | ||||||
|         return new UploadableFile(photoUri, photoFile); |         return new UploadableFile(photoUri, photoFile); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -105,6 +105,8 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment { | ||||||
| 
 | 
 | ||||||
|     @BindView(R.id.mediaDetailImageView) |     @BindView(R.id.mediaDetailImageView) | ||||||
|     SimpleDraweeView image; |     SimpleDraweeView image; | ||||||
|  |     @BindView(R.id.mediaDetailImageViewSpacer) | ||||||
|  |     LinearLayout imageSpacer; | ||||||
|     @BindView(R.id.mediaDetailTitle) |     @BindView(R.id.mediaDetailTitle) | ||||||
|     TextView title; |     TextView title; | ||||||
|     @BindView(R.id.mediaDetailDesc) |     @BindView(R.id.mediaDetailDesc) | ||||||
|  | @ -205,13 +207,15 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment { | ||||||
|         return view; |         return view; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @OnClick(R.id.mediaDetailImageView) |     @OnClick(R.id.mediaDetailImageViewSpacer) | ||||||
|     public void launchZoomActivity(View view) { |     public void launchZoomActivity(View view) { | ||||||
|  |         if (media.getImageUrl() != null) { | ||||||
|             Context ctx = view.getContext(); |             Context ctx = view.getContext(); | ||||||
|             ctx.startActivity( |             ctx.startActivity( | ||||||
|                 new Intent(ctx, ZoomableActivity.class).setData(Uri.parse(media.getImageUrl())) |                 new Intent(ctx, ZoomableActivity.class).setData(Uri.parse(media.getImageUrl())) | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void onResume() { |     public void onResume() { | ||||||
|  | @ -241,12 +245,21 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment { | ||||||
|         compositeDisposable.add(disposable); |         compositeDisposable.add(disposable); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * The imageSpacer is Basically a transparent overlay for the SimpleDraweeView | ||||||
|  |      * which holds the image to be displayed( moreover this image is out of | ||||||
|  |      * the scroll view ) | ||||||
|  |      * @param imageInfo used to calculate height of the ImageSpacer | ||||||
|  |      */ | ||||||
|     private void updateAspectRatio(ImageInfo imageInfo) { |     private void updateAspectRatio(ImageInfo imageInfo) { | ||||||
|         if (imageInfo != null) { |         if (imageInfo != null) { | ||||||
|             int finalHeight = (scrollView.getWidth()*imageInfo.getHeight()) / imageInfo.getWidth(); |             int finalHeight = (scrollView.getWidth()*imageInfo.getHeight()) / imageInfo.getWidth(); | ||||||
|             ViewGroup.LayoutParams params = image.getLayoutParams(); |             ViewGroup.LayoutParams params = image.getLayoutParams(); | ||||||
|  |             ViewGroup.LayoutParams spacerParams = imageSpacer.getLayoutParams(); | ||||||
|             params.height = finalHeight; |             params.height = finalHeight; | ||||||
|  |             spacerParams.height = finalHeight; | ||||||
|             image.setLayoutParams(params); |             image.setLayoutParams(params); | ||||||
|  |             imageSpacer.setLayoutParams(spacerParams); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,8 +1,6 @@ | ||||||
| package fr.free.nrw.commons.nearby; | package fr.free.nrw.commons.nearby; | ||||||
| 
 | 
 | ||||||
| import android.content.Context; | import android.content.Context; | ||||||
| import android.os.Parcel; |  | ||||||
| import android.os.Parcelable; |  | ||||||
| import android.util.AttributeSet; | import android.util.AttributeSet; | ||||||
| import android.widget.CompoundButton; | import android.widget.CompoundButton; | ||||||
| 
 | 
 | ||||||
|  | @ -12,7 +10,6 @@ import androidx.appcompat.widget.AppCompatCheckBox; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| import fr.free.nrw.commons.R; | import fr.free.nrw.commons.R; | ||||||
| import fr.free.nrw.commons.nearby.presenter.NearbyParentFragmentPresenter; |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Base on https://stackoverflow.com/a/40939367/3950497 answer. |  * Base on https://stackoverflow.com/a/40939367/3950497 answer. | ||||||
|  | @ -25,7 +22,7 @@ public class CheckBoxTriStates extends AppCompatCheckBox { | ||||||
| 
 | 
 | ||||||
|     static public final int CHECKED = 1; |     static public final int CHECKED = 1; | ||||||
| 
 | 
 | ||||||
|     private int state; |     private int state=UNKNOWN; | ||||||
| 
 | 
 | ||||||
|     private Callback callback; |     private Callback callback; | ||||||
| 
 | 
 | ||||||
|  | @ -64,12 +61,6 @@ public class CheckBoxTriStates extends AppCompatCheckBox { | ||||||
|      */ |      */ | ||||||
|     private OnCheckedChangeListener clientListener; |     private OnCheckedChangeListener clientListener; | ||||||
| 
 | 
 | ||||||
|     /** |  | ||||||
|      * This flag is needed to avoid accidentally changing the current {@link #state} when |  | ||||||
|      * {@link #onRestoreInstanceState(Parcelable)} calls {@link #setChecked(boolean)} |  | ||||||
|      * evoking our {@link #privateListener} and therefore changing the real state. |  | ||||||
|      */ |  | ||||||
|     private boolean restoring; |  | ||||||
| 
 | 
 | ||||||
|     public CheckBoxTriStates(Context context) { |     public CheckBoxTriStates(Context context) { | ||||||
|         super(context); |         super(context); | ||||||
|  | @ -91,7 +82,7 @@ public class CheckBoxTriStates extends AppCompatCheckBox { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public void setState(int state) { |     public void setState(int state) { | ||||||
|         if(!this.restoring && this.state != state) { |         if(this.state != state) { | ||||||
|             this.state = state; |             this.state = state; | ||||||
| 
 | 
 | ||||||
|             if(this.clientListener != null) { |             if(this.clientListener != null) { | ||||||
|  | @ -118,27 +109,6 @@ public class CheckBoxTriStates extends AppCompatCheckBox { | ||||||
|         super.setOnCheckedChangeListener(privateListener); |         super.setOnCheckedChangeListener(privateListener); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |  | ||||||
|     public Parcelable onSaveInstanceState() { |  | ||||||
|         Parcelable superState = super.onSaveInstanceState(); |  | ||||||
| 
 |  | ||||||
|         SavedState ss = new SavedState(superState); |  | ||||||
| 
 |  | ||||||
|         ss.state = state; |  | ||||||
| 
 |  | ||||||
|         return ss; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Override |  | ||||||
|     public void onRestoreInstanceState(Parcelable state) { |  | ||||||
|         this.restoring = true; // indicates that the ui is restoring its state |  | ||||||
|         SavedState ss = (SavedState) state; |  | ||||||
|         super.onRestoreInstanceState(ss.getSuperState()); |  | ||||||
|         setState(ss.state); |  | ||||||
|         requestLayout(); |  | ||||||
|         this.restoring = false; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     private void init() { |     private void init() { | ||||||
|         state = UNKNOWN; |         state = UNKNOWN; | ||||||
|         updateBtn(); |         updateBtn(); | ||||||
|  | @ -164,44 +134,4 @@ public class CheckBoxTriStates extends AppCompatCheckBox { | ||||||
|         setButtonDrawable(btnDrawable); |         setButtonDrawable(btnDrawable); | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     static class SavedState extends BaseSavedState { |  | ||||||
|         int state; |  | ||||||
| 
 |  | ||||||
|         SavedState(Parcelable superState) { |  | ||||||
|             super(superState); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         private SavedState(Parcel in) { |  | ||||||
|             super(in); |  | ||||||
|             state = in.readInt(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         @Override |  | ||||||
|         public void writeToParcel(Parcel out, int flags) { |  | ||||||
|             super.writeToParcel(out, flags); |  | ||||||
|             out.writeValue(state); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         @Override |  | ||||||
|         public String toString() { |  | ||||||
|             return "CheckboxTriState.SavedState{" |  | ||||||
|                     + Integer.toHexString(System.identityHashCode(this)) |  | ||||||
|                     + " state=" + state + "}"; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         @SuppressWarnings("hiding") |  | ||||||
|         public static final Parcelable.Creator<SavedState> CREATOR = |  | ||||||
|                 new Parcelable.Creator<SavedState>() { |  | ||||||
|                     @Override |  | ||||||
|                     public SavedState createFromParcel(Parcel in) { |  | ||||||
|                         return new SavedState(in); |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     @Override |  | ||||||
|                     public SavedState[] newArray(int size) { |  | ||||||
|                         return new SavedState[size]; |  | ||||||
|                     } |  | ||||||
|                 }; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | @ -41,4 +41,17 @@ public class NearbyAdapterFactory { | ||||||
|         rendererAdapter.notifyDataSetChanged(); |         rendererAdapter.notifyDataSetChanged(); | ||||||
|         rendererAdapter.diffUpdate(newPlaceList); |         rendererAdapter.diffUpdate(newPlaceList); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     public void clear(RVRendererAdapter<Place> rendererAdapter){ | ||||||
|  |         rendererAdapter.clear(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void add(Place place, RVRendererAdapter<Place> rendererAdapter){ | ||||||
|  |         rendererAdapter.add(place); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void update(RVRendererAdapter<Place> rendererAdapter){ | ||||||
|  |         rendererAdapter.notifyDataSetChanged(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -624,6 +624,18 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
|         adapterFactory.updateAdapterData(placeList, (RVRendererAdapter<Place>) rvNearbyList.getAdapter()); |         adapterFactory.updateAdapterData(placeList, (RVRendererAdapter<Place>) rvNearbyList.getAdapter()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public void clearNearbyList() { | ||||||
|  |         adapterFactory.clear((RVRendererAdapter<Place>) rvNearbyList.getAdapter()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void updateNearbyList() { | ||||||
|  |         adapterFactory.update((RVRendererAdapter<Place>) rvNearbyList.getAdapter()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void addPlaceToNearbyList(Place place) { | ||||||
|  |         adapterFactory.add(place, (RVRendererAdapter<Place>) rvNearbyList.getAdapter()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     @Override |     @Override | ||||||
|     public fr.free.nrw.commons.location.LatLng getLastLocation() { |     public fr.free.nrw.commons.location.LatLng getLastLocation() { | ||||||
|         return lastKnownLocation; |         return lastKnownLocation; | ||||||
|  | @ -636,7 +648,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean isCurrentLocationMarkerVisible() { |     public boolean isCurrentLocationMarkerVisible() { | ||||||
|         if (latLngBounds == null) { |         if (latLngBounds == null || currentLocationMarker==null) { | ||||||
|             Timber.d("Map projection bounds are null"); |             Timber.d("Map projection bounds are null"); | ||||||
|             return false; |             return false; | ||||||
|         } else { |         } else { | ||||||
|  | @ -1078,7 +1090,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void filterOutAllMarkers() { |     public void filterOutAllMarkers() { | ||||||
|         hideAllMArkers(); |         hideAllMarkers(); | ||||||
|  |         updateNearbyList(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -1089,6 +1102,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
|         for (MarkerPlaceGroup markerPlaceGroup : NearbyController.markerLabelList) { |         for (MarkerPlaceGroup markerPlaceGroup : NearbyController.markerLabelList) { | ||||||
|             updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |             updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); | ||||||
|         } |         } | ||||||
|  |         updateNearbyList(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -1100,65 +1114,44 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
|      * @param filterForAllNoneType true if we filter places with all none button |      * @param filterForAllNoneType true if we filter places with all none button | ||||||
|      */ |      */ | ||||||
|     @Override |     @Override | ||||||
|     public void filterMarkersByLabels(List<Label> selectedLabels, boolean displayExists, |     public void filterMarkersByLabels(List<Label> selectedLabels, | ||||||
|  |         boolean displayExists, | ||||||
|         boolean displayNeedsPhoto, |         boolean displayNeedsPhoto, | ||||||
|         boolean filterForPlaceState, |         boolean filterForPlaceState, | ||||||
|         boolean filterForAllNoneType) { |         boolean filterForAllNoneType) { | ||||||
|         if (selectedLabels.size() == 0 && filterForPlaceState) { // If nothing is selected, display all |  | ||||||
|             // remove the previous markers before updating them |  | ||||||
|             hideAllMArkers(); |  | ||||||
|             for (MarkerPlaceGroup markerPlaceGroup : NearbyController.markerLabelList) { |  | ||||||
|                 if (displayExists && displayNeedsPhoto) { |  | ||||||
|                     // Exists and needs photo |  | ||||||
|                     if (markerPlaceGroup.getPlace().destroyed.trim().isEmpty() && markerPlaceGroup.getPlace().pic.trim().isEmpty()) { |  | ||||||
|                         updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |  | ||||||
|                     } |  | ||||||
|                 } else if (displayExists && !displayNeedsPhoto) { |  | ||||||
|                     // Exists and all included needs and doesn't needs photo |  | ||||||
|                     if (markerPlaceGroup.getPlace().destroyed.trim().isEmpty()) { |  | ||||||
|                         updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |  | ||||||
|                     } |  | ||||||
|                 } else if (!displayExists && displayNeedsPhoto) { |  | ||||||
|                     // All and only needs photo |  | ||||||
|                     if (markerPlaceGroup.getPlace().pic.trim().isEmpty()) { |  | ||||||
|                         updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |  | ||||||
|                     } |  | ||||||
|                 } else if (!displayExists && !displayNeedsPhoto) { |  | ||||||
|                     // all |  | ||||||
|                     updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |  | ||||||
|                 } |  | ||||||
| 
 | 
 | ||||||
|             } |         hideAllMarkers(); | ||||||
|         } else { |  | ||||||
|             // First remove all the markers |  | ||||||
|             hideAllMArkers(); |  | ||||||
|         for (MarkerPlaceGroup markerPlaceGroup : NearbyController.markerLabelList) { |         for (MarkerPlaceGroup markerPlaceGroup : NearbyController.markerLabelList) { | ||||||
|                 for (Label label : selectedLabels) { |             Place place = markerPlaceGroup.getPlace(); | ||||||
|                     if (markerPlaceGroup.getPlace().getLabel().toString().equals(label.toString())) { | 
 | ||||||
|  |             // When label filter is engaged | ||||||
|  |             // then compare it against place's label | ||||||
|  |             if (selectedLabels != null && (selectedLabels.size() != 0 || !filterForPlaceState) | ||||||
|  |                 && !selectedLabels.contains(place.getLabel())) { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
| 
 | 
 | ||||||
|             if (displayExists && displayNeedsPhoto) { |             if (displayExists && displayNeedsPhoto) { | ||||||
|                 // Exists and needs photo |                 // Exists and needs photo | ||||||
|                             if (markerPlaceGroup.getPlace().destroyed.trim().isEmpty() && markerPlaceGroup.getPlace().pic.trim().isEmpty()) { |                 if (place.destroyed.trim().isEmpty() && place.pic.trim().isEmpty()) { | ||||||
|                                 updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |                     updateMarker(markerPlaceGroup.getIsBookmarked(), place, NearbyController.currentLocation); | ||||||
|                 } |                 } | ||||||
|             } else if (displayExists && !displayNeedsPhoto) { |             } else if (displayExists && !displayNeedsPhoto) { | ||||||
|                 // Exists and all included needs and doesn't needs photo |                 // Exists and all included needs and doesn't needs photo | ||||||
|                             if (markerPlaceGroup.getPlace().destroyed.trim().isEmpty()) { |                 if (place.destroyed.trim().isEmpty()) { | ||||||
|                                 updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |                     updateMarker(markerPlaceGroup.getIsBookmarked(), place, NearbyController.currentLocation); | ||||||
|                 } |                 } | ||||||
|             } else if (!displayExists && displayNeedsPhoto) { |             } else if (!displayExists && displayNeedsPhoto) { | ||||||
|                 // All and only needs photo |                 // All and only needs photo | ||||||
|                             if (markerPlaceGroup.getPlace().pic.trim().isEmpty()) { |                 if (place.pic.trim().isEmpty()) { | ||||||
|                                 updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |                     updateMarker(markerPlaceGroup.getIsBookmarked(), place, NearbyController.currentLocation); | ||||||
|                 } |                 } | ||||||
|             } else if (!displayExists && !displayNeedsPhoto) { |             } else if (!displayExists && !displayNeedsPhoto) { | ||||||
|                 // all |                 // all | ||||||
|                             updateMarker(markerPlaceGroup.getIsBookmarked(), markerPlaceGroup.getPlace(), NearbyController.currentLocation); |                 updateMarker(markerPlaceGroup.getIsBookmarked(), place, NearbyController.currentLocation); | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         updateNearbyList(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | @ -1173,6 +1166,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
|      * @param curLatLng current location |      * @param curLatLng current location | ||||||
|      */ |      */ | ||||||
|     public void updateMarker(boolean isBookmarked, Place place, @Nullable fr.free.nrw.commons.location.LatLng curLatLng) { |     public void updateMarker(boolean isBookmarked, Place place, @Nullable fr.free.nrw.commons.location.LatLng curLatLng) { | ||||||
|  |         addPlaceToNearbyList(place); | ||||||
|  | 
 | ||||||
|         VectorDrawableCompat vectorDrawable; |         VectorDrawableCompat vectorDrawable; | ||||||
|         if (isBookmarked) { |         if (isBookmarked) { | ||||||
|             vectorDrawable = VectorDrawableCompat.create( |             vectorDrawable = VectorDrawableCompat.create( | ||||||
|  | @ -1219,10 +1214,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
|      * but it is transparent more than grey(as the name of the icon might suggest) |      * but it is transparent more than grey(as the name of the icon might suggest) | ||||||
|      * since grey icon may lead the users to believe that it is disabled or prohibited contribution |      * since grey icon may lead the users to believe that it is disabled or prohibited contribution | ||||||
|      */ |      */ | ||||||
|     private void hideAllMArkers() { | 
 | ||||||
|         if(currentLocationMarker==null){ |     private void hideAllMarkers() { | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         VectorDrawableCompat vectorDrawable; |         VectorDrawableCompat vectorDrawable; | ||||||
|         vectorDrawable = VectorDrawableCompat.create( |         vectorDrawable = VectorDrawableCompat.create( | ||||||
|                 getContext().getResources(), R.drawable.ic_custom_greyed_out_marker, getContext().getTheme()); |                 getContext().getResources(), R.drawable.ic_custom_greyed_out_marker, getContext().getTheme()); | ||||||
|  | @ -1233,6 +1226,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         addCurrentLocationMarker(NearbyController.currentLocation); |         addCurrentLocationMarker(NearbyController.currentLocation); | ||||||
|  |         clearNearbyList(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private void addNearbyMarkersToMapBoxMap(List<NearbyBaseMarker> nearbyBaseMarkers, Marker selectedMarker) { |     private void addNearbyMarkersToMapBoxMap(List<NearbyBaseMarker> nearbyBaseMarkers, Marker selectedMarker) { | ||||||
|  |  | ||||||
|  | @ -284,7 +284,11 @@ public class NearbyParentFragmentPresenter | ||||||
|                     nearbyParentFragmentView.setRecyclerViewAdapterItemsGreyedOut(); |                     nearbyParentFragmentView.setRecyclerViewAdapterItemsGreyedOut(); | ||||||
|                     break; |                     break; | ||||||
|                 case CHECKED: |                 case CHECKED: | ||||||
|                     nearbyParentFragmentView.displayAllMarkers(); |                     // Despite showing all labels NearbyFilterState still should be applied | ||||||
|  |                     nearbyParentFragmentView.filterMarkersByLabels(selectedLabels, | ||||||
|  |                         NearbyFilterState.getInstance().isExistsSelected(), | ||||||
|  |                         NearbyFilterState.getInstance().isNeedPhotoSelected(), | ||||||
|  |                         filterForPlaceState, false); | ||||||
|                     nearbyParentFragmentView.setRecyclerViewAdapterAllSelected(); |                     nearbyParentFragmentView.setRecyclerViewAdapterAllSelected(); | ||||||
|                     break; |                     break; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -26,7 +26,8 @@ public class CommonsDateUtil { | ||||||
|      * @return timestamp |      * @return timestamp | ||||||
|      */ |      */ | ||||||
|         public static SimpleDateFormat getIso8601DateFormatTimestamp() { |         public static SimpleDateFormat getIso8601DateFormatTimestamp() { | ||||||
|         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT); |             final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX", | ||||||
|  |                 Locale.ROOT); | ||||||
|             simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); |             simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); | ||||||
|             return simpleDateFormat; |             return simpleDateFormat; | ||||||
|     } |     } | ||||||
|  |  | ||||||
							
								
								
									
										9
									
								
								app/src/main/res/drawable/bg_copy_wikitext_button.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/src/main/res/drawable/bg_copy_wikitext_button.xml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | ||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <shape | ||||||
|  |     xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     android:shape="rectangle"> | ||||||
|  |     <solid | ||||||
|  |         android:color="@color/button_blue" /> | ||||||
|  |     <corners | ||||||
|  |         android:radius="@dimen/progressbar_stroke" /> | ||||||
|  | </shape> | ||||||
|  | @ -9,12 +9,9 @@ | ||||||
|         <shape |         <shape | ||||||
|             android:shape="rectangle"> |             android:shape="rectangle"> | ||||||
|             <solid |             <solid | ||||||
|                 android:color="@color/deleteButton"/> |                 android:color="?attr/mediaDetailNominationBackground"/> | ||||||
|             <corners |             <corners | ||||||
|                 android:radius="@dimen/progressbar_stroke" /> |                 android:radius="@dimen/progressbar_stroke" /> | ||||||
|             <stroke |  | ||||||
|                 android:width="5px" |  | ||||||
|                 android:color="@color/deleteRed" /> |  | ||||||
|         </shape> |         </shape> | ||||||
|     </item> |     </item> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										9
									
								
								app/src/main/res/drawable/ic_info_outline_dark_24dp.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/src/main/res/drawable/ic_info_outline_dark_24dp.xml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | ||||||
|  | <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |         android:width="@dimen/half_standard_height" | ||||||
|  |         android:height="@dimen/half_standard_height" | ||||||
|  |         android:viewportWidth="24.0" | ||||||
|  |         android:viewportHeight="24.0"> | ||||||
|  |     <path | ||||||
|  |         android:fillColor="@color/button_background_dark" | ||||||
|  |         android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/> | ||||||
|  | </vector> | ||||||
							
								
								
									
										9
									
								
								app/src/main/res/drawable/ic_map_dark_24dp.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/src/main/res/drawable/ic_map_dark_24dp.xml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | ||||||
|  | <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |         android:width="@dimen/half_standard_height" | ||||||
|  |         android:height="@dimen/half_standard_height" | ||||||
|  |         android:viewportWidth="24.0" | ||||||
|  |         android:viewportHeight="24.0"> | ||||||
|  |     <path | ||||||
|  |         android:fillColor="@color/button_background_dark" | ||||||
|  |         android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/> | ||||||
|  | </vector> | ||||||
|  | @ -10,15 +10,15 @@ | ||||||
|         android:id="@+id/mediaDetailCategoryItemText" |         android:id="@+id/mediaDetailCategoryItemText" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:background="?attr/subBackground" |         android:background="?attr/mainBackground" | ||||||
|         android:foreground="?attr/selectableItemBackground" |         android:foreground="?attr/selectableItemBackground" | ||||||
|         android:gravity="center_vertical" |         android:gravity="center_vertical" | ||||||
|         android:minHeight="@dimen/overflow_button_dimen" |         android:minHeight="@dimen/overflow_button_dimen" | ||||||
|         android:padding="@dimen/quarter_standard_height" |         android:padding="@dimen/small_gap" | ||||||
|         android:textColor="@android:color/white" |         android:textColor="?attr/mediaDetailsText" | ||||||
|         android:textSize="@dimen/description_text_size" |         android:textSize="@dimen/description_text_size" | ||||||
|         app:drawablePadding="@dimen/small_gap" |         app:drawablePadding="@dimen/tiny_gap" | ||||||
|         app:drawableStart="@drawable/ic_info_outline_24dp" |         app:drawableStart="?attr/iconInfo24" | ||||||
|         /> |         /> | ||||||
| 
 | 
 | ||||||
| </LinearLayout> | </LinearLayout> | ||||||
|  |  | ||||||
|  | @ -19,11 +19,10 @@ | ||||||
|         /> |         /> | ||||||
| 
 | 
 | ||||||
|     <com.facebook.drawee.view.SimpleDraweeView |     <com.facebook.drawee.view.SimpleDraweeView | ||||||
|         android:id="@+id/mediaDetailImage" |         android:id="@+id/mediaDetailImageView" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="match_parent" |         android:layout_height="@dimen/dimen_250" | ||||||
|         app:actualImageScaleType="centerCrop" |         app:actualImageScaleType="none" /> | ||||||
|         /> |  | ||||||
| 
 | 
 | ||||||
|     <ScrollView |     <ScrollView | ||||||
|         android:id="@+id/mediaDetailScrollView" |         android:id="@+id/mediaDetailScrollView" | ||||||
|  | @ -40,257 +39,200 @@ | ||||||
| 
 | 
 | ||||||
|             <!-- Placeholder. Height gets set at runtime based on container size; the initial value is a hack to keep |             <!-- Placeholder. Height gets set at runtime based on container size; the initial value is a hack to keep | ||||||
|                  the detail info offscreen until it's placed properly. May be a better way to do this. --> |                  the detail info offscreen until it's placed properly. May be a better way to do this. --> | ||||||
|             <com.facebook.drawee.view.SimpleDraweeView | 
 | ||||||
|                 android:id="@+id/mediaDetailImageView" |             <LinearLayout | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="match_parent" | ||||||
|                 android:layout_height="@dimen/dimen_250" |                 android:layout_height="@dimen/dimen_250" | ||||||
|                 app:actualImageScaleType="none" /> |                 android:orientation="vertical" | ||||||
|  |                 android:background="@android:color/transparent" | ||||||
|  |                 android:id="@+id/mediaDetailImageViewSpacer" | ||||||
|  |                 /> | ||||||
| 
 | 
 | ||||||
|             <LinearLayout |             <LinearLayout | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="match_parent" | ||||||
|                 android:layout_height="wrap_content" |                 android:layout_height="wrap_content" | ||||||
|                 android:background="?attr/fragmentCategorisationBackground" |                 android:background="?attr/mainBackground" | ||||||
|                 android:orientation="vertical" |                 android:orientation="vertical"> | ||||||
|                 android:padding="@dimen/standard_gap"> |  | ||||||
| 
 | 
 | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:background="?attr/subBackground" |                     android:background="@color/primaryDarkColor" | ||||||
|                     android:orientation="vertical" |                     android:orientation="horizontal" | ||||||
|                     android:padding="@dimen/standard_gap"> |                     android:padding="@dimen/quarter_standard_height"> | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelTitle" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:layout_height="match_parent" | ||||||
|                         android:text="@string/media_detail_title" |                         android:text="@string/media_detail_title" /> | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|  |                         style="@style/MediaDetailTextBody" | ||||||
|                         android:id="@+id/mediaDetailTitle" |                         android:id="@+id/mediaDetailTitle" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |  | ||||||
|                         android:layout_gravity="start" |  | ||||||
|                         android:background="?attr/subBackground" |  | ||||||
|                         android:padding="@dimen/small_gap" |  | ||||||
|                         android:textColor="@android:color/white" |                         android:textColor="@android:color/white" | ||||||
|                         android:textSize="@dimen/description_text_size" |                         android:layout_height="match_parent" | ||||||
|                         tools:text="Title of the media" /> |                         tools:text="Title of the media" /> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="@dimen/small_gap" /> |  | ||||||
| 
 |  | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|  |                     style="@style/MediaDetailContainer" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:id="@+id/authorLinearLayout" |                     android:id="@+id/authorLinearLayout" | ||||||
|                     android:background="?attr/subBackground" |                     android:orientation="horizontal"> | ||||||
|                     android:orientation="vertical" |  | ||||||
|                     android:padding="@dimen/standard_gap"> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelGeneric" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:layout_height="match_parent" | ||||||
|                         android:text="@string/media_detail_author" |                         android:text="@string/media_detail_author" /> | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|  |                         style="@style/MediaDetailTextBody" | ||||||
|                         android:id="@+id/mediaDetailAuthor" |                         android:id="@+id/mediaDetailAuthor" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="match_parent" | ||||||
|                         android:layout_gravity="start" |  | ||||||
|                         android:background="?attr/subBackground" |  | ||||||
|                         android:padding="@dimen/small_gap" |  | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/description_text_size" |  | ||||||
|                         tools:text="Media author user name goes here." /> |                         tools:text="Media author user name goes here." /> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="@dimen/small_gap" /> |  | ||||||
| 
 |  | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|  |                     style="@style/MediaDetailContainer" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:background="?attr/subBackground" |                     android:orientation="horizontal"> | ||||||
|                     android:orientation="vertical" |  | ||||||
|                     android:padding="@dimen/standard_gap"> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelGeneric" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:layout_height="match_parent" | ||||||
|                         android:text="@string/media_detail_description" |                         android:text="@string/media_detail_description" /> | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <fr.free.nrw.commons.ui.widget.HtmlTextView |                     <fr.free.nrw.commons.ui.widget.HtmlTextView | ||||||
|                         android:id="@+id/mediaDetailDesc" |                         android:id="@+id/mediaDetailDesc" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="match_parent" | ||||||
|  |                         android:layout_weight="70" | ||||||
|                         android:layout_gravity="start" |                         android:layout_gravity="start" | ||||||
|                         android:background="?attr/subBackground" |  | ||||||
|                         android:padding="@dimen/small_gap" |                         android:padding="@dimen/small_gap" | ||||||
|                         android:textColor="@android:color/white" |                         android:textColor="?attr/mediaDetailsText" | ||||||
|                         android:textSize="@dimen/description_text_size" |                         android:textSize="@dimen/description_text_size" | ||||||
|                         tools:text="Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though." /> |                         tools:text="Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though." /> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |                 <View | ||||||
|  |                     android:background="?attr/mediaDetailSpacerColor" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="@dimen/small_gap" /> |                     android:layout_height="@dimen/tiny_gap"/> | ||||||
| 
 | 
 | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|  |                     style="@style/MediaDetailContainer" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:background="?attr/subBackground" |                     android:orientation="horizontal"> | ||||||
|                     android:orientation="vertical" |  | ||||||
|                     android:padding="@dimen/standard_gap"> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelGeneric" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:layout_height="match_parent" | ||||||
|                         android:text="@string/media_detail_license" |                         android:text="@string/media_detail_license" /> | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <fr.free.nrw.commons.ui.widget.CompatTextView |                     <fr.free.nrw.commons.ui.widget.CompatTextView | ||||||
|                         android:id="@+id/mediaDetailLicense" |                         android:id="@+id/mediaDetailLicense" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="match_parent" | ||||||
|  |                         android:layout_weight="70" | ||||||
|                         android:layout_gravity="start" |                         android:layout_gravity="start" | ||||||
|                         android:background="?attr/subBackground" |  | ||||||
|                         android:foreground="?attr/selectableItemBackground" |                         android:foreground="?attr/selectableItemBackground" | ||||||
|                         android:gravity="center_vertical" |                         android:gravity="center_vertical" | ||||||
|                         android:padding="@dimen/small_gap" |                         android:padding="@dimen/small_gap" | ||||||
|                         android:textColor="@android:color/white" |                         android:textColor="?attr/mediaDetailsText" | ||||||
|                         android:textSize="@dimen/description_text_size" |                         android:textSize="@dimen/description_text_size" | ||||||
|                         app:drawablePadding="@dimen/tiny_gap" |                         app:drawablePadding="@dimen/tiny_gap" | ||||||
|                         app:drawableStart="@drawable/ic_info_outline_24dp" |                         app:drawableStart="?attr/iconInfo24" | ||||||
|                         tools:text="License link" /> |                         tools:text="License link" /> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="@dimen/small_gap" /> |  | ||||||
| 
 |  | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|  |                     style="@style/MediaDetailContainer" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:background="?attr/subBackground" |                     android:orientation="horizontal"> | ||||||
|                     android:orientation="vertical" |  | ||||||
|                     android:padding="@dimen/standard_gap"> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelGeneric" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:layout_height="match_parent" | ||||||
|                         android:text="@string/media_detail_coordinates" |                         android:text="@string/media_detail_coordinates" /> | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <fr.free.nrw.commons.ui.widget.CompatTextView |                     <fr.free.nrw.commons.ui.widget.CompatTextView | ||||||
|                         android:id="@+id/mediaDetailCoordinates" |                         android:id="@+id/mediaDetailCoordinates" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="match_parent" | ||||||
|  |                         android:layout_weight="70" | ||||||
|                         android:layout_gravity="start" |                         android:layout_gravity="start" | ||||||
|                         android:background="?attr/subBackground" |  | ||||||
|                         android:foreground="?attr/selectableItemBackground" |                         android:foreground="?attr/selectableItemBackground" | ||||||
|                         android:gravity="center_vertical" |                         android:gravity="center_vertical" | ||||||
|                         android:padding="@dimen/small_gap" |                         android:padding="@dimen/small_gap" | ||||||
|                         android:textColor="@android:color/white" |                         android:textColor="?attr/mediaDetailsText" | ||||||
|                         android:textSize="@dimen/description_text_size" |                         android:textSize="@dimen/description_text_size" | ||||||
|                         app:drawablePadding="@dimen/tiny_gap" |                         app:drawablePadding="@dimen/tiny_gap" | ||||||
|                         app:drawableStart="@drawable/ic_map_white_24dp" |                         app:drawableStart="?attr/iconMap24" | ||||||
|                         tools:text="Coordinates link" /> |                         tools:text="Coordinates link" /> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="@dimen/small_gap" /> |  | ||||||
| 
 |  | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|  |                     style="@style/MediaDetailContainer" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:background="?attr/subBackground" |                     android:orientation="horizontal" | ||||||
|                     android:orientation="vertical" |  | ||||||
|                     android:padding="@dimen/standard_gap" |  | ||||||
|                     android:textStyle="bold"> |                     android:textStyle="bold"> | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelGeneric" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_gravity="start" |                         android:layout_height="match_parent" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:text="@string/detail_panel_cats_label" /> | ||||||
|                         android:text="@string/detail_panel_cats_label" |  | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <LinearLayout |                     <LinearLayout | ||||||
|                         android:id="@+id/mediaDetailCategoryContainer" |                         android:id="@+id/mediaDetailCategoryContainer" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="match_parent" | ||||||
|  |                         android:layout_weight="70" | ||||||
|                         android:orientation="vertical" /> |                         android:orientation="vertical" /> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="@dimen/small_gap" /> |  | ||||||
| 
 |  | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|  |                     style="@style/MediaDetailContainer" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:background="?attr/subBackground" |                     android:orientation="horizontal"> | ||||||
|                     android:orientation="vertical" |  | ||||||
|                     android:padding="@dimen/standard_gap"> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelGeneric" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:layout_height="match_parent" | ||||||
|                         android:text="@string/media_detail_uploaded_date" |                         android:text="@string/media_detail_uploaded_date" /> | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|  |                         style="@style/MediaDetailTextBody" | ||||||
|                         android:id="@+id/mediaDetailuploadeddate" |                         android:id="@+id/mediaDetailuploadeddate" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="match_parent" | ||||||
|                         android:layout_gravity="start" |  | ||||||
|                         android:background="?attr/subBackground" |  | ||||||
|                         android:padding="@dimen/small_gap" |  | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/description_text_size" |  | ||||||
|                         tools:text="Uploaded date" /> |                         tools:text="Uploaded date" /> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="@dimen/small_gap" /> |  | ||||||
| 
 |  | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|                     android:id="@+id/nominatedDeletionBanner" |                     android:id="@+id/nominatedDeletionBanner" | ||||||
|                     android:background="@color/deleteRed" |                     android:background="?attr/mediaDetailNominationBackground" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:orientation="vertical" |                     android:orientation="vertical" | ||||||
|                     android:padding="@dimen/standard_gap" |                     android:padding="@dimen/quarter_standard_height" | ||||||
|                     android:visibility="gone"> |                     android:visibility="gone"> | ||||||
|  | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="match_parent" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="wrap_content" | ||||||
|  | @ -299,6 +241,7 @@ | ||||||
|                         android:textColor="@color/primaryTextColor" |                         android:textColor="@color/primaryTextColor" | ||||||
|                         android:textSize="@dimen/normal_text" |                         android:textSize="@dimen/normal_text" | ||||||
|                         android:textStyle="bold"/> |                         android:textStyle="bold"/> | ||||||
|  | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:id="@+id/seeMore" |                         android:id="@+id/seeMore" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="match_parent" | ||||||
|  | @ -310,35 +253,23 @@ | ||||||
|                         android:textStyle="bold"/> |                         android:textStyle="bold"/> | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <fr.free.nrw.commons.media.MediaDetailSpacer |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="@dimen/small_gap" /> |  | ||||||
| 
 |  | ||||||
|                 <LinearLayout |                 <LinearLayout | ||||||
|  |                     style="@style/MediaDetailContainer" | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:background="?attr/subBackground" |                     android:orientation="horizontal"> | ||||||
|                     android:orientation="vertical" |  | ||||||
|                     android:padding="@dimen/standard_gap"> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|                         android:layout_width="match_parent" |                         style="@style/MediaDetailTextLabelGeneric" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:paddingBottom="@dimen/tiny_gap" |                         android:layout_height="match_parent" | ||||||
|                         android:text="@string/media_detail_discussion" |                         android:text="@string/media_detail_discussion" /> | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/normal_text" |  | ||||||
|                         android:textStyle="bold" /> |  | ||||||
| 
 | 
 | ||||||
|                     <TextView |                     <TextView | ||||||
|  |                         style="@style/MediaDetailTextBody" | ||||||
|                         android:id="@+id/mediaDetailDisc" |                         android:id="@+id/mediaDetailDisc" | ||||||
|                         android:layout_width="match_parent" |                         android:layout_width="@dimen/widget_margin" | ||||||
|                         android:layout_height="wrap_content" |                         android:layout_height="match_parent" /> | ||||||
|                         android:layout_gravity="start" |  | ||||||
|                         android:background="?attr/subBackground" |  | ||||||
|                         android:padding="@dimen/small_gap" |  | ||||||
|                         android:textColor="@android:color/white" |  | ||||||
|                         android:textSize="@dimen/description_text_size" /> |  | ||||||
|                 </LinearLayout> |                 </LinearLayout> | ||||||
| 
 | 
 | ||||||
|                 <Button |                 <Button | ||||||
|  | @ -346,7 +277,7 @@ | ||||||
|                     android:layout_width="match_parent" |                     android:layout_width="match_parent" | ||||||
|                     android:layout_height="wrap_content" |                     android:layout_height="wrap_content" | ||||||
|                     android:layout_margin="@dimen/standard_gap" |                     android:layout_margin="@dimen/standard_gap" | ||||||
|                     android:background="@color/button_blue" |                     android:background="@drawable/bg_copy_wikitext_button" | ||||||
|                     android:text="@string/copy_wikicode" |                     android:text="@string/copy_wikicode" | ||||||
|                     android:textColor="@color/primaryTextColor" /> |                     android:textColor="@color/primaryTextColor" /> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,6 +26,12 @@ | ||||||
|     <attr name="mainTabBackground" format="reference"/> |     <attr name="mainTabBackground" format="reference"/> | ||||||
|     <attr name="mainCardBackground" format="reference"/> |     <attr name="mainCardBackground" format="reference"/> | ||||||
|     <attr name="mainScreenNearbyPermissionbutton" format="reference"/> |     <attr name="mainScreenNearbyPermissionbutton" format="reference"/> | ||||||
|  |     <attr name="iconInfo24" format="reference" /> | ||||||
|  |     <attr name="iconMap24" format="reference" /> | ||||||
|  |     <attr name="mediaDetailsText" format="reference" /> | ||||||
|  |     <attr name="mediaDetailsHeadingText" format="reference" /> | ||||||
|  |     <attr name="mediaDetailNominationBackground" format="reference" /> | ||||||
|  |     <attr name="mediaDetailSpacerColor" format="reference" /> | ||||||
|     <attr name="icon" format="reference"/> |     <attr name="icon" format="reference"/> | ||||||
|     <attr name="aboutIconsColor" format="reference"/> |     <attr name="aboutIconsColor" format="reference"/> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,7 +24,8 @@ | ||||||
|     <color name="primaryTextColor">#ffffff</color> |     <color name="primaryTextColor">#ffffff</color> | ||||||
|     <color name="secondaryTextColor">#000000</color> |     <color name="secondaryTextColor">#000000</color> | ||||||
| 
 | 
 | ||||||
|     <color name="deleteRed">#90960a0a</color> |     <color name="deleteRed">#D32F2F</color> | ||||||
|  |     <color name="deleteRedDark">#90960a0a</color> | ||||||
|     <color name="deleteButton">#44000000</color> |     <color name="deleteButton">#44000000</color> | ||||||
|     <color name="deleteButtonDark">#88000000</color> |     <color name="deleteButtonDark">#88000000</color> | ||||||
|     <color name="deleteButtonLight">#44ffffff</color> |     <color name="deleteButtonLight">#44ffffff</color> | ||||||
|  |  | ||||||
|  | @ -34,6 +34,12 @@ | ||||||
|         <item name="textEnabled">@color/enabled_button_text_color_dark</item> |         <item name="textEnabled">@color/enabled_button_text_color_dark</item> | ||||||
|         <item name="mainCardBackground">@color/main_background_dark</item> |         <item name="mainCardBackground">@color/main_background_dark</item> | ||||||
|         <item name="mainScreenNearbyPermissionbutton">@style/DarkFlatNearbyPermissionButton</item> |         <item name="mainScreenNearbyPermissionbutton">@style/DarkFlatNearbyPermissionButton</item> | ||||||
|  |         <item name="iconInfo24">@drawable/ic_info_outline_24dp</item> | ||||||
|  |         <item name="iconMap24" >@drawable/ic_map_white_24dp</item> | ||||||
|  |         <item name="mediaDetailsText" >@color/white</item> | ||||||
|  |         <item name="mediaDetailsHeadingText">@color/layout_light_grey</item> | ||||||
|  |         <item name="mediaDetailNominationBackground">@color/deleteRedDark</item> | ||||||
|  |         <item name="mediaDetailSpacerColor">@color/browser_actions_divider_color</item> | ||||||
|     </style> |     </style> | ||||||
| 
 | 
 | ||||||
|     <style name="LightAppTheme" parent="Theme.AppCompat.Light.NoActionBar"> |     <style name="LightAppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | ||||||
|  | @ -69,6 +75,12 @@ | ||||||
|         <item name="textEnabled">@color/enabled_button_text_color_light</item> |         <item name="textEnabled">@color/enabled_button_text_color_light</item> | ||||||
|         <item name="mainCardBackground">@color/primaryDarkColor</item> |         <item name="mainCardBackground">@color/primaryDarkColor</item> | ||||||
|         <item name="mainScreenNearbyPermissionbutton">@style/LightFlatNearbyPermissionButton</item> |         <item name="mainScreenNearbyPermissionbutton">@style/LightFlatNearbyPermissionButton</item> | ||||||
|  |         <item name="iconInfo24">@drawable/ic_info_outline_dark_24dp</item> | ||||||
|  |         <item name="iconMap24">@drawable/ic_map_dark_24dp</item> | ||||||
|  |         <item name="mediaDetailsText">@color/enabled_button_text_color_light</item> | ||||||
|  |         <item name="mediaDetailsHeadingText">@color/primaryDarkColor</item> | ||||||
|  |         <item name="mediaDetailNominationBackground">@color/deleteRed</item> | ||||||
|  |         <item name="mediaDetailSpacerColor">@color/divider_grey</item> | ||||||
|     </style> |     </style> | ||||||
| 
 | 
 | ||||||
|     <style name="WhiteSearchBarTheme" parent="DarkAppTheme"> |     <style name="WhiteSearchBarTheme" parent="DarkAppTheme"> | ||||||
|  | @ -129,4 +141,35 @@ | ||||||
|         <item name="centerRegion">#906078</item> |         <item name="centerRegion">#906078</item> | ||||||
|     </style> |     </style> | ||||||
| 
 | 
 | ||||||
|  |     <style name="MediaDetailContainer"> | ||||||
|  |         <item name="android:paddingLeft">@dimen/quarter_standard_height</item> | ||||||
|  |         <item name="android:paddingRight">@dimen/quarter_standard_height</item> | ||||||
|  |         <item name="android:paddingTop">@dimen/tiny_gap</item> | ||||||
|  |         <item name="android:paddingBottom">@dimen/tiny_gap</item> | ||||||
|  |     </style> | ||||||
|  | 
 | ||||||
|  |     <style name="MediaDetailTextLabel"> | ||||||
|  |         <item name="android:layout_weight">30</item> | ||||||
|  |         <item name="android:paddingTop">@dimen/dimen_6</item> | ||||||
|  |         <item name="android:paddingLeft">@dimen/tiny_gap</item> | ||||||
|  |         <item name="android:textSize">@dimen/normal_text</item> | ||||||
|  |         <item name="android:textStyle">bold</item> | ||||||
|  |     </style> | ||||||
|  | 
 | ||||||
|  |     <style name="MediaDetailTextLabelTitle" parent="@style/MediaDetailTextLabel"> | ||||||
|  |         <item name="android:textColor">@android:color/white</item> | ||||||
|  |     </style> | ||||||
|  | 
 | ||||||
|  |     <style name="MediaDetailTextLabelGeneric" parent="@style/MediaDetailTextLabel"> | ||||||
|  |         <item name="android:textColor">?attr/mediaDetailsHeadingText</item> | ||||||
|  |     </style> | ||||||
|  | 
 | ||||||
|  |     <style name="MediaDetailTextBody"> | ||||||
|  |         <item name="android:layout_weight">70</item> | ||||||
|  |         <item name="android:layout_gravity">start</item> | ||||||
|  |         <item name="android:padding">@dimen/small_gap</item> | ||||||
|  |         <item name="android:textColor">?attr/mediaDetailsText</item> | ||||||
|  |         <item name="android:textSize">@dimen/description_text_size</item> | ||||||
|  |     </style> | ||||||
|  | 
 | ||||||
| </resources> | </resources> | ||||||
|  | @ -17,9 +17,6 @@ class CategoriesModelTest { | ||||||
|     @Mock |     @Mock | ||||||
|     internal var categoryInterface: CategoryInterface? = null |     internal var categoryInterface: CategoryInterface? = null | ||||||
| 
 | 
 | ||||||
|     @Mock |  | ||||||
|     internal var categoryItem: CategoryItem? = null |  | ||||||
| 
 |  | ||||||
|     @Spy |     @Spy | ||||||
|     internal lateinit var gson: Gson |     internal lateinit var gson: Gson | ||||||
| 
 | 
 | ||||||
|  | @ -43,28 +40,6 @@ class CategoriesModelTest { | ||||||
|         MockitoAnnotations.initMocks(this) |         MockitoAnnotations.initMocks(this) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Test Case for verifying that Categories search (MW api calls) are case-insensitive |  | ||||||
|     @Test |  | ||||||
|     fun searchAllFoundCaseTest() { |  | ||||||
|        val mwQueryPage = Mockito.mock(MwQueryPage::class.java) |  | ||||||
|         Mockito.`when`(mwQueryPage.title()).thenReturn("Category:Test") |  | ||||||
|         val mwQueryResult = Mockito.mock(MwQueryResult::class.java) |  | ||||||
|         Mockito.`when`(mwQueryResult.pages()).thenReturn(listOf(mwQueryPage)) |  | ||||||
|         val mockResponse = Mockito.mock(MwQueryResponse::class.java) |  | ||||||
|         Mockito.`when`(mockResponse.query()).thenReturn(mwQueryResult) |  | ||||||
|         val categoriesModel: CategoriesModel = CategoriesModel(categoryClient,null,null) |  | ||||||
| 
 |  | ||||||
|         Mockito.`when`(categoryInterface!!.searchCategoriesForPrefix(ArgumentMatchers.anyString(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt())) |  | ||||||
|                 .thenReturn(Observable.just(mockResponse)) |  | ||||||
| 
 |  | ||||||
|         // Checking if both return "Test" |  | ||||||
|         val actualCategoryName = categoriesModel!!.searchAll("tes",null).blockingFirst() |  | ||||||
|         assertEquals("Test", actualCategoryName.getName()) |  | ||||||
|          |  | ||||||
|         val actualCategoryNameCaps = categoriesModel!!.searchAll("Tes",null).blockingFirst() |  | ||||||
|         assertEquals("Test", actualCategoryNameCaps.getName()) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|     * For testing the substring search algorithm for Categories search |     * For testing the substring search algorithm for Categories search | ||||||
|     * To be more precise it tests the In Between substring( ex: searching `atte`  |     * To be more precise it tests the In Between substring( ex: searching `atte`  | ||||||
|  |  | ||||||
|  | @ -58,7 +58,6 @@ class CategoryClientTest { | ||||||
|                 { fail("SearchCategories returned element when it shouldn't have.") }, |                 { fail("SearchCategories returned element when it shouldn't have.") }, | ||||||
|                 { s -> throw s }) |                 { s -> throw s }) | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     @Test |     @Test | ||||||
|     fun searchCategoriesForPrefixFound() { |     fun searchCategoriesForPrefixFound() { | ||||||
|         val mwQueryPage = Mockito.mock(MwQueryPage::class.java) |         val mwQueryPage = Mockito.mock(MwQueryPage::class.java) | ||||||
|  | @ -93,7 +92,6 @@ class CategoryClientTest { | ||||||
|                 { fail("SearchCategories returned element when it shouldn't have.") }, |                 { fail("SearchCategories returned element when it shouldn't have.") }, | ||||||
|                 { s -> throw s }) |                 { s -> throw s }) | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     @Test |     @Test | ||||||
|     fun getParentCategoryListFound() { |     fun getParentCategoryListFound() { | ||||||
|         val mwQueryPage = Mockito.mock(MwQueryPage::class.java) |         val mwQueryPage = Mockito.mock(MwQueryPage::class.java) | ||||||
|  |  | ||||||
|  | @ -0,0 +1,20 @@ | ||||||
|  | package fr.free.nrw.commons.utils | ||||||
|  | 
 | ||||||
|  | import org.hamcrest.core.IsEqual.equalTo | ||||||
|  | import org.junit.Assert.assertThat | ||||||
|  | import org.junit.Test | ||||||
|  | 
 | ||||||
|  | class CommonsDateUtilTest { | ||||||
|  | 
 | ||||||
|  |     @Test | ||||||
|  |     fun `Iso8601DateFormatTimestamp parses legal date`() { | ||||||
|  |         val iso8601DateFormatTimestamp = CommonsDateUtil | ||||||
|  |             .getIso8601DateFormatTimestamp() | ||||||
|  |         val parsedDate = iso8601DateFormatTimestamp | ||||||
|  |             .parse("2020-04-07T14:21:57Z") | ||||||
|  |         assertThat( | ||||||
|  |             "2020-04-07T14:21:57Z", | ||||||
|  |             equalTo(iso8601DateFormatTimestamp.format(parsedDate)) | ||||||
|  |         ) | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue