Changement des listes menu et session

This commit is contained in:
biloute02 2024-01-05 13:50:20 +01:00
parent d7bade2287
commit bff62daaec
23 changed files with 279 additions and 226 deletions

View file

@ -29,7 +29,6 @@ android {
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "1.8"
} }
buildToolsVersion = "33.0.1"
buildFeatures { buildFeatures {
viewBinding = true viewBinding = true
} }
@ -38,16 +37,21 @@ android {
dependencies { dependencies {
implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1") implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0") implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.navigation:navigation-fragment-ktx:2.7.5") implementation("androidx.navigation:navigation-fragment-ktx:2.7.6")
implementation("androidx.navigation:navigation-ui-ktx:2.7.5") implementation("androidx.navigation:navigation-ui-ktx:2.7.6")
implementation("androidx.annotation:annotation:1.7.0") implementation("androidx.annotation:annotation:1.7.1")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.2") implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2") implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
implementation("androidx.legacy:legacy-support-v4:1.0.0") implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("androidx.recyclerview:recyclerview:1.3.0") implementation("androidx.recyclerview:recyclerview:1.3.2")
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
// Retrofit and Moshi for API requests.
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-moshi:2.9.0")
implementation("com.squareup.moshi:moshi-kotlin:1.13.0")
} }

View file

@ -1,18 +1,20 @@
package com.example.palto package com.example.palto
import android.nfc.NfcAdapter import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.activity.viewModels import androidx.activity.viewModels
import com.example.palto.ui.NfcViewModel
import com.example.palto.ui.UserViewModel
class PaltoActivity : AppCompatActivity() { class PaltoActivity : AppCompatActivity() {
private var nfcAdapter: NfcAdapter? = null private var nfcAdapter: NfcAdapter? = null
private val paltoViewModel: PaltoViewModel by viewModels() private val nfcViewModel: NfcViewModel by viewModels()
private val userViewModel: UserViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -32,11 +34,6 @@ class PaltoActivity : AppCompatActivity() {
} }
setContentView(R.layout.activity_palto) setContentView(R.layout.activity_palto)
/*
val url = URL("https://www.faraphel.fr/palto/api/auth/token/")
val connection = url.openConnection()
val auth_data = Json.decodeFromString(connection.content)
*/
} }
override fun onResume() { override fun onResume() {
@ -44,7 +41,7 @@ class PaltoActivity : AppCompatActivity() {
nfcAdapter?.enableReaderMode( nfcAdapter?.enableReaderMode(
this, this,
paltoViewModel.tagLiveData::postValue, nfcViewModel.tag::postValue,
NfcAdapter.FLAG_READER_NFC_A or NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK, NfcAdapter.FLAG_READER_NFC_A or NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK,
null null
) )
@ -57,8 +54,10 @@ class PaltoActivity : AppCompatActivity() {
nfcAdapter?.disableReaderMode(this) nfcAdapter?.disableReaderMode(this)
} }
/*
@OptIn(ExperimentalStdlibApi::class) @OptIn(ExperimentalStdlibApi::class)
fun processTag(tag: Tag) { fun processTag(tag: Tag) {
Log.d("NFC", "Tag ID : " + tag.id.toHexString()) Log.d("NFC", "Tag ID : " + tag.id.toHexString())
} }
*/
} }

View file

@ -1,10 +1,10 @@
package com.example.palto.data.repository package com.example.palto.data.repository
import com.example.palto.data.network.ServerDataSource import com.example.palto.data.network.PaltoApiService
/** /**
* *
*/ */
class AttendanceRepository(val dataSource: ServerDataSource) { class AttendanceRepository() {
// private val cards // private val cards
} }

View file

@ -1,10 +1,10 @@
package com.example.palto.data.repository package com.example.palto.data.repository
import com.example.palto.data.network.ServerDataSource import com.example.palto.data.network.PaltoApiService
/** /**
* *
*/ */
class SessionRepository(val dataSource: ServerDataSource) { class SessionRepository(val dataSource: PaltoApiService) {
// private val cards // private val cards
} }

View file

@ -1,4 +1,4 @@
package com.example.palto.model package com.example.palto.domain
import java.io.Serializable import java.io.Serializable
/** /**

View file

@ -1,5 +1,4 @@
package com.example.palto.model package com.example.palto.domain
import java.io.Serializable
data class Card( data class Card(
val id: String, val id: String,

View file

@ -1,4 +1,4 @@
package com.example.palto.model package com.example.palto.domain
import java.io.Serializable import java.io.Serializable
/** /**
@ -6,4 +6,4 @@ import java.io.Serializable
*/ */
data class Session( data class Session(
val id: String val id: String
) : Serializable )

View file

@ -0,0 +1,14 @@
package com.example.palto.ui
import android.nfc.Tag
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.example.palto.domain.User
class NfcViewModel: ViewModel() {
val tag = MutableLiveData<Tag>()
private var _user : MutableLiveData<User> = MutableLiveData<User>()
val user : LiveData<User> = _user
}

View file

@ -1,69 +0,0 @@
package com.example.palto.ui.attendanceList
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.navigation.navGraphViewModels
import com.example.palto.PaltoViewModel
import com.example.palto.R
import com.example.palto.databinding.FragmentAttendanceListBinding
/**
* A fragment representing a list of attendances.
*/
class AttendanceListFragment : Fragment() {
private val attendanceListViewModel: AttendanceListViewModel by
navGraphViewModels(R.id.nav_graph) { AttendanceListViewModel.Factory }
private val paltoViewModel: PaltoViewModel by
activityViewModels()
private var _binding: FragmentAttendanceListBinding? = null
// This property is only valid between onCreateView and onDestroyView
private val binding get() = _binding!!
/**
* Only inflate the view.
*/
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentAttendanceListBinding.inflate(inflater, container, false)
return binding.root
}
/**
* Logic on the returned view of onCreateView.
*/
override fun onViewCreated(
view: View,
savedInstanceState: Bundle?
) {
super.onViewCreated(view, savedInstanceState)
// Set the adapter of the view for managing automatically the list of items on the screen.
val adapter = AttendanceListAdapter()
binding.list.adapter = adapter
attendanceListViewModel.cardsLiveData.observe(viewLifecycleOwner) {
Log.d("NFC", "A card has been had to the list")
adapter.submitList(it)
}
// Set the listener for a new NFC tag.
paltoViewModel.tagLiveData.observe(viewLifecycleOwner) {
Log.d("NFC", "tag observer has been notified")
attendanceListViewModel.insertCard(it)
}
}
}

View file

@ -0,0 +1,69 @@
package com.example.palto.ui.menu
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.example.palto.databinding.FragmentMenuItemBinding
import com.example.palto.domain.Session
/**
* A [ListAdapter] that can display [Session] items.
*/
class MenuAdapter :
ListAdapter<Session, MenuAdapter.ViewHolder>(SessionDiffCallback) {
/*
class ViewHolder(binding: FragmentSessionItemBinding) :
RecyclerView.ViewHolder(binding.root) {
val idView: TextView = binding.itemNumber
val contentView: TextView = binding.content
override fun toString(): String {
return super.toString() + " '" + contentView.text + "'"
}
}
*/
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
FragmentMenuItemBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = getItem(position)
holder.idView.text = position.toString()
holder.contentView.text = item.id
}
//override fun getItemCount(): Int = values.size
inner class ViewHolder(
binding: FragmentMenuItemBinding
) : RecyclerView.ViewHolder(binding.root) {
val idView: TextView = binding.itemNumber
val contentView: TextView = binding.content
override fun toString(): String {
return super.toString() + " '" + idView.text + contentView.text + "'"
}
}
}
object SessionDiffCallback : DiffUtil.ItemCallback<Session>() {
override fun areItemsTheSame(oldItem: Session, newItem: Session): Boolean {
return oldItem == newItem
}
override fun areContentsTheSame(oldItem: Session, newItem: Session): Boolean {
return oldItem.id == newItem.id
}
}

View file

@ -0,0 +1,45 @@
package com.example.palto.ui.menu
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import com.example.palto.databinding.FragmentMenuListBinding
import com.example.palto.databinding.FragmentSessionListBinding
/**
* A fragment representing a list of Sessions.
*/
class MenuFragment : Fragment() {
private val menuViewModel: MenuViewModel by viewModels()
private var _binding: FragmentMenuListBinding? = null
// This property is only valid between onCreateView and onDestroyView
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentMenuListBinding.inflate(inflater, container, false)
val adapter = MenuAdapter()
binding.menuList.adapter = MenuAdapter()
menuViewModel.sessions.observe(viewLifecycleOwner) {
Log.d("PALTO", "A session has been created")
adapter.submitList(it)
}
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
menuViewModel.createSession()
}
}

View file

@ -0,0 +1,21 @@
package com.example.palto.ui.menu
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.example.palto.data.repository.LoginRepository
import com.example.palto.domain.Session
class MenuViewModel() : ViewModel() {
private var _sessions = MutableLiveData<List<Session>>(emptyList())
val sessions: LiveData<List<Session>> = _sessions
fun createSession() {
val session = Session(
id = "aahh"
)
_sessions.value = (_sessions.value ?: emptyList()) + session
}
}

View file

@ -1,4 +1,4 @@
package com.example.palto.ui.attendanceList package com.example.palto.ui.session
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
@ -6,22 +6,18 @@ import android.widget.TextView
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.example.palto.databinding.FragmentAttendanceItemBinding import com.example.palto.databinding.FragmentSessionItemBinding
import com.example.palto.model.Card import com.example.palto.domain.Card
/** /**
* * A [ListAdapter] that can display [Card] items.
*/ */
class AttendanceListAdapter : class SessionAdapter :
ListAdapter<Card, AttendanceListAdapter.ViewHolder>(CardDiffCallback) { ListAdapter<Card, SessionAdapter.ViewHolder>(CardDiffCallback) {
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): ViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder( return ViewHolder(
FragmentAttendanceItemBinding.inflate( FragmentSessionItemBinding.inflate(
LayoutInflater.from(parent.context), LayoutInflater.from(parent.context),
parent, parent,
false false
@ -37,7 +33,7 @@ class AttendanceListAdapter :
} }
inner class ViewHolder( inner class ViewHolder(
binding: FragmentAttendanceItemBinding binding: FragmentSessionItemBinding
) : RecyclerView.ViewHolder(binding.root) { ) : RecyclerView.ViewHolder(binding.root) {
val cardId: TextView = binding.cardId val cardId: TextView = binding.cardId

View file

@ -0,0 +1,56 @@
package com.example.palto.ui.session
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.navigation.navGraphViewModels
import com.example.palto.ui.NfcViewModel
import com.example.palto.R
import com.example.palto.databinding.FragmentSessionListBinding
/**
* A fragment representing a list of attendances.
*/
class SessionFragment : Fragment() {
private val sessionViewModel: SessionViewModel by
navGraphViewModels(R.id.nav_graph) { SessionViewModel.Factory }
private val nfcViewModel: NfcViewModel by
activityViewModels()
private var _binding: FragmentSessionListBinding? = null
// This property is only valid between onCreateView and onDestroyView
private val binding get() = _binding!!
/**
* Have the fragment instantiate the user interface.
*/
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentSessionListBinding.inflate(inflater, container, false)
// Set the adapter of the view for managing automatically the list of items on the screen.
val adapter = SessionAdapter()
binding.sessionList.adapter = adapter
sessionViewModel.cards.observe(viewLifecycleOwner) {
Log.d("NFC", "A card has been had to the list")
adapter.submitList(it)
}
// Set the listener for a new NFC tag.
nfcViewModel.tag.observe(viewLifecycleOwner) {
Log.d("NFC", "tag observer has been notified")
sessionViewModel.insertCard(it)
}
return binding.root
}
}

View file

@ -1,4 +1,4 @@
package com.example.palto.ui.attendanceList package com.example.palto.ui.session
import android.nfc.Tag import android.nfc.Tag
import android.util.Log import android.util.Log
@ -6,18 +6,18 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import com.example.palto.data.network.ServerDataSource
import com.example.palto.data.repository.AttendanceRepository import com.example.palto.data.repository.AttendanceRepository
import com.example.palto.model.Card import com.example.palto.domain.Card
/** /**
* ViewModel of a session which has a list of attendances. * ViewModel of a session which has a list of attendances.
*/ */
class AttendanceListViewModel( class SessionViewModel(
private val attendanceRepository: AttendanceRepository private val attendanceRepository: AttendanceRepository
) : ViewModel() { ) : ViewModel() {
val cardsLiveData: MutableLiveData<List<Card>> = MutableLiveData(emptyList()) private val _cards: MutableLiveData<List<Card>> = MutableLiveData(emptyList())
val cards = _cards as LiveData<List<Card>>
fun insertCard(tag: Tag) { fun insertCard(tag: Tag) {
val card = Card( val card = Card(
@ -26,12 +26,12 @@ class AttendanceListViewModel(
"tmp", "tmp",
"tmp" "tmp"
) )
cardsLiveData.value = (cardsLiveData.value ?: emptyList()) + card _cards.value = (_cards.value ?: emptyList()) + card
Log.d("NFC", "view model: A card has been had to the list") Log.d("NFC", "view model: A card has been had to the list")
} }
/** /**
* ViewModel Factory. * ViewModel Factory.
*/ */
companion object { companion object {
@ -40,8 +40,8 @@ class AttendanceListViewModel(
override fun <T : ViewModel> create( override fun <T : ViewModel> create(
modelClass: Class<T> modelClass: Class<T>
): T { ): T {
return AttendanceListViewModel( return SessionViewModel(
AttendanceRepository(ServerDataSource()) AttendanceRepository()
) as T ) as T
} }
} }

View file

@ -1,44 +0,0 @@
package com.example.palto.ui.sessionList
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.TextView
import com.example.palto.ui.sessionList.placeholder.PlaceholderContent.PlaceholderItem
import com.example.palto.databinding.FragmentSessionItemBinding
/**
* [RecyclerView.Adapter] that can display a [PlaceholderItem].
*/
class SessionListAdapter(private val values: List<PlaceholderItem>) :
RecyclerView.Adapter<SessionListAdapter.ViewHolder>() {
class ViewHolder(binding: FragmentSessionItemBinding) :
RecyclerView.ViewHolder(binding.root) {
val idView: TextView = binding.itemNumber
val contentView: TextView = binding.content
override fun toString(): String {
return super.toString() + " '" + contentView.text + "'"
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = FragmentSessionItemBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
return ViewHolder(view)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = values[position]
holder.idView.text = item.id
holder.contentView.text = item.content
}
override fun getItemCount(): Int = values.size
}

View file

@ -1,31 +0,0 @@
package com.example.palto.ui.sessionList
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.palto.R
import com.example.palto.ui.sessionList.placeholder.PlaceholderContent
/**
* A fragment representing a list of Sessions.
*/
class SessionListFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_session_list, container, false)
if (view is RecyclerView) {
view.layoutManager = LinearLayoutManager(context)
view.adapter = SessionListAdapter(PlaceholderContent.ITEMS)
}
return view
}
}

View file

@ -1,14 +0,0 @@
package com.example.palto.ui.sessionList
import androidx.lifecycle.ViewModel
import com.example.palto.data.repository.LoginRepository
class SessionListViewModel(private val loginRepository: LoginRepository) : ViewModel() {
/*
private val _loginForm = MutableLiveData<LoginFormState>()
val loginFormState: LiveData<LoginFormState> = _loginForm
private val _loginResult = MutableLiveData<LoginResult>()
val loginResult: LiveData<LoginResult> = _loginResult
*/
}

View file

@ -5,7 +5,14 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/card_̤id" android:id="@+id/item_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem" />
<TextView
android:id="@+id/content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:layout_margin="@dimen/text_margin"

View file

@ -2,12 +2,12 @@
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list" android:id="@+id/menu_list"
android:name="com.example.palto.ui.attendanceList.AttendanceFragment" android:name="com.example.palto.ui.menu.menuFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
tools:context=".ui.attendanceList.AttendanceListFragment" tools:context=".ui.menu.MenuFragment"
tools:listitem="@layout/fragment_attendance_item" /> tools:listitem="@layout/fragment_menu_item" />

View file

@ -5,14 +5,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/item_number" android:id="@+id/card_̤id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem" />
<TextView
android:id="@+id/content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:layout_margin="@dimen/text_margin"

View file

@ -2,12 +2,12 @@
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list" android:id="@+id/session_list"
android:name="com.example.palto.ui.session.SessionListFragment" android:name="com.example.palto.ui.session.sessionFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
tools:context=".ui.sessionList.SessionListFragment" tools:context=".ui.session.SessionFragment"
tools:listitem="@layout/fragment_session_item" /> tools:listitem="@layout/fragment_session_item" />

View file

@ -3,20 +3,28 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph" android:id="@+id/nav_graph"
app:startDestination="@id/attendanceListFragment"> app:startDestination="@id/menuFragment">
<fragment <fragment
android:id="@+id/loginFragment" android:id="@+id/loginFragment"
android:name="com.example.palto.ui.login.LoginFragment" android:name="com.example.palto.ui.login.LoginFragment"
android:label="fragment._login" android:label="fragment._login"
tools:layout="@layout/fragment_login" /> tools:layout="@layout/fragment_login" />
<fragment <fragment
android:id="@+id/sessionListFragment" android:id="@+id/sessionFragment"
android:name="com.example.palto.ui.sessionList.SessionListFragment" android:name="com.example.palto.ui.session.SessionFragment"
android:label="fragment_session_list" android:label="fragment_session_list"
tools:layout="@layout/fragment_session_list" /> tools:layout="@layout/fragment_session_list" />
<fragment <fragment
android:id="@+id/attendanceListFragment" android:id="@+id/menuFragment"
android:name="com.example.palto.ui.attendanceList.AttendanceListFragment" android:name="com.example.palto.ui.menu.MenuFragment"
android:label="fragment_attendance_list" android:label="fragment_menu_list"
tools:layout="@layout/fragment_attendance_list" /> tools:layout="@layout/fragment_menu_list" >
<action
android:id="@+id/action_menuFragment_to_loginFragment"
app:destination="@id/loginFragment" />
<action
android:id="@+id/action_menuFragment_to_sessionFragment"
app:destination="@id/sessionFragment" />
</fragment>
</navigation> </navigation>