[android-developers] Re: Resizable appwidgets and backward compatibility

2011-06-22 Thread String
OK, here's an absolute kludge but one which seems to work.

In my resources/xml directory, I still have the four existing 
AppWidgetProviderInfo metadata files for backward compatibility:

mywidget_1x1.xml
mywidget_2x2.xml
mywidget_3x3.xml
mywidget_4x4.xml


Each of these is for a different size of widget as used pre-3.1, with a 
pretty basic XML, like this:

?xml version=1.0 encoding=utf-8?
appwidget-provider 
xmlns:android=http://schemas.android.com/apk/res/android; 
android:initialLayout=@layout/mywidget_1x1
android:minWidth=72dp
android:minHeight=72dp
/appwidget-provider


Then for 3.1, my resources/xml-v12 directory looks like this:

mywidget_1x1.xml
mywidget_2x2.xml
mywidget_3x3.xml
mywidget_4x4.xml
*mywidget_resizable.xml*


The key is that mywidget_resizable.xml is the only live one here, defining 
the single resizable widget for 3.1. The other four are all dummy XML files 
like this:

?xml version=1.0 encoding=utf-8?
foo /


It doesn't matter what you put in them as long as they're valid XML but *not
* a valid AppWidgetProviderInfo structure. That way, they'll override the 
earlier-version XMLs, but the OS will be unable to parse appwidgets out of 
them, so won't show them to the user in the appwidget picker. Naturally, all 
five need to be defined in your manifest.

Like I said, it's a horrible kludge, but I'm not seeing any actual problems 
with it If anyone has a better idea, I'd still like to hear it.

String

-- 
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: Resizable appwidgets and backward compatibility

2011-06-22 Thread Zsolt Vasvari
The receiver element has an enabled attribute.  Have your tried
setting that to from a boolean resources that you can define in as
true in values and false in values-v12?

By the way, I would use V11, why restrict it to V12?

On Jun 22, 5:49 pm, String sterling.ud...@googlemail.com wrote:
 OK, here's an absolute kludge but one which seems to work.

 In my resources/xml directory, I still have the four existing
 AppWidgetProviderInfo metadata files for backward compatibility:

 mywidget_1x1.xml
 mywidget_2x2.xml
 mywidget_3x3.xml
 mywidget_4x4.xml

 Each of these is for a different size of widget as used pre-3.1, with a
 pretty basic XML, like this:

 ?xml version=1.0 encoding=utf-8?
 appwidget-provider
 xmlns:android=http://schemas.android.com/apk/res/android;
     android:initialLayout=@layout/mywidget_1x1
     android:minWidth=72dp
     android:minHeight=72dp
 /appwidget-provider

 Then for 3.1, my resources/xml-v12 directory looks like this:

 mywidget_1x1.xml
 mywidget_2x2.xml
 mywidget_3x3.xml
 mywidget_4x4.xml
 *mywidget_resizable.xml*

 The key is that mywidget_resizable.xml is the only live one here, defining
 the single resizable widget for 3.1. The other four are all dummy XML files
 like this:

 ?xml version=1.0 encoding=utf-8?
 foo /

 It doesn't matter what you put in them as long as they're valid XML but *not
 * a valid AppWidgetProviderInfo structure. That way, they'll override the
 earlier-version XMLs, but the OS will be unable to parse appwidgets out of
 them, so won't show them to the user in the appwidget picker. Naturally, all
 five need to be defined in your manifest.

 Like I said, it's a horrible kludge, but I'm not seeing any actual problems
 with it If anyone has a better idea, I'd still like to hear it.

 String

-- 
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: Resizable appwidgets and backward compatibility

2011-06-22 Thread String
Hey, that works, thanks! Good idea.

As for the version number, resizable appwidgets were only added in v12.

String


-- 
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