From 621c74c1d6c99cf78b83582da47cbaaa4c8e9981 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 22 Aug 2023 10:58:06 +0930 Subject: [PATCH] Improve animations --- .../conversation/expiration/ExpirationSettingsActivity.kt | 5 +++-- .../securesms/preferences/RadioOptionAdapter.kt | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsActivity.kt index 632667a01b..50e9043dc6 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsActivity.kt @@ -5,14 +5,13 @@ import android.os.Parcelable import android.util.SparseArray import android.widget.Toast import androidx.activity.viewModels -import androidx.core.content.ContextCompat import androidx.core.text.HtmlCompat import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle -import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.SimpleItemAnimator import com.google.android.material.divider.MaterialDividerItemDecoration import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch @@ -92,6 +91,7 @@ class ExpirationSettingsActivity: PassphraseRequiredActionBarActivity() { viewModel.onExpirationTypeSelected(it) } binding.recyclerViewDeleteTypes.apply { + (itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false adapter = deleteTypeOptionAdapter addDividers() setHasFixedSize(true) @@ -102,6 +102,7 @@ class ExpirationSettingsActivity: PassphraseRequiredActionBarActivity() { viewModel.onExpirationTimerSelected(it) } binding.recyclerViewTimerOptions.apply { + (itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false adapter = timerOptionAdapter addDividers() } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt index 8f74d89a0b..2cd246cf7d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt @@ -35,14 +35,14 @@ class RadioOptionAdapter( isSelected = position == selectedOptionPosition ) { onClickListener(it) - selectedOptionPosition = position - notifyItemRangeChanged(0, itemCount) + setSelectedPosition(position) } } fun setSelectedPosition(selectedPosition: Int) { + notifyItemChanged(selectedOptionPosition) selectedOptionPosition = selectedPosition - notifyDataSetChanged() + notifyItemChanged(selectedOptionPosition) } class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView) {