Skip to content

Commit

Permalink
fiat icons
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrlzy committed May 29, 2024
1 parent aed5a64 commit e001aa9
Show file tree
Hide file tree
Showing 168 changed files with 4,511 additions and 33 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ android {
}

dependencies {
implementation project(':fiaticons')

implementation "androidx.compose.ui:ui:1.5.4"
implementation "androidx.navigation:navigation-compose:2.7.5"
implementation "androidx.compose.material3:material3:1.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -55,6 +56,7 @@ import dev.arkbuilders.rate.presentation.ui.AppHorDiv
import dev.arkbuilders.rate.presentation.ui.AppHorDiv16
import dev.arkbuilders.rate.presentation.ui.AppSwipeToDismiss
import dev.arkbuilders.rate.presentation.ui.AppTopBarCenterTitle
import dev.arkbuilders.rate.presentation.ui.CurrIcon
import dev.arkbuilders.rate.presentation.ui.GroupViewPager
import dev.arkbuilders.rate.presentation.ui.NotifyAddedSnackbar
import kotlinx.coroutines.flow.launchIn
Expand Down Expand Up @@ -216,11 +218,7 @@ private fun PairAlertItem(pairAlert: PairAlert) {
},
verticalAlignment = Alignment.CenterVertically
) {
Icon(
painter = painterResource(id = R.drawable.ic_earth),
contentDescription = "",
tint = Color.Unspecified
)
CurrIcon(modifier = Modifier.size(40.dp), code = pairAlert.targetCode)
Column(
modifier = Modifier
.padding(start = 12.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -54,6 +55,7 @@ import dev.arkbuilders.rate.presentation.ui.NotifyAddedSnackbar
import dev.arkbuilders.rate.presentation.ui.NotifyAddedSnackbarVisuals
import dev.arkbuilders.rate.presentation.ui.AppHorDiv16
import dev.arkbuilders.rate.presentation.ui.AppSwipeToDismiss
import dev.arkbuilders.rate.presentation.ui.CurrIcon
import dev.arkbuilders.rate.presentation.ui.GroupViewPager
import dev.arkbuilders.rate.presentation.ui.SearchTextFieldWithSort
import kotlinx.coroutines.flow.launchIn
Expand Down Expand Up @@ -222,11 +224,7 @@ private fun CurrencyItem(
},
verticalAlignment = Alignment.CenterVertically
) {
Icon(
painter = painterResource(id = R.drawable.ic_earth),
contentDescription = "",
tint = Color.Unspecified
)
CurrIcon(modifier = Modifier.size(40.dp), code = amount.amount.code)
Column(
modifier = Modifier.padding(start = 12.dp),
verticalArrangement = Arrangement.Center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import dev.arkbuilders.rate.presentation.theme.ArkColor
import dev.arkbuilders.rate.presentation.theme.ArkTypography
import dev.arkbuilders.rate.presentation.ui.AppHorDiv16
import dev.arkbuilders.rate.presentation.ui.AppSwipeToDismiss
import dev.arkbuilders.rate.presentation.ui.CurrIcon
import dev.arkbuilders.rate.presentation.ui.GroupViewPager
import dev.arkbuilders.rate.presentation.ui.NotifyAddedSnackbar
import dev.arkbuilders.rate.presentation.ui.SearchTextFieldWithSort
Expand Down Expand Up @@ -233,12 +234,7 @@ private fun QuickItem(
modifier = Modifier
.size(40.dp)
) {
Icon(
modifier = Modifier.size(40.dp),
painter = painterResource(R.drawable.ic_earth),
contentDescription = "",
tint = Color.Unspecified
)
CurrIcon(modifier = Modifier.size(40.dp), code = quick.pair.from)
}
if (!expanded) {
Box(
Expand All @@ -248,12 +244,7 @@ private fun QuickItem(
.border(2.dp, Color.White, CircleShape)
) {
if (quick.to.size == 1) {
Icon(
modifier = Modifier.size(40.dp),
painter = painterResource(R.drawable.ic_earth),
contentDescription = "",
tint = Color.Unspecified
)
CurrIcon(modifier = Modifier.size(39.dp), code = quick.pair.to.first())
} else {
Box(
modifier = Modifier
Expand Down Expand Up @@ -288,12 +279,7 @@ private fun QuickItem(
modifier = Modifier.padding(top = 4.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
modifier = Modifier.size(20.dp),
painter = painterResource(R.drawable.ic_earth),
contentDescription = "",
tint = Color.Unspecified
)
CurrIcon(modifier = Modifier.size(20.dp), code = it.first)
Text(
modifier = Modifier.padding(start = 8.dp),
text = "${CurrUtils.prepareToDisplay(it.second)} ${it.first}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down Expand Up @@ -38,6 +39,7 @@ import dev.arkbuilders.rate.presentation.shared.AppSharedFlow
import dev.arkbuilders.rate.presentation.shared.AppSharedFlowKey
import dev.arkbuilders.rate.presentation.theme.ArkColor
import dev.arkbuilders.rate.presentation.ui.AppTopBarBack
import dev.arkbuilders.rate.presentation.ui.CurrIcon
import kotlinx.coroutines.launch

@Destination
Expand Down Expand Up @@ -174,11 +176,7 @@ private fun CurItem(
},
verticalAlignment = Alignment.CenterVertically
) {
Icon(
painter = painterResource(id = R.drawable.ic_earth),
contentDescription = "",
tint = Color.Unspecified
)
CurrIcon(modifier = Modifier.size(40.dp), code = name.code)
Column(
modifier = Modifier.padding(start = 12.dp),
verticalArrangement = Arrangement.Center
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/dev/arkbuilders/rate/presentation/ui/CurrIcon.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.arkbuilders.rate.presentation.ui

import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import dev.arkbuilders.rate.data.model.CurrencyCode
import dev.arkbuilders.rate.presentation.utils.IconUtils

@Composable
fun CurrIcon(modifier: Modifier = Modifier, code: CurrencyCode) {
val ctx = LocalContext.current
Icon(
modifier = modifier,
painter = painterResource(id = IconUtils.iconForCurrCode(ctx, code)),
contentDescription = code,
tint = Color.Unspecified
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package dev.arkbuilders.rate.presentation.utils

import android.content.Context
import dev.arkbuilders.rate.R
import dev.arkbuilders.rate.data.model.CurrencyCode

object IconUtils {
fun iconForCurrCode(ctx: Context, code: CurrencyCode): Int {
var lowercaseCode = code.lowercase()
// try is reserved work, but we have Turkish lira
if (lowercaseCode == "try") {
lowercaseCode = "curr_try"
}

val drawableID = ctx.resources
.getIdentifier(
lowercaseCode,
"drawable",
ctx.packageName
)

return if (drawableID > 0) drawableID
else R.drawable.ic_earth
}

}
Binary file added fiaticons.zip
Binary file not shown.
1 change: 1 addition & 0 deletions fiaticons/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions fiaticons/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
}

android {
namespace = "dev.arkbuilders.rate.fiaticons"
compileSdk = 34

defaultConfig {
minSdk = 26

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {

implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.12.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
Empty file added fiaticons/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions fiaticons/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.arkbuilders.rate.fiaticons

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("dev.arkbuilders.rate.fiaticons.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions fiaticons/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
22 changes: 22 additions & 0 deletions fiaticons/src/main/res/drawable/aed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,24C18.627,24 24,18.627 24,12C24,5.373 18.627,0 12,0C5.373,0 0,5.373 0,12C0,18.627 5.373,24 12,24Z"
android:fillColor="#F0F0F0"/>
<path
android:pathData="M6.783,16.173L7.827,23.253C9.127,23.735 10.533,23.999 12.001,23.999C17.16,23.999 21.559,20.743 23.254,16.173H6.783Z"
android:fillColor="#000000"/>
<path
android:pathData="M6.783,7.827L7.827,0.747C9.127,0.264 10.533,0 12.001,0C17.16,0 21.559,3.257 23.254,7.827H6.783Z"
android:fillColor="#6DA544"/>
<path
android:pathData="M0,12C0,17.16 3.257,21.558 7.826,23.254V0.747C3.257,2.442 0,6.841 0,12Z"
android:fillColor="#A2001D"/>
</group>
</vector>
25 changes: 25 additions & 0 deletions fiaticons/src/main/res/drawable/afa.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M17.216,1.191C15.639,0.428 13.869,0 11.999,0C10.129,0 8.359,0.428 6.782,1.191L5.738,12L6.782,22.809C8.359,23.572 10.129,24 11.999,24C13.869,24 15.639,23.572 17.216,22.809L18.26,12L17.216,1.191Z"
android:fillColor="#D80027"/>
<path
android:pathData="M6.783,1.191C2.769,3.132 0,7.243 0,12C0,16.758 2.769,20.868 6.783,22.809V1.191Z"
android:fillColor="#000000"/>
<path
android:pathData="M17.217,1.191V22.809C21.231,20.868 23.999,16.758 23.999,12C23.999,7.243 21.231,3.132 17.217,1.191Z"
android:fillColor="#496E2D"/>
<path
android:pathData="M12,7.827C9.695,7.827 7.826,9.695 7.826,12.001C7.826,14.306 9.695,16.174 12,16.174C14.305,16.174 16.174,14.306 16.174,12.001C16.174,9.695 14.305,7.827 12,7.827ZM12,14.609C10.559,14.609 9.391,13.441 9.391,12.001C9.391,10.56 10.559,9.392 12,9.392C13.441,9.392 14.609,10.56 14.609,12.001C14.609,13.441 13.441,14.609 12,14.609Z"
android:fillColor="#FFDA44"/>
<path
android:pathData="M12,10.436C11.424,10.436 10.957,10.903 10.957,11.479V13.045H13.044V11.479C13.044,10.903 12.577,10.436 12,10.436Z"
android:fillColor="#FFDA44"/>
</group>
</vector>
16 changes: 16 additions & 0 deletions fiaticons/src/main/res/drawable/all.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,24C18.627,24 24,18.627 24,12C24,5.373 18.627,0 12,0C5.373,0 0,5.373 0,12C0,18.627 5.373,24 12,24Z"
android:fillColor="#D80027"/>
<path
android:pathData="M18.782,8.907H14.436C14.704,8.627 14.869,8.246 14.869,7.827C14.869,6.963 14.168,6.262 13.304,6.262C12.759,6.262 12.28,6.54 11.999,6.962C11.719,6.54 11.24,6.262 10.695,6.262C9.831,6.262 9.13,6.963 9.13,7.827C9.13,8.246 9.295,8.627 9.563,8.907H5.217C5.217,10.06 6.221,10.994 7.373,10.994H7.304C7.304,12.147 8.238,13.081 9.391,13.081C9.391,13.455 9.489,13.805 9.661,14.108L7.93,15.839L9.258,17.167L11.142,15.283C11.216,15.31 11.292,15.332 11.371,15.347L10.232,17.917L11.999,19.827L13.766,17.917L12.628,15.346C12.707,15.332 12.783,15.31 12.857,15.283L14.741,17.167L16.069,15.839L14.338,14.108C14.51,13.805 14.608,13.455 14.608,13.081C15.761,13.081 16.695,12.147 16.695,10.994H16.625C17.778,10.994 18.782,10.06 18.782,8.907Z"
android:fillColor="#000000"/>
</group>
</vector>
25 changes: 25 additions & 0 deletions fiaticons/src/main/res/drawable/ang.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,24C18.627,24 24,18.627 24,12C24,5.373 18.627,0 12,0C5.373,0 0,5.373 0,12C0,18.627 5.373,24 12,24Z"
android:fillColor="#FFDA44"/>
<path
android:pathData="M11.999,24C15.936,24 19.431,22.104 21.619,19.175H2.379C4.567,22.104 8.062,24 11.999,24Z"
android:fillColor="#0052B4"/>
<path
android:pathData="M24,12C24,5.373 18.627,0 12,0C5.373,0 0,5.373 0,12C0,13.419 0.247,14.78 0.699,16.044H23.301C23.753,14.78 24,13.419 24,12Z"
android:fillColor="#0052B4"/>
<path
android:pathData="M8.214,7.696L8.861,9.689H10.957L9.261,10.92L9.909,12.913L8.214,11.682L6.518,12.913L7.166,10.92L5.471,9.689H7.566L8.214,7.696Z"
android:fillColor="#F0F0F0"/>
<path
android:pathData="M4.614,5.609L5.003,6.805H6.26L5.243,7.544L5.632,8.74L4.614,8.001L3.597,8.74L3.986,7.544L2.969,6.805H4.226L4.614,5.609Z"
android:fillColor="#F0F0F0"/>
</group>
</vector>
Loading

0 comments on commit e001aa9

Please sign in to comment.