Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LMOFreeForm support #5100

Closed
wants to merge 2 commits into from

Conversation

elisenlebkuch
Copy link

Description

#5096

Type of change

❌ General change (non-breaking change that doesn't fit the below categories like copyediting)
❌ Bug fix (non-breaking change which fixes an issue)
✅ New feature (non-breaking change which adds functionality)
❌ Breaking change (fix or feature that would cause existing functionality to not work as expected)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +287 to +318
class FloatingSystemShortcut extends SystemShortcut<RecentsViewContainer> {
private static final String FREEFORM_PACKAGE = "com.libremobileos.freeform";
private static final String FREEFORM_INTENT = "com.libremobileos.freeform.START_FREEFORM";
private final TaskView mTaskView;
public FloatingSystemShortcut(RecentsViewContainer container, TaskContainer taskContainer) {
// TODO new icon?
super(R.drawable.float_portrait_2_24px, R.string.floating_window,
container, taskContainer.getItemInfo(), taskContainer.getTaskView());
mTaskView = taskContainer.getTaskView();
}
@Override
public void onClick(View view) {
dismissTaskMenuView();
RecentsView rv = mTarget.getOverviewPanel();
rv.switchToScreenshot(() -> {
rv.finishRecentsAnimation(true /* toRecents */, false /* shouldPip */, () -> {
mTarget.returnToHomescreen();
rv.getHandler().post(this::startLmoFreeform);
});
});
}
private void startLmoFreeform() {
final Task task = mTaskView.getFirstTask();
final Intent intent = new Intent(FREEFORM_INTENT)
.setPackage(FREEFORM_PACKAGE)
.putExtra("packageName", task.key.getPackageName())
.putExtra("activityName", task.getTopComponent().getClassName())
.putExtra("userId", task.key.userId)
.putExtra("taskId", task.key.id);
mTarget.asContext().sendBroadcast(intent);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it here : TaskShortcutFactory.kt

Comment on lines +429 to +439
TaskShortcutFactory FLOATING = new TaskShortcutFactory() {
@Override
public List<SystemShortcut> getShortcuts(RecentsViewContainer container,
TaskContainer taskContainer) {
final Task task = taskContainer.getTask();
if (!task.isDockable) {
return null;
}
return Collections.singletonList(new FloatingSystemShortcut(container, taskContainer));
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one too : TaskShortcutFactory.kt

@@ -500,4 +500,7 @@
<string name="ps_add_button_label">Install</string>
<!-- Content description for install app icon -->
<string name="ps_add_button_content_description">Install apps to Private Space</string>

<!-- Floating window -->
<string name="floating_window">Floating</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move it in lawnchair string resources : string.xml

Comment on lines +386 to +414
public static final Factory<ActivityContext> FREE_FORM = (activity, itemInfo, originalView) ->
new FreeForm(activity, itemInfo, originalView);
public static class FreeForm<T extends ActivityContext> extends SystemShortcut<T> {
private final String mPackageName;
private final ComponentName mComponentName;
private final int mUserId;

public FreeForm(T target, ItemInfo itemInfo, View originalView) {
super(R.drawable.ic_caption_desktop_button_foreground, R.string.recent_task_option_freeform, target, itemInfo, originalView);
mPackageName = itemInfo.getTargetComponent().getPackageName();
mComponentName = itemInfo.getTargetComponent();
mUserId = originalView.getContext().getUserId();
}
@Override
public void onClick(View view) {
if (mPackageName != null) {
startLmoFreeform(view.getContext());
AbstractFloatingView.closeAllOpenViews(((ActivityContext) mTarget));
}
}
private void startLmoFreeform(Context context) {
final Intent intent = new Intent("com.libremobileos.freeform.START_FREEFORM")
.setPackage("com.libremobileos.freeform")
.putExtra("packageName", mPackageName)
.putExtra("activityName", mComponentName.getClassName())
.putExtra("userId", mUserId);
context.sendBroadcast(intent);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to LawnchairShortcut.kt

the usage can be found here

@@ -43,13 +43,16 @@
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission android:name="android.permission.ACCESS_RESTRICTED_SETTINGS" />

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also avoid white space changing if possible Thanks!

Comment on lines +53 to +55
<!-- Floating window -->
<uses-permission android:name="com.yaap.permission.START_FREEFORM" />

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this too in here Thanks!

@elisenlebkuch
Copy link
Author

elisenlebkuch commented Jan 15, 2025

Closing for now, as I have no way to test it because qickswitch doesn't work on my rom (A15 QPR2) at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants