Page 1 of 1

Copying widget items doesn't work as intended

Posted: Sun Apr 07, 2019 7:31 pm
by dew
When copying widgets I always get errors that the object could not be found. Tapping the element then requires to re-configure the widget. This is not really a copy its like adding a fresh instance of the same widget with no configuration and additionally getting an error message.

Please have a look at the attached screenshots. In the first screen you see a Dash Clock widget. It simple and only contains a simple weather element. Copying the widget [[+] leads to the error seen in the second screen :(

Re: Copying widget items doesn't work as intended

Posted: Sun Apr 07, 2019 9:34 pm
by TrianguloY
I was going to say that coping a widget properties is not possible because Android saves the information internally. However restoring a backup does restore the widgets properties (not always) so maybe there is a chance this is just a bug that can be fixed...not sure though.

Re: Copying widget items doesn't work as intended

Posted: Mon Apr 08, 2019 6:12 am
by Pierrot
There's no real way to copy a widget. It needs three things:
  1. ask the remote app for existing data
  2. ask the remote app to create a new widget
  3. ask the remote app to import the data
1. is possible, but using a non standard interface. It only works for widget providers that supports it, that is: quite a few but among them are big players.
2. is possible using standard Android APIs
3. is possible using the same non standard interface, BUT it's uses to recreate the same widget, not a copy. There's no way to guaranty that the widget provider will support using the same set of data for two distinct widget.

For these reasons, I didn't spent too much effort on widget copy. It's reset to an invalid one.

Re: Copying widget items doesn't work as intended

Posted: Mon Apr 08, 2019 7:48 am
by dew
Ok, I understand. It's a bit strange that Android doesn't support standard API calls for 1 + 3. Because it would allow a preset manager and stuff. Really strange.

But if it's not too much effort to use the non-guaranteed non-standard interface for 1 + 3 would you eventually add this functionality as an option to the settings in case of widget copies, that widgets can be TRIED to be copied like this - with no guarantee that it's successful. But better try and fail than not try?

Thanks :)

Re: Copying widget items doesn't work as intended

Posted: Mon Apr 08, 2019 8:31 am
by Pierrot
That's a bit problematic, hence the reason for the non implemented feature. The process is asynchronous and might lead to the app being stopped in the meantime, hence the context need to be saved, and that's boring. (lazyness here)