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
This commit is contained in:
Kshitij Bhardwaj 2020-04-19 18:24:17 -04:00 committed by GitHub
parent fcd2867d26
commit 81e12a9e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 194 additions and 178 deletions

View file

@ -104,6 +104,8 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
@BindView(R.id.mediaDetailImageView)
SimpleDraweeView image;
@BindView(R.id.mediaDetailImageViewSpacer)
LinearLayout imageSpacer;
@BindView(R.id.mediaDetailTitle)
TextView title;
@BindView(R.id.mediaDetailDesc)
@ -204,7 +206,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
return view;
}
@OnClick(R.id.mediaDetailImageView)
@OnClick(R.id.mediaDetailImageViewSpacer)
public void launchZoomActivity(View view) {
Context ctx = view.getContext();
ctx.startActivity(
@ -248,13 +250,22 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
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) {
if (imageInfo != null) {
int screenWidth = scrollView.getWidth();
int finalHeight = (screenWidth*imageInfo.getHeight()) / imageInfo.getWidth();
ViewGroup.LayoutParams params = image.getLayoutParams();
ViewGroup.LayoutParams spacerParams = imageSpacer.getLayoutParams();
params.height = finalHeight;
spacerParams.height = finalHeight;
image.setLayoutParams(params);
imageSpacer.setLayoutParams(spacerParams);
}
}