- change list item view

- added pop menu to list item
 - fixed update/add shift bug
This commit is contained in:
2023-09-13 15:45:58 +01:00
parent e5d1ef3a75
commit c9b4190a93
14 changed files with 649 additions and 68 deletions

View File

@@ -131,6 +131,13 @@ class FragmentAddItem : FormFragment<SubmissionViewModel>(R.layout.fragment_add_
}
}
requireActivity().onBackPressedDispatcher.addCallback(this, onBackPressed)
id = try {
FragmentAddItemArgs.fromBundle(requireArguments()).shiftId
} catch (e: Exception) {
Log.i("Nav Args", "Failed to retrieve args from navigation")
null
}
}
override fun onResume() {
@@ -150,17 +157,10 @@ class FragmentAddItem : FormFragment<SubmissionViewModel>(R.layout.fragment_add_
}
private fun setupViewAfterViewCreated() {
val id = try {
FragmentAddItemArgs.fromBundle(requireArguments()).shiftId
} catch (e: Exception) {
Log.i("Nav Args", "Failed to retrieve args from navigation")
null
}
wholeView.hide()
// Since we are editing a shift lets load the shift data into the views
id?.let { viewModel.getCurrentShift(id) }?.run {
id?.let { viewModel.getCurrentShift(it) }?.run {
mLocationEditText.setText(description)
mDateEditText.setText(date)

View File

@@ -63,9 +63,7 @@ class FragmentMain : BaseFragment<MainViewModel>(R.layout.fragment_main) {
emptyView = view.findViewById(R.id.empty_view)
productListView = view.findViewById(R.id.list_item_view)
mAdapter = ShiftListAdapter(this, emptyView) {
viewModel.deleteShift(it)
}
mAdapter = ShiftListAdapter(this, emptyView, viewModel)
productListView.adapter = mAdapter
view.findViewById<FloatingActionButton>(R.id.fab1).setOnClickListener {

View File

@@ -2,27 +2,30 @@ package com.appttude.h_mal.farmr.ui
import android.annotation.SuppressLint
import android.app.AlertDialog
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.PopupMenu
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DiffUtil
import com.appttude.h_mal.farmr.R
import com.appttude.h_mal.farmr.base.BaseListAdapter
import com.appttude.h_mal.farmr.data.legacydb.ShiftObject
import com.appttude.h_mal.farmr.model.ShiftType
import com.appttude.h_mal.farmr.utils.ID
import com.appttude.h_mal.farmr.utils.formatToTwoDpString
import com.appttude.h_mal.farmr.utils.formatToTwoDp
import com.appttude.h_mal.farmr.utils.generateView
import com.appttude.h_mal.farmr.utils.navigateTo
import com.appttude.h_mal.farmr.utils.navigateToFragment
import com.appttude.h_mal.farmr.viewmodel.MainViewModel
const val PIECE_ITEM = 500
const val HOURLY_ITEM = 501
class ShiftListAdapter(
private val fragment: Fragment,
emptyView: View,
private val longPressCallback: (Long) -> Unit
private val viewModel: MainViewModel
) : BaseListAdapter<ShiftObject>(diffCallBack, R.layout.list_item_1, emptyView) {
@SuppressLint("SetTextI18n")
@@ -33,40 +36,28 @@ class ShiftListAdapter(
val descriptionTextView: TextView = view.findViewById(R.id.location)
val dateTextView: TextView = view.findViewById(R.id.date)
val totalPay: TextView = view.findViewById(R.id.total_pay)
val hoursView: TextView = view.findViewById(R.id.hours)
val h: TextView = view.findViewById(R.id.h)
val minutesView: TextView = view.findViewById(R.id.minutes)
val m: TextView = view.findViewById(R.id.m)
val editView: ImageView = view.findViewById(R.id.imageView)
h.text = "h"
m.text = "m"
val typeText: String = data.type
val descriptionText: String = data.description
val dateText: String = data.date
val totalPayText: String = data.totalPay.formatToTwoDpString()
descriptionTextView.text = descriptionText
dateTextView.text = dateText
totalPay.text = totalPayText
when (getItemViewType(position)) {
HOURLY_ITEM -> {
val hoursView: TextView = view.findViewById(R.id.hours)
val minutesView: TextView = view.findViewById(R.id.minutes)
when (ShiftType.getEnumByType(typeText)) {
ShiftType.HOURLY -> {
val time = data.getHoursMinutesPairFromDuration()
hoursView.text = time.first
minutesView.text = time.second
minutesView.text = if (time.second.length == 1) "0${time.second}" else time.second
}
ShiftType.PIECE -> {
PIECE_ITEM -> {
val unitsView: TextView = view.findViewById(R.id.pieces)
val unitsText: String = data.units.toString()
hoursView.text = unitsText
h.text = ""
minutesView.text = ""
m.text = "pcs"
unitsView.text = unitsText
}
}
descriptionTextView.text = data.description
dateTextView.text = data.date
totalPay.text = data.totalPay.formatToTwoDpString()
view.setOnClickListener {
// Navigate to further info
@@ -74,20 +65,60 @@ class ShiftListAdapter(
fragment.navigateTo(nav)
}
editView.setOnClickListener {
//creating a popup menu
val popup = PopupMenu(it.context, it)
//inflating menu from xml resource
popup.inflate(R.menu.options_menu)
//adding click listener
popup.setOnMenuItemClickListener { menu ->
when (menu.itemId) {
R.id.update -> {
// Navigate to edit
val nav = FragmentMainDirections.mainToAddItem(data.id)
fragment.navigateTo(nav)
return@setOnMenuItemClickListener true
}
view.setOnLongClickListener {
R.id.delete -> {
AlertDialog.Builder(it.context)
.setMessage("Are you sure you want to delete")
.setPositiveButton("delete") { _, _ -> longPressCallback.invoke(data.id) }
.setPositiveButton("delete") { _, _ -> viewModel.deleteShift(data.id) }
.setNegativeButton("cancel") { dialog, _ ->
dialog?.dismiss()
}
.create().show()
true
return@setOnMenuItemClickListener true
}
else -> return@setOnMenuItemClickListener false
}
}
//displaying the popup
popup.show()
}
}
override fun getItemViewType(position: Int): Int {
val typeString = getItem(position).type
return when (ShiftType.getEnumByType(typeString)) {
ShiftType.HOURLY -> HOURLY_ITEM
ShiftType.PIECE -> PIECE_ITEM
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CurrentViewHolder {
val layoutId = when (viewType) {
HOURLY_ITEM -> R.layout.list_cell_hourly
PIECE_ITEM -> R.layout.list_cell_piece
else -> {
return super.onCreateViewHolder(parent, viewType)
}
}
val currentView = LayoutInflater
.from(parent.context)
.inflate(layoutId, parent, false)
return CurrentViewHolder(currentView)
}
companion object {

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="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>

View File

@@ -0,0 +1,135 @@
<?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:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#656565"
android:orientation="horizontal"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:showDividers="end">
<LinearLayout
android:id="@+id/time_holder"
android:layout_width="@dimen/unit_holder_width"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="12dp"
android:gravity="end"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="00"
android:textColor="#143d66"
android:textSize="@dimen/unit_text_size" />
<TextView
android:id="@+id/h"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hours_symbol"
android:textColor="#143d66"
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/minutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="00"
android:textColor="#143d66"
android:textSize="@dimen/unit_text_size" />
<TextView
android:id="@+id/m"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/minutes_symbol"
android:textColor="#143d66"
android:textSize="@dimen/units_symbol_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/totalpay_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:orientation="horizontal"
app:layout_constraintRight_toRightOf="@id/time_holder"
app:layout_constraintTop_toBottomOf="@id/time_holder">
<TextView
android:id="@+id/currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pound_sign"
android:textColor="#728fcc"
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/total_pay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="000.00"
android:textColor="#728fcc"
android:textSize="@dimen/total_pay_size" />
</LinearLayout>
<View
android:id="@+id/line"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"
app:layout_constraintLeft_toRightOf="@id/time_holder"
app:layout_constraintTop_toTopOf="@id/time_holder" />
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:gravity="bottom|start"
android:textColor="#000000"
android:textSize="@dimen/location_size"
android:autoSizeMinTextSize="@dimen/location_autosize_min"
android:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="@id/time_holder"
app:layout_constraintLeft_toRightOf="@id/line"
app:layout_constraintRight_toLeftOf="@id/imageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
android:maxLines="2"
tools:text="Location Name is quite long and with a second line and more" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:maxLines="3"
tools:text="01-05-2010"
android:textSize="@dimen/date_size"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@id/location"
app:layout_constraintLeft_toLeftOf="@id/location"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_more_vert_24"
android:layout_marginEnd="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,118 @@
<?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:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#656565"
android:orientation="horizontal"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:showDividers="end">
<LinearLayout
android:id="@+id/time_holder"
android:layout_width="@dimen/unit_holder_width"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="12dp"
android:gravity="end"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/pieces"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="10.0"
android:textColor="#143d66"
android:textSize="@dimen/unit_text_size" />
<TextView
android:id="@+id/h"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/piece_symbol"
android:textColor="#143d66"
android:textSize="@dimen/units_symbol_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/totalpay_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:orientation="horizontal"
app:layout_constraintRight_toRightOf="@id/time_holder"
app:layout_constraintTop_toBottomOf="@id/time_holder">
<TextView
android:id="@+id/currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pound_sign"
android:textColor="#728fcc"
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/total_pay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="000.00"
android:textColor="#728fcc"
android:textSize="@dimen/total_pay_size" />
</LinearLayout>
<View
android:id="@+id/line"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"
app:layout_constraintLeft_toRightOf="@id/time_holder"
app:layout_constraintTop_toTopOf="@id/time_holder" />
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:gravity="bottom|start"
android:textColor="#000000"
android:textSize="@dimen/location_size"
android:autoSizeMinTextSize="@dimen/location_autosize_min"
android:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="@id/time_holder"
app:layout_constraintLeft_toRightOf="@id/line"
app:layout_constraintRight_toLeftOf="@id/imageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
android:maxLines="2"
tools:text="Location Name is quite long and with a second line" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:maxLines="3"
tools:text="01-05-2010"
android:textSize="@dimen/date_size"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@id/location"
app:layout_constraintLeft_toLeftOf="@id/location"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_more_vert_24"
android:layout_marginEnd="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/list_item_1">
tools:listitem="@layout/list_cell_hourly">
</androidx.recyclerview.widget.RecyclerView>
<com.google.android.material.floatingactionbutton.FloatingActionButton

View File

@@ -0,0 +1,132 @@
<?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:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#656565"
android:orientation="horizontal"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:showDividers="end">
<LinearLayout
android:id="@+id/time_holder"
android:layout_width="@dimen/unit_holder_width"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="12dp"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="00"
android:textColor="#143d66"
android:textSize="@dimen/unit_text_size" />
<TextView
android:id="@+id/h"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hours_symbol"
android:textColor="#143d66"
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/minutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="00"
android:textColor="#143d66"
android:textSize="@dimen/unit_text_size" />
<TextView
android:id="@+id/m"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/minutes_symbol"
android:textColor="#143d66"
android:textSize="@dimen/units_symbol_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/totalpay_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:orientation="horizontal"
app:layout_constraintRight_toRightOf="@id/time_holder"
app:layout_constraintTop_toBottomOf="@id/time_holder">
<TextView
android:id="@+id/currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pound_sign"
android:textColor="#728fcc"
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/total_pay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="000.00"
android:textColor="#728fcc"
android:textSize="@dimen/total_pay_size" />
</LinearLayout>
<View
android:id="@+id/line"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"
app:layout_constraintLeft_toRightOf="@id/time_holder"
app:layout_constraintTop_toTopOf="@id/time_holder" />
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:gravity="bottom|start"
android:textColor="#000000"
android:textSize="@dimen/location_size"
app:layout_constraintBottom_toBottomOf="@id/time_holder"
app:layout_constraintLeft_toRightOf="@id/line"
app:layout_constraintRight_toLeftOf="@id/imageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
android:maxLines="1"
tools:text="Location Name" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:maxLines="3"
tools:text="01-05-2010"
android:textSize="@dimen/date_size"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@id/location"
app:layout_constraintLeft_toLeftOf="@id/location"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_more_vert_24"
android:layout_marginEnd="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,117 @@
<?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:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#656565"
android:orientation="horizontal"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:showDividers="end">
<LinearLayout
android:id="@+id/time_holder"
android:layout_width="@dimen/unit_holder_width"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="12dp"
android:gravity="end"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/pieces"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="10.0"
android:textColor="#143d66"
android:textSize="@dimen/unit_text_size" />
<TextView
android:id="@+id/h"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/piece_symbol"
android:textColor="#143d66"
android:textSize="@dimen/units_symbol_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/totalpay_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:orientation="horizontal"
app:layout_constraintRight_toRightOf="@id/time_holder"
app:layout_constraintTop_toBottomOf="@id/time_holder">
<TextView
android:id="@+id/currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pound_sign"
android:textColor="#728fcc"
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/total_pay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="000.00"
android:textColor="#728fcc"
android:textSize="@dimen/total_pay_size" />
</LinearLayout>
<View
android:id="@+id/line"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"
app:layout_constraintLeft_toRightOf="@id/time_holder"
app:layout_constraintTop_toTopOf="@id/time_holder" />
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:gravity="bottom|start"
android:textColor="#000000"
android:textSize="@dimen/location_size"
app:layout_constraintBottom_toBottomOf="@id/time_holder"
app:layout_constraintLeft_toRightOf="@id/line"
app:layout_constraintRight_toLeftOf="@id/imageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
android:maxLines="1"
tools:text="Location Name" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:maxLines="3"
tools:text="01-05-2010"
android:textSize="@dimen/date_size"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@id/location"
app:layout_constraintLeft_toLeftOf="@id/location"
app:layout_constraintBottom_toBottomOf="@id/totalpay_holder"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_more_vert_24"
android:layout_marginEnd="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -8,10 +9,11 @@
android:orientation="horizontal"
android:paddingBottom="24dp"
android:paddingTop="24dp"
android:showDividers="end">
android:showDividers="end"
tools:ignore="HardcodedText">
<LinearLayout
android:layout_width="87dp"
android:layout_width="@dimen/unit_holder_width"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
@@ -30,7 +32,7 @@
android:layout_height="wrap_content"
android:text="00"
android:textColor="#143d66"
android:textSize="30sp" />
android:textSize="@dimen/unit_text_size" />
<TextView
android:id="@+id/h"
@@ -38,7 +40,7 @@
android:layout_height="wrap_content"
android:text="h"
android:textColor="#143d66"
android:textSize="12sp" />
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/minutes"
@@ -47,7 +49,7 @@
android:layout_weight="1"
android:text="00"
android:textColor="#143d66"
android:textSize="30sp" />
android:textSize="@dimen/unit_text_size"/>
<TextView
android:id="@+id/m"
@@ -56,7 +58,7 @@
android:layout_weight="1"
android:text="m"
android:textColor="#143d66"
android:textSize="12sp" />
android:textSize="@dimen/units_symbol_size" />
</LinearLayout>
<LinearLayout
@@ -70,9 +72,9 @@
android:id="@+id/currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="£"
android:text="@string/pound_sign"
android:textColor="#728fcc"
android:textSize="12sp" />
android:textSize="@dimen/units_symbol_size" />
<TextView
android:id="@+id/total_pay"
@@ -80,7 +82,7 @@
android:layout_height="wrap_content"
android:text="000.00"
android:textColor="#728fcc"
android:textSize="20sp" />
android:textSize="@dimen/total_pay_size" />
</LinearLayout>
</LinearLayout>
@@ -106,7 +108,7 @@
android:layout_below="@+id/date"
android:maxLines="3"
android:text="Location Name"
android:textSize="20sp" />
android:textSize="@dimen/location_size" />
<TextView
android:id="@+id/date"
@@ -119,7 +121,7 @@
android:layout_marginTop="16dp"
android:text="01-05-2010"
android:textColor="#000000"
android:textSize="16sp" />
android:textSize="@dimen/date_size" />
<ImageView
android:id="@+id/imageView"

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/update"
android:orderInCategory="100"
android:title="@string/update_shift"
app:showAsAction="never" />
<item
android:id="@+id/delete"
android:orderInCategory="100"
android:title="@string/delete_shift"
app:showAsAction="never" />
</menu>

View File

@@ -12,13 +12,25 @@
tools:layout="@layout/fragment_main" >
<action
android:id="@+id/main_to_addItem"
app:destination="@id/fragmentAddItem" />
app:destination="@id/fragmentAddItem"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
<action
android:id="@+id/main_to_filterData"
app:destination="@id/filterDataFragment" />
app:destination="@id/filterDataFragment"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"/>
<action
android:id="@+id/main_to_furtherInfo"
app:destination="@id/furtherInfoFragment" />
app:destination="@id/furtherInfoFragment"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"/>
</fragment>
<fragment
android:id="@+id/fragmentAddItem"
@@ -41,7 +53,11 @@
tools:layout="@layout/fragment_futher_info" >
<action
android:id="@+id/furtherInfo_to_AddItem"
app:destination="@id/fragmentAddItem" />
app:destination="@id/fragmentAddItem"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"/>
<argument
android:name="shiftId"
app:argType="long" />

View File

@@ -4,6 +4,13 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
<dimen name="unit_text_size">20sp</dimen>
<dimen name="units_symbol_size">12sp</dimen>
<dimen name="total_pay_size">16sp</dimen>
<dimen name="location_size">16sp</dimen>
<dimen name="date_size">14sp</dimen>
<dimen name="unit_holder_width">75dp</dimen>
<dimen name="location_autosize_min">12sp</dimen>
</resources>

View File

@@ -97,4 +97,10 @@
<string name="further_info_title">Shift Details</string>
<string name="insert_break_in_minutes">insert break in minutes</string>
<string name="break_res">Break</string>
<string name="hours_symbol">h</string>
<string name="minutes_symbol">m</string>
<string name="piece_symbol">pcs</string>
<string name="pound_sign">£</string>
<string name="delete_shift">Delete shift</string>
<string name="update_shift">Update Shift</string>
</resources>