diff --git a/app/src/main/java/ir/hanzodev1375/ghostide/settings/BackgroundPluginSettingSection.java b/app/src/main/java/ir/hanzodev1375/ghostide/settings/BackgroundPluginSettingSection.java index 61c86df..b04d6f8 100644 --- a/app/src/main/java/ir/hanzodev1375/ghostide/settings/BackgroundPluginSettingSection.java +++ b/app/src/main/java/ir/hanzodev1375/ghostide/settings/BackgroundPluginSettingSection.java @@ -19,7 +19,12 @@ public BackgroundPluginSettingSection(SettingActivity activity) { @Override protected List buildItems() { List items = new ArrayList<>(); - items.add(textItem(R.string.background_plugin_title, currentPluginDescription())); + List plugins = + BackgroundPluginManager.listInstalled(activity); + // With no background plugin installed there is nothing to pick; leave the list empty so the + // host hides the whole section instead of showing a dead row. + if (plugins.isEmpty()) return items; + items.add(textItem(R.string.background_plugin_title, describeSelected(plugins))); return items; } @@ -29,12 +34,15 @@ public void onItemClick(int position) { } private String currentPluginDescription() { + return describeSelected(BackgroundPluginManager.listInstalled(activity)); + } + + private String describeSelected(List plugins) { String selected = BackgroundPluginManager.selected(activity); if (selected == null || selected.isEmpty()) { return getString(R.string.background_plugin_default); } - for (BackgroundPluginManager.BackgroundPluginEntry entry : - BackgroundPluginManager.listInstalled(activity)) { + for (BackgroundPluginManager.BackgroundPluginEntry entry : plugins) { if (entry.id().equals(selected)) { if (entry.version() == null || entry.version().isEmpty()) { return entry.name(); diff --git a/app/src/main/java/ir/hanzodev1375/ghostide/settings/IconPackSettingSection.java b/app/src/main/java/ir/hanzodev1375/ghostide/settings/IconPackSettingSection.java index 197670a..5b6431e 100644 --- a/app/src/main/java/ir/hanzodev1375/ghostide/settings/IconPackSettingSection.java +++ b/app/src/main/java/ir/hanzodev1375/ghostide/settings/IconPackSettingSection.java @@ -23,7 +23,11 @@ public IconPackSettingSection(SettingActivity activity, PreferencesUtils prefs) @Override protected List buildItems() { List items = new ArrayList<>(); - items.add(textItem(R.string.icon_pack_title, currentPackDescription())); + List packs = IconPackManager.listInstalled(activity); + // With no icon pack plugin installed there is nothing to pick; leave the list empty so the + // host hides the whole section instead of showing a dead row. + if (packs.isEmpty()) return items; + items.add(textItem(R.string.icon_pack_title, describeSelected(packs))); return items; } @@ -33,11 +37,15 @@ public void onItemClick(int position) { } private String currentPackDescription() { + return describeSelected(IconPackManager.listInstalled(activity)); + } + + private String describeSelected(List packs) { String selected = prefs.getIconPack(); if (selected == null || selected.isEmpty()) { return getString(R.string.icon_pack_default); } - for (IconPackManager.IconPackEntry entry : IconPackManager.listInstalled(activity)) { + for (IconPackManager.IconPackEntry entry : packs) { if (entry.id().equals(selected)) { if (entry.version() == null || entry.version().isEmpty()) { return entry.name();