forked from GitHub-Mirror/riotX-android
Introduce HomeDrawerFragment to manage communities and rooms
This commit is contained in:
parent
7e59933fda
commit
7dc7b4b8eb
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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>
|
23
app/src/main/res/layout/fragment_home_drawer.xml
Normal file
23
app/src/main/res/layout/fragment_home_drawer.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user