Fix EditHabitDialog theme

pull/538/head
Alinson S. Xavier 6 years ago
parent cc05543692
commit 5191290188

@ -60,4 +60,11 @@ class AndroidThemeSwitcher
activity.window.navigationBarColor =
ContextCompat.getColor(activity, R.color.black)
}
fun getDialogTheme(): Int {
return when {
isNightMode -> R.style.DarkDialogWithTitle
else -> R.style.DialogWithTitle
}
}
}

@ -51,5 +51,5 @@ interface HabitsActivityComponent {
val listHabitsScreen: ListHabitsScreen
val listHabitsSelectionMenu: ListHabitsSelectionMenu
val showHabitScreen: ShowHabitScreen
val themeSwitcher: ThemeSwitcher
val themeSwitcher: AndroidThemeSwitcher
}

@ -41,7 +41,6 @@ import org.isoron.uhabits.core.preferences.*;
import butterknife.*;
import static android.view.View.GONE;
import static org.isoron.uhabits.core.ui.ThemeSwitcher.THEME_LIGHT;
public class EditHabitDialog extends AppCompatDialogFragment
{
@ -78,13 +77,8 @@ public class EditHabitDialog extends AppCompatDialogFragment
@Override
public int getTheme()
{
HabitsApplicationComponent component =
((HabitsApplication) getContext().getApplicationContext()).getComponent();
if(component.getPreferences().getTheme() == THEME_LIGHT)
return R.style.DialogWithTitle;
else
return R.style.DarkDialogWithTitle;
HabitsActivity activity = (HabitsActivity) getActivity();
return activity.getComponent().getThemeSwitcher().getDialogTheme();
}
@Override

Loading…
Cancel
Save