mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Add links and comply with GPL
This commit is contained in:
parent
7c8ea00cce
commit
04a8bebe3a
27
build.gradle
27
build.gradle
@ -1,9 +1,7 @@
|
||||
import com.android.build.gradle.AppExtension
|
||||
import com.android.build.gradle.api.ApkVariantOutput
|
||||
import com.android.build.gradle.api.ApplicationVariant
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
import com.github.jk1.license.render.TextReportRenderer
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.4.21'
|
||||
@ -19,6 +17,14 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.github.jk1.dependency-license-report' version '1.16'
|
||||
}
|
||||
def licenseResDir = new File("$projectDir/build/dependency-license-res")
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
defaultConfig {
|
||||
@ -49,7 +55,7 @@ android {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
resources.srcDirs = ['resources']
|
||||
res.srcDirs = ['res']
|
||||
res.srcDirs = ['res', licenseResDir]
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
test {
|
||||
@ -203,3 +209,16 @@ repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
licenseReport {
|
||||
configurations = ALL
|
||||
renderers = [new TextReportRenderer()]
|
||||
}
|
||||
generateLicenseReport.doLast {
|
||||
def target = new File(licenseResDir, "raw/license")
|
||||
target.parentFile.mkdirs()
|
||||
target.text =
|
||||
files("COPYING", "$projectDir/build/reports/dependency-license/THIRD-PARTY-NOTICES.txt")
|
||||
.collect { it.getText() }.join('\n')
|
||||
}
|
||||
preBuild.dependsOn(generateLicenseReport)
|
||||
|
10
res/drawable/ic_baseline_attach_money_24.xml
Normal file
10
res/drawable/ic_baseline_attach_money_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M11.8,10.9c-2.27,-0.59 -3,-1.2 -3,-2.15 0,-1.09 1.01,-1.85 2.7,-1.85 1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-1.94,0.42 -3.5,1.68 -3.5,3.61 0,2.31 1.91,3.46 4.7,4.13 2.5,0.6 3,1.48 3,2.41 0,0.69 -0.49,1.79 -2.7,1.79 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c1.95,-0.37 3.5,-1.5 3.5,-3.55 0,-2.84 -2.43,-3.81 -4.7,-4.4z"/>
|
||||
</vector>
|
10
res/drawable/ic_baseline_bug_report_24.xml
Normal file
10
res/drawable/ic_baseline_bug_report_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,8h-2.81c-0.45,-0.78 -1.07,-1.45 -1.82,-1.96L17,4.41 15.59,3l-2.17,2.17C12.96,5.06 12.49,5 12,5c-0.49,0 -0.96,0.06 -1.41,0.17L8.41,3 7,4.41l1.62,1.63C7.88,6.55 7.26,7.22 6.81,8L4,8v2h2.09c-0.05,0.33 -0.09,0.66 -0.09,1v1L4,12v2h2v1c0,0.34 0.04,0.67 0.09,1L4,16v2h2.81c1.04,1.79 2.97,3 5.19,3s4.15,-1.21 5.19,-3L20,18v-2h-2.09c0.05,-0.33 0.09,-0.66 0.09,-1v-1h2v-2h-2v-1c0,-0.34 -0.04,-0.67 -0.09,-1L20,10L20,8zM14,16h-4v-2h4v2zM14,12h-4v-2h4v2z"/>
|
||||
</vector>
|
10
res/drawable/ic_baseline_code_24.xml
Normal file
10
res/drawable/ic_baseline_code_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/>
|
||||
</vector>
|
19
res/drawable/ic_baseline_gavel_24.xml
Normal file
19
res/drawable/ic_baseline_gavel_24.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M5.2496,8.0688l2.83,-2.8268l14.134,14.15l-2.83,2.8268z"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M9.4857,3.8272l2.828,-2.8288l5.6576,5.656l-2.828,2.8288z"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M0.9989,12.3147l2.8284,-2.8284l5.6568,5.6568l-2.8284,2.8284z"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M1,21h12v2h-12z"/>
|
||||
</vector>
|
@ -420,5 +420,12 @@
|
||||
<item>light</item>
|
||||
<item>dark</item>
|
||||
</string-array>
|
||||
<string name="report_bug">Report Bug</string>
|
||||
<string name="report_bug_url" translatable="false">https://bugs.kde.org/enter_bug.cgi?product=kdeconnect&component=android-application</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="donate_url" translatable="false">https://kde.org/community/donations/?app=kdeconnect-android</string>
|
||||
<string name="source_code">Source Code</string>
|
||||
<string name="source_code_url" translatable="false">https://invent.kde.org/network/kdeconnect-android/</string>
|
||||
<string name="licenses">Licenses</string>
|
||||
|
||||
</resources>
|
||||
|
@ -1,9 +1,11 @@
|
||||
package org.kde.kdeconnect.UserInterface;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@ -18,13 +20,45 @@ import androidx.preference.ListPreference;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.kde.kdeconnect.BackgroundService;
|
||||
import org.kde.kdeconnect.Helpers.DeviceHelper;
|
||||
import org.kde.kdeconnect.Helpers.NotificationHelper;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
private static class LicenseTextSingleton {
|
||||
private static volatile String licenseText;
|
||||
|
||||
// Need these separate methods because Context is required to load the string
|
||||
// Mixing Context and static here is fine because the license
|
||||
// is a pure function of the project directory (i.e. doesn't depend on language, etc.)
|
||||
|
||||
static synchronized String getOrLoadLicenseText(Context context) {
|
||||
String licenseText = LicenseTextSingleton.licenseText;
|
||||
if (licenseText != null) {
|
||||
return licenseText;
|
||||
}
|
||||
try (InputStream is = context.getResources().openRawResource(R.raw.license)) {
|
||||
licenseText = IOUtils.toString(is, Charset.defaultCharset());
|
||||
} catch (IOException ie) {
|
||||
throw new RuntimeException(ie);
|
||||
}
|
||||
return LicenseTextSingleton.licenseText = licenseText;
|
||||
}
|
||||
|
||||
static synchronized void startLoadingLicenseText(Context context) {
|
||||
if (licenseText == null) {
|
||||
new Thread(() -> getOrLoadLicenseText(context)).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EditTextPreference renameDevice;
|
||||
|
||||
@Override
|
||||
@ -153,6 +187,40 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
moreSettingsText.setSummary(R.string.settings_more_settings_text);
|
||||
screen.addPreference(moreSettingsText);
|
||||
|
||||
Preference bug = new Preference(context);
|
||||
bug.setTitle(R.string.report_bug);
|
||||
bug.setPersistent(false);
|
||||
bug.setIcon(R.drawable.ic_baseline_bug_report_24);
|
||||
bug.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.report_bug_url))));
|
||||
screen.addPreference(bug);
|
||||
|
||||
Preference donate = new Preference(context);
|
||||
donate.setTitle(R.string.donate);
|
||||
donate.setPersistent(false);
|
||||
donate.setIcon(R.drawable.ic_baseline_attach_money_24);
|
||||
donate.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.donate_url))));
|
||||
screen.addPreference(donate);
|
||||
|
||||
Preference source = new Preference(context);
|
||||
source.setTitle(R.string.source_code);
|
||||
source.setPersistent(false);
|
||||
source.setIcon(R.drawable.ic_baseline_code_24);
|
||||
source.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.source_code_url))));
|
||||
screen.addPreference(source);
|
||||
|
||||
Preference licences = new Preference(context);
|
||||
licences.setTitle(R.string.licenses);
|
||||
licences.setPersistent(false);
|
||||
licences.setIcon(R.drawable.ic_baseline_gavel_24);
|
||||
licences.setOnPreferenceClickListener(preference -> {
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(LicenseTextSingleton.getOrLoadLicenseText(context))
|
||||
.create().show();
|
||||
return true;
|
||||
});
|
||||
LicenseTextSingleton.startLoadingLicenseText(context);
|
||||
screen.addPreference(licences);
|
||||
|
||||
setPreferenceScreen(screen);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user