Resolves merge conflict

This commit is contained in:
misaochan 2015-10-28 15:52:09 +13:00
parent 3972ab9fd3
commit 4876501d50

View file

@ -19,7 +19,9 @@ import fr.free.nrw.commons.R;
class ContributionsListAdapter extends CursorAdapter { class ContributionsListAdapter extends CursorAdapter {
private DisplayImageOptions contributionDisplayOptions = Utils.getGenericDisplayOptions().build(); private DisplayImageOptions contributionDisplayOptions = Utils.getGenericDisplayOptions().build();
private Activity activity; private Activity activity;
public ContributionsListAdapter(Activity activity, Cursor c, int flags) { public ContributionsListAdapter(Activity activity, Cursor c, int flags) {
@ -36,14 +38,14 @@ class ContributionsListAdapter extends CursorAdapter {
@Override @Override
public void bindView(View view, Context context, Cursor cursor) { public void bindView(View view, Context context, Cursor cursor) {
final ContributionViewHolder views = (ContributionViewHolder) view.getTag(); final ContributionViewHolder views = (ContributionViewHolder)view.getTag();
final Contribution contribution = Contribution.fromCursor(cursor); final Contribution contribution = Contribution.fromCursor(cursor);
String actualUrl = (contribution.getLocalUri() != null && !TextUtils.isEmpty(contribution.getLocalUri().toString())) ? contribution.getLocalUri().toString() : contribution.getThumbnailUrl(640); String actualUrl = (contribution.getLocalUri() != null && !TextUtils.isEmpty(contribution.getLocalUri().toString())) ? contribution.getLocalUri().toString() : contribution.getThumbnailUrl(640);
if (views.url == null || !views.url.equals(actualUrl)) { if(views.url == null || !views.url.equals(actualUrl)) {
if (actualUrl.startsWith("http")) { if(actualUrl.startsWith("http")) {
MediaWikiImageView mwImageView = (MediaWikiImageView) views.imageView; MediaWikiImageView mwImageView = (MediaWikiImageView)views.imageView;
mwImageView.setMedia(contribution, ((CommonsApplication) activity.getApplicationContext()).getImageLoader()); mwImageView.setMedia(contribution, ((CommonsApplication) activity.getApplicationContext()).getImageLoader());
// FIXME: For transparent images // FIXME: For transparent images
} else { } else {
@ -51,7 +53,7 @@ class ContributionsListAdapter extends CursorAdapter {
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (loadedImage.hasAlpha()) { if(loadedImage.hasAlpha()) {
views.imageView.setBackgroundResource(android.R.color.white); views.imageView.setBackgroundResource(android.R.color.white);
} }
views.seqNumView.setVisibility(View.GONE); views.seqNumView.setVisibility(View.GONE);
@ -60,7 +62,7 @@ class ContributionsListAdapter extends CursorAdapter {
@Override @Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) { public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
super.onLoadingFailed(imageUri, view, failReason); super.onLoadingFailed(imageUri, view, failReason);
MediaWikiImageView mwImageView = (MediaWikiImageView) views.imageView; MediaWikiImageView mwImageView = (MediaWikiImageView)views.imageView;
mwImageView.setMedia(contribution, ((CommonsApplication) activity.getApplicationContext()).getImageLoader()); mwImageView.setMedia(contribution, ((CommonsApplication) activity.getApplicationContext()).getImageLoader());
} }
}); });
@ -68,8 +70,8 @@ class ContributionsListAdapter extends CursorAdapter {
views.url = actualUrl; views.url = actualUrl;
} }
BitmapDrawable actualImageDrawable = (BitmapDrawable) views.imageView.getDrawable(); BitmapDrawable actualImageDrawable = (BitmapDrawable)views.imageView.getDrawable();
if (actualImageDrawable != null && actualImageDrawable.getBitmap() != null && actualImageDrawable.getBitmap().hasAlpha()) { if(actualImageDrawable != null && actualImageDrawable.getBitmap() != null && actualImageDrawable.getBitmap().hasAlpha()) {
views.imageView.setBackgroundResource(android.R.color.white); views.imageView.setBackgroundResource(android.R.color.white);
} else { } else {
views.imageView.setBackgroundDrawable(null); views.imageView.setBackgroundDrawable(null);
@ -80,7 +82,7 @@ class ContributionsListAdapter extends CursorAdapter {
views.seqNumView.setText(String.valueOf(cursor.getPosition() + 1)); views.seqNumView.setText(String.valueOf(cursor.getPosition() + 1));
views.seqNumView.setVisibility(View.VISIBLE); views.seqNumView.setVisibility(View.VISIBLE);
switch (contribution.getState()) { switch(contribution.getState()) {
case Contribution.STATE_COMPLETED: case Contribution.STATE_COMPLETED:
views.stateView.setVisibility(View.GONE); views.stateView.setVisibility(View.GONE);
views.progressView.setVisibility(View.GONE); views.progressView.setVisibility(View.GONE);
@ -96,10 +98,10 @@ class ContributionsListAdapter extends CursorAdapter {
views.progressView.setVisibility(View.VISIBLE); views.progressView.setVisibility(View.VISIBLE);
long total = contribution.getDataLength(); long total = contribution.getDataLength();
long transferred = contribution.getTransferred(); long transferred = contribution.getTransferred();
if (transferred == 0 || transferred >= total) { if(transferred == 0 || transferred >= total) {
views.progressView.setIndeterminate(true); views.progressView.setIndeterminate(true);
} else { } else {
views.progressView.setProgress((int) (((double) transferred / (double) total) * 100)); views.progressView.setProgress((int)(((double)transferred / (double)total) * 100));
} }
break; break;
case Contribution.STATE_FAILED: case Contribution.STATE_FAILED: