Skip to content

Commit 5d06601

Browse files
kbhardwaj123ashishkumar468
authored andcommitted
Fixes commons-app#3436 and commons-app#2881: Media Detail design Overhaul (commons-app#3505)
* ic_map_dark_24dp: map icon for white background * ic_info_outline_dark_24dp: info icon for dark background * MediaDetailFragment: update the spacer as per image aspect ratio * fragment_media_detail: design overhaul * fragment_media_detail: remove redundant background color statements * make requested changes * add dark mode support * minor ui tweak * white map icon in dark mode * make rquested changes * make requested changes to layout * fix misalignment of category list * subtle amendments * convert comments to javadocs * minor amendments * minor changes * add styles for media detail * Media detail fragment refactored * make suggested changes * minor name fix * fix the delete button border
1 parent ea31ec9 commit 5d06601

File tree

3 files changed

+230
-322
lines changed

3 files changed

+230
-322
lines changed

app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ public static MediaDetailFragment forMedia(int index, boolean editable, boolean
104104

105105
@BindView(R.id.mediaDetailImageView)
106106
SimpleDraweeView image;
107+
@BindView(R.id.mediaDetailImageViewSpacer)
108+
LinearLayout imageSpacer;
107109
@BindView(R.id.mediaDetailTitle)
108110
TextView title;
109111
@BindView(R.id.mediaDetailDesc)
@@ -204,7 +206,7 @@ && getParentFragment() instanceof MediaDetailPagerFragment) {
204206
return view;
205207
}
206208

207-
@OnClick(R.id.mediaDetailImageView)
209+
@OnClick(R.id.mediaDetailImageViewSpacer)
208210
public void launchZoomActivity(View view) {
209211
Context ctx = view.getContext();
210212
ctx.startActivity(
@@ -248,13 +250,22 @@ private void displayMediaDetails() {
248250
compositeDisposable.add(disposable);
249251
}
250252

253+
/**
254+
* The imageSpacer is Basically a transparent overlay for the SimpleDraweeView
255+
* which holds the image to be displayed( moreover this image is out of
256+
* the scroll view )
257+
* @param imageInfo used to calculate height of the ImageSpacer
258+
*/
251259
private void updateAspectRatio(ImageInfo imageInfo) {
252260
if (imageInfo != null) {
253261
int screenWidth = scrollView.getWidth();
254262
int finalHeight = (screenWidth*imageInfo.getHeight()) / imageInfo.getWidth();
255263
ViewGroup.LayoutParams params = image.getLayoutParams();
264+
ViewGroup.LayoutParams spacerParams = imageSpacer.getLayoutParams();
256265
params.height = finalHeight;
266+
spacerParams.height = finalHeight;
257267
image.setLayoutParams(params);
268+
imageSpacer.setLayoutParams(spacerParams);
258269
}
259270
}
260271

Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:orientation="vertical"
4-
android:layout_width="match_parent"
5-
android:layout_height="wrap_content">
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:orientation="vertical"
5+
android:layout_width="match_parent"
6+
android:layout_height="wrap_content"
7+
>
68

7-
<TextView
9+
<fr.free.nrw.commons.ui.widget.CompatTextView
810
android:id="@+id/mediaDetailCategoryItemText"
911
android:layout_width="match_parent"
1012
android:layout_height="wrap_content"
@@ -15,8 +17,8 @@
1517
android:padding="@dimen/small_gap"
1618
android:textColor="?attr/mediaDetailsText"
1719
android:textSize="@dimen/description_text_size"
18-
android:drawablePadding="@dimen/tiny_gap"
19-
android:drawableStart="?attr/iconInfo24"
20+
app:drawablePadding="@dimen/tiny_gap"
21+
app:drawableStart="?attr/iconInfo24"
2022
/>
2123

2224
</LinearLayout>

0 commit comments

Comments
 (0)