Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Features #25

Merged
merged 201 commits into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
3bebcb7
feature_coin_list module initial commit
RyanKoech Jan 6, 2023
eeee2c0
set up dependencies
RyanKoech Jan 7, 2023
eec0f85
implement api service
RyanKoech Jan 7, 2023
a273b81
implement api service di module
RyanKoech Jan 7, 2023
9b755a7
implement repository
RyanKoech Jan 7, 2023
9f43c42
defined entity
RyanKoech Jan 7, 2023
6d58a8b
implement getCoins usecase
RyanKoech Jan 7, 2023
cddfe49
fix data types
RyanKoech Jan 7, 2023
fbec7c8
implement repository fake
RyanKoech Jan 7, 2023
609dfc5
add test dependencies
RyanKoech Jan 7, 2023
fd2bcd1
implement tests
RyanKoech Jan 7, 2023
bc38735
correct build import
RyanKoech Jan 7, 2023
5ab3af1
fix circular dependency
RyanKoech Jan 7, 2023
de9e207
implement searchbar component
RyanKoech Jan 7, 2023
d51a901
add basic screens
RyanKoech Jan 7, 2023
7112927
remove unused imports
RyanKoech Jan 7, 2023
7900ef3
update coin entity structure
RyanKoech Jan 8, 2023
86bac40
implemented market cap string util
RyanKoech Jan 8, 2023
3585370
update string format
RyanKoech Jan 8, 2023
98b2093
implement search tag
RyanKoech Jan 8, 2023
dcd8afd
add enum class
RyanKoech Jan 8, 2023
0c80779
add color resources
RyanKoech Jan 8, 2023
baa93fb
add arrow icon resource
RyanKoech Jan 8, 2023
73205cc
implement coin item component
RyanKoech Jan 8, 2023
a70c3b4
implement repo di module
RyanKoech Jan 8, 2023
bd4dddc
implement sorting logic
RyanKoech Jan 8, 2023
f527c94
implement viewmodel
RyanKoech Jan 8, 2023
b304bd3
add screen state logic
RyanKoech Jan 8, 2023
e6269c3
change function visibility and val name
RyanKoech Jan 8, 2023
8e94aba
update logic to use state and state callback
RyanKoech Jan 8, 2023
b6d83be
implement search tag display and parameters
RyanKoech Jan 8, 2023
a6f99e9
implement sorting info state management
RyanKoech Jan 8, 2023
6e8ad78
implement coin list logic
RyanKoech Jan 8, 2023
e73faff
fix sorting logic
RyanKoech Jan 8, 2023
fa4869c
implement basic cache
RyanKoech Jan 8, 2023
d5b003f
refactor total volume data type
RyanKoech Jan 8, 2023
2bdbaf6
implemented coin search logic in vm and usecase
RyanKoech Jan 8, 2023
6adb189
updated search bar logic to seach coins
RyanKoech Jan 8, 2023
2068d3f
implement loading component
RyanKoech Jan 10, 2023
36ce8ec
fix not caching bug
RyanKoech Jan 10, 2023
7524dca
update work flow of screenstate
RyanKoech Jan 10, 2023
ef445f8
fix component bug and update
RyanKoech Jan 10, 2023
52661c8
add gif resources
RyanKoech Jan 10, 2023
c78b2a7
implement no coin found screen
RyanKoech Jan 10, 2023
c9a1eb2
update to make more flexible
RyanKoech Jan 10, 2023
558a7c8
refactored to utli error component
RyanKoech Jan 10, 2023
77f7247
implement error screen
RyanKoech Jan 10, 2023
4cd82bc
add logic to display fallback error screens
RyanKoech Jan 10, 2023
2a73500
add room dependencies
RyanKoech Jan 12, 2023
72b3235
add local coin dto
RyanKoech Jan 12, 2023
d02ed0e
implement database and dao
RyanKoech Jan 12, 2023
d7f4d74
implement local coin databse di mobule
RyanKoech Jan 12, 2023
f7a625a
implement type converter
RyanKoech Jan 12, 2023
cc6c0d4
implement repositories to interact with dao
RyanKoech Jan 12, 2023
56db3ef
implement usecase to fetch local coins
RyanKoech Jan 12, 2023
edb8783
implement logic to save remote coins to db
RyanKoech Jan 12, 2023
b6696b4
implement local fallback when remote coin fetching fails
RyanKoech Jan 12, 2023
c1e2d32
clear cache after period
RyanKoech Jan 12, 2023
1df655d
implement pull to refresh
RyanKoech Jan 12, 2023
eab0fc2
fix indentation
RyanKoech Jan 12, 2023
46a8d5e
add coinItemCallbackOnClick callback
RyanKoech Jan 12, 2023
80afdf3
add logic to get coin from db
RyanKoech Jan 12, 2023
18975d8
update name to use real repository
RyanKoech Jan 12, 2023
c0f7945
update theme font size
RyanKoech Jan 12, 2023
16eeae6
refactor varaible into companion object
RyanKoech Jan 12, 2023
687889f
cleaned up code
RyanKoech Jan 12, 2023
ab0dd8f
moved logic to handle remote failure to usecase
RyanKoech Jan 12, 2023
5eebb74
implement tests
RyanKoech Jan 12, 2023
25eea34
refactored usecase deletion
RyanKoech Jan 12, 2023
33c8d50
android test truth dependency
RyanKoech Jan 12, 2023
1ab04e4
implement dao tests
RyanKoech Jan 12, 2023
d9e86d4
add test tags
RyanKoech Jan 13, 2023
f050161
update dependencies
RyanKoech Jan 13, 2023
1ae3b45
implement tests
RyanKoech Jan 13, 2023
057eb14
add test tags
RyanKoech Jan 13, 2023
f40cc06
implement tests
RyanKoech Jan 13, 2023
efe413b
implement sorting tests
RyanKoech Jan 13, 2023
108e8a8
added internet permission
RyanKoech Jan 13, 2023
caaef2d
add transaction feature module
RyanKoech Jan 16, 2023
8014dd6
setup basic dependencies
RyanKoech Jan 16, 2023
51f4233
improved resusability of component
RyanKoech Jan 17, 2023
8af6ae7
added compose and retrofit dependencies
RyanKoech Jan 17, 2023
4d1c446
implement usecase with entity data class
RyanKoech Jan 17, 2023
462af77
implement extension function
RyanKoech Jan 17, 2023
1580ef6
added icon resource
RyanKoech Jan 17, 2023
190b819
implement viewmodel
RyanKoech Jan 17, 2023
83d617e
defined viewstate
RyanKoech Jan 17, 2023
955c673
implement item
RyanKoech Jan 17, 2023
8841d4c
implement chooseasset screen
RyanKoech Jan 17, 2023
8d76d5b
add search functionality
RyanKoech Jan 17, 2023
94ae047
update data structure
RyanKoech Jan 17, 2023
9e729d6
added onclick
RyanKoech Jan 17, 2023
7a69a05
implement success screen
RyanKoech Jan 17, 2023
a6627d7
implement state with success screen
RyanKoech Jan 17, 2023
63bd102
refactored file location
RyanKoech Jan 17, 2023
d746fd9
implement component
RyanKoech Jan 17, 2023
2d385f4
implement error screen
RyanKoech Jan 17, 2023
53fd479
implement loading screen
RyanKoech Jan 17, 2023
7a63ab2
add retry callback
RyanKoech Jan 17, 2023
1983e56
add fallback screens
RyanKoech Jan 17, 2023
f373c24
update hilt named string
RyanKoech Jan 17, 2023
cb8bb1a
add pager accompanist dependencies
RyanKoech Jan 20, 2023
2414270
update body1 font size
RyanKoech Feb 12, 2023
cc5d3f0
refactor entity structure
RyanKoech Feb 12, 2023
8e71c64
add room dependencies
RyanKoech Feb 12, 2023
0229b63
implement transaction db
RyanKoech Feb 12, 2023
6f016a6
implement repository
RyanKoech Feb 12, 2023
2490cf6
implement usecases
RyanKoech Feb 12, 2023
4128c86
fix wrong entity class
RyanKoech Feb 12, 2023
0f7aeb5
utilize modifier parameter
RyanKoech Feb 12, 2023
b1b8c09
add color flexibility
RyanKoech Feb 12, 2023
6bddd4b
implement transaction screen UI
RyanKoech Feb 12, 2023
e449941
implement dao repo usecase to get single owned coin
RyanKoech Feb 13, 2023
f6e61bb
fix usecase to return flow
RyanKoech Feb 13, 2023
242358a
add enable parameter and preview
RyanKoech Feb 13, 2023
542bbe1
update type to double
RyanKoech Feb 13, 2023
b40eca8
add home module dependency
RyanKoech Feb 13, 2023
95ff2da
update to match new double type
RyanKoech Feb 13, 2023
aca9a48
implement viewmodel
RyanKoech Feb 13, 2023
a476a3e
implement ui logic
RyanKoech Feb 13, 2023
a26ecbb
implement null check extension functions
RyanKoech Feb 13, 2023
7685e78
add nullable return type
RyanKoech Feb 13, 2023
49a8a80
implement to account for nullable types from db
RyanKoech Feb 13, 2023
a1d0576
fix functions to suspend functions
RyanKoech Feb 14, 2023
b495a74
add coroutine scope, remove loggers, update ownedcoin update logic
RyanKoech Feb 14, 2023
ba8b74e
minor improvment
RyanKoech Feb 14, 2023
3d15419
update balance formatting logic, extract string resources
RyanKoech Feb 14, 2023
c68dbf4
update owned coin update logic
RyanKoech Feb 14, 2023
c4f657b
add amount tag
RyanKoech Feb 14, 2023
1cb73ee
extract string resources
RyanKoech Feb 14, 2023
d66e172
minor fix
RyanKoech Feb 14, 2023
210e179
set singleline
RyanKoech Feb 14, 2023
06c37f3
update name variable
RyanKoech Feb 14, 2023
2f61092
implement navigation condition and logic
RyanKoech Feb 14, 2023
25f15be
amount check
RyanKoech Feb 14, 2023
ea580d7
add feature module
RyanKoech Feb 15, 2023
649e1d3
add missing color
RyanKoech Feb 15, 2023
770a2eb
fix wrong package name
RyanKoech Feb 15, 2023
d769f46
use gradle variables
RyanKoech Feb 15, 2023
f7c96cc
add retrofit2, okhttp dependencies
RyanKoech Feb 15, 2023
f7d8cb8
implement api serivce with dto
RyanKoech Feb 15, 2023
ea2ace1
add hilt dependencies
RyanKoech Feb 15, 2023
6e8fcf1
implement api service provider module
RyanKoech Feb 15, 2023
258f303
implement repository
RyanKoech Feb 18, 2023
c02ee56
add timber dependency
RyanKoech Feb 18, 2023
406a17f
implement usecase, list type convertor
RyanKoech Feb 18, 2023
c332598
rename file
RyanKoech Feb 19, 2023
9230ba2
implement header info ui
RyanKoech Feb 19, 2023
014a06e
implement viewmodel
RyanKoech Feb 19, 2023
3d4c0b7
implement line chart component
RyanKoech Feb 19, 2023
24eb55d
add compose dependencies
RyanKoech Feb 19, 2023
1a7e2c8
add module dependency
RyanKoech Feb 20, 2023
8d633e0
refactored api service class name
RyanKoech Feb 20, 2023
28fe66d
add hilt retrofit okhttp dependencies
RyanKoech Feb 20, 2023
686cc0d
refactor providers to common
RyanKoech Feb 20, 2023
36ca8a3
add hilt annotation
RyanKoech Feb 20, 2023
0035d65
add coin object
RyanKoech Feb 23, 2023
da1874a
update graph color
RyanKoech Feb 23, 2023
3dde62f
implement component
RyanKoech Feb 23, 2023
3aeec14
implement component
RyanKoech Feb 23, 2023
667a7ce
implement coin detail screen to coin statistics
RyanKoech Feb 23, 2023
aa71552
fix coin statistics body
RyanKoech Feb 23, 2023
597999d
add module dependency
RyanKoech Feb 23, 2023
6cb418d
implement composable
RyanKoech Feb 23, 2023
3b9eba4
implement logic to get transactions
RyanKoech Feb 28, 2023
00e5106
implement transactions section
RyanKoech Feb 28, 2023
6928f1d
fix structure
RyanKoech Feb 28, 2023
d7d1378
fix endpoint
RyanKoech Mar 1, 2023
c7e110a
implement type convertor
RyanKoech Mar 1, 2023
63489dd
polish component
RyanKoech Mar 1, 2023
952557c
implement logic to toggle market chart graph data
RyanKoech Mar 1, 2023
09cf5a0
fix incorrect icons
RyanKoech Mar 1, 2023
db12e79
implement no transactions fallback
RyanKoech Mar 1, 2023
051b637
implement transfer ctas
RyanKoech Mar 2, 2023
2b73cee
add color resource
RyanKoech Mar 2, 2023
66e4ffc
make test data public
RyanKoech Mar 2, 2023
1d785ee
refactor out success screen and add conditional loading screens logic
RyanKoech Mar 2, 2023
ed9a85b
refactor file location
RyanKoech Mar 2, 2023
c9a9e70
refactor out component
RyanKoech Mar 2, 2023
3664fed
refactor component name
RyanKoech Mar 2, 2023
1ca2c9a
pass modifier parameter
RyanKoech Mar 2, 2023
3fa3093
implement loading screen
RyanKoech Mar 2, 2023
bc80e6e
implement fallback error screen
RyanKoech Mar 2, 2023
69ed8bd
extract string resources
RyanKoech Mar 3, 2023
4b8f53c
implement delete transaction
RyanKoech Mar 3, 2023
b97f585
fix format warnings
RyanKoech Mar 3, 2023
832be7c
minor fixes
RyanKoech Mar 3, 2023
e9ae4bd
implement navigation flow along with bottom navigation
RyanKoech Mar 6, 2023
aa21172
implement top app bar
RyanKoech Mar 8, 2023
26a1abe
fix navigation bug
RyanKoech Mar 8, 2023
5608649
remove redundant clickable
RyanKoech Mar 8, 2023
3c21793
add check for zero amount
RyanKoech Mar 9, 2023
3c6129a
fix zero amount owned coins bug
RyanKoech Mar 9, 2023
1344e06
fix coin change calculation
RyanKoech Mar 9, 2023
2a77a73
implement cache in use case
RyanKoech Mar 9, 2023
39cb9cc
refactored passing coin to passing coinId coin details screen
RyanKoech Mar 9, 2023
07c7a9f
add navigate to home screen callback
RyanKoech Mar 9, 2023
7dca756
change status bar color
RyanKoech Mar 9, 2023
2fa71e9
run function in coroutine scope
RyanKoech Mar 9, 2023
f1f55d3
fix bar stylings
RyanKoech Mar 9, 2023
73054b7
passed callback
RyanKoech Mar 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,20 @@ dependencies {
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.activity:activity-compose:$compose_activity_version"
implementation "androidx.navigation:navigation-compose:$navigation_compose_version"

// local modules
implementation project(":common")
implementation project(":feature_transaction")
implementation project(":feature_coin_list")
implementation project(":feature_coin_details")
implementation project(":feature_home")

// dagger-hilt - for dependency injection
implementation "com.google.dagger:hilt-android:$hilt_android_version"
implementation "androidx.hilt:hilt-navigation-compose:$hilt_navigation_compose_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_android_compile_version"
kapt "androidx.hilt:hilt-compiler:$hilt_compile_version"

// dagger-hilt - for dependency injection
implementation "com.google.dagger:hilt-android:$hilt_android_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object CrashAndLog {
if (BuildConfig.DEBUG) {
Timber.plant(object : Timber.DebugTree() {
override fun createStackElementTag(element: StackTraceElement): String? {
return "(${element.fileName}:${element.lineNumber})#${element.methodName}"
return "Timber: (${element.fileName}:${element.lineNumber})#${element.methodName}"
}
})
} else {
Expand Down
256 changes: 248 additions & 8 deletions app/src/main/java/com/ryankoech/krypto/presentation/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,267 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavDestination.Companion.hierarchy
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import com.ryankoech.krypto.R
import com.ryankoech.krypto.common.presentation.theme.KryptoTheme
import com.ryankoech.krypto.feature_coin_details.presentation.CoinDetailsScreen
import com.ryankoech.krypto.feature_coin_list.presentation.CoinListScreen
import com.ryankoech.krypto.feature_home.presentation.HomeScreen
import com.ryankoech.krypto.feature_transaction.data.dto.transaction_dto.TransactionType
import com.ryankoech.krypto.feature_transaction.domain.entity.Coin as TransactionCoin
import com.ryankoech.krypto.feature_transaction.presentation.choose_asset.ChooseAssetScreen
import com.ryankoech.krypto.feature_transaction.presentation.transaction.TransactionScreen
import com.ryankoech.krypto.presentation.utils.Screens
import com.ryankoech.krypto.presentation.viewmodel.MainViewModel
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
val viewModel = hiltViewModel<MainViewModel>()
val navController = rememberNavController()

val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination

var topBarTitle by remember {
mutableStateOf("")
}

val bottomNavigationItems = listOf(
Screens.Home,
Screens.CoinList,
Screens.Settings
)

fun navigateToTransactionScreen(coin : TransactionCoin, transactionType: String) {
viewModel.addTransactionCoin(coin)
navController.navigate(Screens.Transaction.route + "/$transactionType"){
launchSingleTop = true
}
}

fun navigateToChooseAssetScreen(transactionType: String) {
navController.navigate(Screens.ChooseAsset.route + "/$transactionType"){
launchSingleTop = true
}
}

fun navigateToHomeScreen() {
navController.navigate(Screens.Home.route) {
popUpTo(navController.graph.findStartDestination().id) {
inclusive = true
}
launchSingleTop = true
}
}

fun navigateToCoinDetails(coinId : String) {
navController.navigate(Screens.CoinDetails.route + "/$coinId"){
launchSingleTop = true
}
}


KryptoTheme {
// A surface container using the 'background' color from the theme
Surface(
Scaffold(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
Greeting("Android")
topBar = {
TopAppBar(
backgroundColor = MaterialTheme.colors.surface,
contentColor = MaterialTheme.colors.onSurface,
elevation = 0.dp,
title = {
Text(
text = topBarTitle,
style = MaterialTheme.typography.h1
)
},
navigationIcon =
if (bottomNavigationItems.none { it.route == currentDestination?.route }) {
{
IconButton(onClick = {
navController.popBackStack()
}) {
Icon(
painter = painterResource(R.drawable.icon_arrow_left),
contentDescription = "Go back"
)
}
}
} else null,
)
},
bottomBar = {
BottomNavigation(
modifier = Modifier
.padding(bottom = 12.dp)
.height(64.dp),
backgroundColor = Color(0xfff2f2f2),
contentColor = MaterialTheme.colors.onSurface,
) {
bottomNavigationItems.forEach { screen ->
BottomNavigationItem(
icon = {
Icon(
modifier = Modifier
.padding(bottom = 4.dp),
painter = painterResource(screen.iconResId),
contentDescription = null
)
},
label = {
Text(
text = stringResource(screen.labelResId)
)
},
selected = currentDestination?.hierarchy?.any { it.route == screen.route } == true,
onClick = {
navController.navigate(screen.route) {
// Pop up to the start destination of the graph to
// avoid building up a large stack of destinations
// on the back stack as users select items
popUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
// Avoid multiple copies of the same destination when
// reselecting the same item
launchSingleTop = true
// Restore state when reselecting a previously selected item
restoreState = true
}
}
)
}
}
}

) { innerPadding ->
Surface(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding),
color = MaterialTheme.colors.background
) {

NavHost(navController = navController, startDestination = "home") {

composable(Screens.Home.route) {
topBarTitle = stringResource(Screens.Home.titleResId)
HomeScreen(
onTransferInClick = {
navigateToChooseAssetScreen(TransactionType.BUY.toString())
},
onTransferOutClick = {
navigateToChooseAssetScreen(TransactionType.SELL.toString())
},
navigateToCoinDetails = ::navigateToCoinDetails
)
}

composable(
Screens.ChooseAsset.route + "/{transactionType}",
arguments = listOf(
navArgument("transactionType") {
type = NavType.StringType
defaultValue = TransactionType.BUY.toString()
}
)
) { backStackEntry ->
topBarTitle = stringResource(Screens.ChooseAsset.titleResId)
ChooseAssetScreen(
toTransactionScreen = ::navigateToTransactionScreen,
toTransactionType = backStackEntry.arguments?.getString("transactionType")!!
)
}

composable(
Screens.Transaction.route + "/{transactionType}",
arguments = listOf(
navArgument("transactionType") {
type = NavType.StringType
defaultValue = TransactionType.BUY.toString()
}
)
) { backStackEntry ->
topBarTitle = stringResource(Screens.Transaction.titleResId)

val coin = viewModel.transactionCoin

coin?.apply {
TransactionScreen(
coin = coin,
navigateBackToHomeScreen = ::navigateToHomeScreen,
transactionType = backStackEntry.arguments?.getString("transactionType")!!
)
return@composable
}

// Fall back error screen
}

composable(Screens.CoinList.route){
topBarTitle = stringResource(Screens.CoinList.titleResId)
CoinListScreen(
coinItemOnClick = ::navigateToCoinDetails
)
}

composable(
Screens.CoinDetails.route + "/{coinId}",
arguments = listOf(
navArgument("coinId") {
type = NavType.StringType
defaultValue = "bitcoin"
}
)
){ backStackEntry ->
topBarTitle = stringResource(Screens.CoinDetails.titleResId)

CoinDetailsScreen(
coinId = backStackEntry.arguments?.getString("coinId")!!,
navigateToBuyTransactionScreen = { transactionCoin ->
navigateToTransactionScreen(transactionCoin, TransactionType.BUY.toString())
},
navigateToSellTransactionScreen = { transactionCoin ->
navigateToTransactionScreen(transactionCoin, TransactionType.SELL.toString())
}
)

}


composable(Screens.Settings.route){
topBarTitle = stringResource(Screens.Settings.titleResId)
Text(
text = "Settings"
)
}


}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.ryankoech.krypto.presentation.utils

import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import com.ryankoech.krypto.R

sealed class Screens(
val route : String,
@StringRes val labelResId : Int,
@DrawableRes val iconResId : Int = R.drawable.icon_home,
@StringRes val titleResId : Int = R.string.app_name,
) {
object Home : Screens(
route = "home",
labelResId = R.string.screen_label_home,
iconResId = R.drawable.icon_home,
titleResId = R.string.screen_title_home
)
object ChooseAsset : Screens(
route = "choose-asset",
labelResId = R.string.screen_label_choose_asset,
titleResId = R.string.screen_title_choose_asset
)
object Transaction : Screens(
route = "transaction",
labelResId = R.string.screen_label_transaction,
titleResId = R.string.screen_title_transaction
)
object CoinList : Screens(
route = "coin-list",
labelResId = R.string.screen_label_coin_list,
iconResId = R.drawable.icon_bar_graph,
titleResId = R.string.screen_title_coin_list
)
object CoinDetails : Screens(
route = "coin-details",
labelResId = R.string.screen_label_coin_details,
titleResId = R.string.screen_title_coin_details
)
object Settings : Screens(
route = "settings",
labelResId = R.string.screen_label_settings,
iconResId = R.drawable.icon_settings,
titleResId = R.string.screen_title_settings
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.ryankoech.krypto.presentation.viewmodel

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import com.ryankoech.krypto.feature_transaction.domain.entity.Coin as TransactionCoin
import com.ryankoech.krypto.feature_coin_list.domain.entity.Coin as CoinListCoin
import javax.inject.Inject

class MainViewModel @Inject constructor() : ViewModel(){

var transactionCoin by mutableStateOf<TransactionCoin?>(null)
private set

fun addTransactionCoin(coin: TransactionCoin){
transactionCoin = coin
}
}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/icon_arrow_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#00000000" android:pathData="M4,12L20,12"
android:strokeColor="#323232" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="2"/>
<path android:fillColor="#00000000"
android:pathData="M10,6L4.063,11.938V11.938C4.028,11.972 4.028,12.028 4.063,12.063V12.063L10,18"
android:strokeColor="#323232" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="2"/>
</vector>
Loading