Update Android Studio to 3.0

This commit is contained in:
inorichi 2017-10-28 14:44:19 +02:00
parent 3631a9fac2
commit d545cfd38c
5 changed files with 19 additions and 52 deletions

View file

@ -4,10 +4,9 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
apply plugin: 'com.github.zellius.shortcut-helper'
if (file("custom.gradle").exists()) { shortcutHelper.filePath = './shortcuts.xml'
apply from: "custom.gradle"
}
ext { ext {
// Git is needed in your system PATH for these commands to work. // Git is needed in your system PATH for these commands to work.
@ -31,7 +30,7 @@ ext {
android { android {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.1" buildToolsVersion "26.0.2"
publishNonDefault true publishNonDefault true
defaultConfig { defaultConfig {
@ -68,15 +67,20 @@ android {
} }
} }
flavorDimensions "default"
productFlavors { productFlavors {
standard { standard {
buildConfigField "boolean", "INCLUDE_UPDATER", "true" buildConfigField "boolean", "INCLUDE_UPDATER", "true"
dimension "default"
} }
fdroid { fdroid {
dimension "default"
} }
dev { dev {
minSdkVersion 21 minSdkVersion 21
resConfigs "en", "xxhdpi" resConfigs "en", "xxhdpi"
dimension "default"
} }
} }
@ -247,38 +251,3 @@ kotlin {
coroutines 'enable' coroutines 'enable'
} }
} }
// add support for placeholders in resource files
//https://code.google.com/p/android/issues/detail?id=69224
def replacePlaceholdersInFile(basePath, fileName, placeholders) {
def file = new File(basePath, fileName);
if (!file.exists()) {
logger.quiet("Unable to replace placeholders in " + file.toString() + ". File cannot be found.")
return;
}
logger.debug("Replacing placeholders in " + file.toString())
logger.debug("Placeholders: " + placeholders.toString())
def content = file.getText('UTF-8')
placeholders.each { entry ->
content = content.replaceAll("\\\$\\{${entry.key}\\}", entry.value)
}
file.write(content, 'UTF-8')
}
afterEvaluate {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processResources.doFirst {
// prepare placeholder map from manifestPlaceholders including applicationId placeholder
def placeholders = variant.mergedFlavor.manifestPlaceholders + [applicationId: variant.applicationId]
replacePlaceholdersInFile(resDir, 'xml-v25/shortcuts.xml', placeholders)
}
}
}
}

View file

@ -9,8 +9,7 @@
android:shortcutShortLabel="@string/label_library"> android:shortcutShortLabel="@string/label_library">
<intent <intent
android:action="eu.kanade.tachiyomi.SHOW_LIBRARY" android:action="eu.kanade.tachiyomi.SHOW_LIBRARY"
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
android:targetPackage="${applicationId}" />
</shortcut> </shortcut>
<shortcut <shortcut
android:enabled="true" android:enabled="true"
@ -21,8 +20,7 @@
android:shortcutShortLabel="@string/short_recent_updates"> android:shortcutShortLabel="@string/short_recent_updates">
<intent <intent
android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_UPDATED" android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_UPDATED"
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
android:targetPackage="${applicationId}" />
</shortcut> </shortcut>
<shortcut <shortcut
android:enabled="true" android:enabled="true"
@ -33,8 +31,7 @@
android:shortcutShortLabel="@string/label_recent_manga"> android:shortcutShortLabel="@string/label_recent_manga">
<intent <intent
android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_READ" android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_READ"
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
android:targetPackage="${applicationId}" />
</shortcut> </shortcut>
<shortcut <shortcut
android:enabled="true" android:enabled="true"
@ -45,7 +42,6 @@
android:shortcutShortLabel="@string/label_catalogues"> android:shortcutShortLabel="@string/label_catalogues">
<intent <intent
android:action="eu.kanade.tachiyomi.SHOW_CATALOGUES" android:action="eu.kanade.tachiyomi.SHOW_CATALOGUES"
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
android:targetPackage="${applicationId}" />
</shortcut> </shortcut>
</shortcuts> </shortcuts>

View file

@ -26,8 +26,9 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="@xml/shortcuts"/> <!--suppress AndroidDomInspection -->
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts"/>
</activity> </activity>
<activity <activity
android:name=".ui.reader.ReaderActivity" android:name=".ui.reader.ReaderActivity"

View file

@ -6,8 +6,9 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0' classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0'
classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }

View file

@ -1,6 +1,6 @@
#Fri Mar 03 16:14:18 CET 2017 #Wed Oct 25 23:17:30 CEST 2017
distributionBase=GRADLE_USER_HOME 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.1-all.zip