From 39ec2b236343d4bd0481f6784e7e2ae1248998f6 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Sun, 12 May 2019 18:44:50 +0300 Subject: [PATCH] update gradle, add cleartext support for 9+ (need test), cleanup --- app/build.gradle | 200 +++++++++--------- app/src/main/AndroidManifest.xml | 3 +- .../purplei2p/lightning/utils/ThemeUtils.java | 3 +- .../main/res/drawable/ic_action_reading.xml | 9 - app/src/main/res/layout/bookmark_drawer.xml | 2 +- app/src/main/res/layout/reading_view.xml | 48 ----- app/src/main/res/menu/reading.xml | 18 -- build.gradle | 14 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 110 insertions(+), 189 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_action_reading.xml delete mode 100644 app/src/main/res/layout/reading_view.xml delete mode 100644 app/src/main/res/menu/reading.xml diff --git a/app/build.gradle b/app/build.gradle index 7f60481..a12f7aa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,113 +2,107 @@ apply plugin: 'com.android.application' apply plugin: 'com.getkeepsafe.dexcount' android { - compileSdkVersion project.targetSdkVersion - buildToolsVersion project.buildToolsVersion - - defaultConfig { - minSdkVersion project.minSdkVersion - targetSdkVersion project.targetSdkVersion - applicationId "org.purplei2p.lightning" - versionName project.versionName - versionCode project.versionCode - vectorDrawables.useSupportLibrary = true - } - - signingConfigs { - r4sas { - storeFile file("store.jks") - storePassword "storepass" - keyAlias "keyalias" - keyPassword "keypass" - } - } - - buildTypes { - debug { - minifyEnabled false - shrinkResources false - proguardFiles 'proguard-project.txt' - applicationVariants.all { variant -> - renameAPK(variant, defaultConfig, 'debug') - } - } - - release { - minifyEnabled true - shrinkResources true - signingConfig signingConfigs.r4sas - proguardFiles 'proguard-project.txt' - applicationVariants.all { variant -> - renameAPK(variant, defaultConfig, 'release') - } - } - } - - lintOptions { - abortOnError true - } - - packagingOptions { - exclude '.readme' - } + compileSdkVersion project.targetSdkVersion + buildToolsVersion project.buildToolsVersion + + defaultConfig { + minSdkVersion project.minSdkVersion + targetSdkVersion project.targetSdkVersion + applicationId "org.purplei2p.lightning" + versionName project.versionName + versionCode project.versionCode + vectorDrawables.useSupportLibrary = true + } + + signingConfigs { + r4sas { + storeFile file("store.jks") + storePassword "storepass" + keyAlias "keyalias" + keyPassword "keypass" + } + } + + buildTypes { + debug { + minifyEnabled false + shrinkResources false + proguardFiles 'proguard-project.txt' + } + + release { + minifyEnabled true + shrinkResources true + signingConfig signingConfigs.r4sas + proguardFiles 'proguard-project.txt' + } + } + + android.applicationVariants.all { variant -> + variant.outputs.all { output -> + def formattedDate = new Date().format('yyMMdd') + + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.apk')) { + def fileName = outputFile.name.replace("app", "${defaultConfig.applicationId}_${defaultConfig.versionCode}_${formattedDate}") + outputFileName = fileName + } + } + } + + lintOptions { + abortOnError true + } + + packagingOptions { + exclude '.readme' + } } dexcount { - includeClasses = false - includeFieldCount = false - format = "tree" - orderByMethodCount = true - verbose = false + includeClasses = false + includeFieldCount = false + // format = "tree" + orderByMethodCount = true + verbose = false } dependencies { - testCompile 'junit:junit:4.12' - - // support libraries - def supportLibVersion = '25.4.0' - compile "com.android.support:palette-v7:$supportLibVersion" - compile "com.android.support:appcompat-v7:$supportLibVersion" - compile "com.android.support:design:$supportLibVersion" - compile "com.android.support:recyclerview-v7:$supportLibVersion" - compile "com.android.support:support-v4:$supportLibVersion" - - // dependency injection - def daggerVersion = '2.11' - compile "com.google.dagger:dagger:$daggerVersion" - annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion" - provided 'javax.annotation:jsr250-api:1.0' - - // view binding - def butterknifeVersion = '8.6.0' - compile "com.jakewharton:butterknife:$butterknifeVersion" - annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion" - - // permissions - compile 'com.anthonycr.grant:permissions:1.1.2' - - // tor proxy - def netcipherVersion = '2.0.0-alpha1' - compile "info.guardianproject.netcipher:netcipher:$netcipherVersion" - compile "info.guardianproject.netcipher:netcipher-webkit:$netcipherVersion" - - compile 'com.anthonycr.bonsai:bonsai:1.1.0' - - compile 'com.anthonycr.progress:animated-progress:1.0' - - // memory leak analysis - def leakCanaryVersion = '1.5.1' - debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion" - releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion" - - // Kotlin + testImplementation 'junit:junit:4.12' + + // support libraries + def supportLibVersion = '28.0.0' + implementation "com.android.support:palette-v7:$supportLibVersion" + implementation "com.android.support:appcompat-v7:$supportLibVersion" + implementation "com.android.support:design:$supportLibVersion" + implementation "com.android.support:recyclerview-v7:$supportLibVersion" + implementation "com.android.support:support-v4:$supportLibVersion" + + // dependency injection + def daggerVersion = '2.11' + implementation "com.google.dagger:dagger:$daggerVersion" + annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion" + compileOnly 'javax.annotation:jsr250-api:1.0' + + // view binding + def butterknifeVersion = '8.6.0' + implementation "com.jakewharton:butterknife:$butterknifeVersion" + annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion" + + // permissions + implementation 'com.anthonycr.grant:permissions:1.1.2' + + // tor proxy + def netcipherVersion = '2.0.0-alpha1' + implementation "info.guardianproject.netcipher:netcipher:$netcipherVersion" + implementation "info.guardianproject.netcipher:netcipher-webkit:$netcipherVersion" + + implementation 'com.anthonycr.bonsai:bonsai:1.1.0' + + implementation 'com.anthonycr.progress:animated-progress:1.0' + + // memory leak analysis + def leakCanaryVersion = '1.5.1' + debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion" + releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion" } - -def renameAPK(variant, defaultConfig, buildType) { - variant.outputs.each { output -> - def formattedDate = new Date().format('yyMMdd') - - def file = output.packageApplication.outputFile - def fileName = defaultConfig.applicationId + "_" + defaultConfig.versionCode + "_" + formattedDate + "_" + buildType + ".apk" - output.packageApplication.outputFile = new File(file.parent, fileName) - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1005a96..8fdca1f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,7 +22,8 @@ android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" - android:label="@string/app_name"> + android:label="@string/app_name" + android:usesCleartextTraffic="true"> diff --git a/app/src/main/java/org/purplei2p/lightning/utils/ThemeUtils.java b/app/src/main/java/org/purplei2p/lightning/utils/ThemeUtils.java index 3a28998..6704a09 100644 --- a/app/src/main/java/org/purplei2p/lightning/utils/ThemeUtils.java +++ b/app/src/main/java/org/purplei2p/lightning/utils/ThemeUtils.java @@ -1,5 +1,6 @@ package org.purplei2p.lightning.utils; +import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; @@ -125,7 +126,7 @@ public class ThemeUtils { @NonNull private static Drawable getVectorDrawable(@NonNull Context context, int drawableId) { - Drawable drawable = ContextCompat.getDrawable(context, drawableId); + @SuppressLint("RestrictedApi") Drawable drawable = ContextCompat.getDrawable(context, drawableId); Preconditions.checkNonNull(drawable); diff --git a/app/src/main/res/drawable/ic_action_reading.xml b/app/src/main/res/drawable/ic_action_reading.xml deleted file mode 100644 index bd20794..0000000 --- a/app/src/main/res/drawable/ic_action_reading.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/layout/bookmark_drawer.xml b/app/src/main/res/layout/bookmark_drawer.xml index 25035ff..61d0c0c 100644 --- a/app/src/main/res/layout/bookmark_drawer.xml +++ b/app/src/main/res/layout/bookmark_drawer.xml @@ -57,7 +57,7 @@ android:background="?attr/dividerColor" android:baselineAligned="false" android:orientation="horizontal" - android:weightSum="3"> + android:weightSum="2"> - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/reading.xml b/app/src/main/res/menu/reading.xml deleted file mode 100644 index 70ff4d0..0000000 --- a/app/src/main/res/menu/reading.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 195593b..ad47ab3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,26 +1,26 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' - classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.3' + classpath 'com.android.tools.build:gradle:3.3.1' + classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.4' } } allprojects { repositories { jcenter() - mavenCentral() - maven { url "https://maven.google.com" } + google() } } ext { minSdkVersion = 14 - targetSdkVersion = 26 - buildToolsVersion = '26.0.3' + targetSdkVersion = 28 + buildToolsVersion = '28.0.3' versionName = '0.1.2' - versionCode = 3 + versionCode = 125 } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 665e5ab..b4151aa 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip