mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
parent
7dde464d9d
commit
e5db79e652
5 changed files with 16 additions and 11 deletions
|
|
@ -1130,6 +1130,8 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
if (imageTitle != null) {
|
||||
boolean deletionStatus = pageExists("Commons:Deletion_requests/" + imageTitle);
|
||||
if (!deletionStatus) {
|
||||
// strip File: prefix
|
||||
imageTitle = imageTitle.replace("File:", "");
|
||||
media = new Media(imageTitle);
|
||||
//media = fetchMediaByFilename(fileName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -91,10 +92,9 @@ public class ReviewActivity extends AuthenticatedActivity {
|
|||
|
||||
if (id == R.id.action_review_randomizer) {
|
||||
Observable.fromCallable(() -> {
|
||||
Media result = null;
|
||||
try {
|
||||
Media result = mwApi.getRecentRandomImage();
|
||||
reviewController.onImageRefreshed(result.getFilename()); //file name is updated
|
||||
reviewPagerAdapter.getItem(0); //new fragment with this new filename created
|
||||
result = mwApi.getRecentRandomImage();
|
||||
|
||||
//String thumBaseUrl = Utils.makeThumbBaseUrl(result.getFilename());
|
||||
//reviewPagerAdapter.currentThumbBasedUrl = thumBaseUrl;
|
||||
|
|
@ -104,17 +104,22 @@ public class ReviewActivity extends AuthenticatedActivity {
|
|||
} catch (IOException e) {
|
||||
Log.d("review", e.toString());
|
||||
}
|
||||
return "Booga!";
|
||||
return result;
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe();
|
||||
.subscribe(this::updateImage);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void updateImage(Media result) {
|
||||
|
||||
reviewController.onImageRefreshed(result.getFilename()); //file name is updated
|
||||
reviewPagerAdapter.getItem(0); //new fragment with this new filename created
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -130,9 +135,8 @@ public class ReviewActivity extends AuthenticatedActivity {
|
|||
* Consumers should be simply using this method to use this activity.
|
||||
* @param context
|
||||
* @param title Page title
|
||||
* @param categoryName Name of the category for displaying its images
|
||||
*/
|
||||
public static void startYourself(Context context, String title, String categoryName) {
|
||||
public static void startYourself(Context context, String title) {
|
||||
Intent reviewActivity = new Intent(context, ReviewActivity.class);
|
||||
context.startActivity(reviewActivity);
|
||||
}
|
||||
|
|
@ -143,7 +147,7 @@ public class ReviewActivity extends AuthenticatedActivity {
|
|||
void onSurveyFinished();
|
||||
void onImproperImageReported();
|
||||
void onLicenceViolationReported();
|
||||
void oWrongCategoryReported();
|
||||
void onWrongCategoryReported();
|
||||
void onThankSent();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ReviewController implements ReviewActivity.ReviewCallback {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void oWrongCategoryReported() {
|
||||
public void onWrongCategoryReported() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
|
||||
case R.id.action_review:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
ReviewActivity.startYourself(this, getString(R.string.title_activity_featured_images), FEATURED_IMAGES_CATEGORY);
|
||||
ReviewActivity.startYourself(this, getString(R.string.title_activity_review));
|
||||
return true;
|
||||
default:
|
||||
Timber.e("Unknown option [%s] selected from the navigation menu", itemId);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue