Merge pull request #1567 from nextcloud/license_sourcecode

add license/source code link
This commit is contained in:
Andy Scherzinger 2017-09-21 18:37:27 +02:00 committed by GitHub
commit 8950439d55
4 changed files with 58 additions and 0 deletions

View file

@ -556,6 +556,49 @@ public class Preferences extends PreferenceActivity
pAboutApp.setSummary(String.format(getString(R.string.about_version), appVersion));
}
// source code
boolean sourcecodeEnabled = getResources().getBoolean(R.bool.sourcecode_enabled);
Preference sourcecodePreference = findPreference("sourcecode");
if (sourcecodePreference != null) {
String sourcecodeUrl = getString(R.string.sourcecode_url);
if (sourcecodeEnabled && !sourcecodeUrl.isEmpty()) {
sourcecodePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Uri uriUrl = Uri.parse(sourcecodeUrl);
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
return true;
}
});
} else {
preferenceCategoryAbout.removePreference(sourcecodePreference);
}
}
// license
boolean licenseEnabled = getResources().getBoolean(R.bool.license_enabled);
Preference licensePreference = findPreference("license");
if (licensePreference != null) {
String licenseUrl = getString(R.string.license_url);
if (licenseEnabled && !licenseUrl.isEmpty()) {
licensePreference.setSummary(R.string.prefs_gpl_v2);
licensePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Uri uriUrl = Uri.parse(licenseUrl);
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
return true;
}
});
} else {
preferenceCategoryAbout.removePreference(licensePreference);
}
}
// privacy
boolean privacyEnabled = getResources().getBoolean(R.bool.privacy_enabled);
Preference privacyPreference = findPreference("privacy");

View file

@ -98,6 +98,10 @@
<bool name="recommend_enabled">true</bool>
<bool name="feedback_enabled">true</bool>
<bool name="logger_enabled">false</bool>
<bool name="sourcecode_enabled">true</bool>
<string name="sourcecode_url" translatable="false">https://github.com/nextcloud/android</string>
<bool name="license_enabled">true</bool>
<string name="license_url" translatable="false">https://www.gnu.org/licenses/gpl-2.0.html</string>
<string name="url_imprint"></string>
<string name="mail_feedback">"mailto:android@nextcloud.com"</string>
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>

View file

@ -703,4 +703,7 @@
<string name="common_warning" translatable="false">Warning</string>
<string name="corrupt_account_info" translatable="false">Accounts have been corrupted in case you have been using a release candidate of 2.0.0 between RC1 and RC5.\n\nWe are sorry to tell you that you need to remove the Nextcloud accounts from your device and need to re-login again completely in order to get fully working login-sessions on this device!</string>
<string name="prefs_sourcecode">Get source code</string>
<string name="prefs_license">License</string>
<string name="prefs_gpl_v2" translatable="false">GNU General Public License, version 2</string>
</resources>

View file

@ -72,6 +72,14 @@
android:title="@string/privacy"
android:id="@+id/privacy"
android:key="privacy"/>
<Preference
android:title="@string/prefs_sourcecode"
android:id="@+id/sourcecode"
android:key="sourcecode"/>
<Preference
android:title="@string/prefs_license"
android:id="@+id/license"
android:key="license"/>
<Preference android:title="@string/about_title" android:id="@+id/about_app" android:key="about_app" />
</PreferenceCategory>