mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Pass context and adapters as parameters to controller
This commit is contained in:
parent
029d742e58
commit
5b63fc60cd
3 changed files with 13 additions and 12 deletions
|
|
@ -57,7 +57,7 @@ public class ReviewActivity extends AuthenticatedActivity {
|
|||
|
||||
@Inject MediaWikiApi mwApi;
|
||||
|
||||
private ReviewPagerAdapter reviewPagerAdapter;
|
||||
public ReviewPagerAdapter reviewPagerAdapter;
|
||||
|
||||
//private ReviewCallback reviewCallback;
|
||||
private ReviewController reviewController;
|
||||
|
|
@ -81,7 +81,7 @@ public class ReviewActivity extends AuthenticatedActivity {
|
|||
ButterKnife.bind(this);
|
||||
initDrawer();
|
||||
|
||||
reviewController = new ReviewController();
|
||||
reviewController = new ReviewController(this);
|
||||
|
||||
reviewPagerAdapter = new ReviewPagerAdapter(getSupportFragmentManager());
|
||||
pager.setAdapter(reviewPagerAdapter);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package fr.free.nrw.commons.review;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
|
|
@ -9,6 +12,13 @@ import java.util.ArrayList;
|
|||
public class ReviewController implements ReviewActivity.ReviewCallback {
|
||||
public static String fileName;
|
||||
protected static ArrayList<String> categories;
|
||||
ReviewPagerAdapter reviewPagerAdapter;
|
||||
ViewPager viewPager;
|
||||
|
||||
ReviewController(Context context) {
|
||||
reviewPagerAdapter = ((ReviewActivity)context).reviewPagerAdapter;
|
||||
viewPager = ((ReviewActivity)context).pager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImageRefreshed(String fileName) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
|
|||
private int position;
|
||||
private String fileName;
|
||||
private String catString;
|
||||
//private View catsView;
|
||||
|
||||
private View textViewQuestionContext;
|
||||
private SimpleDraweeView simpleDraweeView;
|
||||
public ProgressBar progressBar;
|
||||
|
|
@ -75,20 +75,15 @@ 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);
|
||||
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));
|
||||
question = getString(R.string.review_category);
|
||||
updateCategories(ReviewController.categories);
|
||||
//catsView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case SPAM:
|
||||
question = getString(R.string.review_spam);
|
||||
|
|
@ -103,10 +98,6 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
|
|||
simpleDraweeView.setImageURI(Utils.makeThumbBaseUrl(fileName));
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/*if (catString != null) {
|
||||
((TextView) catsView).setText(catString);
|
||||
}*/
|
||||
return layoutView;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue