Removes intermediate "Habit type" dialog upon creation

Defaults to a Yes/No habit for now.
pull/419/head
Jake Powell 7 years ago
parent bf8c14fc03
commit f7bebf0b3a

@ -140,7 +140,7 @@ public class EditHabitDialog extends AppCompatDialogFragment
private int getTypeFromArguments()
{
return getArguments().getInt(BUNDLE_HABIT_TYPE);
return Habit.YES_NO_HABIT;
}
private void initDependencies()

@ -35,21 +35,18 @@ public class EditHabitDialogFactory
{
}
public EditHabitDialog createBoolean()
public EditHabitDialog createNumerical()
{
EditHabitDialog dialog = new EditHabitDialog();
Bundle args = new Bundle();
args.putInt(BUNDLE_HABIT_TYPE, Habit.YES_NO_HABIT);
args.putInt(BUNDLE_HABIT_TYPE, Habit.NUMBER_HABIT);
dialog.setArguments(args);
return dialog;
}
public EditHabitDialog createNumerical()
public EditHabitDialog create()
{
EditHabitDialog dialog = new EditHabitDialog();
Bundle args = new Bundle();
args.putInt(BUNDLE_HABIT_TYPE, Habit.NUMBER_HABIT);
dialog.setArguments(args);
return dialog;
}

@ -137,26 +137,9 @@ class ListHabitsScreen
activity.startActivity(intent)
}
fun showCreateBooleanHabitScreen() {
val dialog = editHabitDialogFactory.createBoolean()
activity.showDialog(dialog, "editHabit")
}
override fun showCreateHabitScreen() {
if (!preferences.isNumericalHabitsFeatureEnabled) {
showCreateBooleanHabitScreen()
return
}
val dialog = AlertDialog.Builder(activity)
.setTitle("Type of habit")
.setItems(R.array.habitTypes) { _, which ->
if (which == 0) showCreateBooleanHabitScreen()
else showCreateNumericalHabitScreen()
}
.create()
dialog.show()
val dialog = editHabitDialogFactory.create()
activity.showDialog(dialog, "editHabit")
}
override fun showDeleteConfirmationScreen(callback: OnConfirmedCallback) {
@ -236,11 +219,6 @@ class ListHabitsScreen
}
}
private fun showCreateNumericalHabitScreen() {
val dialog = editHabitDialogFactory.createNumerical()
activity.showDialog(dialog, "editHabit")
}
private fun onImportData(file: File, onFinished: () -> Unit) {
taskRunner.execute(importTaskFactory.create(file) { result ->
if (result == ImportDataTask.SUCCESS) {

Loading…
Cancel
Save