Update tom minimum SDK 23

Adding icon
Creating Light style
Setting based color
Moving from 3 nav buttons to 2
Removing action top bar
Changing icons for navigation bar buttons
Renaming
This commit is contained in:
2020-04-12 02:23:42 +02:00
parent 71afa04d8b
commit 114f5ca078
37 changed files with 72 additions and 146 deletions

View File

@ -3,8 +3,6 @@ package fr.sanchezm.attestationsCovid19
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
@ -16,14 +14,8 @@ class MainActivity : AppCompatActivity() {
val navView: BottomNavigationView = findViewById(R.id.nav_view)
val navController = findNavController(R.id.nav_host_fragment)
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
val appBarConfiguration = AppBarConfiguration(
setOf(
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications
)
)
setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)
navView.setBackgroundColor(resources.getColor(R.color.itemBackground, theme))
}
}
}

View File

@ -1,4 +1,4 @@
package fr.sanchezm.attestationsCovid19.ui.home
package fr.sanchezm.attestationsCovid19.ui.add
import android.os.Bundle
import android.view.LayoutInflater
@ -10,9 +10,9 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import fr.sanchezm.attestationsCovid19.R
class HomeFragment : Fragment() {
class AddFragment : Fragment() {
private lateinit var homeViewModel: HomeViewModel
private lateinit var homeViewModel: AddViewModel
override fun onCreateView(
inflater: LayoutInflater,
@ -20,8 +20,8 @@ class HomeFragment : Fragment() {
savedInstanceState: Bundle?
): View? {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_home, container, false)
ViewModelProviders.of(this).get(AddViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_add_attestation, container, false)
val textView: TextView = root.findViewById(R.id.text_home)
homeViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it

View File

@ -1,13 +1,13 @@
package fr.sanchezm.attestationsCovid19.ui.home
package fr.sanchezm.attestationsCovid19.ui.add
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class HomeViewModel : ViewModel() {
class AddViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is home Fragment"
value = "Fragment ajouter une attestation"
}
val text: LiveData<String> = _text
}

View File

@ -1,4 +1,4 @@
package fr.sanchezm.attestationsCovid19.ui.dashboard
package fr.sanchezm.attestationsCovid19.ui.attestations
import android.os.Bundle
import android.view.LayoutInflater
@ -10,9 +10,9 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import fr.sanchezm.attestationsCovid19.R
class DashboardFragment : Fragment() {
class AttestationsFragment : Fragment() {
private lateinit var dashboardViewModel: DashboardViewModel
private lateinit var dashboardViewModel: AttestationsViewModel
override fun onCreateView(
inflater: LayoutInflater,
@ -20,8 +20,8 @@ class DashboardFragment : Fragment() {
savedInstanceState: Bundle?
): View? {
dashboardViewModel =
ViewModelProviders.of(this).get(DashboardViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_dashboard, container, false)
ViewModelProviders.of(this).get(AttestationsViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_attestations, container, false)
val textView: TextView = root.findViewById(R.id.text_dashboard)
dashboardViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it

View File

@ -1,10 +1,10 @@
package fr.sanchezm.attestationsCovid19.ui.dashboard
package fr.sanchezm.attestationsCovid19.ui.attestations
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class DashboardViewModel : ViewModel() {
class AttestationsViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is dashboard Fragment"

View File

@ -1,31 +0,0 @@
package fr.sanchezm.attestationsCovid19.ui.notifications
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import fr.sanchezm.attestationsCovid19.R
class NotificationsFragment : Fragment() {
private lateinit var notificationsViewModel: NotificationsViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
notificationsViewModel =
ViewModelProviders.of(this).get(NotificationsViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_notifications, container, false)
val textView: TextView = root.findViewById(R.id.text_notifications)
notificationsViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it
})
return root
}
}

View File

@ -1,13 +0,0 @@
package fr.sanchezm.attestationsCovid19.ui.notifications
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class NotificationsViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is notifications Fragment"
}
val text: LiveData<String> = _text
}