From d2914f947d1350562cc5b2c4318d11d3922ed306 Mon Sep 17 00:00:00 2001 From: NekoInverter <42698724+NekoInverter@users.noreply.github.com> Date: Tue, 3 Mar 2020 16:29:54 +0800 Subject: [PATCH] Replace licenseDialog --- app/build.gradle | 3 ++- .../edxposed/manager/AboutActivity.java | 21 +++---------------- .../edxposed/manager/DownloadActivity.java | 4 +--- .../edxposed/manager/util/NavUtil.java | 2 +- build.gradle | 1 + 5 files changed, 8 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3728717d..fe68b374 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.application' +apply plugin: 'com.google.android.gms.oss-licenses-plugin' android { compileSdkVersion 28 @@ -43,5 +44,5 @@ dependencies { implementation "androidx.recyclerview:recyclerview:1.2.0-alpha01" implementation 'com.annimon:stream:1.2.0' implementation 'com.google.code.gson:gson:2.8.6' - implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0' + implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' } diff --git a/app/src/main/java/org/meowcat/edxposed/manager/AboutActivity.java b/app/src/main/java/org/meowcat/edxposed/manager/AboutActivity.java index 8b83e3dd..3365efda 100644 --- a/app/src/main/java/org/meowcat/edxposed/manager/AboutActivity.java +++ b/app/src/main/java/org/meowcat/edxposed/manager/AboutActivity.java @@ -1,5 +1,6 @@ package org.meowcat.edxposed.manager; +import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Bundle; @@ -10,15 +11,11 @@ import android.widget.TextView; import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.Toolbar; +import com.google.android.gms.oss.licenses.OssLicensesMenuActivity; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import org.meowcat.edxposed.manager.util.NavUtil; -import de.psdev.licensesdialog.LicensesDialog; -import de.psdev.licensesdialog.licenses.ApacheSoftwareLicense20; -import de.psdev.licensesdialog.model.Notice; -import de.psdev.licensesdialog.model.Notices; - public class AboutActivity extends BaseActivity { @Override @@ -67,7 +64,7 @@ public class AboutActivity extends BaseActivity { } catch (PackageManager.NameNotFoundException ignored) { } - licensesView.setOnClickListener(v12 -> createLicenseDialog()); + licensesView.setOnClickListener(v12 -> startActivity(new Intent(this, OssLicensesMenuActivity.class))); txtModuleSupport.setText(getString(R.string.support_modules_description, getString(R.string.module_support))); @@ -89,18 +86,6 @@ public class AboutActivity extends BaseActivity { v.setOnClickListener(v1 -> NavUtil.startURL(this, getString(url))); } - private void createLicenseDialog() { - Notices notices = new Notices(); - notices.addNotice(new Notice("sticky-headers-recyclerview", "https://github.com/timehop/sticky-headers-recyclerview", "timehop", new ApacheSoftwareLicense20())); - notices.addNotice(new Notice("libsu", "https://github.com/topjohnwu/libsu", "John Wu", new ApacheSoftwareLicense20())); - - new LicensesDialog.Builder(this) - .setNotices(notices) - .setIncludeOwnLicense(true) - .build() - .show(); - } - public void openLink(View view) { NavUtil.startURL(this, view.getTag().toString()); } diff --git a/app/src/main/java/org/meowcat/edxposed/manager/DownloadActivity.java b/app/src/main/java/org/meowcat/edxposed/manager/DownloadActivity.java index ad044d66..60afee70 100644 --- a/app/src/main/java/org/meowcat/edxposed/manager/DownloadActivity.java +++ b/app/src/main/java/org/meowcat/edxposed/manager/DownloadActivity.java @@ -12,7 +12,6 @@ import android.net.ConnectivityManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.util.TypedValue; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -20,7 +19,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.SearchView; @@ -351,7 +349,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis txtStatus.setText(mContext.getString( R.string.download_status_installed, installedVersion)); //txtStatus.setTextColor(ThemeUtil.getThemeColor(mContext, R.attr.download_status_installed)); - TypedArray typedArray = DownloadActivity.this.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorSecondary }); + TypedArray typedArray = DownloadActivity.this.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorSecondary}); int textColor = typedArray.getColor(0, 0); typedArray.recycle(); txtStatus.setTextColor(textColor); diff --git a/app/src/main/java/org/meowcat/edxposed/manager/util/NavUtil.java b/app/src/main/java/org/meowcat/edxposed/manager/util/NavUtil.java index 5021930e..64e2c43e 100644 --- a/app/src/main/java/org/meowcat/edxposed/manager/util/NavUtil.java +++ b/app/src/main/java/org/meowcat/edxposed/manager/util/NavUtil.java @@ -34,7 +34,7 @@ public final class NavUtil { public static void startURL(AppCompatActivity activity, Uri uri) { CustomTabsIntent.Builder customTabsIntent = new CustomTabsIntent.Builder(); customTabsIntent.setShowTitle(true); - customTabsIntent.setToolbarColor(ContextCompat.getColor(activity, R.color.colorPrimary)); + customTabsIntent.setToolbarColor(ContextCompat.getColor(activity, R.color.colorActionBar)); customTabsIntent.build().launchUrl(activity, uri); } diff --git a/build.gradle b/build.gradle index b0c2eca8..40b2eeab 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.6.1' + classpath 'com.google.android.gms:oss-licenses-plugin:0.10.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files