mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 22:04:24 +01:00
extend tab layout theming for text / states and ripple effect
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
37d88b7ea5
commit
9a2d7ee1ff
@ -52,12 +52,14 @@ import com.nextcloud.talk.models.json.conversations.Conversation
|
|||||||
import com.nextcloud.talk.models.json.generic.GenericOverall
|
import com.nextcloud.talk.models.json.generic.GenericOverall
|
||||||
import com.nextcloud.talk.models.json.reactions.ReactionsOverall
|
import com.nextcloud.talk.models.json.reactions.ReactionsOverall
|
||||||
import com.nextcloud.talk.ui.theme.ServerTheme
|
import com.nextcloud.talk.ui.theme.ServerTheme
|
||||||
|
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||||
import com.nextcloud.talk.utils.ApiUtils
|
import com.nextcloud.talk.utils.ApiUtils
|
||||||
import io.reactivex.Observer
|
import io.reactivex.Observer
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class ShowReactionsDialog(
|
class ShowReactionsDialog(
|
||||||
@ -70,12 +72,19 @@ class ShowReactionsDialog(
|
|||||||
private val serverTheme: ServerTheme
|
private val serverTheme: ServerTheme
|
||||||
) : BottomSheetDialog(activity), ReactionItemClickListener {
|
) : BottomSheetDialog(activity), ReactionItemClickListener {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
private lateinit var binding: DialogMessageReactionsBinding
|
private lateinit var binding: DialogMessageReactionsBinding
|
||||||
|
|
||||||
private var adapter: ReactionsAdapter? = null
|
private var adapter: ReactionsAdapter? = null
|
||||||
|
|
||||||
private val tagAll: String? = null
|
private val tagAll: String? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = DialogMessageReactionsBinding.inflate(layoutInflater)
|
binding = DialogMessageReactionsBinding.inflate(layoutInflater)
|
||||||
@ -98,7 +107,6 @@ class ShowReactionsDialog(
|
|||||||
adapter?.list?.clear()
|
adapter?.list?.clear()
|
||||||
if (chatMessage.reactions != null && chatMessage.reactions!!.isNotEmpty()) {
|
if (chatMessage.reactions != null && chatMessage.reactions!!.isNotEmpty()) {
|
||||||
var reactionsTotal = 0
|
var reactionsTotal = 0
|
||||||
binding.emojiReactionsTabs.setSelectedTabIndicatorColor(serverTheme.primaryColor)
|
|
||||||
for ((emoji, amount) in chatMessage.reactions!!) {
|
for ((emoji, amount) in chatMessage.reactions!!) {
|
||||||
reactionsTotal = reactionsTotal.plus(amount as Int)
|
reactionsTotal = reactionsTotal.plus(amount as Int)
|
||||||
val tab: TabLayout.Tab = binding.emojiReactionsTabs.newTab() // Create a new Tab names "First Tab"
|
val tab: TabLayout.Tab = binding.emojiReactionsTabs.newTab() // Create a new Tab names "First Tab"
|
||||||
@ -139,6 +147,8 @@ class ShowReactionsDialog(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
viewThemeUtils.colorTabLayout(binding.emojiReactionsTabs)
|
||||||
|
|
||||||
updateParticipantsForEmoji(chatMessage, tagAll)
|
updateParticipantsForEmoji(chatMessage, tagAll)
|
||||||
}
|
}
|
||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
|
@ -581,6 +581,21 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
|||||||
fun colorTabLayout(tabLayout: TabLayout) {
|
fun colorTabLayout(tabLayout: TabLayout) {
|
||||||
withScheme(tabLayout) { scheme ->
|
withScheme(tabLayout) { scheme ->
|
||||||
tabLayout.setSelectedTabIndicatorColor(scheme.primary)
|
tabLayout.setSelectedTabIndicatorColor(scheme.primary)
|
||||||
|
tabLayout.tabTextColors = ColorStateList(
|
||||||
|
arrayOf(
|
||||||
|
intArrayOf(android.R.attr.state_selected),
|
||||||
|
intArrayOf(-android.R.attr.state_selected)
|
||||||
|
),
|
||||||
|
intArrayOf(scheme.primary, ContextCompat.getColor(tabLayout.context, R.color.high_emphasis_text))
|
||||||
|
)
|
||||||
|
tabLayout.tabRippleColor = ColorStateList(
|
||||||
|
arrayOf(
|
||||||
|
intArrayOf(android.R.attr.state_pressed)
|
||||||
|
),
|
||||||
|
intArrayOf(
|
||||||
|
calculateDisabledColor(scheme.primary, SURFACE_OPACITY_BUTTON_DISABLED)
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user