Code review fixes.
This commit is contained in:
parent
f650e29ddd
commit
1124aa25fd
|
@ -29,7 +29,6 @@ import com.airbnb.mvrx.Success
|
|||
import com.airbnb.mvrx.args
|
||||
import com.airbnb.mvrx.fragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.matrix.android.api.permalinks.PermalinkFactory
|
||||
import im.vector.matrix.android.api.util.MatrixItem
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.animations.AppBarStateChangeListener
|
||||
|
@ -99,7 +98,7 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||
is RoomMemberProfileViewEvents.Failure -> showFailure(it.throwable)
|
||||
is RoomMemberProfileViewEvents.OnIgnoreActionSuccess -> Unit
|
||||
is RoomMemberProfileViewEvents.StartVerification -> handleStartVerification(it)
|
||||
is RoomMemberProfileViewEvents.ShareRoomMemberProfile -> handleShareRoomMemberProfile()
|
||||
is RoomMemberProfileViewEvents.ShareRoomMemberProfile -> handleShareRoomMemberProfile(it.permalink)
|
||||
}.exhaustive
|
||||
}
|
||||
}
|
||||
|
@ -225,9 +224,7 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||
vectorBaseActivity.notImplemented("Mention")
|
||||
}
|
||||
|
||||
private fun handleShareRoomMemberProfile() = withState(viewModel) {
|
||||
PermalinkFactory.createPermalink(it.userId)?.let { permalink ->
|
||||
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
||||
}
|
||||
private fun handleShareRoomMemberProfile(permalink: String) = withState(viewModel) {
|
||||
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ sealed class RoomMemberProfileViewEvents : VectorViewEvents {
|
|||
val canCrossSign: Boolean
|
||||
) : RoomMemberProfileViewEvents()
|
||||
|
||||
object ShareRoomMemberProfile : RoomMemberProfileViewEvents()
|
||||
data class ShareRoomMemberProfile(val permalink: String) : RoomMemberProfileViewEvents()
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.airbnb.mvrx.ViewModelContext
|
|||
import com.squareup.inject.assisted.Assisted
|
||||
import com.squareup.inject.assisted.AssistedInject
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.permalinks.PermalinkFactory
|
||||
import im.vector.matrix.android.api.query.QueryStringValue
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.android.api.session.events.model.EventType
|
||||
|
@ -236,7 +237,9 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
|
|||
}
|
||||
}
|
||||
|
||||
private fun handleShareRoomMemberProfile() {
|
||||
_viewEvents.post(RoomMemberProfileViewEvents.ShareRoomMemberProfile)
|
||||
private fun handleShareRoomMemberProfile() = withState { state ->
|
||||
PermalinkFactory.createPermalink(state.userId)?.let { permalink ->
|
||||
_viewEvents.post(RoomMemberProfileViewEvents.ShareRoomMemberProfile(permalink))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import androidx.core.view.isVisible
|
|||
import com.airbnb.mvrx.args
|
||||
import com.airbnb.mvrx.fragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.matrix.android.api.permalinks.PermalinkFactory
|
||||
import im.vector.matrix.android.api.session.room.notification.RoomNotificationState
|
||||
import im.vector.matrix.android.api.util.toMatrixItem
|
||||
import im.vector.riotx.R
|
||||
|
@ -94,7 +93,7 @@ class RoomProfileFragment @Inject constructor(
|
|||
is RoomProfileViewEvents.Loading -> showLoading(it.message)
|
||||
is RoomProfileViewEvents.Failure -> showFailure(it.throwable)
|
||||
is RoomProfileViewEvents.OnLeaveRoomSuccess -> onLeaveRoom()
|
||||
is RoomProfileViewEvents.ShareRoomProfile -> onShareRoomProfile()
|
||||
is RoomProfileViewEvents.ShareRoomProfile -> onShareRoomProfile(it.permalink)
|
||||
}.exhaustive
|
||||
}
|
||||
roomListQuickActionsSharedActionViewModel
|
||||
|
@ -204,9 +203,7 @@ class RoomProfileFragment @Inject constructor(
|
|||
.show()
|
||||
}
|
||||
|
||||
private fun onShareRoomProfile() {
|
||||
PermalinkFactory.createPermalink(roomProfileArgs.roomId)?.let { permalink ->
|
||||
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
||||
}
|
||||
private fun onShareRoomProfile(permalink: String) {
|
||||
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,5 +26,5 @@ sealed class RoomProfileViewEvents : VectorViewEvents {
|
|||
data class Failure(val throwable: Throwable) : RoomProfileViewEvents()
|
||||
|
||||
object OnLeaveRoomSuccess : RoomProfileViewEvents()
|
||||
object ShareRoomProfile : RoomProfileViewEvents()
|
||||
data class ShareRoomProfile(val permalink: String) : RoomProfileViewEvents()
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.airbnb.mvrx.ViewModelContext
|
|||
import com.squareup.inject.assisted.Assisted
|
||||
import com.squareup.inject.assisted.AssistedInject
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.permalinks.PermalinkFactory
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.rx.rx
|
||||
import im.vector.matrix.rx.unwrap
|
||||
|
@ -90,7 +91,9 @@ class RoomProfileViewModel @AssistedInject constructor(@Assisted initialState: R
|
|||
})
|
||||
}
|
||||
|
||||
private fun handleShareRoomProfile() {
|
||||
_viewEvents.post(RoomProfileViewEvents.ShareRoomProfile)
|
||||
private fun handleShareRoomProfile() = withState { state ->
|
||||
PermalinkFactory.createPermalink(state.roomId)?.let { permalink ->
|
||||
_viewEvents.post(RoomProfileViewEvents.ShareRoomProfile(permalink))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||
<path android:fillColor="#00000000" android:fillType="evenOdd"
|
||||
android:pathData="M18,8C19.6569,8 21,6.6568 21,5C21,3.3431 19.6569,2 18,2C16.3431,2 15,3.3431 15,5C15,6.6568 16.3431,8 18,8Z"
|
||||
android:strokeColor="#03B381" android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" android:strokeWidth="2"/>
|
||||
<path android:fillColor="#00000000" android:fillType="evenOdd"
|
||||
android:pathData="M6,15C7.6568,15 9,13.6569 9,12C9,10.3431 7.6568,9 6,9C4.3432,9 3,10.3431 3,12C3,13.6569 4.3432,15 6,15Z"
|
||||
android:strokeColor="#03B381" android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" android:strokeWidth="2"/>
|
||||
<path android:fillColor="#00000000" android:fillType="evenOdd"
|
||||
android:pathData="M18,22C19.6569,22 21,20.6569 21,19C21,17.3431 19.6569,16 18,16C16.3431,16 15,17.3431 15,19C15,20.6569 16.3431,22 18,22Z"
|
||||
android:strokeColor="#03B381" android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" android:strokeWidth="2"/>
|
||||
<path android:fillColor="#00000000"
|
||||
android:pathData="M8.59,13.51L15.42,17.49"
|
||||
android:strokeColor="#03B381" android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" android:strokeWidth="2"/>
|
||||
<path android:fillColor="#00000000"
|
||||
android:pathData="M15.41,6.51L8.59,10.49"
|
||||
android:strokeColor="#03B381" android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" android:strokeWidth="2"/>
|
||||
</vector>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/matrixProfileCollapsingToolbarLayout"
|
||||
style="@style/VectorAppBarLayoutStyle"
|
||||
android:theme="@style/Vector.Toolbar.Profile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:contentScrim="?riotx_background"
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
android:id="@+id/roomMemberProfileShareAction"
|
||||
android:icon="@drawable/ic_material_share"
|
||||
android:title="@string/share"
|
||||
app:iconTint="?attr/colorAccent"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
|
@ -5,6 +5,6 @@
|
|||
android:id="@+id/roomProfileShareAction"
|
||||
android:icon="@drawable/ic_material_share"
|
||||
android:title="@string/share"
|
||||
app:iconTint="@color/riotx_accent"
|
||||
app:iconTint="?attr/colorAccent"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
|
@ -30,6 +30,10 @@
|
|||
<item name="android:fontFamily">"sans-serif"</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.Toolbar.Profile" parent="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||
<item name="colorControlNormal">?attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorAppBarLayoutStyle" parent="Widget.Design.AppBarLayout">
|
||||
<item name="android:background">?riotx_background</item>
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue