Showing skipped in habits view

pull/1319/head
Jakub Kalinowski 4 years ago
parent dff0ed6c11
commit df795fd977

@ -21,14 +21,17 @@ package org.isoron.uhabits.activities.common.dialogs
import android.content.Context import android.content.Context
import android.content.DialogInterface import android.content.DialogInterface
import android.content.DialogInterface.BUTTON_NEGATIVE
import android.text.InputFilter import android.text.InputFilter
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE import android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.widget.EditText import android.widget.EditText
import android.widget.NumberPicker import android.widget.NumberPicker
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import org.isoron.uhabits.HabitsApplication
import org.isoron.uhabits.R import org.isoron.uhabits.R
import org.isoron.uhabits.core.models.Entry import org.isoron.uhabits.core.models.Entry
import org.isoron.uhabits.core.ui.screens.habits.list.ListHabitsBehavior import org.isoron.uhabits.core.ui.screens.habits.list.ListHabitsBehavior
@ -88,6 +91,11 @@ class NumberPickerFactory
.create() .create()
dialog.setOnShowListener { dialog.setOnShowListener {
val preferences = (context.applicationContext as HabitsApplication).component.preferences
if(!preferences.isSkipEnabled){
dialog.getButton(BUTTON_NEGATIVE).visibility = View.GONE
}
picker.getChildAt(0)?.requestFocus() picker.getChildAt(0)?.requestFocus()
dialog.window?.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_VISIBLE) dialog.window?.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_VISIBLE)
} }

@ -29,6 +29,7 @@ import android.view.View
import android.view.View.OnClickListener import android.view.View.OnClickListener
import android.view.View.OnLongClickListener import android.view.View.OnLongClickListener
import org.isoron.uhabits.R import org.isoron.uhabits.R
import org.isoron.uhabits.core.models.Entry
import org.isoron.uhabits.core.preferences.Preferences import org.isoron.uhabits.core.preferences.Preferences
import org.isoron.uhabits.inject.ActivityContext import org.isoron.uhabits.inject.ActivityContext
import org.isoron.uhabits.utils.InterfaceUtils.getDimension import org.isoron.uhabits.utils.InterfaceUtils.getDimension
@ -132,6 +133,12 @@ class NumberButtonView(
private val lowContrast: Int private val lowContrast: Int
private val mediumContrast: Int private val mediumContrast: Int
private val paint = TextPaint().apply {
typeface = getFontAwesome()
isAntiAlias = true
textAlign = Paint.Align.CENTER
}
private val pUnit: TextPaint = TextPaint().apply { private val pUnit: TextPaint = TextPaint().apply {
textSize = getDimension(context, R.dimen.smallerTextSize) textSize = getDimension(context, R.dimen.smallerTextSize)
typeface = NORMAL_TYPEFACE typeface = NORMAL_TYPEFACE
@ -169,6 +176,11 @@ class NumberButtonView(
typeface = BOLD_TYPEFACE typeface = BOLD_TYPEFACE
textSize = dim(R.dimen.smallTextSize) textSize = dim(R.dimen.smallTextSize)
} }
value == Entry.SKIP.toDouble() / 1000 ->{
label = resources.getString(R.string.fa_skipped)
textSize = dim(R.dimen.smallTextSize)
typeface = getFontAwesome()
}
preferences.areQuestionMarksEnabled -> { preferences.areQuestionMarksEnabled -> {
label = resources.getString(R.string.fa_question) label = resources.getString(R.string.fa_question)
typeface = getFontAwesome() typeface = getFontAwesome()

Loading…
Cancel
Save