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:background="@drawable/background_total"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
<ImageButton
|
||||||
android:id="@+id/increment"
|
android:id="@+id/increment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:background="@color/transparent"
|
android:background="@color/transparent"
|
||||||
android:padding="0dp"
|
android:src="@drawable/ic_minus" />
|
||||||
android:text="+"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/display"
|
android:id="@+id/display"
|
||||||
|
@ -24,15 +22,13 @@
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:textColor="?attr/numPickerText"
|
android:textColor="?attr/numPickerText"
|
||||||
android:text="1" />
|
tools:text="1" />
|
||||||
|
|
||||||
<Button
|
<ImageButton
|
||||||
android:id="@+id/decrement"
|
android:id="@+id/decrement"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:background="@color/transparent"
|
android:background="@color/transparent"
|
||||||
android:padding="0dp"
|
android:src="@drawable/ic_plus" />
|
||||||
android:text="—"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -20,6 +20,7 @@ import android.view.accessibility.AccessibilityManager
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
|
import android.widget.ImageButton
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
@ -39,8 +40,8 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
|
||||||
}
|
}
|
||||||
|
|
||||||
var editText: EditText? = null
|
var editText: EditText? = null
|
||||||
private var minusButton: Button? = null
|
private var minusButton: ImageButton? = null
|
||||||
private var plusButton: Button? = null
|
private var plusButton: ImageButton? = null
|
||||||
var currentValue = 0.0
|
var currentValue = 0.0
|
||||||
var minValue = 0.0
|
var minValue = 0.0
|
||||||
var maxValue = 1.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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="130dp"
|
android:layout_width="130dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
android:background="@drawable/background_total"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal">
|
||||||
android:background="@drawable/background_total">
|
|
||||||
|
|
||||||
<Button
|
<ImageButton
|
||||||
android:id="@+id/decrement"
|
android:id="@+id/decrement"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="0dp"
|
android:background="@color/transparent"
|
||||||
android:background="@android:color/transparent"
|
android:src="@drawable/ic_minus" />
|
||||||
app:backgroundTint="@android:color/transparent"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="-"
|
|
||||||
tools:ignore="HardcodedText" />
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/display"
|
android:id="@+id/display"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:background="@drawable/border_gray"
|
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:text="1"
|
android:background="@drawable/border_gray"
|
||||||
android:inputType="number"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="number"
|
||||||
android:textColor="?attr/numPickerText"
|
android:textColor="?attr/numPickerText"
|
||||||
tools:ignore="HardcodedText" />
|
tools:text="1" />
|
||||||
<Button
|
|
||||||
|
<ImageButton
|
||||||
android:id="@+id/increment"
|
android:id="@+id/increment"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="0dp"
|
android:background="@color/transparent"
|
||||||
android:textSize="25sp"
|
android:src="@drawable/ic_plus" />
|
||||||
android:background="@android:color/transparent"
|
|
||||||
app:backgroundTint="@android:color/transparent"
|
|
||||||
android:text="+"
|
|
||||||
tools:ignore="HardcodedText" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue