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' @@ -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)
}
}

3
app/src/main/AndroidManifest.xml

@ -22,7 +22,8 @@ @@ -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">
<meta-data
android:name="android.webkit.WebView.MetricsOptOut"
android:value="true"/>

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

@ -1,5 +1,6 @@ @@ -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 { @@ -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);

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

@ -1,9 +0,0 @@ @@ -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 @@ @@ -57,7 +57,7 @@
android:background="?attr/dividerColor"
android:baselineAligned="false"
android:orientation="horizontal"
android:weightSum="3">
android:weightSum="2">
<FrameLayout
android:id="@+id/action_toggle_desktop"

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

@ -1,48 +0,0 @@ @@ -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 @@ @@ -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 @@ @@ -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
}

2
gradle/wrapper/gradle-wrapper.properties vendored

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME @@ -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

Loading…
Cancel
Save