Skip to content

Commit d7c2480

Browse files
kbhardwaj123misaochan
authored andcommitted
Fixes #3436 and #2881: Media Detail design Overhaul (#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 05a9aa8 commit d7c2480

10 files changed

+194
-178
lines changed

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

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

106106
@BindView(R.id.mediaDetailImageView)
107107
SimpleDraweeView image;
108+
@BindView(R.id.mediaDetailImageViewSpacer)
109+
LinearLayout imageSpacer;
108110
@BindView(R.id.mediaDetailTitle)
109111
TextView title;
110112
@BindView(R.id.mediaDetailDesc)
@@ -205,7 +207,7 @@ && getParentFragment() instanceof MediaDetailPagerFragment) {
205207
return view;
206208
}
207209

208-
@OnClick(R.id.mediaDetailImageView)
210+
@OnClick(R.id.mediaDetailImageViewSpacer)
209211
public void launchZoomActivity(View view) {
210212
Context ctx = view.getContext();
211213
ctx.startActivity(
@@ -241,12 +243,21 @@ private void displayMediaDetails() {
241243
compositeDisposable.add(disposable);
242244
}
243245

246+
/**
247+
* The imageSpacer is Basically a transparent overlay for the SimpleDraweeView
248+
* which holds the image to be displayed( moreover this image is out of
249+
* the scroll view )
250+
* @param imageInfo used to calculate height of the ImageSpacer
251+
*/
244252
private void updateAspectRatio(ImageInfo imageInfo) {
245253
if (imageInfo != null) {
246254
int finalHeight = (scrollView.getWidth()*imageInfo.getHeight()) / imageInfo.getWidth();
247255
ViewGroup.LayoutParams params = image.getLayoutParams();
256+
ViewGroup.LayoutParams spacerParams = imageSpacer.getLayoutParams();
248257
params.height = finalHeight;
258+
spacerParams.height = finalHeight;
249259
image.setLayoutParams(params);
260+
imageSpacer.setLayoutParams(spacerParams);
250261
}
251262
}
252263

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:shape="rectangle">
5+
<solid
6+
android:color="@color/button_blue" />
7+
<corners
8+
android:radius="@dimen/progressbar_stroke" />
9+
</shape>

app/src/main/res/drawable/bg_delete_button.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99
<shape
1010
android:shape="rectangle">
1111
<solid
12-
android:color="@color/deleteButton"/>
12+
android:color="?attr/mediaDetailNominationBackground"/>
1313
<corners
1414
android:radius="@dimen/progressbar_stroke" />
15-
<stroke
16-
android:width="5px"
17-
android:color="@color/deleteRed" />
1815
</shape>
1916
</item>
2017

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="@dimen/half_standard_height"
3+
android:height="@dimen/half_standard_height"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="@color/button_background_dark"
8+
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"/>
9+
</vector>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="@dimen/half_standard_height"
3+
android:height="@dimen/half_standard_height"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="@color/button_background_dark"
8+
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"/>
9+
</vector>

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
android:id="@+id/mediaDetailCategoryItemText"
1111
android:layout_width="match_parent"
1212
android:layout_height="wrap_content"
13-
android:background="?attr/subBackground"
13+
android:background="?attr/mainBackground"
1414
android:foreground="?attr/selectableItemBackground"
1515
android:gravity="center_vertical"
1616
android:minHeight="@dimen/overflow_button_dimen"
17-
android:padding="@dimen/quarter_standard_height"
18-
android:textColor="@android:color/white"
17+
android:padding="@dimen/small_gap"
18+
android:textColor="?attr/mediaDetailsText"
1919
android:textSize="@dimen/description_text_size"
20-
app:drawablePadding="@dimen/small_gap"
21-
app:drawableStart="@drawable/ic_info_outline_24dp"
20+
app:drawablePadding="@dimen/tiny_gap"
21+
app:drawableStart="?attr/iconInfo24"
2222
/>
2323

2424
</LinearLayout>

0 commit comments

Comments
 (0)