Removed default license settings, and implemented selecting last selected license as default licence(#2170) (#2218)

* Removed default license settings, and implemented selecting last selected license as default licence(#2170)
* Replace settings license tests with recent upload limit test
This commit is contained in:
sp2710 2019-01-04 20:56:39 +05:30 committed by Adam Jones
parent f5c8e7ad93
commit dabcd43a5b
4 changed files with 32 additions and 53 deletions

View file

@ -47,16 +47,6 @@ public class SettingsFragment extends PreferenceFragment {
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
// Update spinner to show selected value as summary
ListPreference licensePreference = (ListPreference) findPreference(Prefs.DEFAULT_LICENSE);
licensePreference.setSummary(getString(Utils.licenseNameFor(licensePreference.getValue())));
// Keep summary updated when changing value
licensePreference.setOnPreferenceChangeListener((preference, newValue) -> {
preference.setSummary(getString(Utils.licenseNameFor((String) newValue)));
return true;
});
SwitchPreference themePreference = (SwitchPreference) findPreference("theme");
themePreference.setOnPreferenceChangeListener((preference, newValue) -> {
getActivity().recreate();

View file

@ -332,6 +332,7 @@ public class UploadModel {
void setSelectedLicense(String licenseName) {
this.license = licensesByName.get(licenseName);
prefs.edit().putString(Prefs.DEFAULT_LICENSE, license).commit();
}
Observable<Contribution> buildContributions(List<String> categoryStringList) {

View file

@ -16,13 +16,6 @@
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory
android:title="@string/preference_category_general">
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleListPreference
android:key="defaultLicense"
android:title="@string/preference_license"
android:entries="@array/pref_defaultLicense_entries"
android:entryValues="@array/pref_defaultLicense_values"
android:defaultValue="@string/license_pref_cc_by_sa_4_0" />
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleSwitchPreference
android:key="useExternalStorage"
android:title="@string/use_external_storage"