diff --git a/vector/src/main/java/im/vector/app/core/ui/list/GenericItemHeader.kt b/vector/src/main/java/im/vector/app/core/ui/list/GenericHeaderItem.kt similarity index 95% rename from vector/src/main/java/im/vector/app/core/ui/list/GenericItemHeader.kt rename to vector/src/main/java/im/vector/app/core/ui/list/GenericHeaderItem.kt index bc5446e836..b4b0211b91 100644 --- a/vector/src/main/java/im/vector/app/core/ui/list/GenericItemHeader.kt +++ b/vector/src/main/java/im/vector/app/core/ui/list/GenericHeaderItem.kt @@ -29,7 +29,7 @@ import im.vector.app.features.themes.ThemeUtils * A generic list item header left aligned with notice color. */ @EpoxyModelClass(layout = R.layout.item_generic_header) -abstract class GenericItemHeader : VectorEpoxyModel() { +abstract class GenericHeaderItem : VectorEpoxyModel() { @EpoxyAttribute var text: String? = null diff --git a/vector/src/main/java/im/vector/app/core/ui/list/GenericItemWithValue.kt b/vector/src/main/java/im/vector/app/core/ui/list/GenericWithValueItem.kt similarity index 94% rename from vector/src/main/java/im/vector/app/core/ui/list/GenericItemWithValue.kt rename to vector/src/main/java/im/vector/app/core/ui/list/GenericWithValueItem.kt index c83311e6fe..a143530a0e 100644 --- a/vector/src/main/java/im/vector/app/core/ui/list/GenericItemWithValue.kt +++ b/vector/src/main/java/im/vector/app/core/ui/list/GenericWithValueItem.kt @@ -37,9 +37,8 @@ import im.vector.app.features.themes.ThemeUtils * Can display an accessory on the right, that can be an image or an indeterminate progress. * If provided with an action, will display a button at the bottom of the list item. */ -// TODO This class is not following the name convention. Should end with `Item @EpoxyModelClass(layout = R.layout.item_generic_with_value) -abstract class GenericItemWithValue : VectorEpoxyModel() { +abstract class GenericWithValueItem : VectorEpoxyModel() { @EpoxyAttribute var title: CharSequence? = null diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchResultController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchResultController.kt index 74bd168d09..1debf32104 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchResultController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchResultController.kt @@ -29,7 +29,7 @@ import im.vector.app.core.date.VectorDateFormatter import im.vector.app.core.epoxy.loadingItem import im.vector.app.core.epoxy.noResultItem import im.vector.app.core.resources.StringProvider -import im.vector.app.core.ui.list.GenericItemHeader_ +import im.vector.app.core.ui.list.GenericHeaderItem_ import im.vector.app.features.home.AvatarRenderer import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.events.model.Content @@ -111,7 +111,7 @@ class SearchResultController @Inject constructor( timeInMillis = eventAndSender.event.originServerTs ?: System.currentTimeMillis() } if (lastDate?.get(Calendar.DAY_OF_YEAR) != eventDate.get(Calendar.DAY_OF_YEAR)) { - GenericItemHeader_() + GenericHeaderItem_() .id(eventDate.hashCode()) .text(dateFormatter.format(eventDate.timeInMillis, DateFormatKind.EDIT_HISTORY_HEADER)) .let { result.add(it) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt index c3c53084ed..b526e0e058 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt @@ -26,8 +26,8 @@ import im.vector.app.core.date.VectorDateFormatter import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.genericFooterItem +import im.vector.app.core.ui.list.genericHeaderItem import im.vector.app.core.ui.list.genericItem -import im.vector.app.core.ui.list.genericItemHeader import im.vector.app.core.ui.list.genericLoaderItem import im.vector.app.features.html.EventHtmlRenderer import me.gujun.android.span.span @@ -87,7 +87,7 @@ class ViewEditHistoryEpoxyController @Inject constructor( } if (lastDate?.get(Calendar.DAY_OF_YEAR) != evDate.get(Calendar.DAY_OF_YEAR)) { // need to display header with day - genericItemHeader { + genericHeaderItem { id(evDate.hashCode()) text(host.dateFormatter.format(evDate.timeInMillis, DateFormatKind.EDIT_HISTORY_HEADER)) } diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt index 20958bb3c0..c4216ffaba 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt @@ -29,7 +29,7 @@ import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.ItemStyle import im.vector.app.core.ui.list.genericFooterItem import im.vector.app.core.ui.list.genericItem -import im.vector.app.core.ui.list.genericItemWithValue +import im.vector.app.core.ui.list.genericWithValueItem import im.vector.app.core.utils.DimensionConverter import im.vector.app.features.settings.VectorPreferences import me.gujun.android.span.span @@ -101,7 +101,7 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider: } else { // Build list of device with status deviceList.forEach { device -> - genericItemWithValue { + genericWithValueItem { id(device.deviceId) titleIconResourceId(if (device.isVerified) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning) apply { @@ -152,7 +152,7 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider: private fun addDebugInfo(data: DeviceListViewState) { val host = this data.memberCrossSigningKey?.masterKey()?.let { - genericItemWithValue { + genericWithValueItem { id("msk") titleIconResourceId(R.drawable.key_small) title( @@ -168,7 +168,7 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider: } } data.memberCrossSigningKey?.userKey()?.let { - genericItemWithValue { + genericWithValueItem { id("usk") titleIconResourceId(R.drawable.key_small) title( @@ -184,7 +184,7 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider: } } data.memberCrossSigningKey?.selfSigningKey()?.let { - genericItemWithValue { + genericWithValueItem { id("ssk") titleIconResourceId(R.drawable.key_small) title( diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt index 39c3c137f4..34ab8d0e4d 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt @@ -23,7 +23,7 @@ import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.ItemStyle import im.vector.app.core.ui.list.genericFooterItem import im.vector.app.core.ui.list.genericItem -import im.vector.app.core.ui.list.genericItemWithValue +import im.vector.app.core.ui.list.genericWithValueItem import im.vector.app.core.utils.DimensionConverter import im.vector.app.features.crypto.verification.epoxy.bottomSheetVerificationActionItem import im.vector.app.features.settings.VectorPreferences @@ -77,7 +77,7 @@ class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvi // text(stringProvider.getString(R.string.verification_profile_device_untrust_info)) } - genericItemWithValue { + genericWithValueItem { id(cryptoDeviceInfo.deviceId) titleIconResourceId(if (isVerified) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning) title( diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt index c361e859d0..79a9278570 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt @@ -21,8 +21,8 @@ import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.genericButtonItem import im.vector.app.core.ui.list.genericItem -import im.vector.app.core.ui.list.genericItemWithValue import im.vector.app.core.ui.list.genericPositiveButtonItem +import im.vector.app.core.ui.list.genericWithValueItem import im.vector.app.core.utils.DimensionConverter import me.gujun.android.span.span import javax.inject.Inject @@ -104,7 +104,7 @@ class CrossSigningSettingsController @Inject constructor( val crossSigningKeys = data.crossSigningInfo crossSigningKeys?.masterKey()?.let { - genericItemWithValue { + genericWithValueItem { id("msk") titleIconResourceId(R.drawable.key_small) title( @@ -120,7 +120,7 @@ class CrossSigningSettingsController @Inject constructor( } } crossSigningKeys?.userKey()?.let { - genericItemWithValue { + genericWithValueItem { id("usk") titleIconResourceId(R.drawable.key_small) title( @@ -136,7 +136,7 @@ class CrossSigningSettingsController @Inject constructor( } } crossSigningKeys?.selfSigningKey()?.let { - genericItemWithValue { + genericWithValueItem { id("ssk") titleIconResourceId(R.drawable.key_small) title( diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt index a3c7ffaa8f..a446e9646e 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt @@ -29,7 +29,7 @@ import im.vector.app.core.epoxy.loadingItem import im.vector.app.core.error.ErrorFormatter import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.StringProvider -import im.vector.app.core.ui.list.genericItemHeader +import im.vector.app.core.ui.list.genericHeaderItem import im.vector.app.core.utils.DimensionConverter import im.vector.app.features.settings.VectorPreferences import org.matrix.android.sdk.internal.crypto.crosssigning.DeviceTrustLevel @@ -90,7 +90,7 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor }?.let { fullInfo -> val deviceInfo = fullInfo.deviceInfo // Current device - genericItemHeader { + genericHeaderItem { id("current") text(host.stringProvider.getString(R.string.devices_current_device)) } @@ -126,7 +126,7 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor // Other devices if (devices.size > 1) { - genericItemHeader { + genericHeaderItem { id("others") text(host.stringProvider.getString(R.string.devices_other_devices)) } diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataEpoxyController.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataEpoxyController.kt index be04dc1a69..fd3cd0962b 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataEpoxyController.kt @@ -25,7 +25,7 @@ import im.vector.app.R import im.vector.app.core.epoxy.loadingItem import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.genericFooterItem -import im.vector.app.core.ui.list.genericItemWithValue +import im.vector.app.core.ui.list.genericWithValueItem import org.matrix.android.sdk.api.session.accountdata.AccountDataEvent import javax.inject.Inject @@ -65,7 +65,7 @@ class AccountDataEpoxyController @Inject constructor( } } else { dataList.forEach { accountData -> - genericItemWithValue { + genericWithValueItem { id(accountData.type) title(accountData.type) itemClickAction { diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt index 7d3bb80132..dd7424f618 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt @@ -22,7 +22,6 @@ import im.vector.app.RoomGroupingMethod import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.genericFooterItem -import im.vector.app.core.ui.list.genericItemHeader import im.vector.app.features.grouplist.groupSummaryItem import im.vector.app.features.grouplist.homeSpaceSummaryItem import im.vector.app.features.home.AvatarRenderer @@ -72,7 +71,7 @@ class SpaceSummaryController @Inject constructor( text(" ") } - genericItemHeader { + genericHeaderItem { id("legacy_groups") text(host.stringProvider.getString(R.string.groups_header)) textColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)) diff --git a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt index e15f404cbf..7daa6ae0db 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt @@ -22,7 +22,7 @@ import com.airbnb.mvrx.Success import im.vector.app.R import im.vector.app.core.epoxy.loadingItem import im.vector.app.core.resources.StringProvider -import im.vector.app.core.ui.list.genericItemHeader +import im.vector.app.core.ui.list.genericHeaderItem import im.vector.app.core.utils.TextUtils import im.vector.app.features.home.AvatarRenderer import javax.inject.Inject @@ -48,7 +48,7 @@ class SpacePreviewController @Inject constructor( val result = data?.childInfoList?.invoke() ?: return if (result.isNotEmpty()) { - genericItemHeader { + genericHeaderItem { id("header_rooms") text(host.stringProvider.getString(R.string.rooms)) }