-
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.
-2nd Screen Finished (i think, API acces died for today, gotta wait t…
…ill tomorrow) -a test is failing on purpose for checking out the Unit Testing CI
- Loading branch information
1 parent
094e75a
commit 0d797fc
Showing
24 changed files
with
559 additions
and
69 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
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
2 changes: 1 addition & 1 deletion
2
...mple/stockmarketcheck/StockApplication.kt → ...stockmarketcheck/core/StockApplication.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
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/example/stockmarketcheck/core/navigation/AppNavHost.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,23 @@ | ||
package com.example.stockmarketcheck.core.navigation | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.toRoute | ||
import com.example.stockmarketcheck.mainFeature.presentation.company_info.CompanyInfoScreen | ||
import com.example.stockmarketcheck.mainFeature.presentation.company_listings.CompanyListingsScreen | ||
|
||
// https://www.notion.so/StockMarket-app-fd555472e30c45ef8586565dc35d7d42?pvs=4#374709ebbc634c2abbaa464580d829c3 | ||
@Composable | ||
fun AppNavHost(navController: NavHostController) { | ||
NavHost(navController, startDestination = CompanyListings::class) { | ||
composable<CompanyListings> { | ||
CompanyListingsScreen(navController = navController) | ||
} | ||
composable<CompanyInfo> { backStackEntry -> | ||
val screenBArgs: CompanyInfo = backStackEntry.toRoute() | ||
CompanyInfoScreen(screenBArgs.symbol) | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/example/stockmarketcheck/core/navigation/Routes.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,9 @@ | ||
package com.example.stockmarketcheck.core.navigation | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
object CompanyListings | ||
|
||
@Serializable | ||
data class CompanyInfo(val symbol: String) |
2 changes: 1 addition & 1 deletion
2
...example/stockmarketcheck/util/Resource.kt → ...le/stockmarketcheck/core/util/Resource.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
2 changes: 1 addition & 1 deletion
2
...e/stockmarketcheck/di/RepositoryModule.kt → ...tcheck/mainFeature/di/RepositoryModule.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
10 changes: 5 additions & 5 deletions
10
app/src/main/java/com/example/stockmarketcheck/mainFeature/domain/model/CompanyInfo.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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package com.example.stockmarketcheck.mainFeature.domain.model | ||
|
||
data class CompanyInfo( | ||
val symbol: String?, | ||
val description: String?, | ||
val name: String?, | ||
val country: String?, | ||
val industry: String?, | ||
val symbol: String, | ||
val description: String, | ||
val name: String, | ||
val country: String, | ||
val industry: String, | ||
) |
2 changes: 1 addition & 1 deletion
2
...c/main/java/com/example/stockmarketcheck/mainFeature/domain/repository/StockRepository.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
157 changes: 157 additions & 0 deletions
157
...a/com/example/stockmarketcheck/mainFeature/presentation/company_info/CompanyInfoScreen.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,157 @@ | ||
package com.example.stockmarketcheck.mainFeature.presentation.company_info | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.WindowInsets | ||
import androidx.compose.foundation.layout.asPaddingValues | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.offset | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.systemBars | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material3.CircularProgressIndicator | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Alignment.Companion.Center | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import androidx.compose.ui.zIndex | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import com.example.stockmarketcheck.ui.theme.DarkBlue | ||
|
||
@Composable | ||
fun CompanyInfoScreen( | ||
symbol: String, | ||
viewModel: CompanyInfoViewModel = hiltViewModel(), | ||
) { | ||
val state = viewModel.state | ||
val systemBarsPadding = WindowInsets.systemBars.asPaddingValues() | ||
|
||
if (state.error == null) { | ||
Column( | ||
modifier = | ||
Modifier | ||
.fillMaxSize() | ||
.background(DarkBlue) | ||
.padding(top = systemBarsPadding.calculateTopPadding()), | ||
) { | ||
state.company?.let { company -> | ||
Text( | ||
text = company.name, | ||
fontWeight = FontWeight.Bold, | ||
fontSize = 18.sp, | ||
overflow = TextOverflow.Ellipsis, | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(start = 5.dp), | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text( | ||
text = company.symbol, | ||
fontStyle = FontStyle.Italic, | ||
fontSize = 14.sp, | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(start = 5.dp), | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
HorizontalDivider( | ||
modifier = | ||
Modifier | ||
.fillMaxWidth(), | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text( | ||
text = "Industry: ${company.industry}", | ||
fontSize = 14.sp, | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(start = 5.dp), | ||
overflow = TextOverflow.Ellipsis, | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text( | ||
text = "Country: ${company.country}", | ||
fontSize = 14.sp, | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(start = 5.dp), | ||
overflow = TextOverflow.Ellipsis, | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
HorizontalDivider( | ||
modifier = | ||
Modifier | ||
.fillMaxWidth(), | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text( | ||
text = company.description, | ||
fontSize = 12.sp, | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(start = 5.dp), | ||
) | ||
if (state.stockIntradayInfos.isNotEmpty()) { | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
Text(text = "Market Summary") | ||
Spacer(modifier = Modifier.height(32.dp)) | ||
|
||
Box( | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.height(300.dp), | ||
) { | ||
IntradayInfoChart( | ||
infos = state.stockIntradayInfos, | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.height(300.dp), | ||
) | ||
Box( | ||
modifier = | ||
Modifier | ||
.height(300.dp) | ||
.width(20.dp) | ||
.background(DarkBlue) | ||
.align(Alignment.CenterEnd) | ||
.offset(x = (-20).dp) | ||
.zIndex(1f), | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
Box( | ||
modifier = Modifier.fillMaxSize(), | ||
contentAlignment = Center, | ||
) { | ||
if (state.isLoading) { | ||
CircularProgressIndicator() | ||
} else if (state.error != null) { | ||
Text( | ||
text = state.error, | ||
color = MaterialTheme.colorScheme.error, | ||
) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.