From 740866626f0d8dae5ffe74dfd819235ea016f811 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 4 Jul 2025 18:10:40 +0545 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(launcher,=20dialogs):=20show?= =?UTF-8?q?=20empty=20state=20in=20hidden/frozen=20apps=20dialogs,=20impro?= =?UTF-8?q?ve=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sankalp/lunox/LauncherActivity.java | 40 ++++++++++++++++++- .../lunox/dialogs/FrozenAppsDialogs.java | 9 +++++ .../lunox/dialogs/HiddenAppsDialogs.java | 9 +++++ app/src/main/res/layout/activity_launcher.xml | 10 +++++ .../main/res/layout/dialog_hidden_apps.xml | 10 +++++ 5 files changed, 76 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/sankalp/lunox/LauncherActivity.java b/app/src/main/java/io/github/sankalp/lunox/LauncherActivity.java index e255b44..77a699a 100644 --- a/app/src/main/java/io/github/sankalp/lunox/LauncherActivity.java +++ b/app/src/main/java/io/github/sankalp/lunox/LauncherActivity.java @@ -197,6 +197,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener, }; private SearchTask mSearchTask; private Dialog globalSettingsDialog; + private TextView bottomLabel; //endregion private void showSearchResult(ArrayList filteredApps) { @@ -330,6 +331,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener, // Show onboarding tutorial for first-time users showOnboardingTutorialIfNeeded(); + bottomLabel = findViewById(R.id.bottom_label); } private void setSearchBoxListeners() { @@ -1158,12 +1160,46 @@ public class LauncherActivity extends Activity implements View.OnClickListener, // show the hidden app dialog public void showHiddenApps() { - showDialog(new HiddenAppsDialogs(this, mAppsList), false); + // Check for hidden apps + boolean hasHidden = false; + for (Apps app : mAppsList) { + if (app.isHidden()) { + hasHidden = true; + break; + } + } + if (hasHidden) { + showDialog(new HiddenAppsDialogs(this, mAppsList), false); + if (bottomLabel != null) bottomLabel.setVisibility(View.GONE); + } else { + if (bottomLabel != null) { + bottomLabel.setText("No apps are hidden"); + bottomLabel.setVisibility(View.VISIBLE); + bottomLabel.postDelayed(() -> bottomLabel.setVisibility(View.GONE), 3000); + } + } } // show the frozen app dialog public void showFrozenApps() { - showDialog(new FrozenAppsDialogs(this, mAppsList), false); + // Check for frozen apps + boolean hasFrozen = false; + for (Apps app : mAppsList) { + if (app.isSizeFrozen()) { + hasFrozen = true; + break; + } + } + if (hasFrozen) { + showDialog(new FrozenAppsDialogs(this, mAppsList), false); + if (bottomLabel != null) bottomLabel.setVisibility(View.GONE); + } else { + if (bottomLabel != null) { + bottomLabel.setText("No apps are frozen"); + bottomLabel.setVisibility(View.VISIBLE); + bottomLabel.postDelayed(() -> bottomLabel.setVisibility(View.GONE), 3000); + } + } } //set the flow layout alignment it is called from global settings diff --git a/app/src/main/java/io/github/sankalp/lunox/dialogs/FrozenAppsDialogs.java b/app/src/main/java/io/github/sankalp/lunox/dialogs/FrozenAppsDialogs.java index cfaae77..64cb10e 100644 --- a/app/src/main/java/io/github/sankalp/lunox/dialogs/FrozenAppsDialogs.java +++ b/app/src/main/java/io/github/sankalp/lunox/dialogs/FrozenAppsDialogs.java @@ -59,6 +59,15 @@ public class FrozenAppsDialogs extends Dialog { adapter.setOnClickListener(this::confirmationAndRemove); + // Show or hide the empty label based on list content + android.widget.TextView emptyLabel = findViewById(R.id.empty_label); + if (frozenApps.isEmpty()) { + emptyLabel.setVisibility(android.view.View.VISIBLE); + emptyLabel.setText("No apps are frozen"); + } else { + emptyLabel.setVisibility(android.view.View.GONE); + } + } private void confirmationAndRemove(Apps apps, View view) { diff --git a/app/src/main/java/io/github/sankalp/lunox/dialogs/HiddenAppsDialogs.java b/app/src/main/java/io/github/sankalp/lunox/dialogs/HiddenAppsDialogs.java index 504c706..f051e1f 100644 --- a/app/src/main/java/io/github/sankalp/lunox/dialogs/HiddenAppsDialogs.java +++ b/app/src/main/java/io/github/sankalp/lunox/dialogs/HiddenAppsDialogs.java @@ -59,6 +59,15 @@ public class HiddenAppsDialogs extends Dialog { listView.setAdapter(adapter); adapter.setOnClickListener(this::confirmationAndRemove); + // Show or hide the empty label based on list content + android.widget.TextView emptyLabel = findViewById(R.id.empty_label); + if (hiddenApps.isEmpty()) { + emptyLabel.setVisibility(android.view.View.VISIBLE); + emptyLabel.setText("No apps are hidden"); + } else { + emptyLabel.setVisibility(android.view.View.GONE); + } + } diff --git a/app/src/main/res/layout/activity_launcher.xml b/app/src/main/res/layout/activity_launcher.xml index 39dea04..ce7877e 100644 --- a/app/src/main/res/layout/activity_launcher.xml +++ b/app/src/main/res/layout/activity_launcher.xml @@ -50,5 +50,15 @@ android:text="@string/set_as_default_launcher" /> + + diff --git a/app/src/main/res/layout/dialog_hidden_apps.xml b/app/src/main/res/layout/dialog_hidden_apps.xml index 4be4386..1464a06 100644 --- a/app/src/main/res/layout/dialog_hidden_apps.xml +++ b/app/src/main/res/layout/dialog_hidden_apps.xml @@ -32,4 +32,14 @@ android:layout_margin="6dp" android:foregroundGravity="center_vertical|center|center_horizontal" /> + + \ No newline at end of file