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) {