Переглянути джерело

Update Android Studio to 3.0

inorichi 7 роки тому
батько
коміт
d545cfd38c

+ 8 - 39
app/build.gradle

@@ -4,10 +4,9 @@ apply plugin: 'com.android.application'
 apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-android-extensions'
 apply plugin: 'kotlin-kapt'
+apply plugin: 'com.github.zellius.shortcut-helper'
 
-if (file("custom.gradle").exists()) {
-    apply from: "custom.gradle"
-}
+shortcutHelper.filePath = './shortcuts.xml'
 
 ext {
     // Git is needed in your system PATH for these commands to work.
@@ -31,7 +30,7 @@ ext {
 
 android {
     compileSdkVersion 26
-    buildToolsVersion "26.0.1"
+    buildToolsVersion "26.0.2"
     publishNonDefault true
 
     defaultConfig {
@@ -68,15 +67,20 @@ android {
         }
     }
 
+    flavorDimensions "default"
+
     productFlavors {
         standard {
             buildConfigField "boolean", "INCLUDE_UPDATER", "true"
+            dimension "default"
         }
         fdroid {
+            dimension "default"
         }
         dev {
             minSdkVersion 21
             resConfigs "en", "xxhdpi"
+            dimension "default"
         }
     }
 
@@ -247,38 +251,3 @@ kotlin {
         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)
-            }
-        }
-    }
-}

+ 4 - 8
app/src/main/res/xml-v25/shortcuts.xml → app/shortcuts.xml

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

+ 3 - 2
app/src/main/AndroidManifest.xml

@@ -26,8 +26,9 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </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
             android:name=".ui.reader.ReaderActivity"

+ 2 - 1
build.gradle

@@ -6,8 +6,9 @@ buildscript {
         jcenter()
     }
     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.zellius:android-shortcut-gradle-plugin:0.1.1'
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
     }

+ 2 - 2
gradle/wrapper/gradle-wrapper.properties

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