mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge pull request #382 from maskaravivek/license
Fixes #144: Add CC 4.0 to license options
This commit is contained in:
commit
268e8690d4
7 changed files with 36 additions and 15 deletions
|
|
@ -7,8 +7,10 @@ public class Prefs {
|
|||
public static final String DEFAULT_LICENSE = "defaultLicense";
|
||||
|
||||
public static class Licenses {
|
||||
public static final String CC_BY_SA = "CC BY-SA";
|
||||
public static final String CC_BY = "CC BY";
|
||||
public static final String CC_BY_SA_3 = "CC BY-SA";
|
||||
public static final String CC_BY_3 = "CC BY";
|
||||
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 CC0 = "CC0";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
|||
licensePreference.setEntries(new String[]{
|
||||
getString(R.string.license_name_cc0),
|
||||
getString(R.string.license_name_cc_by),
|
||||
getString(R.string.license_name_cc_by_sa)
|
||||
getString(R.string.license_name_cc_by_four),
|
||||
getString(R.string.license_name_cc_by_sa),
|
||||
getString(R.string.license_name_cc_by_sa_four)
|
||||
});
|
||||
licensePreference.setEntryValues(new String[]{
|
||||
Prefs.Licenses.CC0,
|
||||
Prefs.Licenses.CC_BY,
|
||||
Prefs.Licenses.CC_BY_SA
|
||||
Prefs.Licenses.CC_BY_3,
|
||||
Prefs.Licenses.CC_BY_4,
|
||||
Prefs.Licenses.CC_BY_SA_3,
|
||||
Prefs.Licenses.CC_BY_SA_4
|
||||
});
|
||||
|
||||
licensePreference.setSummary(getString(Utils.licenseNameFor(licensePreference.getValue())));
|
||||
|
|
|
|||
|
|
@ -205,10 +205,14 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static String licenseTemplateFor(String license) {
|
||||
if(license.equals(Prefs.Licenses.CC_BY)) {
|
||||
if(license.equals(Prefs.Licenses.CC_BY_3)) {
|
||||
return "{{self|cc-by-3.0}}";
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA)) {
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_4)) {
|
||||
return "{{self|cc-by-4.0}}";
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA_3)) {
|
||||
return "{{self|cc-by-sa-3.0}}";
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA_4)) {
|
||||
return "{{self|cc-by-sa-4.0}}";
|
||||
} else if(license.equals(Prefs.Licenses.CC0)) {
|
||||
return "{{self|cc-zero}}";
|
||||
}
|
||||
|
|
@ -216,10 +220,14 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static int licenseNameFor(String license) {
|
||||
if(license.equals(Prefs.Licenses.CC_BY)) {
|
||||
if(license.equals(Prefs.Licenses.CC_BY_3)) {
|
||||
return R.string.license_name_cc_by;
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA)) {
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_4)) {
|
||||
return R.string.license_name_cc_by_four;
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA_3)) {
|
||||
return R.string.license_name_cc_by_sa;
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA_4)) {
|
||||
return R.string.license_name_cc_by_sa_four;
|
||||
} else if(license.equals(Prefs.Licenses.CC0)) {
|
||||
return R.string.license_name_cc0;
|
||||
}
|
||||
|
|
@ -227,11 +235,16 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static String licenseUrlFor(String license) {
|
||||
if(license.equals(Prefs.Licenses.CC_BY)) {
|
||||
if(license.equals(Prefs.Licenses.CC_BY_3)) {
|
||||
return "https://creativecommons.org/licenses/by/3.0/";
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA)) {
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_4)) {
|
||||
return "https://creativecommons.org/licenses/by/4.0/";
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA_3)) {
|
||||
return "https://creativecommons.org/licenses/by-sa/3.0/";
|
||||
} else if(license.equals(Prefs.Licenses.CC0)) {
|
||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA_4)) {
|
||||
return "https://creativecommons.org/licenses/by-sa/4.0/";
|
||||
}
|
||||
else if(license.equals(Prefs.Licenses.CC0)) {
|
||||
return "https://creativecommons.org/publicdomain/zero/1.0/";
|
||||
}
|
||||
throw new RuntimeException("Unrecognized license value");
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ public class Contribution extends Media {
|
|||
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN height INTEGER;");
|
||||
db.execSQL("UPDATE " + TABLE_NAME + " SET height = 0");
|
||||
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN license STRING;");
|
||||
db.execSQL("UPDATE " + TABLE_NAME + " SET license='" + Prefs.Licenses.CC_BY_SA + "';");
|
||||
db.execSQL("UPDATE " + TABLE_NAME + " SET license='" + Prefs.Licenses.CC_BY_SA_3 + "';");
|
||||
from++;
|
||||
onUpdate(db, from, to);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class SingleUploadFragment extends Fragment {
|
|||
titleEdit.addTextChangedListener(uploadEnabler);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
final String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA);
|
||||
final String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3);
|
||||
licenseSummaryView.setText(getString(R.string.share_license_summary, getString(Utils.licenseNameFor(license))));
|
||||
|
||||
// Open license page on touch
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class UploadController {
|
|||
contribution.setDescription("");
|
||||
}
|
||||
|
||||
String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA);
|
||||
String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3);
|
||||
contribution.setLicense(license);
|
||||
|
||||
//FIXME: Add permission request here. Only executeAsyncTask if permission has been granted
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ Tap this message (or hit back) to skip this step.</string>
|
|||
<string name="use_previous">Use previous title/description</string>
|
||||
<string name="allow_gps">Automatically get current location</string>
|
||||
<string name="allow_gps_summary">Retrieve current location to offer category suggestions if image is not geotagged</string>
|
||||
<string name="license_name_cc_by_sa_four"> Attribution-ShareAlike 4.0</string>
|
||||
<string name="license_name_cc_by_four"> Attribution 4.0</string>
|
||||
<string name="license_name_cc_by_sa"> Attribution-ShareAlike 3.0</string>
|
||||
<string name="license_name_cc_by"> Attribution 3.0</string>
|
||||
<string name="license_name_cc0">CC0</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue