✨ feat(launcher, dialogs): show empty state in hidden/frozen apps dialogs, improve UI
This commit is contained in:
5 files changed
+76
-2
No files matched your search
@@ -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<Apps> 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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,5 +50,15 @@
|
||||
android:text="@string/set_as_default_launcher" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bottom_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:padding="12dp"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -32,4 +32,14 @@
|
||||
android:layout_margin="6dp"
|
||||
android:foregroundGravity="center_vertical|center|center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="No apps are hidden"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:padding="16dp"
|
||||
android:textColor="@android:color/darker_gray" />
|
||||
|
||||
</LinearLayout>
|
||||
Reference in new issue
Block a user