mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
parent
314ebd8919
commit
03e3d0599b
4 changed files with 18 additions and 24 deletions
|
|
@ -103,12 +103,8 @@ public class Utils {
|
||||||
return R.string.license_name_cc_by_sa_four;
|
return R.string.license_name_cc_by_sa_four;
|
||||||
case Prefs.Licenses.CC0:
|
case Prefs.Licenses.CC0:
|
||||||
return R.string.license_name_cc0;
|
return R.string.license_name_cc0;
|
||||||
case Prefs.Licenses.CC_BY: // for backward compatibility to v2.1
|
|
||||||
return R.string.license_name_cc_by_3_0;
|
|
||||||
case Prefs.Licenses.CC_BY_SA: // for backward compatibility to v2.1
|
|
||||||
return R.string.license_name_cc_by_sa_3_0;
|
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Unrecognized license value: " + license);
|
throw new IllegalStateException("Unrecognized license value: " + license);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -132,7 +128,7 @@ public class Utils {
|
||||||
case Prefs.Licenses.CC0:
|
case Prefs.Licenses.CC0:
|
||||||
return "https://creativecommons.org/publicdomain/zero/1.0/";
|
return "https://creativecommons.org/publicdomain/zero/1.0/";
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unrecognized license value: " + license);
|
throw new IllegalStateException("Unrecognized license value: " + license);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,10 +258,6 @@ public class Contribution extends Media {
|
||||||
return "{{self|cc-by-sa-4.0}}";
|
return "{{self|cc-by-sa-4.0}}";
|
||||||
case Prefs.Licenses.CC0:
|
case Prefs.Licenses.CC0:
|
||||||
return "{{self|cc-zero}}";
|
return "{{self|cc-zero}}";
|
||||||
case Prefs.Licenses.CC_BY:
|
|
||||||
return "{{self|cc-by-3.0}}";
|
|
||||||
case Prefs.Licenses.CC_BY_SA:
|
|
||||||
return "{{self|cc-by-sa-3.0}}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException("Unrecognized license value: " + license);
|
throw new RuntimeException("Unrecognized license value: " + license);
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,5 @@ public class Prefs {
|
||||||
public static final String CC_BY_SA_4 = "CC BY-SA 4.0";
|
public static final String CC_BY_SA_4 = "CC BY-SA 4.0";
|
||||||
public static final String CC_BY_4 = "CC BY 4.0";
|
public static final String CC_BY_4 = "CC BY 4.0";
|
||||||
public static final String CC0 = "CC0";
|
public static final String CC0 = "CC0";
|
||||||
|
|
||||||
// kept for backward compatibility to v2.1
|
|
||||||
@Deprecated public static final String CC_BY = "CC BY";
|
|
||||||
@Deprecated public static final String CC_BY_SA = "CC BY-SA";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,8 @@ package fr.free.nrw.commons.upload;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import java.lang.reflect.Proxy;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
import fr.free.nrw.commons.Utils;
|
||||||
import fr.free.nrw.commons.category.CategoriesModel;
|
import fr.free.nrw.commons.category.CategoriesModel;
|
||||||
import fr.free.nrw.commons.contributions.Contribution;
|
import fr.free.nrw.commons.contributions.Contribution;
|
||||||
import fr.free.nrw.commons.filepicker.UploadableFile;
|
import fr.free.nrw.commons.filepicker.UploadableFile;
|
||||||
|
|
@ -23,6 +15,12 @@ import fr.free.nrw.commons.utils.StringUtils;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static fr.free.nrw.commons.upload.UploadModel.UploadItem;
|
import static fr.free.nrw.commons.upload.UploadModel.UploadItem;
|
||||||
|
|
@ -330,7 +328,15 @@ public class UploadPresenter {
|
||||||
* Sets the list of licences and the default license.
|
* Sets the list of licences and the default license.
|
||||||
*/
|
*/
|
||||||
private void updateLicenses() {
|
private void updateLicenses() {
|
||||||
String selectedLicense = defaultKvStore.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3);
|
String selectedLicense = defaultKvStore.getString(Prefs.DEFAULT_LICENSE,
|
||||||
|
Prefs.Licenses.CC_BY_SA_4);//CC_BY_SA_4 is the default one used by the commons web app
|
||||||
|
try {//I have to make sure that the stored default license was not one of the deprecated one's
|
||||||
|
Utils.licenseNameFor(selectedLicense);
|
||||||
|
} catch (IllegalStateException exception) {
|
||||||
|
Timber.e(exception.getMessage());
|
||||||
|
selectedLicense = Prefs.Licenses.CC_BY_SA_4;
|
||||||
|
defaultKvStore.putString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_4);
|
||||||
|
}
|
||||||
view.updateLicenses(uploadModel.getLicenses(), selectedLicense);
|
view.updateLicenses(uploadModel.getLicenses(), selectedLicense);
|
||||||
view.updateLicenseSummary(selectedLicense, uploadModel.getCount());
|
view.updateLicenseSummary(selectedLicense, uploadModel.getCount());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue