diff --git a/vector/src/main/java/im/vector/riotredesign/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/riotredesign/core/platform/VectorBaseActivity.kt
index 3ae8f3a8..b4b7609e 100644
--- a/vector/src/main/java/im/vector/riotredesign/core/platform/VectorBaseActivity.kt
+++ b/vector/src/main/java/im/vector/riotredesign/core/platform/VectorBaseActivity.kt
@@ -296,8 +296,8 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
* Temporary method
* ========================================================================================== */
- fun notImplemented() {
- toast(getString(R.string.not_implemented))
+ fun notImplemented(message: String = "") {
+ toast(getString(R.string.not_implemented) + message.takeIf { message.isNotBlank() }.run { ": $message" })
}
}
\ No newline at end of file
diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/riotredesign/features/home/HomeActivity.kt
index a61412df..ed1fd844 100644
--- a/vector/src/main/java/im/vector/riotredesign/features/home/HomeActivity.kt
+++ b/vector/src/main/java/im/vector/riotredesign/features/home/HomeActivity.kt
@@ -123,12 +123,6 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
SignOutUiWorker(this).perform(Matrix.getInstance().currentSession!!)
return true
}
- // TODO Temporary code here to create a room
- R.id.tmp_menu_create_room -> {
- // Start Activity for now
- startActivity(Intent(this, RoomDirectoryActivity::class.java))
- return true
- }
}
return true
diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt b/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt
index 38fff5c5..c06cbe5e 100644
--- a/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt
+++ b/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt
@@ -24,6 +24,7 @@ import com.airbnb.mvrx.ViewModelContext
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.group.model.GroupSummary
import im.vector.matrix.rx.rx
+import im.vector.riotredesign.R
import im.vector.riotredesign.core.platform.VectorViewModel
import im.vector.riotredesign.core.resources.StringProvider
import im.vector.riotredesign.core.utils.LiveEvent
@@ -88,8 +89,7 @@ class GroupListViewModel(initialState: GroupListViewState,
val myUser = session.getUser(session.sessionParams.credentials.userId)
val allCommunityGroup = GroupSummary(
groupId = ALL_COMMUNITIES_GROUP_ID,
- // TODO i18n
- displayName = "All Communities",
+ displayName = stringProvider.getString(R.string.group_all_communities),
avatarUrl = myUser?.avatarUrl ?: "")
listOf(allCommunityGroup) + it
}
diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt
index 3286d540..0ac135d8 100644
--- a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt
+++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt
@@ -16,15 +16,12 @@
package im.vector.riotredesign.features.home.room.list
+import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import androidx.annotation.StringRes
import androidx.recyclerview.widget.LinearLayoutManager
-import com.airbnb.mvrx.Fail
-import com.airbnb.mvrx.Incomplete
-import com.airbnb.mvrx.Success
-import com.airbnb.mvrx.args
-import com.airbnb.mvrx.fragmentViewModel
+import com.airbnb.mvrx.*
import im.vector.matrix.android.api.failure.Failure
import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.riotredesign.R
@@ -32,13 +29,11 @@ import im.vector.riotredesign.core.epoxy.LayoutManagerStateRestorer
import im.vector.riotredesign.core.extensions.observeEvent
import im.vector.riotredesign.core.platform.StateView
import im.vector.riotredesign.core.platform.VectorBaseFragment
-import im.vector.riotredesign.features.home.HomeModule
import im.vector.riotredesign.features.home.HomeNavigator
+import im.vector.riotredesign.features.roomdirectory.RoomDirectoryActivity
import kotlinx.android.parcel.Parcelize
import kotlinx.android.synthetic.main.fragment_room_list.*
import org.koin.android.ext.android.inject
-import org.koin.android.scope.ext.android.bindScope
-import org.koin.android.scope.ext.android.getOrCreateScope
@Parcelize
data class RoomListParams(
@@ -82,7 +77,8 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback {
private fun setupCreateRoomButton() {
createRoomButton.setImageResource(R.drawable.ic_add_white)
createRoomButton.setOnClickListener {
- vectorBaseActivity.notImplemented()
+ // Start Activity for now
+ startActivity(Intent(requireActivity(), RoomDirectoryActivity::class.java))
}
}
diff --git a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsController.kt b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsController.kt
index 50baf6d6..6f3725f1 100644
--- a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsController.kt
+++ b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsController.kt
@@ -83,23 +83,27 @@ class PublicRoomsController(private val stringProvider: StringProvider,
avatarUrl(publicRoom.avatarUrl)
roomName(publicRoom.name)
nbOfMembers(publicRoom.numJoinedMembers)
- when {
- viewState.joinedRoomsIds.contains(publicRoom.roomId) -> joinState(PublicRoomItem.JoinState.JOINED)
- viewState.joiningRoomsIds.contains(publicRoom.roomId) -> joinState(PublicRoomItem.JoinState.JOINING)
- viewState.joiningErrorRoomsIds.contains(publicRoom.roomId) -> joinState(PublicRoomItem.JoinState.JOINING_ERROR)
- else -> joinState(PublicRoomItem.JoinState.NOT_JOINED)
+
+ val joinState = when {
+ viewState.joinedRoomsIds.contains(publicRoom.roomId) -> PublicRoomItem.JoinState.JOINED
+ viewState.joiningRoomsIds.contains(publicRoom.roomId) -> PublicRoomItem.JoinState.JOINING
+ viewState.joiningErrorRoomsIds.contains(publicRoom.roomId) -> PublicRoomItem.JoinState.JOINING_ERROR
+ else -> PublicRoomItem.JoinState.NOT_JOINED
}
+
+ joinState(joinState)
+
joinListener {
callback?.onPublicRoomJoin(publicRoom)
}
globalListener {
- callback?.onPublicRoomClicked(publicRoom)
+ callback?.onPublicRoomClicked(publicRoom, joinState)
}
}
}
interface Callback {
- fun onPublicRoomClicked(publicRoom: PublicRoom)
+ fun onPublicRoomClicked(publicRoom: PublicRoom, joinState: PublicRoomItem.JoinState)
fun onPublicRoomJoin(publicRoom: PublicRoom)
fun loadMore()
}
diff --git a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt
index aca1e30c..2497a1fd 100644
--- a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt
+++ b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt
@@ -30,6 +30,8 @@ import im.vector.riotredesign.R
import im.vector.riotredesign.core.error.ErrorFormatter
import im.vector.riotredesign.core.extensions.addFragmentToBackstack
import im.vector.riotredesign.core.platform.VectorBaseFragment
+import im.vector.riotredesign.features.home.room.detail.RoomDetailActivity
+import im.vector.riotredesign.features.home.room.detail.RoomDetailArgs
import im.vector.riotredesign.features.roomdirectory.picker.RoomDirectoryPickerFragment
import io.reactivex.rxkotlin.subscribeBy
import kotlinx.android.synthetic.main.fragment_public_rooms.*
@@ -114,9 +116,25 @@ class PublicRoomsFragment : VectorBaseFragment(), PublicRoomsController.Callback
publicRoomsList.setController(publicRoomsController)
}
- override fun onPublicRoomClicked(publicRoom: PublicRoom) {
+ override fun onPublicRoomClicked(publicRoom: PublicRoom, joinState: PublicRoomItem.JoinState) {
Timber.v("PublicRoomClicked: $publicRoom")
- vectorBaseActivity.notImplemented()
+
+ when (joinState) {
+ PublicRoomItem.JoinState.JOINED -> {
+ val args = RoomDetailArgs(publicRoom.roomId)
+ val roomDetailIntent = RoomDetailActivity.newIntent(requireActivity(), args)
+ requireActivity().startActivity(roomDetailIntent)
+ }
+ PublicRoomItem.JoinState.NOT_JOINED,
+ PublicRoomItem.JoinState.JOINING_ERROR -> {
+ // ROOM PREVIEW
+ vectorBaseActivity.notImplemented("Opening room preview")
+ }
+ else -> {
+ Snackbar.make(publicRoomsCoordinator, getString(R.string.please_wait), Snackbar.LENGTH_SHORT)
+ .show()
+ }
+ }
}
override fun onPublicRoomJoin(publicRoom: PublicRoom) {
diff --git a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/picker/RoomDirectoryPickerController.kt b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/picker/RoomDirectoryPickerController.kt
index 5b758e28..52d22c3b 100644
--- a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/picker/RoomDirectoryPickerController.kt
+++ b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/picker/RoomDirectoryPickerController.kt
@@ -88,7 +88,7 @@ class RoomDirectoryPickerController(private val stringProvider: StringProvider,
}
interface Callback {
- fun onRoomDirectoryClicked(roomDirectory: RoomDirectoryData)
+ fun onRoomDirectoryClicked(roomDirectoryData: RoomDirectoryData)
fun retry()
}
diff --git a/vector/src/main/res/layout/fragment_home_detail.xml b/vector/src/main/res/layout/fragment_home_detail.xml
index 9ef12b15..7b4a59bf 100644
--- a/vector/src/main/res/layout/fragment_home_detail.xml
+++ b/vector/src/main/res/layout/fragment_home_detail.xml
@@ -57,9 +57,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
- app:labelVisibilityMode="unlabeled"
app:itemIconTint="@android:color/white"
app:itemTextColor="@color/home_bottom_nav_view_tint"
+ app:labelVisibilityMode="unlabeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
diff --git a/vector/src/main/res/layout/fragment_room_detail.xml b/vector/src/main/res/layout/fragment_room_detail.xml
index 345f1189..d414b01b 100644
--- a/vector/src/main/res/layout/fragment_room_detail.xml
+++ b/vector/src/main/res/layout/fragment_room_detail.xml
@@ -149,7 +149,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/roomToolbar"
- app:layout_constraintVertical_bias="1.0"
tools:visibility="visible" />
\ No newline at end of file
diff --git a/vector/src/main/res/layout/vector_invite_view.xml b/vector/src/main/res/layout/vector_invite_view.xml
index 1cb2c0c6..80f90eda 100644
--- a/vector/src/main/res/layout/vector_invite_view.xml
+++ b/vector/src/main/res/layout/vector_invite_view.xml
@@ -40,7 +40,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/inviteNameView"
- tools:text="\@matthew:matrix.org" />
+ tools:text=" @matthew:matrix.org" />
-
-
-
\ No newline at end of file
diff --git a/vector/src/main/res/values/strings_riotX.xml b/vector/src/main/res/values/strings_riotX.xml
index a115f102..82c0f77e 100644
--- a/vector/src/main/res/values/strings_riotX.xml
+++ b/vector/src/main/res/values/strings_riotX.xml
@@ -27,5 +27,7 @@
No network. Please check your Internet connection.
"Change"
+ "Please wait…"
+ "All Communities"
\ No newline at end of file