mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 03:16:02 +03:00
Room profile: fix issue with divider color
This commit is contained in:
parent
9eff459ed6
commit
b56ee9a377
12 changed files with 76 additions and 18 deletions
|
@ -15,11 +15,24 @@
|
|||
*/
|
||||
package im.vector.riotx.core.epoxy
|
||||
|
||||
import com.airbnb.epoxy.EpoxyAttribute
|
||||
import com.airbnb.epoxy.EpoxyModelClass
|
||||
import im.vector.riotx.R
|
||||
|
||||
/**
|
||||
* Default background color is for the bottom sheets (R.attr.vctr_list_bottom_sheet_divider_color).
|
||||
* To use in fragment, set color using R.attr.vctr_list_divider_color
|
||||
*/
|
||||
@EpoxyModelClass(layout = R.layout.item_divider)
|
||||
abstract class DividerItem : VectorEpoxyModel<DividerItem.Holder>() {
|
||||
|
||||
@EpoxyAttribute var color: Int = -1
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
if (color != -1) {
|
||||
holder.view.setBackgroundColor(color)
|
||||
}
|
||||
}
|
||||
|
||||
class Holder : VectorEpoxyHolder()
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package im.vector.riotx.core.epoxy.profiles
|
|||
|
||||
import androidx.annotation.DrawableRes
|
||||
import com.airbnb.epoxy.EpoxyController
|
||||
import im.vector.riotx.core.epoxy.DividerItem_
|
||||
import im.vector.riotx.core.epoxy.dividerItem
|
||||
|
||||
fun EpoxyController.buildProfileSection(title: String) {
|
||||
profileSectionItem {
|
||||
|
@ -31,6 +31,7 @@ fun EpoxyController.buildProfileSection(title: String) {
|
|||
fun EpoxyController.buildProfileAction(
|
||||
id: String,
|
||||
title: String,
|
||||
dividerColor: Int,
|
||||
subtitle: String? = null,
|
||||
editable: Boolean = true,
|
||||
@DrawableRes icon: Int = 0,
|
||||
|
@ -50,7 +51,10 @@ fun EpoxyController.buildProfileAction(
|
|||
}
|
||||
}
|
||||
|
||||
DividerItem_()
|
||||
.id("divider_$title")
|
||||
.addIf(divider, this)
|
||||
if (divider) {
|
||||
dividerItem {
|
||||
id("divider_$title")
|
||||
color(dividerColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,16 @@ import com.airbnb.epoxy.TypedEpoxyController
|
|||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.epoxy.profiles.buildProfileAction
|
||||
import im.vector.riotx.core.epoxy.profiles.buildProfileSection
|
||||
import im.vector.riotx.core.resources.ColorProvider
|
||||
import im.vector.riotx.core.resources.StringProvider
|
||||
import javax.inject.Inject
|
||||
|
||||
class RoomMemberProfileController @Inject constructor(private val stringProvider: StringProvider)
|
||||
: TypedEpoxyController<RoomMemberProfileViewState>() {
|
||||
class RoomMemberProfileController @Inject constructor(
|
||||
private val stringProvider: StringProvider,
|
||||
colorProvider: ColorProvider
|
||||
) : TypedEpoxyController<RoomMemberProfileViewState>() {
|
||||
|
||||
private val dividerColor = colorProvider.getColorFromAttribute(R.attr.vctr_list_divider_color)
|
||||
|
||||
var callback: Callback? = null
|
||||
|
||||
|
@ -54,6 +59,7 @@ class RoomMemberProfileController @Inject constructor(private val stringProvider
|
|||
buildProfileAction(
|
||||
id = "ignore",
|
||||
title = ignoreActionTitle,
|
||||
dividerColor = dividerColor,
|
||||
destructive = true,
|
||||
editable = false,
|
||||
divider = false,
|
||||
|
@ -72,6 +78,7 @@ class RoomMemberProfileController @Inject constructor(private val stringProvider
|
|||
buildProfileAction(
|
||||
id = "learn_more",
|
||||
title = stringProvider.getString(R.string.room_profile_section_security_learn_more),
|
||||
dividerColor = dividerColor,
|
||||
editable = false,
|
||||
divider = false,
|
||||
subtitle = stringProvider.getString(learnMoreSubtitle),
|
||||
|
@ -85,6 +92,7 @@ class RoomMemberProfileController @Inject constructor(private val stringProvider
|
|||
id = "read_receipt",
|
||||
editable = false,
|
||||
title = stringProvider.getString(R.string.room_member_jump_to_read_receipt),
|
||||
dividerColor = dividerColor,
|
||||
action = { callback?.onJumpToReadReceiptClicked() }
|
||||
)
|
||||
|
||||
|
@ -93,6 +101,7 @@ class RoomMemberProfileController @Inject constructor(private val stringProvider
|
|||
buildProfileAction(
|
||||
id = "mention",
|
||||
title = stringProvider.getString(R.string.room_participants_action_mention),
|
||||
dividerColor = dividerColor,
|
||||
editable = false,
|
||||
divider = ignoreActionTitle != null,
|
||||
action = { callback?.onMentionClicked() }
|
||||
|
@ -101,6 +110,7 @@ class RoomMemberProfileController @Inject constructor(private val stringProvider
|
|||
buildProfileAction(
|
||||
id = "ignore",
|
||||
title = ignoreActionTitle,
|
||||
dividerColor = dividerColor,
|
||||
destructive = true,
|
||||
editable = false,
|
||||
divider = false,
|
||||
|
|
|
@ -21,11 +21,16 @@ import com.airbnb.epoxy.TypedEpoxyController
|
|||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.epoxy.profiles.buildProfileAction
|
||||
import im.vector.riotx.core.epoxy.profiles.buildProfileSection
|
||||
import im.vector.riotx.core.resources.ColorProvider
|
||||
import im.vector.riotx.core.resources.StringProvider
|
||||
import javax.inject.Inject
|
||||
|
||||
class RoomProfileController @Inject constructor(private val stringProvider: StringProvider)
|
||||
: TypedEpoxyController<RoomProfileViewState>() {
|
||||
class RoomProfileController @Inject constructor(
|
||||
private val stringProvider: StringProvider,
|
||||
colorProvider: ColorProvider
|
||||
) : TypedEpoxyController<RoomProfileViewState>() {
|
||||
|
||||
private val dividerColor = colorProvider.getColorFromAttribute(R.attr.vctr_list_divider_color)
|
||||
|
||||
var callback: Callback? = null
|
||||
|
||||
|
@ -53,6 +58,7 @@ class RoomProfileController @Inject constructor(private val stringProvider: Stri
|
|||
buildProfileAction(
|
||||
id = "learn_more",
|
||||
title = stringProvider.getString(R.string.room_profile_section_security_learn_more),
|
||||
dividerColor = dividerColor,
|
||||
subtitle = stringProvider.getString(learnMoreSubtitle),
|
||||
action = { callback?.onLearnMoreClicked() }
|
||||
)
|
||||
|
@ -62,12 +68,14 @@ class RoomProfileController @Inject constructor(private val stringProvider: Stri
|
|||
buildProfileAction(
|
||||
id = "settings",
|
||||
title = stringProvider.getString(R.string.room_profile_section_more_settings),
|
||||
dividerColor = dividerColor,
|
||||
icon = R.drawable.ic_room_profile_settings,
|
||||
action = { callback?.onSettingsClicked() }
|
||||
)
|
||||
buildProfileAction(
|
||||
id = "notifications",
|
||||
title = stringProvider.getString(R.string.room_profile_section_more_notifications),
|
||||
dividerColor = dividerColor,
|
||||
icon = R.drawable.ic_room_profile_notification,
|
||||
action = { callback?.onNotificationsClicked() }
|
||||
)
|
||||
|
@ -75,18 +83,21 @@ class RoomProfileController @Inject constructor(private val stringProvider: Stri
|
|||
buildProfileAction(
|
||||
id = "member_list",
|
||||
title = stringProvider.getQuantityString(R.plurals.room_profile_section_more_member_list, numberOfMembers, numberOfMembers),
|
||||
dividerColor = dividerColor,
|
||||
icon = R.drawable.ic_room_profile_member_list,
|
||||
action = { callback?.onMemberListClicked() }
|
||||
)
|
||||
buildProfileAction(
|
||||
id = "uploads",
|
||||
title = stringProvider.getString(R.string.room_profile_section_more_uploads),
|
||||
dividerColor = dividerColor,
|
||||
icon = R.drawable.ic_room_profile_uploads,
|
||||
action = { callback?.onUploadsClicked() }
|
||||
)
|
||||
buildProfileAction(
|
||||
id = "leave",
|
||||
title = stringProvider.getString(R.string.room_profile_section_more_leave),
|
||||
dividerColor = dividerColor,
|
||||
divider = false,
|
||||
destructive = true,
|
||||
editable = false,
|
||||
|
|
|
@ -19,20 +19,27 @@ package im.vector.riotx.features.roomprofile.members
|
|||
import com.airbnb.epoxy.TypedEpoxyController
|
||||
import im.vector.matrix.android.api.session.room.model.RoomMemberSummary
|
||||
import im.vector.matrix.android.api.util.toMatrixItem
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.epoxy.dividerItem
|
||||
import im.vector.riotx.core.epoxy.profiles.buildProfileSection
|
||||
import im.vector.riotx.core.epoxy.profiles.profileMatrixItem
|
||||
import im.vector.riotx.core.resources.ColorProvider
|
||||
import im.vector.riotx.core.resources.StringProvider
|
||||
import im.vector.riotx.features.home.AvatarRenderer
|
||||
import javax.inject.Inject
|
||||
|
||||
class RoomMemberListController @Inject constructor(private val avatarRenderer: AvatarRenderer,
|
||||
private val stringProvider: StringProvider) : TypedEpoxyController<RoomMemberListViewState>() {
|
||||
class RoomMemberListController @Inject constructor(
|
||||
private val avatarRenderer: AvatarRenderer,
|
||||
private val stringProvider: StringProvider,
|
||||
colorProvider: ColorProvider
|
||||
) : TypedEpoxyController<RoomMemberListViewState>() {
|
||||
|
||||
interface Callback {
|
||||
fun onRoomMemberClicked(roomMember: RoomMemberSummary)
|
||||
}
|
||||
|
||||
private val dividerColor = colorProvider.getColorFromAttribute(R.attr.vctr_list_divider_color)
|
||||
|
||||
var callback: Callback? = null
|
||||
|
||||
init {
|
||||
|
@ -60,6 +67,7 @@ class RoomMemberListController @Inject constructor(private val avatarRenderer: A
|
|||
|
||||
dividerItem {
|
||||
id("divider_${roomMember.userId}")
|
||||
color(dividerColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="?vctr_list_divider_color" />
|
||||
<solid android:color="?vctr_redacted_message_color" />
|
||||
</shape>
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<View xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/quickReactTopDivider"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/vctr_list_divider_color" />
|
||||
android:background="?attr/vctr_list_bottom_sheet_divider_color"
|
||||
tools:layout_height="100dp" />
|
||||
|
|
|
@ -46,8 +46,11 @@
|
|||
<attr name="vctr_list_header_primary_text_color" format="color" />
|
||||
<attr name="vctr_list_header_secondary_text_color" format="color" />
|
||||
|
||||
<attr name="vctr_list_bottom_sheet_divider_color" format="color" />
|
||||
<attr name="vctr_list_divider_color" format="color" />
|
||||
|
||||
<attr name="vctr_redacted_message_color" format="color" />
|
||||
|
||||
<!-- gradient on the bottom of some activities -->
|
||||
<attr name="vctr_activity_bottom_gradient_color" format="color" />
|
||||
|
||||
|
|
|
@ -70,7 +70,11 @@
|
|||
<item name="vctr_tab_home">@color/primary_color_black</item>
|
||||
<!--Header/Panel Text Secondary-->
|
||||
<item name="vctr_tab_home_secondary">@color/primary_color_dark_black</item>
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_black</item>
|
||||
|
||||
<item name="vctr_list_bottom_sheet_divider_color">@color/list_divider_color_black</item>
|
||||
<item name="vctr_list_divider_color">@color/riotx_header_panel_background_black</item>
|
||||
|
||||
<item name="vctr_redacted_message_color">@color/list_divider_color_black</item>
|
||||
|
||||
<item name="vctr_markdown_block_background_color">#FF4D4D4D</item>
|
||||
|
||||
|
|
|
@ -121,7 +121,10 @@
|
|||
<!--Header/Panel Text Secondary-->
|
||||
<item name="vctr_list_header_secondary_text_color">#FFC8C8CD</item>
|
||||
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_dark</item>
|
||||
<item name="vctr_list_bottom_sheet_divider_color">@color/list_divider_color_dark</item>
|
||||
<item name="vctr_list_divider_color">@color/riotx_header_panel_background_dark</item>
|
||||
|
||||
<item name="vctr_redacted_message_color">@color/list_divider_color_dark</item>
|
||||
|
||||
<!-- gradient on the home bottom -->
|
||||
<item name="vctr_activity_bottom_gradient_color">#80000000</item>
|
||||
|
|
|
@ -121,7 +121,10 @@
|
|||
<!--Header/Panel Text Secondary-->
|
||||
<item name="vctr_list_header_secondary_text_color">#FFC8C8CD</item>
|
||||
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_light</item>
|
||||
<item name="vctr_list_bottom_sheet_divider_color">@color/list_divider_color_light</item>
|
||||
<item name="vctr_list_divider_color">@color/riotx_header_panel_background_light</item>
|
||||
|
||||
<item name="vctr_redacted_message_color">@color/list_divider_color_light</item>
|
||||
|
||||
<!-- gradient on the home bottom -->
|
||||
<item name="vctr_activity_bottom_gradient_color">#80ffffff</item>
|
||||
|
|
|
@ -71,8 +71,6 @@
|
|||
<item name="vctr_list_header_primary_text_color">#7F3C3C3C</item>
|
||||
<item name="vctr_list_header_secondary_text_color">#4D3C3C3C</item>
|
||||
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_light</item>
|
||||
|
||||
<!-- gradient on the home bottom -->
|
||||
<item name="vctr_activity_bottom_gradient_color">#80ffffff</item>
|
||||
|
||||
|
|
Loading…
Reference in a new issue