Room preview world readable room

This commit is contained in:
Benoit Marty 2019-06-03 14:29:29 +02:00
parent 4716ceb950
commit 12b03a844d
4 changed files with 16 additions and 4 deletions

View File

@ -76,8 +76,9 @@ class RoomPreviewActivity : VectorBaseActivity(), ToolbarConfigurable {
val args = intent.getParcelableExtra<RoomPreviewData>(ARG)

if (args.worldReadable) {
// TODO Room preview
notImplemented("Room preview of world readable room")
// TODO Room preview: Note: M does not recommend to use /events anymore, so for now we just display the room preview
// TODO the same way if it was not world readable
addFragment(RoomPreviewNoPreviewFragment.newInstance(args), R.id.simpleFragmentContainer)
} else {
addFragment(RoomPreviewNoPreviewFragment.newInstance(args), R.id.simpleFragmentContainer)
}

View File

@ -36,6 +36,9 @@ import org.koin.android.ext.android.get
import org.koin.android.scope.ext.android.bindScope
import org.koin.android.scope.ext.android.getOrCreateScope

/**
* Note: this Fragment is also used for world readable room for the moment
*/
class RoomPreviewNoPreviewFragment : VectorBaseFragment() {

companion object {
@ -64,6 +67,12 @@ class RoomPreviewNoPreviewFragment : VectorBaseFragment() {
roomPreviewNoPreviewName.text = roomPreviewData.roomName
roomPreviewNoPreviewTopic.setTextOrHide(roomPreviewData.topic)

if (roomPreviewData.worldReadable) {
roomPreviewNoPreviewLabel.setText(R.string.room_preview_world_readable_room_not_supported_yet)
} else {
roomPreviewNoPreviewLabel.setText(R.string.room_preview_no_preview)
}

roomPreviewNoPreviewJoin.callback = object : ButtonStateView.Callback {
override fun onButtonClicked() {
roomPreviewViewModel.joinRoom()

View File

@ -62,9 +62,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:text="@string/room_preview_no_preview"
android:gravity="center"
android:textAppearance="@style/TextAppearance.Vector.Subtitle2"
android:textSize="14sp" />
android:textSize="14sp"
tools:text="@string/room_preview_no_preview" />

<TextView
android:id="@+id/roomPreviewNoPreviewError"

View File

@ -35,5 +35,6 @@
<string name="group_all_communities">"All Communities"</string>

<string name="room_preview_no_preview">"This room can't be previewed"</string>
<string name="room_preview_world_readable_room_not_supported_yet">"The preview of world-readable room is not supported yet in RiotX"</string>

</resources>