the dark theme is automatically applied on startup again
This commit is contained in:
parent
c913fedee4
commit
36932f55f9
4 changed files with 9 additions and 16 deletions
|
|
@ -52,7 +52,6 @@ public class TraditionalT9 extends MainViewHandler {
|
||||||
public View onCreateInputView() {
|
public View onCreateInputView() {
|
||||||
mainView.forceCreate();
|
mainView.forceCreate();
|
||||||
initTray();
|
initTray();
|
||||||
setDarkTheme();
|
|
||||||
statusBar.setText(mInputMode);
|
statusBar.setText(mInputMode);
|
||||||
suggestionOps.set(mInputMode.getSuggestions(), mInputMode.containsGeneratedSuggestions());
|
suggestionOps.set(mInputMode.getSuggestions(), mInputMode.containsGeneratedSuggestions());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ abstract class UiHandler extends AbstractHandler {
|
||||||
protected void initTray() {
|
protected void initTray() {
|
||||||
setInputView(mainView.getView());
|
setInputView(mainView.getView());
|
||||||
createSuggestionBar();
|
createSuggestionBar();
|
||||||
|
getSuggestionOps().setDarkTheme();
|
||||||
statusBar = new StatusBar(mainView.getView());
|
statusBar = new StatusBar(mainView.getView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,8 +37,9 @@ abstract class UiHandler extends AbstractHandler {
|
||||||
public void initUi(InputMode inputMode) {
|
public void initUi(InputMode inputMode) {
|
||||||
if (mainView.create()) {
|
if (mainView.create()) {
|
||||||
initTray();
|
initTray();
|
||||||
|
} else {
|
||||||
|
getSuggestionOps().setDarkTheme();
|
||||||
}
|
}
|
||||||
setDarkTheme();
|
|
||||||
setStatusIcon(inputMode);
|
setStatusIcon(inputMode);
|
||||||
statusBar.setText(inputMode);
|
statusBar.setText(inputMode);
|
||||||
mainView.hideCommandPalette();
|
mainView.hideCommandPalette();
|
||||||
|
|
@ -49,12 +51,6 @@ abstract class UiHandler extends AbstractHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void setDarkTheme() {
|
|
||||||
mainView.setDarkTheme(settings.getDarkTheme());
|
|
||||||
getSuggestionOps().setDarkTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void setStatusIcon(InputMode mode) {
|
protected void setStatusIcon(InputMode mode) {
|
||||||
if (!InputModeKind.isPassthrough(mode) && settings.isStatusIconEnabled()) {
|
if (!InputModeKind.isPassthrough(mode) && settings.isStatusIconEnabled()) {
|
||||||
showStatusIcon(R.drawable.ic_status);
|
showStatusIcon(R.drawable.ic_status);
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,6 @@ abstract class BaseMainLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
void setDarkTheme(boolean dark) {}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getKeys
|
* getKeys
|
||||||
* Returns a list of all the usable Soft Keys. Useful for attaching click handlers and changing
|
* Returns a list of all the usable Soft Keys. Useful for attaching click handlers and changing
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import io.github.sspanak.tt9.util.Logger;
|
||||||
public class MainView {
|
public class MainView {
|
||||||
protected final TraditionalT9 tt9;
|
protected final TraditionalT9 tt9;
|
||||||
protected BaseMainLayout main;
|
protected BaseMainLayout main;
|
||||||
|
private boolean darkTheme;
|
||||||
|
|
||||||
|
|
||||||
protected MainView(TraditionalT9 tt9) {
|
protected MainView(TraditionalT9 tt9) {
|
||||||
|
|
@ -20,6 +21,11 @@ public class MainView {
|
||||||
public boolean create() {
|
public boolean create() {
|
||||||
SettingsStore settings = tt9.getSettings();
|
SettingsStore settings = tt9.getSettings();
|
||||||
|
|
||||||
|
if (darkTheme != settings.getDarkTheme()) {
|
||||||
|
darkTheme = settings.getDarkTheme();
|
||||||
|
main = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.isMainLayoutNumpad() && !(main instanceof MainLayoutNumpad)) {
|
if (settings.isMainLayoutNumpad() && !(main instanceof MainLayoutNumpad)) {
|
||||||
main = new MainLayoutNumpad(tt9);
|
main = new MainLayoutNumpad(tt9);
|
||||||
} else if (settings.isMainLayoutSmall() && (main == null || !main.getClass().equals(MainLayoutSmall.class))) {
|
} else if (settings.isMainLayoutSmall() && (main == null || !main.getClass().equals(MainLayoutSmall.class))) {
|
||||||
|
|
@ -55,10 +61,6 @@ public class MainView {
|
||||||
main.render();
|
main.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDarkTheme(boolean darkEnabled) {
|
|
||||||
main.setDarkTheme(darkEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showCommandPalette() {
|
public void showCommandPalette() {
|
||||||
if (main != null) {
|
if (main != null) {
|
||||||
main.showCommandPalette();
|
main.showCommandPalette();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue