|
|
@ -25,7 +25,9 @@ import android.util.Log
|
|
|
|
import android.view.LayoutInflater
|
|
|
|
import android.view.LayoutInflater
|
|
|
|
import android.view.View
|
|
|
|
import android.view.View
|
|
|
|
import android.widget.EditText
|
|
|
|
import android.widget.EditText
|
|
|
|
|
|
|
|
import android.widget.LinearLayout
|
|
|
|
import android.widget.RadioButton
|
|
|
|
import android.widget.RadioButton
|
|
|
|
|
|
|
|
import android.widget.TextView
|
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
|
import androidx.appcompat.app.AppCompatDialogFragment
|
|
|
|
import androidx.appcompat.app.AppCompatDialogFragment
|
|
|
|
import kotlinx.android.synthetic.main.frequency_picker_dialog.view.*
|
|
|
|
import kotlinx.android.synthetic.main.frequency_picker_dialog.view.*
|
|
|
@ -45,6 +47,21 @@ class FrequencyPickerDialog(
|
|
|
|
val inflater = LayoutInflater.from(activity!!)
|
|
|
|
val inflater = LayoutInflater.from(activity!!)
|
|
|
|
contentView = inflater.inflate(R.layout.frequency_picker_dialog, null)
|
|
|
|
contentView = inflater.inflate(R.layout.frequency_picker_dialog, null)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addBeforeAfterText(
|
|
|
|
|
|
|
|
this.getString(R.string.every_x_days),
|
|
|
|
|
|
|
|
contentView.everyXDaysContainer,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addBeforeAfterText(
|
|
|
|
|
|
|
|
this.getString(R.string.x_times_per_week),
|
|
|
|
|
|
|
|
contentView.xTimesPerWeekContainer,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addBeforeAfterText(
|
|
|
|
|
|
|
|
this.getString(R.string.x_times_per_month),
|
|
|
|
|
|
|
|
contentView.xTimesPerMonthContainer,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
contentView.everyDayRadioButton.setOnClickListener {
|
|
|
|
contentView.everyDayRadioButton.setOnClickListener {
|
|
|
|
check(contentView.everyDayRadioButton)
|
|
|
|
check(contentView.everyDayRadioButton)
|
|
|
|
unfocusAll()
|
|
|
|
unfocusAll()
|
|
|
@ -84,6 +101,19 @@ class FrequencyPickerDialog(
|
|
|
|
.create()
|
|
|
|
.create()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun addBeforeAfterText(
|
|
|
|
|
|
|
|
str: String,
|
|
|
|
|
|
|
|
container: LinearLayout
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
val parts = str.split("%d")
|
|
|
|
|
|
|
|
container.addView(
|
|
|
|
|
|
|
|
TextView(activity).apply { text = parts[0].trim() }, 1,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
container.addView(
|
|
|
|
|
|
|
|
TextView(activity).apply { text = parts[1].trim() }, 3,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun onSaveClicked() {
|
|
|
|
private fun onSaveClicked() {
|
|
|
|
var numerator = 1
|
|
|
|
var numerator = 1
|
|
|
|
var denominator = 1
|
|
|
|
var denominator = 1
|
|
|
|