[android-developers] Re: How to disable Buttons on a Widget
Hi Jeff, I've tried the two options you mentioned below for disabling a button on a widget, but although they can have the appearance of a disabled button from the image, the button is still in an enabled state and does not have the standard Android appearance of a disabled button. I looked into swapping out two buttons using VISIBLE/GONE, but I don't see that "enabled" state is supported in the XML layout definition for an ImageButton. Am I missing somthing? I don't see any way to put a button into a disabled state on a widget. Not directly, but you could send a widget update that swaps out the drawable used and clears the PendingIntent. Or, keep two buttons in your layout, and visible/gone them as needed. Thanks, Blake On Jun 16, 7:19 pm, "Blake B." wrote: > I suspected as much with the Google Search "widget". Thanks for > clarifying. And the results of the grep for @RemotableViewMethod > annotation are very useful. > > Great responses to every question! Thanks Jeff! > > On Jun 16, 3:25 pm, Jeff Sharkey wrote: > > > > > > Is it possible to disable a button on a Cupcake desktop widget? > > > Not directly, but you could send a widget update that swaps out the > > drawable used and clears the PendingIntent. Or, keep two buttons in > > your layout, and visible/gone them as needed. > > > > The current Google Search widget disables the search button until a > > > user enters text, then the button is disabled. Is this only allowed > > > for "special widgets", or is there an approach available to third- > > > party widgets? > > > The Google Search bar on the desktop looks and feels like a widget, > > but it isn't a real widget. It lives directly in the Launcher app, > > which is how it does things like auto completion. Other > > AppWidgetHosts are free to include their custom elements like this: > > >http://d.android.com/reference/android/appwidget/AppWidgetManager.htm... > > > > More generally, is there a list somewhere of the allowed / disallowed > > > calls to widget views via the RemoteViews.set() approach? I've > > > also encountered that "setSelected" and some others are not allowed. > > > The allowed methods are simply marked with the @RemotableViewMethod > > annotation, here's a quick grep across the Cupcake tree: > > >http://pastebin.com/f45b5130a > > > -- > > Jeff Sharkey > > jshar...@android.com- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to disable Buttons on a Widget
I suspected as much with the Google Search "widget". Thanks for clarifying. And the results of the grep for @RemotableViewMethod annotation are very useful. Great responses to every question! Thanks Jeff! On Jun 16, 3:25 pm, Jeff Sharkey wrote: > > Is it possible to disable a button on a Cupcake desktop widget? > > Not directly, but you could send a widget update that swaps out the > drawable used and clears the PendingIntent. Or, keep two buttons in > your layout, and visible/gone them as needed. > > > The current Google Search widget disables the search button until a > > user enters text, then the button is disabled. Is this only allowed > > for "special widgets", or is there an approach available to third- > > party widgets? > > The Google Search bar on the desktop looks and feels like a widget, > but it isn't a real widget. It lives directly in the Launcher app, > which is how it does things like auto completion. Other > AppWidgetHosts are free to include their custom elements like this: > > http://d.android.com/reference/android/appwidget/AppWidgetManager.htm... > > > More generally, is there a list somewhere of the allowed / disallowed > > calls to widget views via the RemoteViews.set() approach? I've > > also encountered that "setSelected" and some others are not allowed. > > The allowed methods are simply marked with the @RemotableViewMethod > annotation, here's a quick grep across the Cupcake tree: > > http://pastebin.com/f45b5130a > > -- > Jeff Sharkey > jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to disable Buttons on a Widget
> Is it possible to disable a button on a Cupcake desktop widget? Not directly, but you could send a widget update that swaps out the drawable used and clears the PendingIntent. Or, keep two buttons in your layout, and visible/gone them as needed. > The current Google Search widget disables the search button until a > user enters text, then the button is disabled. Is this only allowed > for "special widgets", or is there an approach available to third- > party widgets? The Google Search bar on the desktop looks and feels like a widget, but it isn't a real widget. It lives directly in the Launcher app, which is how it does things like auto completion. Other AppWidgetHosts are free to include their custom elements like this: http://d.android.com/reference/android/appwidget/AppWidgetManager.html#EXTRA_CUSTOM_INFO > More generally, is there a list somewhere of the allowed / disallowed > calls to widget views via the RemoteViews.set() approach? I've > also encountered that "setSelected" and some others are not allowed. The allowed methods are simply marked with the @RemotableViewMethod annotation, here's a quick grep across the Cupcake tree: http://pastebin.com/f45b5130a -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---