🐛 fix(launcher): fix settings on empty area click

This commit is contained in:
sankalp committed 2025-07-01 22:06:49 +05:45
1 parent f66307b9f0
commit 0c6d98f040
7 files changed
+76 -96

No files matched your search

@@ -1197,18 +1197,20 @@ public class LauncherActivity extends Activity implements View.OnClickListener,
loadApps();
}
@Override
@Override
public void onSwipe(Gestures.Direction direction) {
if (direction == Gestures.Direction.SWIPE_UP) {
// Open search bar on swipe up (down to up gesture)
if (direction == Gestures.Direction.SWIPE_RIGHT) {
searching = true;
mSearchBox.setText("");
mSearchBox.setVisibility(View.VISIBLE);
mSearchBox.requestFocus();
imm.showSoftInput(mSearchBox, InputMethodManager.SHOW_IMPLICIT);
} else if (direction == Gestures.Direction.SWIPE_DOWN) {
// Open notification panel on swipe down (up to down gesture)
NotificationPanelManager.expandNotificationPanel(this);
} else if (direction == Gestures.Direction.SWIPE_LEFT) {
if (searching) {
mSearchBox.setVisibility(View.GONE);
imm.hideSoftInputFromWindow(mSearchBox.getWindowToken(), 0);
onResume();
}
}
}
@@ -1,20 +1,12 @@
/*
* Lunox Launcher
* Copyright (C) 2024 Sankalp
* Lunox
* Copyright (C) 2025 Sankalp Tharu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This file is part of Last Launcher (forked).
* Licensed under the GNU General Public License v3 or later.
* See <http://www.gnu.org/licenses/>.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package io.github.sankalp.lunox.dialogs;
@@ -282,13 +282,8 @@ public class GlobalSettingsDialog extends Dialog implements View.OnClickListener
}
private void defaultSettings() {
if (!BuildConfig.DEBUG) {
DbUtils.clearDB();
launcherActivity.recreate();
} else {
//DO SOME ESTER EGG.. FOR DEBUG BUILD..
}
DbUtils.clearDB();
launcherActivity.recreate();
}
private void toggleDoubleTapToLock() {
@@ -1,20 +1,12 @@
/*
* Lunox Launcher
* Copyright (C) 2024 Sankalp
* Lunox
* Copyright (C) 2025 Sankalp Tharu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This file is part of Last Launcher (forked).
* Licensed under the GNU General Public License v3 or later.
* See <http://www.gnu.org/licenses/>.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package io.github.sankalp.lunox.services;
@@ -32,41 +24,41 @@ import android.view.accessibility.AccessibilityEvent;
* This service can perform global actions like simulating power key press
*/
public class LockScreenAccessibilityService extends AccessibilityService {
private static final String TAG = "LockScreenAccessibilityService";
private static LockScreenAccessibilityService instance;
public static final String ACTION_LOCK_SCREEN = "io.github.sankalp.lunox.ACTION_LOCK_SCREEN";
@Override
public void onCreate() {
super.onCreate();
instance = this;
Log.d(TAG, "Accessibility service created");
}
@Override
public void onDestroy() {
super.onDestroy();
instance = null;
Log.d(TAG, "Accessibility service destroyed");
}
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
// We don't need to handle accessibility events for this use case
}
@Override
public void onInterrupt() {
Log.d(TAG, "Accessibility service interrupted");
}
@Override
protected boolean onKeyEvent(KeyEvent event) {
return super.onKeyEvent(event);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null && ACTION_LOCK_SCREEN.equals(intent.getAction())) {
@@ -74,7 +66,7 @@ public class LockScreenAccessibilityService extends AccessibilityService {
}
return START_NOT_STICKY;
}
/**
* Lock the screen using accessibility service global action
*/
@@ -96,7 +88,7 @@ public class LockScreenAccessibilityService extends AccessibilityService {
Log.e(TAG, "Failed to lock screen", e);
}
}
/**
* Simulate power button press using accessibility service
*/
@@ -113,14 +105,14 @@ public class LockScreenAccessibilityService extends AccessibilityService {
Log.e(TAG, "Failed to simulate power button", e);
}
}
/**
* Get the current instance of the accessibility service
*/
public static LockScreenAccessibilityService getInstance() {
return instance;
}
/**
* Check if the accessibility service is running
*/
@@ -1,20 +1,12 @@
/*
* Lunox Launcher
* Copyright (C) 2024 Sankalp
* Lunox
* Copyright (C) 2025 Sankalp Tharu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This file is part of Last Launcher (forked).
* Licensed under the GNU General Public License v3 or later.
* See <http://www.gnu.org/licenses/>.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package io.github.sankalp.lunox.utils;
@@ -1,20 +1,12 @@
/*
* Last Launcher
* Copyright (C) 2019,2020 Shubham Tyagi
* Lunox
* Copyright (C) 2025 Sankalp Tharu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This file is part of Last Launcher (forked).
* Licensed under the GNU General Public License v3 or later.
* See <http://www.gnu.org/licenses/>.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package io.github.sankalp.lunox.utils;
@@ -28,9 +20,9 @@ import java.lang.reflect.Method;
* Utility class to manage notification panel expansion
*/
public class NotificationPanelManager {
private static final String TAG = "NotificationPanelManager";
/**
* Attempts to expand the notification panel using reflection
* @param context The application context
@@ -40,15 +32,15 @@ public class NotificationPanelManager {
try {
// Get the StatusBarManager service
Object statusBarService = context.getSystemService("statusbar");
if (statusBarService == null) {
Log.w(TAG, "StatusBar service not available");
return false;
}
Class<?> statusBarManager = Class.forName("android.app.StatusBarManager");
Method expandMethod;
// Different method names for different Android versions
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
// Android 4.2+ uses expandNotificationsPanel
@@ -57,20 +49,20 @@ public class NotificationPanelManager {
// Older versions use expand
expandMethod = statusBarManager.getMethod("expand");
}
expandMethod.setAccessible(true);
expandMethod.invoke(statusBarService);
Log.d(TAG, "Notification panel expanded successfully");
return true;
} catch (Exception e) {
Log.e(TAG, "Failed to expand notification panel: " + e.getMessage());
e.printStackTrace();
return false;
}
}
/**
* Attempts to collapse the notification panel using reflection
* @param context The application context
@@ -80,15 +72,15 @@ public class NotificationPanelManager {
try {
// Get the StatusBarManager service
Object statusBarService = context.getSystemService("statusbar");
if (statusBarService == null) {
Log.w(TAG, "StatusBar service not available");
return false;
}
Class<?> statusBarManager = Class.forName("android.app.StatusBarManager");
Method collapseMethod;
// Different method names for different Android versions
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
// Android 4.2+ uses collapsePanels
@@ -97,13 +89,13 @@ public class NotificationPanelManager {
// Older versions use collapse
collapseMethod = statusBarManager.getMethod("collapse");
}
collapseMethod.setAccessible(true);
collapseMethod.invoke(statusBarService);
Log.d(TAG, "Notification panel collapsed successfully");
return true;
} catch (Exception e) {
Log.e(TAG, "Failed to collapse notification panel: " + e.getMessage());
e.printStackTrace();