some ui stuff

This commit is contained in:
sockenklaus
2022-07-11 02:00:31 +02:00
parent 209ac060f0
commit 002ebb5627
32 changed files with 352 additions and 220 deletions

View File

@@ -12,6 +12,6 @@
</deviceKey> </deviceKey>
</Target> </Target>
</targetSelectedWithDropDown> </targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-07-10T21:30:46.094445100Z" /> <timeTargetWasSelectedWithDropDown value="2022-07-10T23:41:39.169373600Z" />
</component> </component>
</project> </project>

10
.idea/misc.xml generated
View File

@@ -3,14 +3,20 @@
<component name="DesignSurface"> <component name="DesignSurface">
<option name="filePathToZoomLevelMap"> <option name="filePathToZoomLevelMap">
<map> <map>
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.323" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/drawable/ic_launcher_background.xml" value="0.323" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/drawable/ic_menu_camera.xml" value="0.323" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/drawable/ic_menu_slideshow.xml" value="0.323" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/activity_main.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/activity_main.xml" value="0.425" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/app_bar_main.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/app_bar_main.xml" value="0.19607843137254902" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/content_main.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/content_main.xml" value="0.425" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_add_charge.xml" value="0.67" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_gallery.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_gallery.xml" value="0.425" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_home.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_home.xml" value="0.425" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_settings.xml" value="0.425" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_slideshow.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/fragment_slideshow.xml" value="0.425" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/nav_header_main.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/layout/nav_header_main.xml" value="0.425" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/menu/activity_main_drawer.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/menu/activity_main_drawer.xml" value="0.33" />
<entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/menu/main.xml" value="0.425" /> <entry key="..\:/Users/socrates/AndroidStudioProjects/BatteryTracker/app/src/main/res/menu/main.xml" value="0.425" />
</map> </map>
</option> </option>

View File

@@ -44,6 +44,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.0' implementation 'androidx.navigation:navigation-ui-ktx:2.5.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

View File

@@ -2,6 +2,7 @@ package com.sockenklaus.batterytracker
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.navigation.NavigationView import com.google.android.material.navigation.NavigationView
import androidx.navigation.findNavController import androidx.navigation.findNavController
@@ -11,12 +12,14 @@ import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController import androidx.navigation.ui.setupWithNavController
import androidx.drawerlayout.widget.DrawerLayout import androidx.drawerlayout.widget.DrawerLayout
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.NavController
import com.sockenklaus.batterytracker.databinding.ActivityMainBinding import com.sockenklaus.batterytracker.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var appBarConfiguration: AppBarConfiguration
private lateinit var binding: ActivityMainBinding private lateinit var binding: ActivityMainBinding
private lateinit var navController: NavController
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@@ -26,18 +29,14 @@ class MainActivity : AppCompatActivity() {
setSupportActionBar(binding.appBarMain.toolbar) setSupportActionBar(binding.appBarMain.toolbar)
binding.appBarMain.fab.setOnClickListener { view ->
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
val drawerLayout: DrawerLayout = binding.drawerLayout val drawerLayout: DrawerLayout = binding.drawerLayout
val navView: NavigationView = binding.navView val navView: NavigationView = binding.navView
val navController = findNavController(R.id.nav_host_fragment_content_main) navController = findNavController(R.id.nav_host_fragment_content_main)
// 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.
appBarConfiguration = AppBarConfiguration( appBarConfiguration = AppBarConfiguration(
setOf( setOf(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow R.id.nav_home, R.id.nav_add_charge, R.id.nav_add_battery, R.id.nav_settings
), drawerLayout ), drawerLayout
) )
setupActionBarWithNavController(navController, appBarConfiguration) setupActionBarWithNavController(navController, appBarConfiguration)

View File

@@ -0,0 +1,60 @@
package com.sockenklaus.batterytracker.ui
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.sockenklaus.batterytracker.R
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
/**
* A simple [Fragment] subclass.
* Use the [AddBatteryFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class AddBatteryFragment : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_add_battery, container, false)
}
companion object {
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment AddBatteryFragment.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
AddBatteryFragment().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
}
}
}

View File

@@ -0,0 +1,32 @@
package com.sockenklaus.batterytracker.ui.add_charge
import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.sockenklaus.batterytracker.R
class AddChargeFragment : Fragment() {
companion object {
fun newInstance() = AddChargeFragment()
}
private lateinit var viewModel: AddChargeViewModel
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_add_charge, container, false)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(this).get(AddChargeViewModel::class.java)
// TODO: Use the ViewModel
}
}

View File

@@ -0,0 +1,7 @@
package com.sockenklaus.batterytracker.ui.add_charge
import androidx.lifecycle.ViewModel
class AddChargeViewModel : ViewModel() {
// TODO: Implement the ViewModel
}

View File

@@ -1,42 +0,0 @@
package com.sockenklaus.batterytracker.ui.gallery
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.ViewModelProvider
import com.sockenklaus.batterytracker.databinding.FragmentGalleryBinding
class GalleryFragment : Fragment() {
private var _binding: FragmentGalleryBinding? = 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 {
val galleryViewModel =
ViewModelProvider(this).get(GalleryViewModel::class.java)
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textGallery
galleryViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}
return root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@@ -1,13 +0,0 @@
package com.sockenklaus.batterytracker.ui.gallery
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class GalleryViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is gallery Fragment"
}
val text: LiveData<String> = _text
}

View File

@@ -0,0 +1,27 @@
package com.sockenklaus.batterytracker.ui.settings
import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.sockenklaus.batterytracker.R
class SettingsFragment : Fragment() {
companion object {
fun newInstance() = SettingsFragment()
}
private lateinit var viewModel: SettingsViewModel
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
viewModel = ViewModelProvider(this)[SettingsViewModel::class.java]
return inflater.inflate(R.layout.fragment_settings, container, false)
}
}

View File

@@ -0,0 +1,7 @@
package com.sockenklaus.batterytracker.ui.settings
import androidx.lifecycle.ViewModel
class SettingsViewModel : ViewModel() {
// TODO: Implement the ViewModel
}

View File

@@ -1,42 +0,0 @@
package com.sockenklaus.batterytracker.ui.slideshow
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.ViewModelProvider
import com.sockenklaus.batterytracker.databinding.FragmentSlideshowBinding
class SlideshowFragment : Fragment() {
private var _binding: FragmentSlideshowBinding? = 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 {
val slideshowViewModel =
ViewModelProvider(this).get(SlideshowViewModel::class.java)
_binding = FragmentSlideshowBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textSlideshow
slideshowViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}
return root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@@ -1,13 +0,0 @@
package com.sockenklaus.batterytracker.ui.slideshow
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class SlideshowViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is slideshow Fragment"
}
val text: LiveData<String> = _text
}

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M17,5v16c0,0.55 -0.45,1 -1,1H8c-0.55,0 -1,-0.45 -1,-1V5c0,-0.55 0.45,-1 1,-1h2V2h4v2h2C16.55,4 17,4.45 17,5zM15,6H9v4h6V6z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.67,4H14V2h-4v2H8.33C7.6,4 7,4.6 7,5.33v15.33C7,21.4 7.6,22 8.33,22h7.33c0.74,0 1.34,-0.6 1.34,-1.33V5.33C17,4.6 16.4,4 15.67,4zM11,20v-5.5H9L13,7v5.5h2L11,20z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
</vector>

View File

@@ -1,12 +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,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
<path
android:fillColor="#FF000000"
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
</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="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
</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="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z" />
</vector>

View File

@@ -22,4 +22,5 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main" app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" /> app:menu="@menu/activity_main_drawer" />
</androidx.drawerlayout.widget.DrawerLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@@ -20,15 +20,8 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" /> <include
android:id="@+id/content_main"
<com.google.android.material.floatingactionbutton.FloatingActionButton layout="@layout/content_main" />
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="16dp"
app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.AddBatteryFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>

View File

@@ -0,0 +1,90 @@
<?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.add_charge.AddChargeFragment">
<EditText
android:id="@+id/editTextTextPersonName4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:ems="10"
android:inputType="textPersonName"
android:minHeight="48dp"
android:text="Name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView4"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editTextTextPersonName5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:ems="10"
android:inputType="textPersonName"
android:minHeight="48dp"
android:text="Name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/editTextTextPersonName4"
app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName4" />
<EditText
android:id="@+id/editTextTextPersonName6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:ems="10"
android:inputType="textPersonName"
android:minHeight="48dp"
android:text="Name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/editTextTextPersonName5"
app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName5" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@string/battery_id"
app:layout_constraintBaseline_toBaselineOf="@+id/editTextTextPersonName4"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
app:layout_constraintBaseline_toBaselineOf="@+id/editTextTextPersonName5"
app:layout_constraintEnd_toEndOf="@+id/textView4" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Charge"
app:layout_constraintBaseline_toBaselineOf="@+id/editTextTextPersonName6"
app:layout_constraintEnd_toEndOf="@+id/textView5" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="32dp"
android:layout_marginBottom="32dp"
android:contentDescription="@string/button_save_charge"
android:text="@string/button_save_charge"
app:icon="@drawable/ic_baseline_check_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

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.gallery.GalleryFragment">
<TextView
android:id="@+id/text_gallery"
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

@@ -0,0 +1,31 @@
<?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.settings.SettingsFragment">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Hello"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="32dp"
android:layout_marginBottom="32dp"
android:contentDescription="@string/button_save_settings"
android:text="@string/button_save_settings"
app:icon="@drawable/ic_baseline_check_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

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.slideshow.SlideshowFragment">
<TextView
android:id="@+id/text_slideshow"
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

@@ -6,15 +6,24 @@
<group android:checkableBehavior="single"> <group android:checkableBehavior="single">
<item <item
android:id="@+id/nav_home" android:id="@+id/nav_home"
android:icon="@drawable/ic_menu_camera" android:icon="@drawable/ic_baseline_home_24"
android:title="@string/menu_home" /> android:title="@string/menu_home" />
<item <item
android:id="@+id/nav_gallery" android:id="@+id/nav_add_charge"
android:icon="@drawable/ic_menu_gallery" android:title="@string/menu_add_charge"
android:title="@string/menu_gallery" /> android:icon="@drawable/ic_baseline_battery_charging_full_24"
/>
<item <item
android:id="@+id/nav_slideshow" android:id="@+id/nav_add_battery"
android:icon="@drawable/ic_menu_slideshow" android:title="@string/menu_add_battery"
android:title="@string/menu_slideshow" /> android:icon="@drawable/ic_baseline_battery_5_bar_24"
/>
<item
android:id="@+id/nav_settings"
android:icon="@drawable/ic_baseline_settings_24"
android:title="@string/menu_settings" />
</group> </group>
</menu> </menu>

View File

@@ -1,9 +1,9 @@
<?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"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item <!-- <item
android:id="@+id/action_settings" android:id="@+id/action_settings"
android:orderInCategory="100" android:orderInCategory="100"
android:title="@string/action_settings" android:title="@string/action_settings"
app:showAsAction="never" /> app:showAsAction="never" />-->
</menu> </menu>

View File

@@ -12,14 +12,20 @@
tools:layout="@layout/fragment_home" /> tools:layout="@layout/fragment_home" />
<fragment <fragment
android:id="@+id/nav_gallery" android:id="@+id/nav_add_charge"
android:name="com.sockenklaus.batterytracker.ui.gallery.GalleryFragment" android:name="com.sockenklaus.batterytracker.ui.add_charge.AddChargeFragment"
android:label="@string/menu_gallery" android:label="@string/menu_add_charge"
tools:layout="@layout/fragment_gallery" /> tools:layout="@layout/fragment_add_charge" />
<fragment <fragment
android:id="@+id/nav_slideshow" android:id="@+id/nav_add_battery"
android:name="com.sockenklaus.batterytracker.ui.slideshow.SlideshowFragment" android:name="com.sockenklaus.batterytracker.ui.AddBatteryFragment"
android:label="@string/menu_slideshow" android:label="@string/menu_add_battery"
tools:layout="@layout/fragment_slideshow" /> tools:layout="@layout/fragment_add_battery" />
<fragment
android:id="@+id/nav_settings"
android:name="com.sockenklaus.batterytracker.ui.settings.SettingsFragment"
android:label="@string/action_settings"
tools:layout="@layout/fragment_settings" />
</navigation> </navigation>

View File

@@ -10,4 +10,12 @@
<string name="menu_home">Home</string> <string name="menu_home">Home</string>
<string name="menu_gallery">Gallery</string> <string name="menu_gallery">Gallery</string>
<string name="menu_slideshow">Slideshow</string> <string name="menu_slideshow">Slideshow</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="menu_settings">Settings</string>
<string name="button_save_settings">Save Settings</string>
<string name="menu_add_charge">Add Charge</string>
<string name="menu_add_battery">Add Battery</string>
<string name="battery_id">Battery ID</string>
<string name="button_save_charge">Save Charge</string>
</resources> </resources>