Improving widget handling for pinItemRequest

> Preloading widget view while dragging for smoother
  transition
> Skipping config activity and sending confirmation to
  the caller when widget is dropped

Bug: 33584624
Change-Id: Ib23e5964298296d12d9c93f38aefdf924a07368e
This commit is contained in:
Sunny Goyal
2017-01-25 11:30:06 -08:00
parent cd64d62a7e
commit 8a0dc38aeb
7 changed files with 114 additions and 20 deletions

View File

@@ -40,7 +40,7 @@ public class WidgetAddFlowHandler implements Parcelable {
mProviderInfo = providerInfo;
}
private WidgetAddFlowHandler(Parcel parcel) {
protected WidgetAddFlowHandler(Parcel parcel) {
mProviderInfo = AppWidgetProviderInfo.CREATOR.createFromParcel(parcel);
}
@@ -81,7 +81,7 @@ public class WidgetAddFlowHandler implements Parcelable {
*/
public boolean startConfigActivity(Launcher launcher, int appWidgetId, ItemInfo info,
int requestCode) {
if (mProviderInfo.configure == null) {
if (!needsConfigure()) {
return false;
}
launcher.setWaitingForResult(PendingRequestArgs.forWidgetInfo(appWidgetId, this, info));
@@ -91,6 +91,10 @@ public class WidgetAddFlowHandler implements Parcelable {
return true;
}
public boolean needsConfigure() {
return mProviderInfo.configure != null;
}
public LauncherAppWidgetProviderInfo getProviderInfo(Context context) {
return LauncherAppWidgetProviderInfo.fromProviderInfo(context, mProviderInfo);
}