completed bottom bar

This commit is contained in:
Ethan Pearson 2022-10-25 15:29:37 -03:00
parent 597ffd1bd6
commit f6015b9621
18 changed files with 89 additions and 91 deletions

View File

@ -3,8 +3,19 @@
<component name="DesignSurface"> <component name="DesignSurface">
<option name="filePathToZoomLevelMap"> <option name="filePathToZoomLevelMap">
<map> <map>
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.174" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable/ic_download.xml" value="0.1935" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable/ic_folder.xml" value="0.1935" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable/ic_gear.xml" value="0.1935" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable/ic_gearsimplified.xml" value="0.1935" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable/ic_home_black_24dp.xml" value="0.178" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable/ic_launcher_background.xml" value="0.174" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/activity_main.xml" value="0.33" /> <entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/activity_main.xml" value="0.33" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/fragment_completed.xml" value="0.1" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/fragment_compressing.xml" value="0.1" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/fragment_dashboard.xml" value="0.13360507246376813" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/fragment_home.xml" value="0.1" /> <entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/fragment_home.xml" value="0.1" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/layout/fragment_settings.xml" value="0.18342391304347827" />
<entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/menu/bottom_nav_menu.xml" value="0.30648148148148147" /> <entry key="..\:/Users/avera/AndroidStudioProjects/MyApplication3/app/src/main/res/menu/bottom_nav_menu.xml" value="0.30648148148148147" />
</map> </map>
</option> </option>

View File

@ -25,7 +25,7 @@ class MainActivity : AppCompatActivity() {
// Passing each menu ID as a set of Ids because each // Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations. // menu should be considered as top level destinations.
val appBarConfiguration = AppBarConfiguration(setOf( val appBarConfiguration = AppBarConfiguration(setOf(
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)) R.id.navigation_compressing, R.id.navigation_completed,R.id.navigation_settings))
setupActionBarWithNavController(navController, appBarConfiguration) setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController) navView.setupWithNavController(navController)
} }

View File

@ -1,4 +1,4 @@
package com.example.myapplication.ui.dashboard package com.example.myapplication.ui.completed
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -7,11 +7,11 @@ import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentDashboardBinding import com.example.myapplication.databinding.FragmentCompletedBinding
class DashboardFragment : Fragment() { class CompletedFragment : Fragment() {
private var _binding: FragmentDashboardBinding? = null private var _binding: FragmentCompletedBinding? = null
// This property is only valid between onCreateView and // This property is only valid between onCreateView and
// onDestroyView. // onDestroyView.
@ -23,12 +23,12 @@ class DashboardFragment : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View { ): View {
val dashboardViewModel = val dashboardViewModel =
ViewModelProvider(this).get(DashboardViewModel::class.java) ViewModelProvider(this).get(CompletedViewModel::class.java)
_binding = FragmentDashboardBinding.inflate(inflater, container, false) _binding = FragmentCompletedBinding.inflate(inflater, container, false)
val root: View = binding.root val root: View = binding.root
val textView: TextView = binding.textDashboard val textView: TextView = binding.textCompleted
dashboardViewModel.text.observe(viewLifecycleOwner) { dashboardViewModel.text.observe(viewLifecycleOwner) {
textView.text = it textView.text = it
} }

View File

@ -1,13 +1,13 @@
package com.example.myapplication.ui.dashboard package com.example.myapplication.ui.completed
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 CompletedViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply { private val _text = MutableLiveData<String>().apply {
value = "This is dashboard Fragment" value = "This is completed Fragment"
} }
val text: LiveData<String> = _text val text: LiveData<String> = _text
} }

View File

@ -1,4 +1,4 @@
package com.example.myapplication.ui.notifications package com.example.myapplication.ui.compressing
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -7,11 +7,11 @@ import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentNotificationsBinding import com.example.myapplication.databinding.FragmentCompressingBinding
class NotificationsFragment : Fragment() { class CompressingFragment : Fragment() {
private var _binding: FragmentNotificationsBinding? = null private var _binding: FragmentCompressingBinding? = null
// This property is only valid between onCreateView and // This property is only valid between onCreateView and
// onDestroyView. // onDestroyView.
@ -22,14 +22,14 @@ class NotificationsFragment : Fragment() {
container: ViewGroup?, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View { ): View {
val notificationsViewModel = val homeViewModel =
ViewModelProvider(this).get(NotificationsViewModel::class.java) ViewModelProvider(this).get(CompressingViewModel::class.java)
_binding = FragmentNotificationsBinding.inflate(inflater, container, false) _binding = FragmentCompressingBinding.inflate(inflater, container, false)
val root: View = binding.root val root: View = binding.root
val textView: TextView = binding.textNotifications val textView: TextView = binding.textCompressing
notificationsViewModel.text.observe(viewLifecycleOwner) { homeViewModel.text.observe(viewLifecycleOwner) {
textView.text = it textView.text = it
} }
return root return root

View File

@ -1,13 +1,13 @@
package com.example.myapplication.ui.notifications package com.example.myapplication.ui.compressing
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 NotificationsViewModel : ViewModel() { class CompressingViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply { private val _text = MutableLiveData<String>().apply {
value = "This is notifications Fragment" value = "This is compressing Fragment"
} }
val text: LiveData<String> = _text val text: LiveData<String> = _text
} }

View File

@ -1,4 +1,4 @@
package com.example.myapplication.ui.home package com.example.myapplication.ui.settings
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -7,11 +7,12 @@ import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentHomeBinding import com.example.myapplication.databinding.FragmentSettingsBinding
class HomeFragment : Fragment() {
private var _binding: FragmentHomeBinding? = null class SettingsFragment : Fragment() {
private var _binding: FragmentSettingsBinding? = null
// This property is only valid between onCreateView and // This property is only valid between onCreateView and
// onDestroyView. // onDestroyView.
@ -23,12 +24,12 @@ class HomeFragment : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View { ): View {
val homeViewModel = val homeViewModel =
ViewModelProvider(this).get(HomeViewModel::class.java) ViewModelProvider(this).get(SettingsViewModel::class.java)
_binding = FragmentHomeBinding.inflate(inflater, container, false) _binding = FragmentSettingsBinding.inflate(inflater, container, false)
val root: View = binding.root val root: View = binding.root
val textView: TextView = binding.textHome val textView: TextView = binding.textSettings
homeViewModel.text.observe(viewLifecycleOwner) { homeViewModel.text.observe(viewLifecycleOwner) {
textView.text = it textView.text = it
} }

View File

@ -1,13 +1,13 @@
package com.example.myapplication.ui.home package com.example.myapplication.ui.settings
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 SettingsViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply { private val _text = MutableLiveData<String>().apply {
value = "This is home Fragment" value = "This is settings Fragment"
} }
val text: LiveData<String> = _text val text: LiveData<String> = _text
} }

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="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" />
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1000"
android:viewportHeight="1000">
<path
android:fillColor="#FF000000"
android:pathData="M924.3,700.4v222.3c0,37.3 -30.2,67.4 -67.4,67.4H143c-37.2,0 -67.4,-30.1 -67.4,-67.4V700.4c0,-37.2 30.2,-67.4 67.4,-67.4c37.2,0 67.4,30.2 67.4,67.4v154.9h579.2V700.4c0,-37.2 30.2,-67.4 67.4,-67.4C894.2,633 924.3,663.2 924.3,700.4zM452.4,758.1c13.2,13.2 30.4,19.7 47.6,19.7c17.3,0 34.5,-6.6 47.7,-19.7l202,-202c26.4,-26.3 26.4,-68.9 0,-95.2c-26.3,-26.3 -69,-26.3 -95.2,0l-87,87.1V77.4c0,-37.2 -30.1,-67.4 -67.4,-67.4c-37.2,0 -67.4,30.2 -67.4,67.4v470.6l-87.1,-87.1c-26.3,-26.3 -69,-26.3 -95.2,0c-26.3,26.3 -26.3,69 0,95.2L452.4,758.1z"/>
</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="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
</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

@ -4,10 +4,10 @@
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.completed.CompletedFragment">
<TextView <TextView
android:id="@+id/text_dashboard" android:id="@+id/text_completed"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"

View File

@ -4,10 +4,10 @@
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.notifications.NotificationsFragment"> tools:context=".ui.settings.SettingsFragment">
<TextView <TextView
android:id="@+id/text_notifications" android:id="@+id/text_compressing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"

View File

@ -4,10 +4,10 @@
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.settings.SettingsFragment">
<TextView <TextView
android:id="@+id/text_home" android:id="@+id/text_settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"

View File

@ -2,18 +2,20 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:id="@+id/navigation_home" android:id="@+id/navigation_compressing"
android:icon="@drawable/ic_home_black_24dp" android:icon="@drawable/ic_download"
android:title="@string/title_home" /> android:title="@string/title_compressing" />
<item <item
android:id="@+id/navigation_dashboard" android:id="@+id/navigation_completed"
android:icon="@drawable/ic_dashboard_black_24dp" android:icon="@drawable/ic_folderupdate"
android:title="@string/title_dashboard" /> android:title="@string/title_completed" />
<item <item
android:id="@+id/navigation_notifications" android:id="@+id/navigation_settings"
android:icon="@drawable/ic_notifications_black_24dp" android:icon="@drawable/ic_gearsimplified"
android:title="@string/title_notifications" /> android:title="@string/title_settings" />
</menu> </menu>

View File

@ -3,23 +3,25 @@
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_completed">
<fragment <fragment
android:id="@+id/navigation_home" android:id="@+id/navigation_completed"
android:name="com.example.myapplication.ui.home.HomeFragment" android:name="com.example.myapplication.ui.completed.CompletedFragment"
android:label="@string/title_home" android:label="@string/title_completed"
tools:layout="@layout/fragment_home" /> tools:layout="@layout/fragment_completed" />
<fragment <fragment
android:id="@+id/navigation_dashboard" android:id="@+id/navigation_compressing"
android:name="com.example.myapplication.ui.dashboard.DashboardFragment" android:name="com.example.myapplication.ui.compressing.CompressingFragment"
android:label="@string/title_dashboard" android:label="@string/title_compressing"
tools:layout="@layout/fragment_dashboard" /> tools:layout="@layout/fragment_compressing" />
<fragment <fragment
android:id="@+id/navigation_notifications" android:id="@+id/navigation_settings"
android:name="com.example.myapplication.ui.notifications.NotificationsFragment" android:name="com.example.myapplication.ui.settings.SettingsFragment"
android:label="@string/title_notifications" android:label="@string/title_settings"
tools:layout="@layout/fragment_notifications" /> tools:layout="@layout/fragment_settings" />
</navigation> </navigation>

View File

@ -1,6 +1,6 @@
<resources> <resources>
<string name="app_name">My Application</string> <string name="app_name">My Application</string>
<string name="title_files">Files</string> <string name="title_compressing">Compressing</string>
<string name="title_youtube">Dashboard</string> <string name="title_completed">Completed</string>
<string name="title_notifications">Notifications</string> <string name="title_settings">Settings</string>
</resources> </resources>