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