fix: number picker image button
This commit is contained in:
parent
3885b5560b
commit
778fbf2581
5 changed files with 41 additions and 32 deletions
|
@ -6,14 +6,12 @@
|
|||
android:background="@drawable/background_total"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
<ImageButton
|
||||
android:id="@+id/increment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:background="@color/transparent"
|
||||
android:padding="0dp"
|
||||
android:text="+"
|
||||
android:textSize="20sp" />
|
||||
android:src="@drawable/ic_minus" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/display"
|
||||
|
@ -24,15 +22,13 @@
|
|||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:textColor="?attr/numPickerText"
|
||||
android:text="1" />
|
||||
tools:text="1" />
|
||||
|
||||
<Button
|
||||
<ImageButton
|
||||
android:id="@+id/decrement"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:background="@color/transparent"
|
||||
android:padding="0dp"
|
||||
android:text="—"
|
||||
android:textStyle="bold" />
|
||||
android:src="@drawable/ic_plus" />
|
||||
|
||||
</LinearLayout>
|
|
@ -20,6 +20,7 @@ import android.view.accessibility.AccessibilityManager
|
|||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
|
@ -39,8 +40,8 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
|
|||
}
|
||||
|
||||
var editText: EditText? = null
|
||||
private var minusButton: Button? = null
|
||||
private var plusButton: Button? = null
|
||||
private var minusButton: ImageButton? = null
|
||||
private var plusButton: ImageButton? = null
|
||||
var currentValue = 0.0
|
||||
var minValue = 0.0
|
||||
var maxValue = 1.0
|
||||
|
|
10
core/src/main/res/drawable/ic_minus.xml
Normal file
10
core/src/main/res/drawable/ic_minus.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M 19 13 h -14 v -2 h 14 V 13 z" />
|
||||
</vector>
|
10
core/src/main/res/drawable/ic_plus.xml
Normal file
10
core/src/main/res/drawable/ic_plus.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||
</vector>
|
|
@ -3,40 +3,32 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/background_total">
|
||||
android:background="@drawable/background_total"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
<ImageButton
|
||||
android:id="@+id/decrement"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="0dp"
|
||||
android:background="@android:color/transparent"
|
||||
app:backgroundTint="@android:color/transparent"
|
||||
android:textStyle="bold"
|
||||
android:text="-"
|
||||
tools:ignore="HardcodedText" />
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/ic_minus" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/display"
|
||||
android:layout_width="70dp"
|
||||
android:background="@drawable/border_gray"
|
||||
android:layout_height="match_parent"
|
||||
android:text="1"
|
||||
android:inputType="number"
|
||||
android:background="@drawable/border_gray"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:textColor="?attr/numPickerText"
|
||||
tools:ignore="HardcodedText" />
|
||||
<Button
|
||||
tools:text="1" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/increment"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="0dp"
|
||||
android:textSize="25sp"
|
||||
android:background="@android:color/transparent"
|
||||
app:backgroundTint="@android:color/transparent"
|
||||
android:text="+"
|
||||
tools:ignore="HardcodedText" />
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/ic_plus" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
Loading…
Reference in a new issue