16
16
import android .view .View ;
17
17
18
18
import java .io .IOException ;
19
+ import java .util .List ;
19
20
20
21
import javax .inject .Inject ;
21
22
@@ -91,10 +92,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
91
92
92
93
if (id == R .id .action_review_randomizer ) {
93
94
Observable .fromCallable (() -> {
95
+ Media result = null ;
94
96
try {
95
- Media result = mwApi .getRecentRandomImage ();
96
- reviewController .onImageRefreshed (result .getFilename ()); //file name is updated
97
- reviewPagerAdapter .getItem (0 ); //new fragment with this new filename created
97
+ result = mwApi .getRecentRandomImage ();
98
98
99
99
//String thumBaseUrl = Utils.makeThumbBaseUrl(result.getFilename());
100
100
//reviewPagerAdapter.currentThumbBasedUrl = thumBaseUrl;
@@ -104,17 +104,22 @@ public boolean onOptionsItemSelected(MenuItem item) {
104
104
} catch (IOException e ) {
105
105
Log .d ("review" , e .toString ());
106
106
}
107
- return "Booga!" ;
107
+ return result ;
108
108
})
109
109
.subscribeOn (Schedulers .io ())
110
110
.observeOn (AndroidSchedulers .mainThread ())
111
- .subscribe ();
111
+ .subscribe (this :: updateImage );
112
112
return true ;
113
113
}
114
114
115
115
return super .onOptionsItemSelected (item );
116
116
}
117
117
118
+ private void updateImage (Media result ) {
119
+
120
+ reviewController .onImageRefreshed (result .getFilename ()); //file name is updated
121
+ reviewPagerAdapter .getItem (0 ); //new fragment with this new filename created
122
+ }
118
123
119
124
120
125
/**
@@ -130,9 +135,8 @@ public void onDestroy() {
130
135
* Consumers should be simply using this method to use this activity.
131
136
* @param context
132
137
* @param title Page title
133
- * @param categoryName Name of the category for displaying its images
134
138
*/
135
- public static void startYourself (Context context , String title , String categoryName ) {
139
+ public static void startYourself (Context context , String title ) {
136
140
Intent reviewActivity = new Intent (context , ReviewActivity .class );
137
141
context .startActivity (reviewActivity );
138
142
}
@@ -143,7 +147,7 @@ interface ReviewCallback {
143
147
void onSurveyFinished ();
144
148
void onImproperImageReported ();
145
149
void onLicenceViolationReported ();
146
- void oWrongCategoryReported ();
150
+ void onWrongCategoryReported ();
147
151
void onThankSent ();
148
152
}
149
153
}
0 commit comments