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 = activity.window.navigationBarColor =
ContextCompat.getColor(activity, R.color.black) 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 listHabitsScreen: ListHabitsScreen
val listHabitsSelectionMenu: ListHabitsSelectionMenu val listHabitsSelectionMenu: ListHabitsSelectionMenu
val showHabitScreen: ShowHabitScreen val showHabitScreen: ShowHabitScreen
val themeSwitcher: ThemeSwitcher val themeSwitcher: AndroidThemeSwitcher
} }

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

Loading…
Cancel
Save