Skip to content

Commit be1e7d4

Browse files
committed
more code review fixes
1 parent 4faa374 commit be1e7d4

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

app/src/main/java/io/github/sspanak/tt9/ime/UiHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public boolean onEvaluateFullscreenMode() {
6262
@Override
6363
protected void onInit() {
6464
if (foldDetector == null) {
65-
foldDetector = new FoldDetector(this, () -> settings.setFolded(foldDetector.isFolded()));
65+
foldDetector = new FoldDetector(this, () -> settings.setFolded(foldDetector == null || foldDetector.isFolded()));
6666
}
6767

6868
if (mainView == null) {

app/src/main/java/io/github/sspanak/tt9/preferences/screens/appearance/AppearanceScreen.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import androidx.annotation.Nullable;
44
import androidx.preference.Preference;
5+
import androidx.preference.PreferenceCategory;
56
import androidx.preference.SwitchPreferenceCompat;
67

78
import io.github.sspanak.tt9.R;
@@ -25,6 +26,7 @@ public class AppearanceScreen extends ScreenWithPreviewKeyboardHeaderFragment {
2526
protected void onCreate() {
2627
super.onCreate();
2728
createMainSection();
29+
createUnfoldedAppearanceSection();
2830
createHacksSection();
2931
enablePreviewOnChange();
3032
resetFontSize(true);
@@ -46,11 +48,6 @@ protected void createMainSection() {
4648
return;
4749
}
4850

49-
UnfoldedAppearanceLink unfoldedLink = findPreference(UnfoldedAppearanceLink.NAME);
50-
if (unfoldedLink != null) {
51-
unfoldedLink.populate(activity);
52-
}
53-
5451
(new ItemStatusIcon(findPreference(ItemStatusIcon.NAME), activity.getSettings())).populate();
5552
(new ItemSuggestionSmoothScroll(findPreference(ItemSuggestionSmoothScroll.NAME), activity.getSettings())).populate();
5653

@@ -133,6 +130,24 @@ protected void createMainSection() {
133130
}
134131

135132

133+
private void createUnfoldedAppearanceSection() {
134+
if (activity == null) {
135+
return;
136+
}
137+
138+
139+
UnfoldedAppearanceLink unfoldedLink = findPreference(UnfoldedAppearanceLink.NAME);
140+
if (unfoldedLink != null) {
141+
unfoldedLink.populate(activity);
142+
}
143+
144+
PreferenceCategory category = findPreference("category_unfolded_appearance");
145+
if (category != null) {
146+
category.setVisible(unfoldedLink != null && unfoldedLink.isVisible());
147+
}
148+
}
149+
150+
136151
private void createHacksSection() {
137152
if (activity == null) {
138153
return;

app/src/main/res/xml/prefs_screen_appearance.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto" app:orderingFromXml="true">
3-
<PreferenceCategory app:title="@string/pref_category_unfolded_appearance">
3+
<PreferenceCategory app:key="category_unfolded_appearance" app:title="@string/pref_category_unfolded_appearance">
44
<io.github.sspanak.tt9.preferences.screens.appearance.UnfoldedAppearanceLink />
55
</PreferenceCategory>
66

0 commit comments

Comments
 (0)