Clean code after Benoit's review #2
This commit is contained in:
parent
7c0f2d6e32
commit
b44ddcfd61
@ -38,8 +38,8 @@ internal abstract class ProfileModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
abstract fun bindProfileService(userService: DefaultProfileService): ProfileService
|
abstract fun bindProfileService(service: DefaultProfileService): ProfileService
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
abstract fun bindGetProfileTask(getProfileInfoTask: DefaultGetProfileInfoTask): GetProfileInfoTask
|
abstract fun bindGetProfileTask(task: DefaultGetProfileInfoTask): GetProfileInfoTask
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,13 @@
|
|||||||
<data android:host="matrix.to" />
|
<data android:host="matrix.to" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".features.roommemberprofile.RoomMemberProfileActivity" />
|
|
||||||
|
<activity android:name=".features.roommemberprofile.RoomMemberProfileActivity"
|
||||||
|
android:parentActivityName=".features.home.HomeActivity">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value=".features.home.HomeActivity" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<!-- Services -->
|
<!-- Services -->
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import im.vector.riotx.core.extensions.setTextOrHide
|
|||||||
import im.vector.riotx.features.themes.ThemeUtils
|
import im.vector.riotx.features.themes.ThemeUtils
|
||||||
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_profile_action)
|
@EpoxyModelClass(layout = R.layout.item_profile_action)
|
||||||
abstract class ProfileItemAction : VectorEpoxyModel<ProfileItemAction.Holder>() {
|
abstract class ProfileActionItem : VectorEpoxyModel<ProfileActionItem.Holder>() {
|
||||||
|
|
||||||
@EpoxyAttribute
|
@EpoxyAttribute
|
||||||
lateinit var title: String
|
lateinit var title: String
|
@ -22,7 +22,7 @@ import com.airbnb.epoxy.EpoxyController
|
|||||||
import im.vector.riotx.core.epoxy.DividerItem_
|
import im.vector.riotx.core.epoxy.DividerItem_
|
||||||
|
|
||||||
fun EpoxyController.buildProfileSection(title: String) {
|
fun EpoxyController.buildProfileSection(title: String) {
|
||||||
profileItemSection {
|
profileSectionItem {
|
||||||
id("section_$title")
|
id("section_$title")
|
||||||
title(title)
|
title(title)
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ fun EpoxyController.buildProfileAction(
|
|||||||
divider: Boolean = true,
|
divider: Boolean = true,
|
||||||
action: () -> Unit
|
action: () -> Unit
|
||||||
) {
|
) {
|
||||||
profileItemAction {
|
profileActionItem {
|
||||||
iconRes(icon)
|
iconRes(icon)
|
||||||
id("action_$id")
|
id("action_$id")
|
||||||
subtitle(subtitle)
|
subtitle(subtitle)
|
||||||
|
@ -24,7 +24,7 @@ import im.vector.riotx.core.epoxy.VectorEpoxyHolder
|
|||||||
import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
||||||
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_profile_section)
|
@EpoxyModelClass(layout = R.layout.item_profile_section)
|
||||||
abstract class ProfileItemSection: VectorEpoxyModel<ProfileItemSection.Holder>() {
|
abstract class ProfileSectionItem: VectorEpoxyModel<ProfileSectionItem.Holder>() {
|
||||||
|
|
||||||
@EpoxyAttribute
|
@EpoxyAttribute
|
||||||
lateinit var title: String
|
lateinit var title: String
|
@ -64,8 +64,6 @@ class RoomListQuickActionsEpoxyController @Inject constructor(private val avatar
|
|||||||
id("leave_separator")
|
id("leave_separator")
|
||||||
}
|
}
|
||||||
RoomListQuickActionsSharedAction.Leave(roomSummary.roomId).toBottomSheetItem(5)
|
RoomListQuickActionsSharedAction.Leave(roomSummary.roomId).toBottomSheetItem(5)
|
||||||
|
|
||||||
// Leave
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,16 +56,9 @@ class DefaultNavigator @Inject constructor(
|
|||||||
fatalError("Trying to open an unknown room $roomId", vectorPreferences.failFast())
|
fatalError("Trying to open an unknown room $roomId", vectorPreferences.failFast())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val args = RoomDetailArgs(roomId, eventId)
|
val args = RoomDetailArgs(roomId, eventId)
|
||||||
val intent = RoomDetailActivity.newIntent(context, args)
|
val intent = RoomDetailActivity.newIntent(context, args)
|
||||||
if (buildTask) {
|
startActivity(context, intent, buildTask)
|
||||||
val stackBuilder = TaskStackBuilder.create(context)
|
|
||||||
stackBuilder.addNextIntentWithParentStack(intent)
|
|
||||||
stackBuilder.startActivities()
|
|
||||||
} else {
|
|
||||||
context.startActivity(intent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openNotJoinedRoom(context: Context, roomIdOrAlias: String?, eventId: String?, buildTask: Boolean) {
|
override fun openNotJoinedRoom(context: Context, roomIdOrAlias: String?, eventId: String?, buildTask: Boolean) {
|
||||||
@ -86,7 +79,8 @@ class DefaultNavigator @Inject constructor(
|
|||||||
|
|
||||||
override fun openRoomMemberProfile(userId: String, roomId: String?, context: Context, buildTask: Boolean) {
|
override fun openRoomMemberProfile(userId: String, roomId: String?, context: Context, buildTask: Boolean) {
|
||||||
val args = RoomMemberProfileArgs(userId = userId, roomId = roomId)
|
val args = RoomMemberProfileArgs(userId = userId, roomId = roomId)
|
||||||
context.startActivity(RoomMemberProfileActivity.newIntent(context, args))
|
val intent = RoomMemberProfileActivity.newIntent(context, args)
|
||||||
|
startActivity(context, intent, buildTask)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openRoomForSharing(activity: Activity, roomId: String, sharedData: SharedData) {
|
override fun openRoomForSharing(activity: Activity, roomId: String, sharedData: SharedData) {
|
||||||
@ -141,4 +135,14 @@ class DefaultNavigator @Inject constructor(
|
|||||||
override fun openRoomProfile(context: Context, roomId: String) {
|
override fun openRoomProfile(context: Context, roomId: String) {
|
||||||
context.startActivity(RoomProfileActivity.newIntent(context, roomId))
|
context.startActivity(RoomProfileActivity.newIntent(context, roomId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun startActivity(context: Context, intent: Intent, buildTask: Boolean) {
|
||||||
|
if (buildTask) {
|
||||||
|
val stackBuilder = TaskStackBuilder.create(context)
|
||||||
|
stackBuilder.addNextIntentWithParentStack(intent)
|
||||||
|
stackBuilder.startActivities()
|
||||||
|
} else {
|
||||||
|
context.startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("DEPRECATION")
|
|
||||||
|
|
||||||
package im.vector.riotx.features.roommemberprofile
|
package im.vector.riotx.features.roommemberprofile
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@ -80,8 +78,8 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||||||
.subscribe {
|
.subscribe {
|
||||||
dismissLoadingDialog()
|
dismissLoadingDialog()
|
||||||
when (it) {
|
when (it) {
|
||||||
is RoomMemberProfileViewEvents.Loading -> showLoadingDialog(it.message)
|
is RoomMemberProfileViewEvents.Loading -> showLoadingDialog(it.message)
|
||||||
is RoomMemberProfileViewEvents.Failure -> showErrorInSnackbar(it.throwable)
|
is RoomMemberProfileViewEvents.Failure -> showErrorInSnackbar(it.throwable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disposeOnDestroyView()
|
.disposeOnDestroyView()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user