-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
40 changed files
with
1,456 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/com/example/myapplication/ExpListItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.myapplication | ||
|
||
import android.view.View | ||
import android.view.View.OnClickListener | ||
import com.example.myapplication.data.TaxProfile | ||
import com.example.myapplication.databinding.ExpRowBinding | ||
import com.xwray.groupie.viewbinding.BindableItem | ||
|
||
|
||
open class ExpListItem(private val profile: TaxProfile, private val listener: OnClickListener): BindableItem<ExpRowBinding>(profile.fy.toLong()) { | ||
|
||
override fun bind(viewBinding: ExpRowBinding, position: Int) { | ||
with(viewBinding) { | ||
expName.text = profile.exps[position].expName | ||
expType.text = if (profile.exps[position].expType == 0) "Type: Material Cost" | ||
else "Type: Allowable Business Expense" | ||
expVal.text = "Amount: $${profile.exps[position].amt}" | ||
proportions.text = "Proportions: ${profile.exps[position].portion}" | ||
editIcon.setOnClickListener(listener) | ||
} | ||
} | ||
|
||
override fun getLayout(): Int = R.layout.exp_row | ||
|
||
override fun initializeViewBinding(view: View): ExpRowBinding = ExpRowBinding.bind(view) | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/example/myapplication/JobListItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.example.myapplication | ||
|
||
import android.view.View | ||
import android.view.View.OnClickListener | ||
import com.example.myapplication.data.TaxProfile | ||
import com.example.myapplication.databinding.JobRowBinding | ||
import com.xwray.groupie.viewbinding.BindableItem | ||
|
||
|
||
open class JobListItem(private val profile: TaxProfile, private val listener: OnClickListener): BindableItem<JobRowBinding>(profile.fy.toLong()) { | ||
|
||
lateinit var binding: JobRowBinding | ||
|
||
override fun bind(viewBinding: JobRowBinding, position: Int) { | ||
with(viewBinding) { | ||
itemName.text = profile.jobs[position].jobName | ||
jobType.text = "Type: ${profile.jobs[position].jobType}" | ||
editIcon.setOnClickListener(listener) | ||
} | ||
} | ||
|
||
override fun getLayout(): Int = R.layout.job_row | ||
|
||
override fun initializeViewBinding(view: View): JobRowBinding = JobRowBinding.bind(view) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 23 additions & 18 deletions
41
app/src/main/java/com/example/myapplication/ProfileItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/com/example/myapplication/RevListItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.myapplication | ||
|
||
import android.view.View | ||
import android.view.View.OnClickListener | ||
import com.example.myapplication.data.TaxProfile | ||
import com.example.myapplication.databinding.RevRowBinding | ||
import com.xwray.groupie.viewbinding.BindableItem | ||
|
||
|
||
open class RevListItem(private val profile: TaxProfile, private val listener: OnClickListener): BindableItem<RevRowBinding>(profile.fy.toLong()) { | ||
|
||
override fun bind(viewBinding: RevRowBinding, position: Int) { | ||
with(viewBinding) { | ||
revName.text = profile.revs[position].revName | ||
revType.text = if (profile.revs[position].revType == 0) "Type: Salary/commission" | ||
else "Type: Grant/incentive" | ||
revVal.text = "Amount: $${profile.revs[position].amt}" | ||
|
||
editIcon.setOnClickListener(listener) | ||
} | ||
} | ||
|
||
override fun getLayout(): Int = R.layout.rev_row | ||
|
||
override fun initializeViewBinding(view: View): RevRowBinding = RevRowBinding.bind(view) | ||
} |
4 changes: 0 additions & 4 deletions
4
app/src/main/java/com/example/myapplication/StatementActivity.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package com.example.myapplication.data | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
data class Exp ( | ||
val expType: Int, // 0 is mat cost, 1 is allowable expense | ||
val expName: String, | ||
var amt: Float, | ||
val portion: Map<String, Float> // <jobID, portion in %> | ||
){} | ||
) : Parcelable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
package com.example.myapplication.data | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
data class Rev ( | ||
val revType: Int, // 0 is revenue, 1 is govt grant/incentive/etc | ||
val revName: String, | ||
var amt: Float | ||
){} | ||
) : Parcelable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/example/myapplication/fragments/ExpEditFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.example.myapplication.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.navigation.fragment.navArgs | ||
import com.example.myapplication.databinding.ExpEditBinding | ||
|
||
class ExpEditFragment:Fragment() { | ||
lateinit var binding: ExpEditBinding | ||
val args: ExpsOverviewFragmentArgs by navArgs() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
binding = ExpEditBinding.inflate(layoutInflater) | ||
|
||
with(binding){ | ||
|
||
} | ||
|
||
return binding.root | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/example/myapplication/fragments/ExpsOverviewFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.example.myapplication.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.navigation.fragment.findNavController | ||
import androidx.navigation.fragment.navArgs | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.example.myapplication.ExpListItem | ||
import com.example.myapplication.databinding.ExpsOverviewBinding | ||
import com.xwray.groupie.GroupieAdapter | ||
|
||
class ExpsOverviewFragment(): Fragment() { | ||
lateinit var binding: ExpsOverviewBinding | ||
val args: ExpsOverviewFragmentArgs by navArgs() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
super.onCreateView(inflater, container, savedInstanceState) | ||
binding = ExpsOverviewBinding.inflate(layoutInflater) | ||
val profile = args.profile | ||
|
||
val yaAdapter: GroupieAdapter = GroupieAdapter() | ||
val recyclerView: RecyclerView = binding.listExps | ||
recyclerView.adapter = yaAdapter | ||
|
||
for(exp in profile.exps){ | ||
val listener = View.OnClickListener { | ||
val action = ExpsOverviewFragmentDirections.openExpEdit(exp) | ||
findNavController().navigate(action) | ||
} | ||
|
||
yaAdapter.add(ExpListItem(profile, listener)) | ||
} | ||
|
||
return binding.root | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/example/myapplication/fragments/JobEditFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.example.myapplication.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.navigation.fragment.navArgs | ||
import com.example.myapplication.databinding.JobEditBinding | ||
|
||
class JobEditFragment:Fragment() { | ||
lateinit var binding: JobEditBinding | ||
val args: JobsOverviewFragmentArgs by navArgs() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
binding = JobEditBinding.inflate(layoutInflater) | ||
|
||
with(binding){ | ||
|
||
} | ||
|
||
return binding.root | ||
} | ||
} |
Oops, something went wrong.