Browse Source

update gradle, add cleartext support for 9+ (need test), cleanup

master
R4SAS 5 years ago
parent
commit
39ec2b2363
  1. 200
      app/build.gradle
  2. 3
      app/src/main/AndroidManifest.xml
  3. 3
      app/src/main/java/org/purplei2p/lightning/utils/ThemeUtils.java
  4. 9
      app/src/main/res/drawable/ic_action_reading.xml
  5. 2
      app/src/main/res/layout/bookmark_drawer.xml
  6. 48
      app/src/main/res/layout/reading_view.xml
  7. 18
      app/src/main/res/menu/reading.xml
  8. 14
      build.gradle
  9. 2
      gradle/wrapper/gradle-wrapper.properties

200
app/build.gradle

@ -2,113 +2,107 @@ apply plugin: 'com.android.application'
apply plugin: 'com.getkeepsafe.dexcount' apply plugin: 'com.getkeepsafe.dexcount'
android { android {
compileSdkVersion project.targetSdkVersion compileSdkVersion project.targetSdkVersion
buildToolsVersion project.buildToolsVersion buildToolsVersion project.buildToolsVersion
defaultConfig { defaultConfig {
minSdkVersion project.minSdkVersion minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion targetSdkVersion project.targetSdkVersion
applicationId "org.purplei2p.lightning" applicationId "org.purplei2p.lightning"
versionName project.versionName versionName project.versionName
versionCode project.versionCode versionCode project.versionCode
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
signingConfigs { signingConfigs {
r4sas { r4sas {
storeFile file("store.jks") storeFile file("store.jks")
storePassword "storepass" storePassword "storepass"
keyAlias "keyalias" keyAlias "keyalias"
keyPassword "keypass" keyPassword "keypass"
} }
} }
buildTypes { buildTypes {
debug { debug {
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
proguardFiles 'proguard-project.txt' proguardFiles 'proguard-project.txt'
applicationVariants.all { variant -> }
renameAPK(variant, defaultConfig, 'debug')
} release {
} minifyEnabled true
shrinkResources true
release { signingConfig signingConfigs.r4sas
minifyEnabled true proguardFiles 'proguard-project.txt'
shrinkResources true }
signingConfig signingConfigs.r4sas }
proguardFiles 'proguard-project.txt'
applicationVariants.all { variant -> android.applicationVariants.all { variant ->
renameAPK(variant, defaultConfig, 'release') variant.outputs.all { output ->
} def formattedDate = new Date().format('yyMMdd')
}
} def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
lintOptions { def fileName = outputFile.name.replace("app", "${defaultConfig.applicationId}_${defaultConfig.versionCode}_${formattedDate}")
abortOnError true outputFileName = fileName
} }
}
packagingOptions { }
exclude '.readme'
} lintOptions {
abortOnError true
}
packagingOptions {
exclude '.readme'
}
} }
dexcount { dexcount {
includeClasses = false includeClasses = false
includeFieldCount = false includeFieldCount = false
format = "tree" // format = "tree"
orderByMethodCount = true orderByMethodCount = true
verbose = false verbose = false
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
// support libraries // support libraries
def supportLibVersion = '25.4.0' def supportLibVersion = '28.0.0'
compile "com.android.support:palette-v7:$supportLibVersion" implementation "com.android.support:palette-v7:$supportLibVersion"
compile "com.android.support:appcompat-v7:$supportLibVersion" implementation "com.android.support:appcompat-v7:$supportLibVersion"
compile "com.android.support:design:$supportLibVersion" implementation "com.android.support:design:$supportLibVersion"
compile "com.android.support:recyclerview-v7:$supportLibVersion" implementation "com.android.support:recyclerview-v7:$supportLibVersion"
compile "com.android.support:support-v4:$supportLibVersion" implementation "com.android.support:support-v4:$supportLibVersion"
// dependency injection // dependency injection
def daggerVersion = '2.11' def daggerVersion = '2.11'
compile "com.google.dagger:dagger:$daggerVersion" implementation "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion" annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
provided 'javax.annotation:jsr250-api:1.0' compileOnly 'javax.annotation:jsr250-api:1.0'
// view binding // view binding
def butterknifeVersion = '8.6.0' def butterknifeVersion = '8.6.0'
compile "com.jakewharton:butterknife:$butterknifeVersion" implementation "com.jakewharton:butterknife:$butterknifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion" annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"
// permissions // permissions
compile 'com.anthonycr.grant:permissions:1.1.2' implementation 'com.anthonycr.grant:permissions:1.1.2'
// tor proxy // tor proxy
def netcipherVersion = '2.0.0-alpha1' def netcipherVersion = '2.0.0-alpha1'
compile "info.guardianproject.netcipher:netcipher:$netcipherVersion" implementation "info.guardianproject.netcipher:netcipher:$netcipherVersion"
compile "info.guardianproject.netcipher:netcipher-webkit:$netcipherVersion" implementation "info.guardianproject.netcipher:netcipher-webkit:$netcipherVersion"
compile 'com.anthonycr.bonsai:bonsai:1.1.0' implementation 'com.anthonycr.bonsai:bonsai:1.1.0'
compile 'com.anthonycr.progress:animated-progress:1.0' implementation 'com.anthonycr.progress:animated-progress:1.0'
// memory leak analysis // memory leak analysis
def leakCanaryVersion = '1.5.1' def leakCanaryVersion = '1.5.1'
debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion" debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion" releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
// Kotlin
} }
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)
}
}

3
app/src/main/AndroidManifest.xml

@ -22,7 +22,8 @@
android:allowBackup="true" android:allowBackup="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"> android:label="@string/app_name"
android:usesCleartextTraffic="true">
<meta-data <meta-data
android:name="android.webkit.WebView.MetricsOptOut" android:name="android.webkit.WebView.MetricsOptOut"
android:value="true"/> android:value="true"/>

3
app/src/main/java/org/purplei2p/lightning/utils/ThemeUtils.java

@ -1,5 +1,6 @@
package org.purplei2p.lightning.utils; package org.purplei2p.lightning.utils;
import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
@ -125,7 +126,7 @@ public class ThemeUtils {
@NonNull @NonNull
private static Drawable getVectorDrawable(@NonNull Context context, int drawableId) { 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); Preconditions.checkNonNull(drawable);

9
app/src/main/res/drawable/ic_action_reading.xml

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14,17L4,17v2h10v-2zM20,9L4,9v2h16L20,9zM4,15h16v-2L4,13v2zM4,5v2h16L20,5L4,5z"
android:fillColor="#000000"/>
</vector>

2
app/src/main/res/layout/bookmark_drawer.xml

@ -57,7 +57,7 @@
android:background="?attr/dividerColor" android:background="?attr/dividerColor"
android:baselineAligned="false" android:baselineAligned="false"
android:orientation="horizontal" android:orientation="horizontal"
android:weightSum="3"> android:weightSum="2">
<FrameLayout <FrameLayout
android:id="@+id/action_toggle_desktop" android:id="@+id/action_toggle_desktop"

48
app/src/main/res/layout/reading_view.xml

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?toolbarSettingsBackground"
android:elevation="2dp"
android:minHeight="?attr/actionBarSize"
custom:contentInsetEnd="0dp"
custom:contentInsetStart="0dp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:id="@+id/textViewTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal|center_vertical"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textViewBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView>
</LinearLayout>

18
app/src/main/res/menu/reading.xml

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/invert_item"
android:icon="@drawable/ic_action_invert"
android:title="@string/invert_color"
app:showAsAction="ifRoom">
</item>
<item
android:id="@+id/text_size_item"
android:icon="@drawable/ic_action_text_size"
android:title="@string/size"
app:showAsAction="ifRoom">
</item>
</menu>

14
build.gradle

@ -1,26 +1,26 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.3' classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.4'
} }
} }
allprojects { allprojects {
repositories { repositories {
jcenter() jcenter()
mavenCentral() google()
maven { url "https://maven.google.com" }
} }
} }
ext { ext {
minSdkVersion = 14 minSdkVersion = 14
targetSdkVersion = 26 targetSdkVersion = 28
buildToolsVersion = '26.0.3' buildToolsVersion = '28.0.3'
versionName = '0.1.2' versionName = '0.1.2'
versionCode = 3 versionCode = 125
} }

2
gradle/wrapper/gradle-wrapper.properties vendored

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

Loading…
Cancel
Save