Skip to content

Commit

Permalink
Added additional job and expense types
Browse files Browse the repository at this point in the history
Fixed bug where text overlaps delete and edit icons
  • Loading branch information
ken-ruster committed Jun 6, 2023
1 parent bb9769f commit c9714ea
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -14,8 +16,14 @@ import com.example.myapplication.data.Exp
import com.example.myapplication.data.ProfileManager
import com.example.myapplication.data.TaxProfile
import com.example.myapplication.databinding.ExpsOverviewBinding
import com.example.myapplication.flowClicked
import com.example.myapplication.storage.FileReader
import com.xwray.groupie.GroupieAdapter
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach

class ExpsOverviewFragment(): Fragment() {
lateinit var binding: ExpsOverviewBinding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -13,8 +15,14 @@ import com.example.myapplication.R
import com.example.myapplication.data.Job
import com.example.myapplication.data.TaxProfile
import com.example.myapplication.databinding.JobsOverviewBinding
import com.example.myapplication.flowClicked
import com.example.myapplication.storage.FileReader
import com.xwray.groupie.GroupieAdapter
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach


class JobsOverviewFragment(): Fragment() {
Expand Down Expand Up @@ -67,10 +75,6 @@ class JobsOverviewFragment(): Fragment() {
findNavController().navigate(action)
}

binding.backButton.setOnClickListener {
findNavController().popBackStack()
}

return binding.root
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,27 @@ class ExpenseDefaults (context: Context) {
"vehicle_rental" to ExpenseSetting("Vehicle Rental", 1, true),
"fuel" to ExpenseSetting("Vehicle Fuel", 1, true),
"vehicle_maintenance" to ExpenseSetting("Vehicle Maintenance", 1, true),
"fees" to ExpenseSetting("Service Fees (%s)", 1, false),
"teaching_materials" to ExpenseSetting("Teaching Materials (%s)", 1, false),
"fees" to ExpenseSetting("Service Fees (%s)", 1, false),
"compensation" to ExpenseSetting("Compensation", 1, false),
"driving_license" to ExpenseSetting("Driving License Fees", 1, true),
"vocational_license" to ExpenseSetting("Vocational License Fee (%s)", 1, false),
"erp" to ExpenseSetting("ERP Fees", 1, true),
"printing_stationery" to ExpenseSetting("Printing/Stationery Costs (%s)", 1, false),
"venue_rental" to ExpenseSetting("Venue Rental (%s)", 1, false),
"public_transport" to ExpenseSetting("Public Transport (%s)", 1, false),
"overseas_travelling" to ExpenseSetting("Overseas Travel (%s)", 1, false),
"entertainment" to ExpenseSetting("Entertainment (%s)", 1, false),
"staff_remuneration" to ExpenseSetting("Staff Remuneration (%s)", 1, false),
"cpf_contributions" to ExpenseSetting("CPF Contributions (%s)", 1, false),
"utility_charges" to ExpenseSetting("Utility Charges (%s)", 1, false),
"venue_maintenance" to ExpenseSetting("Venue Maintenance (%s)", 1, false),
"transport" to ExpenseSetting("Misc. Transport (%s)", 1, false),
"performance_expenses" to ExpenseSetting("Performance Expenses (%s)", 1, false),
"promotion_expenses" to ExpenseSetting("Promotional Expenses (%s)", 1, false),
"ingredients" to ExpenseSetting("Ingredients", 0, true),
"property_tax" to ExpenseSetting("Property Tax (%s)", 1, false),
"mortgage_interest" to ExpenseSetting("Mortgage Interest (%s)", 1, false),
"association_sub" to ExpenseSetting("Prof. Body/Trade Assn. Subscription (%s)", 1, false)
)

fun loadDefaults() {
Expand Down
16 changes: 13 additions & 3 deletions app/src/main/java/com/example/myapplication/storage/JobDefaults.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ class JobDefaults(context: Context) {

// Default settings can be created here
private var jobSettings : Map<String, List<String>> = mapOf(
"Private Hire Transport" to listOf("vehicle_rental", "fuel", "vehicle_maintenance", "fees"),
"Food Delivery" to listOf("vehicle_rental", "fuel", "vehicle_maintenance", "fees"),
"Tuition" to listOf("teaching_materials", "venue_rental")
"Private Hire Transport" to listOf("vehicle_rental", "fuel", "vehicle_maintenance", "fees", "erp", "driving_license", "vocational_license"),
"Delivery" to listOf("fees", "compensation"),
"Tuition" to listOf("printing_stationery", "venue_rental", "cpf_contributions", "utility_charges", "public_transport", "staff_remuneration", "overseas_travelling", "entertainment"),
"Commission Agent" to listOf("venue_rental", "entertainment", "printing_stationery", "staff_remuneration", "overseas_travelling", "public_transport", "venue_maintenance"),
"Beauty and Wellness Operator" to listOf("public_transport", "entertainment", "staff_remuneration", "cpf_contributions", "utility_charges"),
"Entertainer/ Entertainment Organiser" to listOf("entertainment", "transport", "staff_remuneration", "cpf_contributions", "promotion_expenses", "performance_expenses"),
"Hawker" to listOf("venue_rental", "property_tax", "mortgage_interest", "utility_charges", "transport", "staff_remuneration", "cpf_contributions", "ingredients"),
"Lawyer" to listOf("entertainment", "public_transport", "printing_stationery", "staff_remuneration", "cpf_contributions", "association_sub"),
"Maid Agency Operator" to listOf("venue_rental", "property_tax", "mortgage_interest", "utility_charges", "staff_remuneration", "cpf_contributions"),
"Medical Practitioner" to listOf("venue_rental", "public_transport", "utility_charges", "staff_remuneration", "cpf_contributions", "association_sub"),
"Religious Practitioner" to listOf("public_transport"),
"Social Media Influencer" to listOf("utility_charges"),
"Sportsperson" to listOf("public_transport")
)

fun loadDefaults() {
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/exp_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
android:src="@drawable/baseline_delete_24"
android:layout_marginTop="4dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="16dp"
app:layout_constraintEnd_toEndOf="@id/expVal"
app:layout_constraintTop_toTopOf="parent" />

Expand All @@ -35,7 +36,8 @@
android:textSize="20sp"
android:layout_marginHorizontal="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/deleteIcon" />

<TextView
android:id="@+id/expType"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/job_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
android:textSize="20sp"
android:layout_marginHorizontal="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/deleteIcon"/>

<TextView
android:id="@+id/jobType"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/rev_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
android:textSize="20sp"
android:layout_marginHorizontal="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/deleteIcon"/>

<TextView
android:id="@+id/revType"
Expand Down
12 changes: 11 additions & 1 deletion app/src/main/res/values/JobTypeArray.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
<resources>
<string-array
name="JobTypeArray">
<item>Beauty and Wellness Operator</item>
<item>Commission Agent</item>
<item>Delivery</item>
<item>Entertainer/ Entertainment Organiser</item>
<item>Hawker</item>
<item>Lawyer</item>
<item>Maid Agency Operator</item>
<item>Medical Practitioner</item>
<item>Private Hire Transport</item>
<item>Food Delivery</item>
<item>Religious Practitioner</item>
<item>Social Media Influencer</item>
<item>Sportsperson</item>
<item>Tuition</item>
<item>Other</item>
</string-array>
Expand Down

0 comments on commit c9714ea

Please sign in to comment.