Skip to content

Instantly share code, notes, and snippets.

View nicoqueijo's full-sized avatar

Nico Queijo nicoqueijo

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="1dp" />
<solid android:color="@android:color/darker_gray" />
</shape>
private lateinit var dragLinearLayout: DragLinearLayout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
dragLinearLayout = findViewById(R.id.drag_linear_layout)
addedCurrencies.forEach {
addRow(it)
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="dark_gray">#1A1A1A</color>
</resources>
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
companion object {
private val addedCurrencies = mutableListOf(
Currency("ARS", "Argentine Peso", R.drawable.ars),
class CurrencyRow(context: Context?, attrs: AttributeSet? = null) :
ConstraintLayout(context, attrs) {
val currencyFlag: ImageView
val currencyCode: TextView
val currencyName: TextView
init {
LayoutInflater.from(context).inflate(R.layout.row_currency, this)
currencyFlag = findViewById(R.id.currency_flag)
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@color/dark_gray">
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
tools:context=".MainActivity">
<com.bosphere.fadingedgelayout.FadingEdgeLayout
data class Currency(val currencyCode: String, val currencyName: String, val currencyFlag: Int)
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.Bridge">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>