From 5f5cb39793091be9285dea5adb1f63029c0af374 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 19 May 2020 14:41:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/AppConfig.kt | 13 ------------- .../java/io/legado/app/utils/ContextExtensions.kt | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index f47ec213a..79353351c 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -2,7 +2,6 @@ package io.legado.app.help import android.annotation.SuppressLint import android.content.Context -import android.content.pm.PackageManager import io.legado.app.App import io.legado.app.R import io.legado.app.constant.PreferKey @@ -139,15 +138,3 @@ object AppConfig { val isGooglePlay: Boolean get() = App.INSTANCE.channel == "google" } -val Context.channel: String - get() { - try { - val pm = packageManager - val appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); - return appInfo.metaData.getString("channel") ?: "" - } catch (e: Exception) { - e.printStackTrace(); - } - return "" - } - diff --git a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt index bc3f6f9fa..7a9d1e275 100644 --- a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt @@ -3,6 +3,7 @@ package io.legado.app.utils import android.annotation.SuppressLint import android.content.* +import android.content.pm.PackageManager import android.content.res.ColorStateList import android.content.res.Configuration import android.graphics.Bitmap @@ -178,4 +179,16 @@ fun Context.openUrl(uri: Uri) { toast(e.localizedMessage ?: "open url error") } } -} \ No newline at end of file +} + +val Context.channel: String + get() { + try { + val pm = packageManager + val appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); + return appInfo.metaData.getString("channel") ?: "" + } catch (e: Exception) { + e.printStackTrace(); + } + return "" + }