From e1f82d147c956dd0c62fe8466dcb966572c7b631 Mon Sep 17 00:00:00 2001 From: Zakhar Timoshenko Date: Tue, 9 May 2023 17:28:15 +0300 Subject: [PATCH] Fix ActionMode background on Android Lollipop --- .../org/koitharu/kotatsu/base/ui/BaseActivity.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseActivity.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseActivity.kt index 78099ae3e..c9474a173 100644 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseActivity.kt +++ b/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseActivity.kt @@ -3,6 +3,7 @@ package org.koitharu.kotatsu.base.ui import android.content.Intent import android.content.res.Configuration import android.graphics.Color +import android.os.Build import android.os.Bundle import android.view.KeyEvent import android.view.MenuItem @@ -122,10 +123,14 @@ abstract class BaseActivity : override fun onSupportActionModeStarted(mode: ActionMode) { super.onSupportActionModeStarted(mode) actionModeDelegate.onSupportActionModeStarted(mode) - val actionModeColor = ColorUtils.compositeColors( - ContextCompat.getColor(this, com.google.android.material.R.color.m3_appbar_overlay_color), - getThemeColor(com.google.android.material.R.attr.colorSurface), - ) + val actionModeColor = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + ColorUtils.compositeColors( + ContextCompat.getColor(this, com.google.android.material.R.color.m3_appbar_overlay_color), + getThemeColor(com.google.android.material.R.attr.colorSurface), + ) + } else { + ContextCompat.getColor(this, R.color.kotatsu_secondaryContainer) + } val insets = ViewCompat.getRootWindowInsets(binding.root) ?.getInsets(WindowInsetsCompat.Type.systemBars()) ?: return findViewById(androidx.appcompat.R.id.action_mode_bar).apply {