Add an item in OptionsPopupView to jump to system settings (#3295)

This commit is contained in:
Goooler authored and GitHub committed 2023-02-09 18:04:15 +08:00
1 parent 89552e6eb3
commit a456e52220
3 files changed
+17 -1

No files matched your search

@@ -28,6 +28,7 @@ import android.content.Intent;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.provider.Settings;
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -195,9 +196,14 @@ public class OptionsPopupView extends ArrowPopup<Launcher>
IGNORE,
OptionsPopupView::toggleHomeScreenLock));
}
options.add(new OptionItem(launcher,
R.string.system_settings,
R.drawable.ic_setting,
IGNORE,
OptionsPopupView::startSystemSettings));
options.add(new OptionItem(launcher,
R.string.settings_button_text,
R.drawable.ic_setting,
R.drawable.ic_home_screen,
LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS,
OptionsPopupView::startSettings));
if (!lockHomeScreen && !WidgetsModel.GO_DISABLE_WIDGETS) {
@@ -281,6 +287,13 @@ public class OptionsPopupView extends ArrowPopup<Launcher>
return true;
}
private static boolean startSystemSettings(View view) {
final Launcher launcher = Launcher.getLauncher(view.getContext());
final Intent intent = new Intent(Settings.ACTION_SETTINGS);
launcher.startActivity(intent);
return true;
}
static WorkspaceItemInfo placeholderInfo(Intent intent) {
WorkspaceItemInfo placeholderInfo = new WorkspaceItemInfo();
placeholderInfo.intent = intent;