Skip to content

Commit

Permalink
Merge pull request #82 from drahovac/bug/34_long_coin_name_overflow
Browse files Browse the repository at this point in the history
bug-34 :: Fix coin name overflow in coin detail header
  • Loading branch information
RyanKoech committed Jul 13, 2023
2 parents 7949a80 + 0c8c48b commit d79fef6
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 27 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ buildscript {
apply from : 'dependencies.gradle'

dependencies {
classpath "com.google.dagger:hilt-android-gradle-plugin:2.42"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.44.1"
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.21' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

task clean(type: Delete) {
Expand Down
9 changes: 4 additions & 5 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ ext {
targetSdk = 33
versionMajor = 1
versionMinor = 0
versionPatch = 0
versionPatch = 1
versionCode = versionMajor * 10000 + versionMinor * 100 + versionPatch
compileSdk = 33
versionName = "${versionMajor}.${versionMinor}.${versionPatch}"


compose_version = '1.4.0-alpha02'
compose_version = '1.4.1'
room_version = '2.4.3'
ktx_core_version = '1.9.0'
app_compat_version = '1.5.1'
Expand All @@ -19,8 +19,7 @@ ext {
espresso_version = '3.5.0'
compose_activity_version = '1.6.1'
coil_compose = '2.1.0'
hilt_android_version = '2.43.2'
hilt_android_compile_version = '2.42'
hilt_android_version = '2.44.1'
hilt_lifecycle_viewmodel_version = '1.0.0-alpha03'
hilt_compile_version = '1.0.0'
hilt_navigation_compose_version = '1.1.0-alpha01'
Expand Down Expand Up @@ -70,7 +69,7 @@ ext {
// dagger-hilt - for dependency injection
hilt_android : "com.google.dagger:hilt-android:$hilt_android_version",
navigation_compose : "androidx.hilt:hilt-navigation-compose:$hilt_navigation_compose_version",
android_compiler : "com.google.dagger:hilt-android-compiler:$hilt_android_compile_version",
android_compiler : "com.google.dagger:hilt-android-compiler:$hilt_android_version",
hilt_compiler : "androidx.hilt:hilt-compiler:$hilt_compile_version",
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.ryankoech.krypto.feature_coin_details.presentation.components.success

import androidx.compose.foundation.background
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
Expand All @@ -26,9 +28,10 @@ import com.ryankoech.krypto.feature_coin_list.data.repository.FAKE_COIN_LIST
import com.ryankoech.krypto.feature_coin_list.domain.entity.Coin
import java.util.*

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun CoinDetailsHeader(
coin : Coin,
coin: Coin,
modifier: Modifier = Modifier
) {

Expand Down Expand Up @@ -66,7 +69,9 @@ fun CoinDetailsHeader(
) {
Text(
modifier = Modifier
.padding(end = 2.dp),
.weight(1f)
.padding(end = 4.dp)
.basicMarquee(),
text = coin.name,
style = MaterialTheme.typography.h3,
)
Expand Down Expand Up @@ -95,17 +100,17 @@ fun CoinDetailsHeader(
shape = RoundedCornerShape(3.dp)
),

){
Text(
modifier = Modifier
.padding(
vertical = 0.dp,
horizontal = 3.dp
),
text = coin.marketCapRank.toString(),
style = MaterialTheme.typography.h4,
color = Color.White
)
) {
Text(
modifier = Modifier
.padding(
vertical = 0.dp,
horizontal = 3.dp
),
text = coin.marketCapRank.toString(),
style = MaterialTheme.typography.h4,
color = Color.White
)
}
Text(
modifier = Modifier
Expand Down Expand Up @@ -146,6 +151,9 @@ fun CoinDetailsHeaderPreview() {
CoinDetailsHeader(
FAKE_COIN_LIST.toCoinEntity().first()
)
CoinDetailsHeader(
FAKE_COIN_LIST.toCoinEntity().last()
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,34 @@ val FAKE_COIN_LIST = listOf(
atl_date = "2021-05-19T13:04:37.445Z",
roi = null,
last_updated = "2023-01-07T10:57:59.111Z",
),
CoinDto(
id = "bitcoin-avalanche-bridged-btc-b",
symbol = "btc.b",
name = "Bitcoin Avalanche Bridged (BTC.b)",
image = "https://assets.coingecko.com/coins/images/26115/large/btcb.png?1655921693",
current_price = 30602.00,
market_cap = 180011907,
market_cap_rank = 176,
fully_diluted_valuation = 180011907,
total_volume = 1726197.0,
high_24h = 31085.0,
low_24h = 30423.0,
price_change_24h = 37.82,
price_change_percentage_24h = 0.12374,
market_cap_change_24h = -275479.6007090211,
market_cap_change_percentage_24h = -0.1528,
circulating_supply = 5883.16945376,
total_supply = 5883.16945376,
max_supply = null,
ath = 42442.0,
ath_change_percentage = -28.06027,
ath_date = "2023-01-16T22:36:24.558Z",
atl = 7806.11,
atl_change_percentage = 291.13378,
atl_date = "2023-03-03T05:01:42.603Z",
roi = null,
last_updated = "2023-07-12T16:51:07.716Z",
)
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.ryankoech.krypto.feature_coin_list.presentation.components.success

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -12,24 +14,21 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.VerticalAlignmentLine
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ryankoech.krypto.common.presentation.components.CoinImage
import com.ryankoech.krypto.common.presentation.theme.KryptoTheme
import com.ryankoech.krypto.common.presentation.util.*
import com.ryankoech.krypto.feature_coin_list.R
import com.ryankoech.krypto.feature_coin_list.data.dto.toCoinEntity
import com.ryankoech.krypto.feature_coin_list.data.repository.FAKE_COIN_LIST
import com.ryankoech.krypto.feature_coin_list.domain.entity.Coin
import com.ryankoech.krypto.feature_coin_list.presentation.theme.black100
import com.ryankoech.krypto.feature_coin_list.presentation.theme.black200

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun CoinItem(
onClick : (String) -> Unit,
onClick: (String) -> Unit,
coin: Coin,
modifier: Modifier = Modifier
) {
Expand Down Expand Up @@ -67,7 +66,9 @@ fun CoinItem(
) {
Text(
modifier = Modifier
.padding(end = 2.dp),
.padding(end = 4.dp)
.weight(1f)
.basicMarquee(),
text = coin.name,
style = MaterialTheme.typography.h3,
)
Expand Down

0 comments on commit d79fef6

Please sign in to comment.