-
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.
Added sorting to EMI and refactoring
- Loading branch information
Showing
36 changed files
with
361 additions
and
229 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
27 changes: 0 additions & 27 deletions
27
app/src/main/java/com/suyash/creditmanager/domain/util/CreditCardOrder.kt
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
app/src/main/java/com/suyash/creditmanager/domain/util/EMIOrder.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
app/src/main/java/com/suyash/creditmanager/domain/util/OrderType.kt
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/suyash/creditmanager/domain/util/order/CreditCardOrder.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,27 @@ | ||
package com.suyash.creditmanager.domain.util.order | ||
|
||
sealed class CreditCardOrder( | ||
override val orderType: OrderType, | ||
override val label: String | ||
) : Order { | ||
class Name(orderType: OrderType, label: String = "Name") : CreditCardOrder(orderType, label) | ||
class Expiry(orderType: OrderType, label: String = "Expiry") : CreditCardOrder(orderType, label) | ||
class Limit(orderType: OrderType, label: String = "Limit") : CreditCardOrder(orderType, label) | ||
class DueDate(orderType: OrderType, label: String = "Due Date") : | ||
CreditCardOrder(orderType, label) | ||
|
||
class BillDate(orderType: OrderType, label: String = "Bill Date") : | ||
CreditCardOrder(orderType, label) | ||
|
||
companion object { | ||
fun getOrderList(): List<CreditCardOrder> { | ||
return listOf( | ||
Name(OrderType.Ascending), | ||
Expiry(OrderType.Ascending), | ||
Limit(OrderType.Ascending), | ||
DueDate(OrderType.Ascending), | ||
BillDate(OrderType.Ascending) | ||
) | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/suyash/creditmanager/domain/util/order/EMIOrder.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.suyash.creditmanager.domain.util.order | ||
|
||
sealed class EMIOrder(override val orderType: OrderType, override val label: String) : Order { | ||
class Name(orderType: OrderType, label: String = "Name") : EMIOrder(orderType, label) | ||
class Amount(orderType: OrderType, label: String = "Amount") : EMIOrder(orderType, label) | ||
class Rate(orderType: OrderType, label: String = "Rate") : EMIOrder(orderType, label) | ||
class Months(orderType: OrderType, label: String = "Months") : EMIOrder(orderType, label) | ||
class Date(orderType: OrderType, label: String = "Date") : EMIOrder(orderType, label) | ||
class EMIsPaid(orderType: OrderType, label: String = "EMIs Paid") : EMIOrder(orderType, label) | ||
class EMIsRemaining(orderType: OrderType, label: String = "EMIs Remaining") : EMIOrder(orderType, label) | ||
|
||
companion object { | ||
fun getOrderList(): List<EMIOrder> { | ||
return listOf( | ||
Name(OrderType.Ascending), | ||
Amount(OrderType.Ascending), | ||
Rate(OrderType.Ascending), | ||
Months(OrderType.Ascending), | ||
Date(OrderType.Descending), | ||
EMIsPaid(OrderType.Ascending), | ||
EMIsRemaining(OrderType.Descending) | ||
) | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/suyash/creditmanager/domain/util/order/Order.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,7 @@ | ||
package com.suyash.creditmanager.domain.util.order | ||
|
||
sealed interface Order { | ||
|
||
val orderType: OrderType | ||
val label: String | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/suyash/creditmanager/domain/util/order/OrderType.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,13 @@ | ||
package com.suyash.creditmanager.domain.util.order | ||
|
||
sealed class OrderType { | ||
data object Ascending: OrderType() | ||
data object Descending: OrderType() | ||
|
||
fun getReverse(): OrderType { | ||
return when (this) { | ||
is Ascending -> Descending | ||
is Descending -> Ascending | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...itmanager/domain/util/TransactionOrder.kt → ...ger/domain/util/order/TransactionOrder.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
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
50 changes: 50 additions & 0 deletions
50
.../java/com/suyash/creditmanager/presentation/commons/components/CustomActionBottomSheet.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,50 @@ | ||
package com.suyash.creditmanager.presentation.commons.components | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.ModalBottomSheet | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.suyash.creditmanager.presentation.commons.model.ItemAction | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun CustomActionBottomSheet( | ||
modifier: Modifier = Modifier, | ||
onDismissRequest: () -> Unit, | ||
actions: List<ItemAction> | ||
) { | ||
val bottomSheetState = rememberModalBottomSheetState() | ||
|
||
ModalBottomSheet( | ||
sheetState = bottomSheetState, | ||
onDismissRequest = onDismissRequest | ||
) { | ||
Column( | ||
modifier = modifier.padding(bottom = 16.dp) | ||
) { | ||
actions.forEach { | ||
Row( | ||
modifier = Modifier | ||
.clickable { | ||
onDismissRequest() | ||
it.onClick() | ||
} | ||
.fillMaxWidth() | ||
.padding(16.dp) | ||
) { | ||
Icon(it.icon, it.iconName) | ||
Text(text = it.title, modifier = Modifier.padding(start = 16.dp)) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.