Skip to content

Commit

Permalink
Added UI elements
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-ruster committed May 17, 2023
1 parent 9ff73e9 commit b57c056
Show file tree
Hide file tree
Showing 23 changed files with 436 additions and 13 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.github.lisawray.groupie:groupie:2.10.1'
implementation "com.github.lisawray.groupie:groupie-viewbinding:2.10.1"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
17 changes: 16 additions & 1 deletion app/src/main/java/com/example/myapplication/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@ package com.example.myapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.RecyclerView
import com.example.myapplication.databinding.ActivityMainBinding
import com.xwray.groupie.GroupieAdapter

class MainActivity : AppCompatActivity() {
lateinit var binding: ActivityMainBinding
var profileArray: Array<TaxProfile> = emptyArray()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)

val yaAdapter: GroupieAdapter = GroupieAdapter()
val recyclerView: RecyclerView = binding.listProfiles
recyclerView.adapter = yaAdapter

for(profile in profileArray){
yaAdapter.add(ProfileItem(profile))
}

setContentView(binding.root)
}
}
10 changes: 10 additions & 0 deletions app/src/main/java/com/example/myapplication/TaxProfile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ class TaxProfile(
fun totalMatCost(): Float = exps.sumOf { it.amt.toDouble() * (1 - it.expType) }.toFloat()
fun totalAllowableExp(): Float = exps.sumOf { it.amt.toDouble() * it.expType }.toFloat()
fun totalGrossProfit() = totalRev() - totalMatCost()

fun jobString(): String{
var temp = jobs[0].jobName

if(jobs.lastIndex >= 1){
temp = temp + ", " + jobs[1].jobName
}

return temp
}
fun totalAdjProfit() = totalGrossProfit() - totalAllowableExp()
fun isEmpty(): Boolean {return jobs.isEmpty()}
}
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_edit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:alpha="0.85" android:height="24dp"
android:tint="#474747" 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="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_exp_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:alpha="0.85" android:height="24dp"
android:tint="#2D7BB9" 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="M21.41,11.41l-8.83,-8.83C12.21,2.21 11.7,2 11.17,2H4C2.9,2 2,2.9 2,4v7.17c0,0.53 0.21,1.04 0.59,1.41l8.83,8.83c0.78,0.78 2.05,0.78 2.83,0l7.17,-7.17C22.2,13.46 22.2,12.2 21.41,11.41zM6.5,8C5.67,8 5,7.33 5,6.5S5.67,5 6.5,5S8,5.67 8,6.5S7.33,8 6.5,8z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_jobs_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:alpha="0.85" android:height="24dp"
android:tint="#2D7BB9" 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,16v-1L3.01,15L3,19c0,1.11 0.89,2 2,2h14c1.11,0 2,-0.89 2,-2v-4h-7v1h-4zM20,7h-4.01L15.99,5l-2,-2h-4l-2,2v2L4,7c-1.1,0 -2,0.9 -2,2v3c0,1.11 0.89,2 2,2h6v-2h4v2h6c1.1,0 2,-0.9 2,-2L22,9c0,-1.1 -0.9,-2 -2,-2zM14,7h-4L10,5h4v2z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_menu_preferences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="28dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="28dp" 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>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_rev_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:alpha="0.85" android:height="24dp"
android:tint="#2D7BB9" 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,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13.41,18.09L13.41,20h-2.67v-1.93c-1.71,-0.36 -3.16,-1.46 -3.27,-3.4h1.96c0.1,1.05 0.82,1.87 2.65,1.87 1.96,0 2.4,-0.98 2.4,-1.59 0,-0.83 -0.44,-1.61 -2.67,-2.14 -2.48,-0.6 -4.18,-1.62 -4.18,-3.67 0,-1.72 1.39,-2.84 3.11,-3.21L10.74,4h2.67v1.95c1.86,0.45 2.79,1.86 2.85,3.39L14.3,9.34c-0.05,-1.11 -0.64,-1.87 -2.22,-1.87 -1.5,0 -2.4,0.68 -2.4,1.64 0,0.84 0.65,1.39 2.67,1.91s4.18,1.39 4.18,3.91c-0.01,1.83 -1.38,2.83 -3.12,3.16z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="28dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="28dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>
43 changes: 40 additions & 3 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.motion.widget.MotionLayout 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=".MainActivity">
tools:context=".MainActivity"
app:layoutDescription="@xml/activity_main_scene">

</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/statement_header"
android:paddingTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/profiles"
android:textAlignment="center"
android:textSize="32sp"
android:fontFamily="sans-serif-black"
android:textColor="@color/irasBlue"
android:paddingBottom="32dp"
app:layout_constraintTop_toTopOf="parent" />

<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="20dp"
android:id="@+id/list_profiles"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/appBarWrapper"
app:layout_constraintTop_toBottomOf="@id/statement_header"
android:scrollbars="vertical"/>

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/appBarWrapper">
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/appBarBottom"
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/bottom_app_bar_menu"
android:backgroundTint="@color/irasBlue" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>>
</androidx.constraintlayout.motion.widget.MotionLayout>
58 changes: 58 additions & 0 deletions app/src/main/res/layout/profile_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_bg"
android:padding="4dp"
xmlns:app="http://schemas.android.com/apk/res-auto">

<TextView
android:id="@+id/headerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/ya"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="4dp"
android:layout_marginStart="8dp"
android:fontFamily="sans-serif-black"
android:textSize="24sp"/>
<Button
android:id="@+id/generateButton"
android:layout_height="36dp"
android:layout_width="100dp"
android:text="Generate"
android:padding="0dp"
android:layout_marginEnd="12dp"
android:backgroundTint="@color/irasBlue"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<include
layout="@layout/profile_row_job"
android:id="@+id/profileRow"
android:layout_width="match_parent"
android:layout_height="52dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/headerView" />

<include
layout="@layout/profile_row_rev"
android:id="@+id/profileRowRev"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_marginBottom="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profileRow" />

<include
layout="@layout/profile_row_exp"
android:id="@+id/profileRowExp"
android:layout_width="match_parent"
android:layout_height="52dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profileRowRev"
app:layout_constraintBottom_toBottomOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>
52 changes: 52 additions & 0 deletions app/src/main/res/layout/profile_row_exp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_gravity="center_vertical"
android:paddingBottom="4dp"
xmlns:app="http://schemas.android.com/apk/res-auto">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/jobIcon"
android:src="@drawable/ic_exp_icon"
android:layout_margin="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="@+id/editExpIcon"
android:src="@drawable/ic_edit"
android:layout_marginTop="4dp"
app:layout_constraintEnd_toEndOf="@id/expAmt"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/expView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/expenditure"
android:fontFamily="sans-serif-medium"
android:textSize="20sp"
android:layout_marginHorizontal="8dp"
app:layout_constraintStart_toEndOf="@id/jobIcon"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/expAmt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/white"
android:text="$0"
android:textSize="16sp"
android:textColor="@color/darkBlueFont"
android:textAlignment="viewStart"
android:layout_marginStart="12dp"
android:layout_marginEnd="20dp"
app:layout_constraintStart_toEndOf="@id/jobIcon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
53 changes: 53 additions & 0 deletions app/src/main/res/layout/profile_row_job.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:paddingBottom="4dp"
xmlns:app="http://schemas.android.com/apk/res-auto">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/jobIcon"
android:src="@drawable/ic_jobs_icon"
android:layout_margin="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="@+id/editJobIcon"
android:src="@drawable/ic_edit"
android:layout_marginTop="4dp"
app:layout_constraintEnd_toEndOf="@id/jobsList"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/jobsView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/jobs"
android:fontFamily="sans-serif-medium"
android:textSize="20sp"
android:layout_marginHorizontal="8dp"
app:layout_constraintStart_toEndOf="@id/jobIcon"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/jobsList"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/white"
android:text="Grab, Gojek"
android:textSize="16sp"
android:textColor="@color/darkBlueFont"
android:textAlignment="viewStart"
android:layout_marginStart="12dp"
android:layout_marginEnd="20dp"
app:layout_constraintStart_toEndOf="@id/jobIcon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit b57c056

Please sign in to comment.