Introduce HomeDrawerFragment to manage communities and rooms

This commit is contained in:
ganfra 2018-10-29 17:48:31 +01:00
parent 7e59933fda
commit 7dc7b4b8eb
16 changed files with 74 additions and 19 deletions

View File

@ -12,9 +12,8 @@ import im.vector.riotredesign.R
import im.vector.riotredesign.core.extensions.replaceFragment
import im.vector.riotredesign.core.platform.RiotActivity
import im.vector.riotredesign.core.platform.ToolbarConfigurable
import im.vector.riotredesign.features.home.detail.LoadingRoomDetailFragment
import im.vector.riotredesign.features.home.detail.RoomDetailFragment
import im.vector.riotredesign.features.home.list.RoomListFragment
import im.vector.riotredesign.features.home.room.detail.LoadingRoomDetailFragment
import im.vector.riotredesign.features.home.room.detail.RoomDetailFragment
import kotlinx.android.synthetic.main.activity_home.*
import org.koin.standalone.StandAloneContext.loadKoinModules
@ -27,10 +26,10 @@ class HomeActivity : RiotActivity(), HomeNavigator, ToolbarConfigurable {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_home)
if (savedInstanceState == null) {
val roomListFragment = RoomListFragment.newInstance()
val homeDrawerFragment = HomeDrawerFragment.newInstance()
val loadingDetail = LoadingRoomDetailFragment.newInstance()
replaceFragment(loadingDetail, R.id.homeDetailFragmentContainer)
replaceFragment(roomListFragment, R.id.homeDrawerFragmentContainer)
replaceFragment(homeDrawerFragment, R.id.homeDrawerFragmentContainer)
}
}

View File

@ -0,0 +1,34 @@
package im.vector.riotredesign.features.home
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import im.vector.riotredesign.R
import im.vector.riotredesign.core.extensions.replaceFragment
import im.vector.riotredesign.core.platform.RiotFragment
import im.vector.riotredesign.features.home.room.list.RoomListFragment
class HomeDrawerFragment : RiotFragment() {
companion object {
fun newInstance(): HomeDrawerFragment {
return HomeDrawerFragment()
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_home_drawer, container, false)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
if (savedInstanceState == null) {
val roomListFragment = RoomListFragment.newInstance()
replaceFragment(roomListFragment, R.id.roomListFragmentContainer)
}
}
}

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.detail
package im.vector.riotredesign.features.home.room.detail
import android.support.v7.util.DiffUtil
import im.vector.matrix.android.api.session.events.model.EnrichedEvent

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.detail
package im.vector.riotredesign.features.home.room.detail
import android.os.Bundle
import android.view.LayoutInflater

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.detail
package im.vector.riotredesign.features.home.room.detail
import android.arch.lifecycle.Observer
import android.arch.paging.PagedList

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.detail
package im.vector.riotredesign.features.home.room.detail
import android.arch.paging.PagedList
import android.arch.paging.PagedListAdapter

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.detail
package im.vector.riotredesign.features.home.room.detail
import com.airbnb.epoxy.EpoxyAsyncUtil
import com.airbnb.epoxy.EpoxyModel

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.detail
package im.vector.riotredesign.features.home.room.detail
import android.widget.TextView
import im.vector.riotredesign.R

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.list
package im.vector.riotredesign.features.home.room.list
import im.vector.matrix.android.api.session.room.model.RoomSummary

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.list
package im.vector.riotredesign.features.home.room.list
import android.os.Bundle
import android.view.LayoutInflater

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.list
package im.vector.riotredesign.features.home.room.list
import android.support.v4.app.FragmentActivity
import com.airbnb.mvrx.BaseMvRxViewModel

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.list
package im.vector.riotredesign.features.home.room.list
import com.airbnb.mvrx.Async
import com.airbnb.mvrx.MvRxState

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.list
package im.vector.riotredesign.features.home.room.list
import android.content.Context
import com.airbnb.epoxy.Typed2EpoxyController

View File

@ -1,4 +1,4 @@
package im.vector.riotredesign.features.home.list
package im.vector.riotredesign.features.home.room.list
import android.graphics.drawable.Drawable
import android.widget.ImageView

View File

@ -16,7 +16,6 @@
android:id="@+id/homeDrawerFragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginRight="24dp" />
android:layout_gravity="start" />
</android.support.v4.widget.DrawerLayout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/stateView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/communitiesFragmentContainer"
android:layout_width="56dp"
android:layout_height="match_parent"
android:background="@color/dark" />
<FrameLayout
android:id="@+id/roomListFragmentContainer"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/communitiesFragmentContainer"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>