Skip to content

Commit 951dabe

Browse files
committed
Merge branch 'isse_1857_reset_measurable_entry' into dev
2 parents f68510f + 76b9dd8 commit 951dabe

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

uhabits-android/src/main/java/org/isoron/uhabits/activities/common/dialogs/NumberDialog.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@ class NumberDialog : AppCompatDialogFragment() {
3636
val appComponent = (requireActivity().application as HabitsApplication).component
3737
val prefs = appComponent.preferences
3838
view = CheckmarkPopupBinding.inflate(LayoutInflater.from(context))
39-
arrayOf(view.yesBtn, view.skipBtn).forEach {
39+
arrayOf(view.yesBtn).forEach {
4040
it.setTextColor(requireArguments().getInt("color"))
4141
}
42-
arrayOf(view.noBtn, view.unknownBtn).forEach {
42+
arrayOf(view.noBtn, view.unknownBtnNumber).forEach {
4343
it.setTextColor(view.root.sres.getColor(R.attr.contrast60))
4444
}
45-
arrayOf(view.yesBtn, view.noBtn, view.skipBtn, view.unknownBtn).forEach {
45+
arrayOf(view.yesBtn, view.noBtn, view.unknownBtnNumber).forEach {
4646
it.typeface = InterfaceUtils.getFontAwesome(requireContext())
4747
}
4848
if (!prefs.isSkipEnabled) view.skipBtnNumber.visibility = View.GONE
49+
if (!prefs.areQuestionMarksEnabled) view.unknownBtnNumber.visibility = View.GONE
4950
view.numberButtons.visibility = View.VISIBLE
5051
fixDecimalSeparator(view)
5152
originalNotes = requireArguments().getString("notes")!!
@@ -71,6 +72,12 @@ class NumberDialog : AppCompatDialogFragment() {
7172
view.value.setText(DecimalFormat("#.###").format((Entry.SKIP.toDouble() / 1000)))
7273
save()
7374
}
75+
76+
view.unknownBtnNumber.setOnClickListener {
77+
view.value.setText(DecimalFormat("#.###").format((Entry.UNKNOWN.toDouble() / 1000)))
78+
save()
79+
}
80+
7481
view.notes.setOnEditorActionListener { v, actionId, event ->
7582
save()
7683
true

uhabits-android/src/main/res/layout/checkmark_popup.xml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@
2323
android:id="@+id/container"
2424
android:layout_width="wrap_content"
2525
android:layout_height="wrap_content"
26-
android:minHeight="128dp"
26+
android:background="@drawable/checkmark_dialog_bg"
2727
android:minWidth="208dp"
28-
app:divider="@drawable/checkmark_dialog_divider"
29-
app:showDividers="middle"
28+
android:minHeight="128dp"
3029
android:orientation="vertical"
31-
android:background="@drawable/checkmark_dialog_bg">
30+
app:divider="@drawable/checkmark_dialog_divider"
31+
app:showDividers="middle">
3232

3333
<androidx.appcompat.widget.AppCompatEditText
3434
android:id="@+id/notes"
3535
android:layout_width="match_parent"
3636
android:layout_height="0dp"
3737
android:layout_weight="1"
38+
android:background="@color/transparent"
3839
android:gravity="center"
40+
android:hint="@string/notes"
3941
android:inputType="textCapSentences|textMultiLine"
40-
android:textSize="@dimen/smallTextSize"
4142
android:padding="4dp"
42-
android:background="@color/transparent"
43-
android:hint="@string/notes"
44-
android:text="" />
43+
android:text=""
44+
android:textSize="@dimen/smallTextSize" />
4545

4646
<androidx.appcompat.widget.LinearLayoutCompat
4747
android:id="@+id/booleanButtons"
48-
android:visibility="gone"
4948
android:layout_width="match_parent"
5049
android:layout_height="48dp"
5150
android:orientation="horizontal"
51+
android:visibility="gone"
5252
app:divider="@drawable/checkmark_dialog_divider"
5353
app:showDividers="middle">
5454

@@ -75,32 +75,37 @@
7575

7676
<androidx.appcompat.widget.LinearLayoutCompat
7777
android:id="@+id/numberButtons"
78-
android:visibility="gone"
7978
android:layout_width="match_parent"
8079
android:layout_height="48dp"
8180
android:orientation="horizontal"
81+
android:visibility="gone"
8282
app:divider="@drawable/checkmark_dialog_divider"
8383
app:showDividers="middle">
8484

8585
<androidx.appcompat.widget.AppCompatEditText
8686
android:id="@+id/value"
8787
android:layout_width="0dp"
8888
android:layout_height="match_parent"
89-
android:layout_weight="1"
89+
android:layout_weight="2"
9090
android:background="@color/transparent"
91-
android:textAlignment="center"
9291
android:inputType="numberDecimal"
9392
android:selectAllOnFocus="true"
93+
android:textAlignment="center"
9494
android:textSize="@dimen/smallTextSize" />
9595

96+
<TextView
97+
android:id="@+id/saveBtn"
98+
style="@style/NumericalPopupBtn"
99+
android:text="@string/save" />
100+
96101
<TextView
97102
android:id="@+id/skipBtnNumber"
98103
style="@style/NumericalPopupBtn"
99104
android:text="@string/skip_day" />
100105

101106
<TextView
102-
android:id="@+id/saveBtn"
103-
style="@style/NumericalPopupBtn"
104-
android:text="@string/save" />
107+
android:id="@+id/unknownBtnNumber"
108+
style="@style/CheckmarkPopupBtn"
109+
android:text="@string/fa_question" />
105110
</androidx.appcompat.widget.LinearLayoutCompat>
106111
</androidx.appcompat.widget.LinearLayoutCompat>

0 commit comments

Comments
 (0)