From c35184abdc2361b74c4e7b5be3034cabc7380cbf Mon Sep 17 00:00:00 2001 From: inorichi Date: Sat, 6 Feb 2016 00:37:11 +0100 Subject: [PATCH] Upgrade gradle. Other minor changes --- app/build.gradle | 6 ++- .../data/updater/UpdateDownloader.java | 4 +- .../ui/setting/SettingsAboutFragment.java | 53 +++++++++---------- build.gradle | 3 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 5 files changed, 36 insertions(+), 34 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e389be871b..73802b06de 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,5 @@ import java.text.SimpleDateFormat -apply plugin: 'android-sdk-manager' apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'me.tatarka.retrolambda' @@ -29,6 +28,10 @@ ext { } } +def includeUpdater() { + return hasProperty("include_updater"); +} + android { compileSdkVersion 23 buildToolsVersion "23.0.2" @@ -45,6 +48,7 @@ android { buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\"" buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\"" buildConfigField "String", "BUILD_TIME", "\"${getBuildTime()}\"" + buildConfigField "boolean", "INCLUDE_UPDATER", "${includeUpdater()}" } compileOptions { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateDownloader.java b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateDownloader.java index 465510fd6e..2f1852e705 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateDownloader.java +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateDownloader.java @@ -59,11 +59,11 @@ public class UpdateDownloader extends AsyncTask { @Override - protected Void doInBackground(String... arg0) { + protected Void doInBackground(String... args) { try { createCacheDir(); - URL url = new URL(arg0[0]); + URL url = new URL(args[0]); HttpURLConnection c = (HttpURLConnection) url.openConnection(); c.connect(); diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutFragment.java b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutFragment.java index b6573100e0..4fe669d999 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutFragment.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutFragment.java @@ -67,7 +67,7 @@ public class SettingsAboutFragment extends SettingsNestedFragment { //Set onClickListener to check for new version version.setOnPreferenceClickListener(preference -> { - if (!BuildConfig.DEBUG) + if (!BuildConfig.DEBUG && BuildConfig.INCLUDE_UPDATER) checkVersion(); return true; }); @@ -101,33 +101,32 @@ public class SettingsAboutFragment extends SettingsNestedFragment { releaseSubscription = updateChecker.checkForApplicationUpdate() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(next -> { - //Get version of latest releaseSubscription - String newVersion = next.getVersion(); - newVersion = newVersion.replaceAll("[^\\d.]", ""); + .subscribe(release -> { + //Get version of latest release + String newVersion = release.getVersion(); + newVersion = newVersion.replaceAll("[^\\d.]", ""); - //Check if latest version is different from current version - if (!newVersion.equals(BuildConfig.VERSION_NAME)) { - String downloadLink = next.getDownloadLink(); - String body = next.getChangeLog(); + //Check if latest version is different from current version + if (!newVersion.equals(BuildConfig.VERSION_NAME)) { + String downloadLink = release.getDownloadLink(); + String body = release.getChangeLog(); - //Create confirmation window - new MaterialDialog.Builder(getActivity()) - .title(getString(R.string.update_check_title)) - .content(body) - .positiveText(getString(R.string.update_check_confirm)) - .negativeText(getString(R.string.update_check_ignore)) - .onPositive((dialog, which) -> { - // User output that download has started - ToastUtil.showShort(getActivity(), getString(R.string.update_check_download_started)); - // Start download - new UpdateDownloader(getActivity()).execute(downloadLink); - }) - .show(); - } else { - ToastUtil.showShort(getActivity(), getString(R.string.update_check_no_new_updates)); - } - }, - Throwable::printStackTrace); + //Create confirmation window + new MaterialDialog.Builder(getActivity()) + .title(getString(R.string.update_check_title)) + .content(body) + .positiveText(getString(R.string.update_check_confirm)) + .negativeText(getString(R.string.update_check_ignore)) + .onPositive((dialog, which) -> { + // User output that download has started + ToastUtil.showShort(getActivity(), getString(R.string.update_check_download_started)); + // Start download + new UpdateDownloader(getActivity().getApplicationContext()).execute(downloadLink); + }) + .show(); + } else { + ToastUtil.showShort(getActivity(), getString(R.string.update_check_no_new_updates)); + } + }, Throwable::printStackTrace); } } diff --git a/build.gradle b/build.gradle index 0bbade5918..11eb25d59a 100644 --- a/build.gradle +++ b/build.gradle @@ -6,8 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' - classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+' + classpath 'com.android.tools.build:gradle:2.0.0-beta2' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'me.tatarka:gradle-retrolambda:3.2.4' classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc..f1fc4fbbc1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Fri Feb 05 17:57:08 CET 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip