pull/1960/head
rivago 2 years ago
parent 8b9fc9ebc8
commit 133c98da37

@ -117,7 +117,6 @@ class EditHabitActivity : AppCompatActivity() {
binding.notesInput.setText(habit.description) binding.notesInput.setText(habit.description)
binding.unitInput.setText(habit.unit) binding.unitInput.setText(habit.unit)
binding.targetInput.setText(habit.targetValue.toString()) binding.targetInput.setText(habit.targetValue.toString())
} else { } else {
habitType = HabitType.fromInt(intent.getIntExtra("habitType", HabitType.YES_NO.value)) habitType = HabitType.fromInt(intent.getIntExtra("habitType", HabitType.YES_NO.value))
} }
@ -366,16 +365,17 @@ class EditHabitActivity : AppCompatActivity() {
@SuppressLint("StringFormatMatches") @SuppressLint("StringFormatMatches")
private fun populateWidgetAction() { private fun populateWidgetAction() {
binding.widgetActionPicker.text = when (increment){ binding.widgetActionPicker.text = when (increment) {
0.0 -> getString(R.string.widget_action_dialog) 0.0 -> getString(R.string.widget_action_dialog)
else -> getString(R.string.widget_action_increment) else -> getString(R.string.widget_action_increment)
} }
binding.incrementInput.setText(increment.toString()) binding.incrementInput.setText(increment.toString())
if (increment != 0.0) if (increment != 0.0) {
binding.incrementRightBox.visibility = View.VISIBLE binding.incrementRightBox.visibility = View.VISIBLE
else } else {
binding.incrementRightBox.visibility = View.GONE binding.incrementRightBox.visibility = View.GONE
} }
}
private fun populateTargetType() { private fun populateTargetType() {
binding.targetTypePicker.text = when (targetType) { binding.targetTypePicker.text = when (targetType) {
@ -411,7 +411,7 @@ class EditHabitActivity : AppCompatActivity() {
putInt("reminderHour", reminderHour) putInt("reminderHour", reminderHour)
putInt("reminderMin", reminderMin) putInt("reminderMin", reminderMin)
putInt("reminderDays", reminderDays.toInteger()) putInt("reminderDays", reminderDays.toInteger())
putDouble("increment",increment) putDouble("increment", increment)
} }
} }
} }

@ -108,7 +108,7 @@ class WidgetReceiver : BroadcastReceiver() {
data.timestamp.unixTime data.timestamp.unixTime
) )
) )
controller.onIncrement(data.habit,data.timestamp,(data.habit.increment * 1000).toInt()) controller.onIncrement(data.habit, data.timestamp, (data.habit.increment * 1000).toInt())
} }
} }
} catch (e: RuntimeException) { } catch (e: RuntimeException) {

@ -41,10 +41,11 @@ open class CheckmarkWidget(
override fun getOnClickPendingIntent(context: Context): PendingIntent? { override fun getOnClickPendingIntent(context: Context): PendingIntent? {
return if (habit.isNumerical) { return if (habit.isNumerical) {
if (habit.increment == 0.0) if (habit.increment == 0.0) {
pendingIntentFactory.showNumberPicker(habit, DateUtils.getTodayWithOffset()) pendingIntentFactory.showNumberPicker(habit, DateUtils.getTodayWithOffset())
else } else {
pendingIntentFactory.incrementNumerical(habit, null) pendingIntentFactory.incrementNumerical(habit, null)
}
} else { } else {
pendingIntentFactory.toggleCheckmark(habit, null) pendingIntentFactory.toggleCheckmark(habit, null)
} }

Loading…
Cancel
Save