diff --git a/app/src/main/java/fr/free/nrw/commons/review/ReviewImageFragment.java b/app/src/main/java/fr/free/nrw/commons/review/ReviewImageFragment.java index 08df527db..3b80f70d0 100644 --- a/app/src/main/java/fr/free/nrw/commons/review/ReviewImageFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/review/ReviewImageFragment.java @@ -2,6 +2,7 @@ package fr.free.nrw.commons.review; import android.app.AlertDialog; import android.os.Bundle; +import android.text.Html; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; @@ -33,7 +34,8 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment { private int position; private String fileName; private String catString; - private View catsView; + //private View catsView; + private View textViewQuestionContext; private SimpleDraweeView simpleDraweeView; public ProgressBar progressBar; @@ -48,11 +50,16 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment { } public void updateCategories(Iterable categories) { - catString = TextUtils.join(", ", categories); - if (catsView != null) { - ((TextView) catsView).setText(catString); + if (categories!=null && isAdded()) { + catString = TextUtils.join(", ", categories); + if (catString != null && !catString.equals("") && textViewQuestionContext != null) { + catString = ""+catString+""; + String stringToConvertHtml = String.format(getResources().getString(R.string.review_category_explanation), catString); + ((TextView) textViewQuestionContext).setText(Html.fromHtml(stringToConvertHtml)); + } else if (textViewQuestionContext != null) { + ((TextView)textViewQuestionContext).setText(getResources().getString(R.string.review_no_category)); + } } - } @Override @@ -68,19 +75,20 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment { false); progressBar = layoutView.findViewById(R.id.progressBar); View textView = layoutView.findViewById(R.id.reviewQuestion); - View textViewQuestion = layoutView.findViewById(R.id.reviewQuestion); - View textViewQuestionContext = layoutView.findViewById(R.id.reviewQuestionContext); - catsView = layoutView.findViewById(R.id.reviewCategories); + //View textViewQuestion = layoutView.findViewById(R.id.reviewQuestion); + textViewQuestionContext = layoutView.findViewById(R.id.reviewQuestionContext); + //catsView = layoutView.findViewById(R.id.reviewCategories); String question; switch(position) { case COPYRIGHT: question = getString(R.string.review_copyright); break; case CATEGORY: - textViewQuestion.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT, 0.35f)); - textViewQuestionContext.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT, 0.35f)); + //textViewQuestion.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT, 0.35f)); + //textViewQuestionContext.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT, 0.35f)); question = getString(R.string.review_category); - catsView.setVisibility(View.VISIBLE); + updateCategories(ReviewController.categories); + //catsView.setVisibility(View.VISIBLE); break; case SPAM: question = getString(R.string.review_spam); @@ -95,9 +103,10 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment { simpleDraweeView.setImageURI(Utils.makeThumbBaseUrl(fileName)); progressBar.setVisibility(View.GONE); } - if (catString != null) { + + /*if (catString != null) { ((TextView) catsView).setText(catString); - } + }*/ return layoutView; } } diff --git a/app/src/main/res/layout/fragment_review_image.xml b/app/src/main/res/layout/fragment_review_image.xml index 5335b86b0..1e2f7bea1 100644 --- a/app/src/main/res/layout/fragment_review_image.xml +++ b/app/src/main/res/layout/fragment_review_image.xml @@ -52,18 +52,6 @@ android:text="testing2" /> - - Is this mis-categorized? Is this spam? This image is uncategorized + This image is under %1$s categories.