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
class MainActivity : AppCompatActivity() { | |
... | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
... | |
} | |
private fun addRow(currency: Currency) { |
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
class MainActivity : AppCompatActivity() { | |
... | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
... | |
findViewById<FloatingActionButton>(R.id.floating_action_button).setOnClickListener { | |
if (removedCurrencies.isNotEmpty()) { | |
removedCurrencies.pop().let { |
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
private fun addRow(currency: Currency) { | |
CurrencyRow(this).run row@{ | |
initRow(currency) | |
dragLinearLayout.run { | |
addView(this@row) | |
setViewDraggable(this@row, this@row) | |
scrollableArea.setOnLongClickListener { | |
val indexToRemove = indexOfChild(this@row) | |
addedCurrencies.removeAt(indexToRemove).let { | |
removedCurrencies.push(it) |
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
private fun addRow(currency: Currency) { | |
CurrencyRow(this).run row@{ | |
initRow(currency) | |
dragLinearLayout.run { | |
addView(this@row) | |
setViewDraggable(this@row, this@row) | |
scrollableArea.setOnLongClickListener { | |
val indexToRemove = indexOfChild(this@row) | |
addedCurrencies.removeAt(indexToRemove).let { | |
removedCurrencies.push(it) |
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
class MainActivity : AppCompatActivity() { | |
... | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
... | |
} | |
private fun addRow(currency: Currency) { | |
CurrencyRow(this).run row@{ |
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
class CurrencyRow(context: Context?, attrs: AttributeSet? = null) : | |
ConstraintLayout(context, attrs) { | |
val scrollableArea: ConstraintLayout | |
... | |
init { | |
LayoutInflater.from(context).inflate(R.layout.row_currency, this) | |
scrollableArea = findViewById(R.id.scrollable_area) | |
... |
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
class MainActivity : AppCompatActivity() { | |
private lateinit var scrollView: ScrollView | |
private lateinit var dragLinearLayout: DragLinearLayout | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
scrollView = findViewById(R.id.scroll_view) |
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
class MainActivity : AppCompatActivity() { | |
private lateinit var scrollView: ScrollView | |
private lateinit var dragLinearLayout: DragLinearLayout | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
scrollView = findViewById(R.id.scroll_view) |
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
<?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"> |
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
<com.jmedeisis.draglinearlayout.DragLinearLayout | |
android:id="@+id/drag_linear_layout" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:divider="@drawable/divider" | |
android:orientation="vertical" | |
android:paddingBottom="90dp" | |
android:showDividers="middle|beginning|end" /> |
NewerOlder