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:
Mathieu Sanchez 2020-04-12 02:23:42 +02:00
parent 71afa04d8b
commit 114f5ca078
37 changed files with 72 additions and 146 deletions

View File

@ -8,7 +8,7 @@ android {
defaultConfig { defaultConfig {
applicationId "fr.sanchezm.attestationsCovid19" applicationId "fr.sanchezm.attestationsCovid19"
minSdkVersion 21 minSdkVersion 23
targetSdkVersion 29 targetSdkVersion 29
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"

View File

@ -2,13 +2,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.sanchezm.attestationsCovid19"> package="fr.sanchezm.attestationsCovid19">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme.Light">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name"> android:label="@string/app_name">

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -3,8 +3,6 @@ package fr.sanchezm.attestationsCovid19
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController import androidx.navigation.ui.setupWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.bottomnavigation.BottomNavigationView
@ -16,14 +14,8 @@ class MainActivity : AppCompatActivity() {
val navView: BottomNavigationView = findViewById(R.id.nav_view) val navView: BottomNavigationView = findViewById(R.id.nav_view)
val navController = findNavController(R.id.nav_host_fragment) 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.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.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -10,9 +10,9 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import fr.sanchezm.attestationsCovid19.R import fr.sanchezm.attestationsCovid19.R
class HomeFragment : Fragment() { class AddFragment : Fragment() {
private lateinit var homeViewModel: HomeViewModel private lateinit var homeViewModel: AddViewModel
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
@ -20,8 +20,8 @@ class HomeFragment : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
homeViewModel = homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel::class.java) ViewModelProviders.of(this).get(AddViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_home, container, false) val root = inflater.inflate(R.layout.fragment_add_attestation, container, false)
val textView: TextView = root.findViewById(R.id.text_home) val textView: TextView = root.findViewById(R.id.text_home)
homeViewModel.text.observe(viewLifecycleOwner, Observer { homeViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it 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.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
class HomeViewModel : ViewModel() { class AddViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply { private val _text = MutableLiveData<String>().apply {
value = "This is home Fragment" value = "Fragment ajouter une attestation"
} }
val text: LiveData<String> = _text 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.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -10,9 +10,9 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import fr.sanchezm.attestationsCovid19.R import fr.sanchezm.attestationsCovid19.R
class DashboardFragment : Fragment() { class AttestationsFragment : Fragment() {
private lateinit var dashboardViewModel: DashboardViewModel private lateinit var dashboardViewModel: AttestationsViewModel
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
@ -20,8 +20,8 @@ class DashboardFragment : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
dashboardViewModel = dashboardViewModel =
ViewModelProviders.of(this).get(DashboardViewModel::class.java) ViewModelProviders.of(this).get(AttestationsViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_dashboard, container, false) val root = inflater.inflate(R.layout.fragment_attestations, container, false)
val textView: TextView = root.findViewById(R.id.text_dashboard) val textView: TextView = root.findViewById(R.id.text_dashboard)
dashboardViewModel.text.observe(viewLifecycleOwner, Observer { dashboardViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it 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.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
class DashboardViewModel : ViewModel() { class AttestationsViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply { private val _text = MutableLiveData<String>().apply {
value = "This is dashboard Fragment" 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
}

View File

@ -5,5 +5,5 @@
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" /> android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z" />
</vector> </vector>

View File

@ -5,5 +5,5 @@
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" /> android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
</vector> </vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" />
</vector>

View File

@ -12,7 +12,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:background="?android:attr/windowBackground" android:background="@color/colorPrimaryBackground"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment"> tools:context=".ui.add.AddFragment">
<TextView <TextView
android:id="@+id/text_home" android:id="@+id/text_home"

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.dashboard.DashboardFragment"> tools:context=".ui.attestations.AttestationsFragment">
<TextView <TextView
android:id="@+id/text_dashboard" android:id="@+id/text_dashboard"

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.notifications.NotificationsFragment">
<TextView
android:id="@+id/text_notifications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,19 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/navigation_home" android:id="@+id/navigation_add"
android:icon="@drawable/ic_home_black_24dp" android:icon="@drawable/ic_create_24dp"
android:title="@string/title_home" /> android:title="@string/title_add"
app:itemBackground="?attr/itemBackground" />
<item <item
android:id="@+id/navigation_dashboard" android:id="@+id/navigation_attestations"
android:icon="@drawable/ic_dashboard_black_24dp" android:icon="@drawable/ic_attestations_24dp"
android:title="@string/title_dashboard" /> android:title="@string/title_attestations"
app:itemBackground="?attr/itemBackground" />
<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/title_notifications" />
</menu> </menu>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -3,23 +3,18 @@
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/mobile_navigation" android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_home"> app:startDestination="@+id/navigation_add">
<fragment <fragment
android:id="@+id/navigation_home" android:id="@+id/navigation_add"
android:name="fr.sanchezm.attestationsCovid19.ui.home.HomeFragment" android:name="fr.sanchezm.attestationsCovid19.ui.add.AddFragment"
android:label="@string/title_home" android:label="@string/title_add"
tools:layout="@layout/fragment_home" /> tools:layout="@layout/fragment_add_attestation" />
<fragment <fragment
android:id="@+id/navigation_dashboard" android:id="@+id/navigation_attestations"
android:name="fr.sanchezm.attestationsCovid19.ui.dashboard.DashboardFragment" android:name="fr.sanchezm.attestationsCovid19.ui.attestations.AttestationsFragment"
android:label="@string/title_dashboard" android:label="@string/title_attestations"
tools:layout="@layout/fragment_dashboard" /> tools:layout="@layout/fragment_attestations" />
<fragment
android:id="@+id/navigation_notifications"
android:name="fr.sanchezm.attestationsCovid19.ui.notifications.NotificationsFragment"
android:label="@string/title_notifications"
tools:layout="@layout/fragment_notifications" />
</navigation> </navigation>

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#6200EE</color> <color name="colorPrimary">#303841</color>
<color name="colorPrimaryDark">#3700B3</color> <color name="colorPrimaryDark">#262d34</color>
<color name="colorAccent">#03DAC5</color> <color name="colorAccent">#585E66</color>
<color name="colorPrimaryBackground">#E3E3E3</color>
<color name="itemBackground">#FFF</color>
</resources> </resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#F3F3F3</color>
</resources>

View File

@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name">My Application</string> <string name="app_name">Attestation de déplacement dérogatoire</string>
<string name="title_home">Home</string> <string name="title_add">Nouvelle Attestation</string>
<string name="title_dashboard">Dashboard</string> <string name="title_attestations">Mes Attestations</string>
<string name="title_notifications">Notifications</string>
</resources> </resources>

View File

@ -1,11 +1,18 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme.Light" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="itemBackground">@color/itemBackground</item>
<item name="android:windowBackground">@color/colorPrimaryBackground</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style> </style>
</resources> </resources>