Created AutoScrollingTextView which automatically scrolls its contents horizontally in case the contents do not fit the available width and used it in the Map suggestions' address to display the complete address. Also, improved the Map Toolbar color.
This commit is contained in:
parent
28e0e9df52
commit
4a47b5b637
5 changed files with 47 additions and 6 deletions
|
@ -0,0 +1,35 @@
|
||||||
|
package cy.agorise.bitsybitshareswallet.views
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TextView that in case the content does not fit the available width, scrolls horizontally automatically. The
|
||||||
|
* TextView needs this xml attributes to work correctly:
|
||||||
|
* android:singleLine="true"
|
||||||
|
* android:ellipsize="marquee"
|
||||||
|
* android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
* android:scrollHorizontally="true"
|
||||||
|
*/
|
||||||
|
class AutoScrollingTextView(context: Context?, attrs: AttributeSet?) : AppCompatTextView(context, attrs) {
|
||||||
|
override fun onFocusChanged(
|
||||||
|
focused: Boolean, direction: Int,
|
||||||
|
previouslyFocusedRect: Rect?
|
||||||
|
) {
|
||||||
|
if (focused) {
|
||||||
|
super.onFocusChanged(focused, direction, previouslyFocusedRect)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onWindowFocusChanged(focused: Boolean) {
|
||||||
|
if (focused) {
|
||||||
|
super.onWindowFocusChanged(focused)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun isFocused(): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:background="@color/semiTransparent"
|
android:background="@color/colorMapToolbar"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
app:title="@string/title_merchants_and_tellers"
|
app:title="@string/title_merchants_and_tellers"
|
||||||
android:theme="@style/ThemeOverlay.MaterialComponents" />
|
android:theme="@style/ThemeOverlay.MaterialComponents" />
|
||||||
|
|
|
@ -32,17 +32,21 @@
|
||||||
app:layout_constraintStart_toEndOf="@id/ivMarkerPin"
|
app:layout_constraintStart_toEndOf="@id/ivMarkerPin"
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
<TextView
|
<cy.agorise.bitsybitshareswallet.views.AutoScrollingTextView
|
||||||
android:id="@+id/tvAddress"
|
android:id="@+id/tvAddress"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
tools:text="Carretera, Barra Vieja Km 37, 39936 Acapulco, Gro."
|
tools:text="Carretera, Barra Vieja Km 37, 39936 Acapulco, Gro."
|
||||||
android:textAppearance="@style/TextAppearance.Bitsy.Body2"
|
android:textAppearance="@style/TextAppearance.Bitsy.Body2"
|
||||||
android:maxLines="1"
|
android:singleLine="true"
|
||||||
android:ellipsize="end"
|
android:ellipsize="marquee"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvName"
|
app:layout_constraintTop_toBottomOf="@id/tvName"
|
||||||
app:layout_constraintStart_toEndOf="@id/ivMarkerPin"/>
|
app:layout_constraintStart_toEndOf="@id/ivMarkerPin"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,8 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:background="@drawable/popup_menu_merchants_background">
|
android:background="@drawable/popup_menu_merchants_background">
|
||||||
|
|
|
@ -20,4 +20,5 @@
|
||||||
<color name="colorSend">#D32F2F</color>
|
<color name="colorSend">#D32F2F</color>
|
||||||
<color name="colorSendDark">#B71C1C</color>
|
<color name="colorSendDark">#B71C1C</color>
|
||||||
<color name="semiTransparent">#2888</color>
|
<color name="semiTransparent">#2888</color>
|
||||||
|
<color name="colorMapToolbar">#338888aa</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue