mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Disabled review buttons while an image is being loaded (#3185)
* Disabled review buttons while an image is being loaded * Added javadocs for the new methods
This commit is contained in:
parent
ca8069b21b
commit
2ed32162b7
4 changed files with 56 additions and 1 deletions
|
|
@ -132,7 +132,10 @@ public class ReviewActivity extends AuthenticatedActivity {
|
||||||
runRandomizer(); //Run randomizer whenever everything is ready so that a first random image will be added
|
runRandomizer(); //Run randomizer whenever everything is ready so that a first random image will be added
|
||||||
}
|
}
|
||||||
|
|
||||||
btnSkipImage.setOnClickListener(view -> runRandomizer());
|
btnSkipImage.setOnClickListener(view -> {
|
||||||
|
reviewPagerAdapter.disableButtons();
|
||||||
|
runRandomizer();
|
||||||
|
});
|
||||||
|
|
||||||
btnSkipImage.setOnTouchListener((view, event) -> {
|
btnSkipImage.setOnTouchListener((view, event) -> {
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP && event.getRawX() >= (
|
if (event.getAction() == MotionEvent.ACTION_UP && event.getRawX() >= (
|
||||||
|
|
@ -154,6 +157,7 @@ public class ReviewActivity extends AuthenticatedActivity {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(media -> {
|
.subscribe(media -> {
|
||||||
if (media != null) {
|
if (media != null) {
|
||||||
|
reviewPagerAdapter.disableButtons();
|
||||||
updateImage(media);
|
updateImage(media);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
@ -181,6 +185,7 @@ public class ReviewActivity extends AuthenticatedActivity {
|
||||||
String caption = String.format(getString(R.string.review_is_uploaded_by), fileName, revision.getUser());
|
String caption = String.format(getString(R.string.review_is_uploaded_by), fileName, revision.getUser());
|
||||||
imageCaption.setText(caption);
|
imageCaption.setText(caption);
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
reviewPagerAdapter.enableButtons();
|
||||||
}));
|
}));
|
||||||
reviewPager.setCurrentItem(0);
|
reviewPager.setCurrentItem(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
|
||||||
.reviewController.reportSpam(requireActivity(), getReviewCallback()));
|
.reviewController.reportSpam(requireActivity(), getReviewCallback()));
|
||||||
break;
|
break;
|
||||||
case COPYRIGHT:
|
case COPYRIGHT:
|
||||||
|
enableButtons();
|
||||||
question = getString(R.string.review_copyright);
|
question = getString(R.string.review_copyright);
|
||||||
explanation = getString(R.string.review_copyright_explanation);
|
explanation = getString(R.string.review_copyright_explanation);
|
||||||
yesButtonText = getString(R.string.review_copyright_yes_button_text);
|
yesButtonText = getString(R.string.review_copyright_yes_button_text);
|
||||||
|
|
@ -90,6 +91,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
|
||||||
.reportPossibleCopyRightViolation(requireActivity(), getReviewCallback()));
|
.reportPossibleCopyRightViolation(requireActivity(), getReviewCallback()));
|
||||||
break;
|
break;
|
||||||
case CATEGORY:
|
case CATEGORY:
|
||||||
|
enableButtons();
|
||||||
question = getString(R.string.review_category);
|
question = getString(R.string.review_category);
|
||||||
explanation = updateCategoriesQuestion();
|
explanation = updateCategoriesQuestion();
|
||||||
yesButtonText = getString(R.string.review_category_yes_button_text);
|
yesButtonText = getString(R.string.review_category_yes_button_text);
|
||||||
|
|
@ -102,6 +104,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case THANKS:
|
case THANKS:
|
||||||
|
enableButtons();
|
||||||
question = getString(R.string.review_thanks);
|
question = getString(R.string.review_thanks);
|
||||||
explanation = getString(R.string.review_thanks_explanation, getReviewActivity().reviewController.firstRevision.getUser());
|
explanation = getString(R.string.review_thanks_explanation, getReviewActivity().reviewController.firstRevision.getUser());
|
||||||
yesButtonText = getString(R.string.review_thanks_yes_button_text);
|
yesButtonText = getString(R.string.review_thanks_yes_button_text);
|
||||||
|
|
@ -114,6 +117,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
enableButtons();
|
||||||
question = "How did we get here?";
|
question = "How did we get here?";
|
||||||
explanation = "No idea.";
|
explanation = "No idea.";
|
||||||
yesButtonText = "yes";
|
yesButtonText = "yes";
|
||||||
|
|
@ -142,6 +146,28 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called when an image has
|
||||||
|
* been loaded to enable the review buttons.
|
||||||
|
*/
|
||||||
|
public void enableButtons() {
|
||||||
|
yesButton.setEnabled(true);
|
||||||
|
yesButton.setAlpha(1);
|
||||||
|
noButton.setEnabled(true);
|
||||||
|
noButton.setAlpha(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called when an image is being loaded
|
||||||
|
* to disable the review buttons
|
||||||
|
*/
|
||||||
|
public void disableButtons() {
|
||||||
|
yesButton.setEnabled(false);
|
||||||
|
yesButton.setAlpha(0.5f);
|
||||||
|
noButton.setEnabled(false);
|
||||||
|
noButton.setAlpha(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
@OnClick(R.id.button_no)
|
@OnClick(R.id.button_no)
|
||||||
void onNoButtonClicked() {
|
void onNoButtonClicked() {
|
||||||
getReviewActivity().swipeToNext();
|
getReviewActivity().swipeToNext();
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,26 @@ public class ReviewPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called when an image has
|
||||||
|
* been loaded to enable the review buttons.
|
||||||
|
*/
|
||||||
|
public void enableButtons() {
|
||||||
|
if (reviewImageFragments != null){
|
||||||
|
reviewImageFragments[0].enableButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called when an image is being loaded
|
||||||
|
* to disable the review buttons
|
||||||
|
*/
|
||||||
|
public void disableButtons() {
|
||||||
|
if (reviewImageFragments != null){
|
||||||
|
reviewImageFragments[0].disableButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@
|
||||||
android:layout_margin="@dimen/activity_margin_horizontal"
|
android:layout_margin="@dimen/activity_margin_horizontal"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:text="@string/yes"
|
android:text="@string/yes"
|
||||||
|
android:enabled="false"
|
||||||
|
android:alpha="0.5"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="@color/yes_button_color"/>
|
android:textColor="@color/yes_button_color"/>
|
||||||
|
|
@ -68,6 +70,8 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:enabled="false"
|
||||||
|
android:alpha="0.5"
|
||||||
android:layout_margin="@dimen/activity_margin_horizontal"
|
android:layout_margin="@dimen/activity_margin_horizontal"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:text="@string/no"
|
android:text="@string/no"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue