Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ protected void onCreate(Bundle savedInstanceState) {
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) -> {
if (event.getAction() == MotionEvent.ACTION_UP && event.getRawX() >= (
Expand All @@ -154,6 +157,7 @@ public boolean runRandomizer() {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(media -> {
if (media != null) {
reviewPagerAdapter.disableButtons();
updateImage(media);
}
}));
Expand Down Expand Up @@ -181,6 +185,7 @@ private void updateImage(Media media) {
String caption = String.format(getString(R.string.review_is_uploaded_by), fileName, revision.getUser());
imageCaption.setText(caption);
progressBar.setVisibility(View.GONE);
reviewPagerAdapter.enableButtons();
}));
reviewPager.setCurrentItem(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
.reviewController.reportSpam(requireActivity(), getReviewCallback()));
break;
case COPYRIGHT:
enableButtons();
question = getString(R.string.review_copyright);
explanation = getString(R.string.review_copyright_explanation);
yesButtonText = getString(R.string.review_copyright_yes_button_text);
Expand All @@ -90,6 +91,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
.reportPossibleCopyRightViolation(requireActivity(), getReviewCallback()));
break;
case CATEGORY:
enableButtons();
question = getString(R.string.review_category);
explanation = updateCategoriesQuestion();
yesButtonText = getString(R.string.review_category_yes_button_text);
Expand All @@ -102,6 +104,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
});
break;
case THANKS:
enableButtons();
question = getString(R.string.review_thanks);
explanation = getString(R.string.review_thanks_explanation, getReviewActivity().reviewController.firstRevision.getUser());
yesButtonText = getString(R.string.review_thanks_yes_button_text);
Expand All @@ -114,6 +117,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
});
break;
default:
enableButtons();
question = "How did we get here?";
explanation = "No idea.";
yesButtonText = "yes";
Expand Down Expand Up @@ -142,6 +146,28 @@ public void onFailure() {
};
}

/**
* 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)
void onNoButtonClicked() {
getReviewActivity().swipeToNext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ void updateFileInformation() {
}
}

/**
* 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
public Fragment getItem(int position) {
Bundle bundle = new Bundle();
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/layout/fragment_review_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
android:layout_margin="@dimen/activity_margin_horizontal"
android:background="@android:color/transparent"
android:text="@string/yes"
android:enabled="false"
android:alpha="0.5"
android:textAllCaps="true"
android:textAlignment="center"
android:textColor="@color/yes_button_color"/>
Expand All @@ -68,6 +70,8 @@
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:enabled="false"
android:alpha="0.5"
android:layout_margin="@dimen/activity_margin_horizontal"
android:background="@android:color/transparent"
android:text="@string/no"
Expand Down