mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Handle widget taps in WidgetPickerActivity.
Bug: 307306823 Test: atest Launcher3Tests Flag: NA Change-Id: I05cd42eae91447cfe99165096a735f6e04257203
This commit is contained in:
@@ -22,7 +22,10 @@ import static android.view.WindowInsets.Type.statusBars;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsetsController;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@@ -32,6 +35,7 @@ import com.android.launcher3.dragndrop.SimpleDragLayer;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.popup.PopupDataProvider;
|
||||
import com.android.launcher3.widget.BaseWidgetSheet;
|
||||
import com.android.launcher3.widget.WidgetCell;
|
||||
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
|
||||
import com.android.launcher3.widget.picker.WidgetsFullSheet;
|
||||
|
||||
@@ -81,6 +85,23 @@ public class WidgetPickerActivity extends BaseActivity {
|
||||
return mDragLayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View.OnClickListener getItemOnClickListener() {
|
||||
return v -> {
|
||||
final AppWidgetProviderInfo info =
|
||||
(v instanceof WidgetCell) ? ((WidgetCell) v).getWidgetItem().widgetInfo : null;
|
||||
if (info == null || info.provider == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setResult(RESULT_OK, new Intent()
|
||||
.putExtra(Intent.EXTRA_COMPONENT_NAME, info.provider)
|
||||
.putExtra(Intent.EXTRA_USER, info.getProfile()));
|
||||
|
||||
finish();
|
||||
};
|
||||
}
|
||||
|
||||
private void refreshAndBindWidgets() {
|
||||
MODEL_EXECUTOR.execute(() -> {
|
||||
LauncherAppState app = LauncherAppState.getInstance(this);
|
||||
|
||||
Reference in New Issue
Block a user