Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb595b8b authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Apps: Remove obsolete android version checks



minSdkVersion is high enough for us to drop these checks

Signed-off-by: Aayush Gupta's avatarAayush Gupta <theimpulson@e.email>
parent f8d29aa4
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -28,9 +28,7 @@ object IntentUtils {
            Intent().apply {
                this.action = Intent.ACTION_VIEW
                this.flags = Intent.FLAG_ACTIVITY_NEW_TASK
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                this.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
                }
                this.setDataAndType(UriUtils.fromFileProvider(mContext, File(filePath)), "application/vnd.android.package-archive")
                mContext.startActivity(this)
            }
+2 −16
Original line number Diff line number Diff line
@@ -36,11 +36,7 @@ class LocaleUtils {

    val systemLocal: Locale
        get() {
            return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                LocaleList.getDefault().get(0)
            } else {
                Locale.getDefault()
            }
            return LocaleList.getDefault().get(0)
        }


@@ -51,17 +47,7 @@ class LocaleUtils {
//        }

    private fun forLanguageTag(languageTag: String): Locale {
        return if (Build.VERSION.SDK_INT >= 21) {
            Locale.forLanguageTag(languageTag)
        } else {
            val parts = languageTag.split("-".toRegex()).toTypedArray()
            if (parts.size == 1)
                Locale(parts[0])
            else if (parts.size == 2 || parts.size == 3 && parts[2].startsWith("#"))
                Locale(parts[0], parts[1])
            else
                Locale(parts[0], parts[1], parts[2])
        }
        return Locale.forLanguageTag(languageTag)
    }

    private fun toLanguageTag(locale: Locale): String {
+1 −5
Original line number Diff line number Diff line
@@ -28,10 +28,6 @@ object UriUtils {
    private val fileProviderPath by lazy { "${BuildConfig.APPLICATION_ID}.fileprovider" }

    fun fromFileProvider(mContext: Context, file: File): Uri {
        return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            FileProvider.getUriForFile(mContext, fileProviderPath, file)
        } else {
            Uri.fromFile(file)
        }
        return FileProvider.getUriForFile(mContext, fileProviderPath, file)
    }
}
+0 −6
Original line number Diff line number Diff line
@@ -56,12 +56,6 @@ object XApkInstallUtils {
                            }
                            return@Runnable
                        }
                        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && this.XSplitApks?.size ?: 0 > 1) {
                            handler.post {
                                xApkInstallProgressCallback?.onError(InstallError.LowerSdkError)
                            }
                            return@Runnable
                        }
                        if (this.useObbs()) {
                            installXApkObb(zipFile!!, this, xApkInstallProgressCallback)
                        }
+6 −10
Original line number Diff line number Diff line
@@ -128,7 +128,6 @@ class ApplicationActivity :
        } else {
            toolbar.elevation = defaultElevation
        }
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
        scroll_view.setOnScrollChangeListener { view, ia, ib, ic, id ->
            if (view.scrollY == 0) {
                toolbar.elevation = 0f
@@ -137,7 +136,6 @@ class ApplicationActivity :
            }
        }
    }
    }

    override fun onServiceBind(applicationManager: ApplicationManager) {
        application = applicationManager.findOrCreateApp(applicationPackageName)
@@ -721,9 +719,7 @@ class ApplicationActivity :
            imageView.setImageBitmap(it)
            val outValue = TypedValue()
            theme.resolveAttribute(android.R.attr.selectableItemBackground, outValue, true)
            if (android.os.Build.VERSION.SDK_INT >= 23) {
            imageView.foreground = getDrawable(outValue.resourceId)
            }
            app_images_container.addView(imageView)
            imageView.setOnClickListener { _ ->
                val intent = Intent(this, ScreenshotsActivity::class.java)
Loading