feat: 优化代码

pull/103/head
kunfei 5 years ago
parent 7446caa772
commit 5d130234eb
  1. 14
      app/src/main/AndroidManifest.xml
  2. 4
      app/src/main/java/io/legado/app/help/LauncherIconHelp.kt
  3. 3
      app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt
  4. 24
      app/src/main/res/drawable-v24/ic_launcher_2.xml
  5. 56
      app/src/main/res/drawable/ic_launcher_b2.xml
  6. 5
      app/src/main/res/mipmap-anydpi-v26/launcher2.xml
  7. 2
      app/src/main/res/values/arrays.xml

@ -50,6 +50,20 @@
android:resource="@xml/shortcuts" android:resource="@xml/shortcuts"
android:launchMode="singleTask" /> android:launchMode="singleTask" />
</activity> </activity>
<!--图标1-->
<activity
android:name=".ui.welcome.Launcher2"
android:icon="@mipmap/launcher2"
android:enabled="false">
<intent-filter>
<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"
android:launchMode="singleTask" />
</activity>
<!--主界面--> <!--主界面-->
<activity <activity
android:name=".ui.main.MainActivity" android:name=".ui.main.MainActivity"

@ -6,6 +6,7 @@ import android.os.Build
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.ui.welcome.Launcher1 import io.legado.app.ui.welcome.Launcher1
import io.legado.app.ui.welcome.Launcher2
import io.legado.app.ui.welcome.WelcomeActivity import io.legado.app.ui.welcome.WelcomeActivity
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
@ -16,7 +17,8 @@ import org.jetbrains.anko.toast
object LauncherIconHelp { object LauncherIconHelp {
private val packageManager: PackageManager = App.INSTANCE.packageManager private val packageManager: PackageManager = App.INSTANCE.packageManager
private val componentNames = arrayListOf( private val componentNames = arrayListOf(
ComponentName(App.INSTANCE, Launcher1::class.java.name) ComponentName(App.INSTANCE, Launcher1::class.java.name),
ComponentName(App.INSTANCE, Launcher2::class.java.name)
) )
fun changeIcon(icon: String?) { fun changeIcon(icon: String?) {

@ -48,4 +48,5 @@ open class WelcomeActivity : BaseActivity(R.layout.activity_welcome) {
} }
class Launcher1 : WelcomeActivity() class Launcher1 : WelcomeActivity()
class Launcher2 : WelcomeActivity()

@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M34.73,33.55l-0.09,13.54A5.17,5.17 0,0 1,33.23 50c-0.23,0.06 -0.38,0 -0.44,-0.18l0.09,-6.41L33,34.25l-0.09,-2.55 2,0.71c0.18,0.06 0.21,0.17 0.09,0.35ZM43.08,40.41c0.11,0.06 0.11,0.14 0,0.26l-0.27,0.53 -0.52,2.55c-0.12,0.47 0,0.73 0.35,0.79a4.7,4.7 0,0 0,1.84 -0.18c0.41,0 0.74,-0.38 1,-1.14a0.26,0.26 0,0 1,0.18 -0.09s0.08,0.06 0.08,0.18c-0.11,0.7 0,1.11 0.27,1.23 0.64,0.76 0.44,1.32 -0.62,1.67a6,6 0,0 1,-2.72 0.17c-1.06,-0.29 -1.56,-1.23 -1.5,-2.81l0.09,-2.2L41.26,39.79L39.47,39.79l1.23,0.53c0.12,0.06 0.12,0.15 0,0.26l-0.26,0.35a19.72,19.72 0,0 1,-5.62 7c-0.18,0.05 -0.21,0 -0.09,-0.18a19.79,19.79 0,0 0,4.22 -8h-0.71a3.35,3.35 0,0 1,-1.05 1.41c-0.3,0.17 -0.47,0.14 -0.53,-0.09l0.09,-2.46L36.75,37.42q0,-0.44 -0.09,-1.41v-0.79q0,-0.09 0.18,-0.09l1.49,0.79 2.9,-0.08a16,16 0,0 0,1.14 -4l1.94,0.62c0.11,0 0.11,0.17 0,0.35s-0.5,0.52 -1,1l-1.76,1.94L43,35.75l0.79,-1 1.76,1c0.11,0 0.11,0 0,0.17l-0.44,0.7L45,39.35l0.18,0.27c0,0.11 0,0.17 -0.09,0.17L41.76,39.79ZM35.17,28.72a0.87,0.87 0,0 1,0.26 0.08c1.93,0.65 2.87,1.18 2.81,1.59s-0.26,1 -1,1.67c-0.41,0.17 -0.68,0.08 -0.79,-0.27a8,8 0,0 0,-1.5 -2.9C34.93,28.72 35,28.66 35.17,28.72ZM37.89,32.41c1.47,0.64 2.23,1.23 2.29,1.76a1.51,1.51 0,0 1,-0.88 1.23c-0.35,0.06 -0.56,-0.06 -0.62,-0.36a3.14,3.14 0,0 0,-0.88 -2.46C37.74,32.41 37.77,32.35 37.89,32.41ZM38.24,36.41v3L43,39.26v-3ZM42.46,31.41a20,20 0,0 0,-2.72 0.18L39,31l7.65,-0.26 1,-1.06 1.67,1.15h0.09c0.05,0.05 0,0.14 -0.09,0.26l-0.62,1 0.09,8.79L49,45.68a4.38,4.38 0,0 1,-2.73 4.13,0.66 0.66,0 0,1 -0.26,0.09c-0.06,-0.06 -0.06,-0.15 0,-0.26a2.43,2.43 0,0 0,-0.88 -1.85,0.26 0.26,0 0,1 -0.09,-0.18c0,-0.06 0,-0.08 0.09,-0.08 1.23,0 1.79,-0.24 1.67,-0.88l-0.09,-15.47Z"
android:fillColor="#fff" />
<path
android:pathData="M63.27,43.66c0.18,-0.06 0.21,0 0.09,0.17L60.28,47a21.87,21.87 0,0 0,-1.67 1.67c-0.06,0.12 -0.14,0.12 -0.26,0L57,47.35c-0.17,-0.12 -0.2,-0.2 -0.09,-0.26 0.82,-0.41 1.44,-0.71 1.85,-0.88l-0.09,-10 -1.49,0.09a6.65,6.65 0,0 0,-1.76 0.17l-0.79,-0.7 3.78,-0.09 1,-1.14 1.75,1q0.18,0.09 0,0.27l-0.44,0.61 -0.61,9ZM57.27,29.24c1.69,0.65 2.69,1.26 3,1.85a1.93,1.93 0,0 1,-1 1.85,0.6 0.6,0 0,1 -0.88,-0.27 6.33,6.33 0,0 0,-1.32 -3.25C57.06,29.24 57.12,29.19 57.3,29.24ZM67.84,36.1l2.38,0.79c0.17,0.06 0.2,0.21 0.08,0.44l-0.43,0.62 -0.27,2.9a9.75,9.75 0,0 1,-0.26 1.4l3.6,-0.09 1.23,-1.4 1.76,1.58q0.18,0.18 -0.09,0.18l-6.59,0.26q-0.61,5.1 -11.51,7.56 -0.27,0 -0.27,-0.09a0.28,0.28 0,0 1,0.18 -0.26q9,-2.46 9.75,-7.21L64.77,43a13,13 0,0 0,-2 0.17,1.48 1.48,0 0,1 -0.44,0.09l-0.53,-0.7 5.71,-0.18A5.35,5.35 0,0 0,67.67 41l0.17,-1.76a18,18 0,0 0,0 -2.55ZM65.91,32.58c-0.82,0.06 -1.58,0.15 -2.29,0.27l-0.7,-0.71 4.31,-0.08v-0.62c0,-1.17 0,-2.08 -0.09,-2.72l2.37,0.61q0.18,0 0.18,0.09a0.28,0.28 0,0 1,-0.09 0.35,1.9 1.9,0 0,0 -0.35,1.32l-0.09,0.88 2.29,-0.09 1,-1.05 1.41,1.23 0.09,0.17a0.26,0.26 0,0 1,-0.18 0.09l-4.66,0.18v2.63L72.68,35l0.88,-1 2.11,1.84a0.29,0.29 0,0 1,0.17 0.27,0.9 0.9,0 0,1 -0.26,0.17 5.83,5.83 0,0 0,-3.34 1.41q-0.27,0.09 -0.18,-0.18l0.62,-2 -7.3,0.18a7.26,7.26 0,0 0,-0.79 0.09c-0.94,0.11 -1.55,0.2 -1.84,0.26L62,35.4l5.19,-0.18L67.19,32.58ZM62.83,38.74c1.82,0.47 2.79,0.93 2.9,1.4a1.47,1.47 0,0 1,-0.52 1.41c-0.36,0.29 -0.62,0.23 -0.79,-0.18A8.87,8.87 0,0 0,62.75 39C62.63,38.82 62.66,38.74 62.83,38.74ZM64.15,36.36c1.58,0.35 2.4,0.71 2.46,1.06a1.54,1.54 0,0 1,-0.44 1.32c-0.35,0.23 -0.58,0.17 -0.7,-0.18a3.66,3.66 0,0 0,-1.32 -2Q63.9,36.45 64.15,36.36ZM69.15,44.36q3.87,1.23 4.92,2.46c0.24,0.47 0.09,1.15 -0.44,2 -0.23,0.24 -0.41,0.36 -0.52,0.36s-0.27,-0.15 -0.44,-0.44a11.71,11.71 0,0 0,-3.61 -4.22Q69,44.45 69.16,44.36Z"
android:fillColor="#fff" />
<path
android:pathData="M44.5,53.5l0,0 0,0a2,2 0,0 1,0.57 -0.33,2.29 2.29,0 0,1 0.69,-0.14v0.49a1.39,1.39 0,0 0,-0.5 0.09,1.27 1.27,0 0,0 -0.42,0.25 1.23,1.23 0,0 0,-0.29 0.35,1.33 1.33,0 0,0 -0.14,0.44v2.16H44V53h0.52Z"
android:fillColor="#fff" />
<path
android:pathData="M51.49,56.35a2.72,2.72 0,0 1,-0.71 0.29,2.57 2.57,0 0,1 -0.72,0.11 2.42,2.42 0,0 1,-1 -0.2,2.22 2.22,0 0,1 -0.42,-0.25 1.88,1.88 0,0 1,-0.34 -0.35,1.54 1.54,0 0,1 -0.24,-0.48 2,2 0,0 1,-0.09 -0.61,2 2,0 0,1 0.09,-0.62 1.69,1.69 0,0 1,0.23 -0.51,1.86 1.86,0 0,1 0.36,-0.38 2.43,2.43 0,0 1,0.44 -0.26,2.06 2.06,0 0,1 0.76,-0.17 1.92,1.92 0,0 1,0.74 0.15,2.22 2.22,0 0,1 0.42,0.25 1.48,1.48 0,0 1,0.33 0.37,1.76 1.76,0 0,1 0.22,0.48 2.23,2.23 0,0 1,0.08 0.6L51.64,55L48.51,55a1.41,1.41 0,0 0,0.09 0.38,1.29 1.29,0 0,0 0.16,0.31 1.47,1.47 0,0 0,0.55 0.44,2 2,0 0,0 0.75,0.14 2.36,2.36 0,0 0,0.58 -0.07,2.31 2.31,0 0,0 0.57,-0.24ZM49.33,53.51a1.51,1.51 0,0 0,-0.5 0.38,1.4 1.4,0 0,0 -0.29,0.64h2.58a1.3,1.3 0,0 0,-0.24 -0.66,1.35 1.35,0 0,0 -0.49,-0.37 1.27,1.27 0,0 0,-0.52 -0.1A1.37,1.37 0,0 0,49.33 53.51Z"
android:fillColor="#fff" />
<path
android:pathData="M53.9,53.46a1.72,1.72 0,0 1,0.53 -0.34,2.83 2.83,0 0,1 0.5,-0.13 2.45,2.45 0,0 1,0.54 0,1.86 1.86,0 0,1 0.52,0.11 1.13,1.13 0,0 1,0.43 0.26,0.89 0.89,0 0,1 0.25,0.34 1.4,1.4 0,0 1,0.14 0.56c0,0.2 0,0.43 0,0.68h0v1.76h-0.51v-0.34a1.82,1.82 0,0 1,-0.36 0.2,2.35 2.35,0 0,1 -0.37,0.14 1.71,1.71 0,0 1,-0.84 0,1.09 1.09,0 0,1 -0.83,-0.73 1.17,1.17 0,0 1,-0.05 -0.38,1 1,0 0,1 0.08,-0.42 1.13,1.13 0,0 1,0.24 -0.36,1.31 1.31,0 0,1 0.28,-0.2l0.32,-0.11 0.34,-0.05 0.38,0 0.39,0a2.7,2.7 0,0 0,0.41 -0.06,1.44 1.44,0 0,0 -0.1,-0.48 0.72,0.72 0,0 0,-0.14 -0.19,0.85 0.85,0 0,0 -0.28,-0.16 1.53,1.53 0,0 0,-0.36 -0.07,1.8 1.8,0 0,0 -0.8,0.13 0.75,0.75 0,0 0,-0.2 0.1,0.76 0.76,0 0,0 -0.17,0.13ZM56.32,54.92h0v-0.1l-0.41,0 -0.38,0 -0.56,0a0.82,0.82 0,0 0,-0.42 0.19,0.53 0.53,0 0,0 -0.12,0.2 0.49,0.49 0,0 0,0 0.25,0.69 0.69,0 0,0 0.13,0.43 0.61,0.61 0,0 0,0.36 0.23,1.18 1.18,0 0,0 0.59,0 2,2 0,0 0,0.43 -0.19,2.15 2.15,0 0,0 0.43,-0.33Z"
android:fillColor="#fff" />
<path
android:pathData="M62,56.74h-0.9a1.67,1.67 0,0 1,-0.71 -0.15,1.79 1.79,0 0,1 -0.56,-0.42 2,2 0,0 1,-0.36 -0.6,1.92 1.92,0 0,1 -0.13,-0.72 2,2 0,0 1,0.49 -1.34,1.76 1.76,0 0,1 0.56,-0.41 1.67,1.67 0,0 1,0.71 -0.15L62,52.95v-1.4h0.51v5.19L62,56.74ZM62,53.43h-0.9a1.12,1.12 0,0 0,-0.48 0.1,1.24 1.24,0 0,0 -0.39,0.29 1.29,1.29 0,0 0,-0.27 0.45,1.57 1.57,0 0,0 -0.1,0.58 1.47,1.47 0,0 0,0.1 0.56,1.29 1.29,0 0,0 0.27,0.45 1.11,1.11 0,0 0,0.39 0.29,1.13 1.13,0 0,0 0.48,0.11L62,56.26Z"
android:fillColor="#fff" />
</vector>

@ -0,0 +1,56 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M0,0h108v108h-108z"
android:fillColor="#4d4d4d" />
<path android:pathData="M0,108H54V64c0,-12 -54,-5 -54,-5Z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="79.39"
android:startX="0.55"
android:endY="88.08"
android:endX="53.13"
android:type="linear">
<item
android:offset="0"
android:color="#FFFFFFFF" />
<item
android:offset="1"
android:color="#FFCCCCCC" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M108,108H54V64c0,-12 54,-5 54,-5Z"
android:fillColor="#fff" />
<path android:pathData="M71.5,70 L78,76V57a94.89,94.89 0,0 0,-13 0.75V76Z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="57.11"
android:startX="71.5"
android:endY="76"
android:endX="71.5"
android:type="linear">
<item
android:offset="0"
android:color="#FFFFFFFF" />
<item
android:offset="0.24"
android:color="#FFFFE1DD" />
<item
android:offset="0.58"
android:color="#FFFFBEB6" />
<item
android:offset="0.84"
android:color="#FFFFA89D" />
<item
android:offset="1"
android:color="#FFFFA094" />
</gradient>
</aapt:attr>
</path>
</vector>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_b2" />
<foreground android:drawable="@drawable/ic_launcher_2" />
</adaptive-icon>

@ -133,6 +133,7 @@
</declare-styleable> </declare-styleable>
<string-array name="icon_names"> <string-array name="icon_names">
<item>iconMain</item>
<item>icon1</item> <item>icon1</item>
<item>icon2</item> <item>icon2</item>
</string-array> </string-array>
@ -140,6 +141,7 @@
<string-array name="icons"> <string-array name="icons">
<item>ic_launcher</item> <item>ic_launcher</item>
<item>launcher1</item> <item>launcher1</item>
<item>launcher2</item>
</string-array> </string-array>
<string-array name="chinese_mode"> <string-array name="chinese_mode">

Loading…
Cancel
Save