Remove obsolete checks for API 23

This commit is contained in:
Moez Bhatti
2022-12-12 20:30:04 -05:00
parent ce9ba1b9f9
commit 4f2d4954ed
27 changed files with 88 additions and 282 deletions
@@ -35,7 +35,6 @@ import com.moez.QKSMS.util.GlideApp
import com.moez.QKSMS.util.tryOrNull
import javax.inject.Inject
@RequiresApi(Build.VERSION_CODES.M)
class QkChooserTargetService : ChooserTargetService() {
@Inject lateinit var conversationRepo: ConversationRepository
@@ -63,9 +63,6 @@ fun ProgressBar.setTint(color: Int) {
fun View.setBackgroundTint(color: Int) {
// API 21 doesn't support this
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
background?.setColorFilter(color, PorterDuff.Mode.SRC_IN)
}
backgroundTintList = ColorStateList.valueOf(color)
}
@@ -155,11 +155,6 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
.subscribe()
window.callback = ComposeWindowCallback(window.callback, this)
// These theme attributes don't apply themselves on API 21
if (Build.VERSION.SDK_INT <= 22) {
messageBackground.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
}
}
override fun onStart() {
@@ -123,7 +123,6 @@ class ComposeWindowCallback(
return localCallback.onSearchRequested()
}
@RequiresApi(api = Build.VERSION_CODES.M)
override fun onSearchRequested(searchEvent: SearchEvent): Boolean {
return localCallback.onSearchRequested(searchEvent)
}
@@ -132,7 +131,6 @@ class ComposeWindowCallback(
return localCallback.onWindowStartingActionMode(callback)
}
@RequiresApi(api = Build.VERSION_CODES.M)
override fun onWindowStartingActionMode(callback: ActionMode.Callback, i: Int): ActionMode? {
return localCallback.onWindowStartingActionMode(callback, i)
}
@@ -152,9 +152,7 @@ class MessagesAdapter @Inject constructor(
view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
view.body.hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE
}
view.body.hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE
val partsAdapter = partsAdapterProvider.get()
partsAdapter.clicks.subscribe(partClicks)
@@ -44,11 +44,6 @@ class ChipsAdapter @Inject constructor() : QkAdapter<Recipient>() {
val inflater = LayoutInflater.from(parent.context)
val view = inflater.inflate(R.layout.contact_chip, parent, false)
return QkViewHolder(view).apply {
// These theme attributes don't apply themselves on API 21
if (Build.VERSION.SDK_INT <= 22) {
content.setBackgroundTint(view.context.resolveThemeColor(R.attr.bubbleColor))
}
view.setOnClickListener {
val chip = getItem(adapterPosition)
showDetailedChip(view.context, chip)
@@ -88,11 +88,6 @@ class ContactsActivity : QkThemedActivity(), ContactsContract {
viewModel.bindView(this)
contacts.adapter = contactsAdapter
// These theme attributes don't apply themselves on API 21
if (Build.VERSION.SDK_INT <= 22) {
search.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
}
}
override fun render(state: ContactsState) {
@@ -185,11 +185,6 @@ class MainActivity : QkThemedActivity(), MainView {
// Set the FAB compose icon color
compose.setTint(theme.textPrimary)
}
// These theme attributes don't apply themselves on API 21
if (Build.VERSION.SDK_INT <= 22) {
toolbarSearch.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
}
}
override fun onNewIntent(intent: Intent?) {
@@ -74,15 +74,6 @@ class QkReplyActivity : QkThemedActivity(), QkReplyView {
messages.adapter?.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() = messages.scrollToPosition(adapter.itemCount - 1)
})
// These theme attributes don't apply themselves on API 21
if (Build.VERSION.SDK_INT <= 22) {
toolbar.setBackgroundTint(resolveThemeColor(R.attr.colorPrimary))
background.setBackgroundTint(resolveThemeColor(android.R.attr.windowBackground))
messageBackground.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
composeBackgroundGradient.setBackgroundTint(resolveThemeColor(android.R.attr.windowBackground))
composeBackgroundSolid.setBackgroundTint(resolveThemeColor(android.R.attr.windowBackground))
}
}
override fun render(state: QkReplyState) {
@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<!-- On Marshmallow, explicitly don't use the light status bar -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
@@ -19,7 +19,9 @@
-->
<resources>
<style name="AppTheme" parent="AppBaseTheme" />
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="AppBaseTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:divider">@color/separatorDark</item>
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<!-- On Marshmallow, use the light status bar -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:statusBarColor">@color/backgroundLight</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>
+4 -1
View File
@@ -31,7 +31,10 @@
<item name="android:windowBackground">@color/backgroundDark</item>
</style>
<style name="AppTheme" parent="AppBaseTheme" />
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:statusBarColor">@color/backgroundLight</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:divider">@color/separatorLight</item>