Fixes #3687 : Media needs refactoring to remove code that has been rendered useless (#3693)

This commit is contained in:
Kshitij Bhardwaj 2020-04-22 03:59:48 -04:00 committed by GitHub
parent 0f906b20c9
commit 840e126652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 39 deletions

View file

@ -149,7 +149,6 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
private boolean categoriesPresent = false;
private boolean depictionLoaded = false;
private ViewTreeObserver.OnGlobalLayoutListener layoutListener; // for layout stuff, only used once!
private ViewTreeObserver.OnScrollChangedListener scrollListener;
//Had to make this class variable, to implement various onClicks, which access the media, also I fell why make separate variables when one can serve the purpose
private Media media;
@ -211,9 +210,6 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
authorLayout.setVisibility(GONE);
}
// Progressively darken the image in the background when we scroll detail pane up
scrollListener = this::updateTheDarkness;
view.getViewTreeObserver().addOnScrollChangedListener(scrollListener);
locale = getResources().getConfiguration().locale;
return view;
}
@ -313,10 +309,6 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
getView().getViewTreeObserver().removeGlobalOnLayoutListener(layoutListener); // old Android was on crack. CRACK IS WHACK
layoutListener = null;
}
if (scrollListener != null && getView() != null) {
getView().getViewTreeObserver().removeOnScrollChangedListener(scrollListener);
scrollListener = null;
}
compositeDisposable.clear();
super.onDestroyView();
@ -583,18 +575,6 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
return item;
}
private void updateTheDarkness() {
// You must face the darkness alone
int scrollY = scrollView.getScrollY();
int scrollMax = getView().getHeight();
float scrollPercentage = (float) scrollY / (float) scrollMax;
final float transparencyMax = 0.75f;
if (scrollPercentage > transparencyMax) {
scrollPercentage = transparencyMax;
}
image.setAlpha(1.0f - scrollPercentage);
}
/**
* Returns captions for media details
*

View file

@ -1,19 +0,0 @@
package fr.free.nrw.commons.media;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
public class MediaDetailSpacer extends View {
public MediaDetailSpacer(Context context) {
super(context);
}
public MediaDetailSpacer(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MediaDetailSpacer(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
}