Re: [android-developers] Re: Change the background of an AppWidget

2011-01-10 Thread YuviDroid
>
> Maybe it works likewise if you create
> a Drawable object like GradientDrawable dynamically?


Unfortunately there is no RemoteViews.setImageViewDrawable() :(((


On Mon, Jan 10, 2011 at 9:28 AM, mort  wrote:

> I think if you're feeling masochistic, you could create 9 images and
> do some kind of "manual 9-patch image" with e.g. table or linear
> layout views. Just like in bad old HTML times... ;)
> If your "dynamically created" images aren't too complex, you might
> also use something similar to the XML shape drawables. Opposed to 9-
> patch drawables, XML drawables always were scaled correctly if I set
> them with setImageViewResource. Maybe it works likewise if you create
> a Drawable object like GradientDrawable dynamically?
>
> --
> 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
>



-- 
YuviDroid
Check out Launch-X  (a widget to
quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
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: Change the background of an AppWidget

2011-01-10 Thread mort
I think if you're feeling masochistic, you could create 9 images and
do some kind of "manual 9-patch image" with e.g. table or linear
layout views. Just like in bad old HTML times... ;)
If your "dynamically created" images aren't too complex, you might
also use something similar to the XML shape drawables. Opposed to 9-
patch drawables, XML drawables always were scaled correctly if I set
them with setImageViewResource. Maybe it works likewise if you create
a Drawable object like GradientDrawable dynamically?

-- 
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: Change the background of an AppWidget

2011-01-09 Thread Zsolt Vasvari
I've been down the road with my widgets when I tried them on 2.3.  I
wasted about a week of my development time on this problem.  Remember
my thread?

http://groups.google.com/group/android-developers/browse_thread/thread/6fa088c7640ca9b2/9bba78001843642b

It's very frustrating that the widget cell size was changed without it
being documented and that it's impossible to prepare for it in a non-
hackish way.

I find the overall SDK/API quality excellent, but the widget API gets
at most a C in my book.  The good thing is, if the Honeycomb preview
video is any indication, this will all change in 3.0 as it appears to
support scrolliing widgets.



On Jan 10, 6:01 am, Kostya Vasilyev  wrote:
> Exactly.
>
> Causing even more trouble if you're trying to make widgets that:
>
> - Fit into the home screen grid;
> - Look good;
> - Don't take up the entire screen width.
>
> Replacement home screens and different Android versions add even more
> uncertainty (Mark posted exact numbers on how 2.3 vs. previous versions
> allocate real estate for widgets vs. other home screen elements).
>
> I think this has gotten to the point where some assistance from the
> framework is needed.
>
> My suggestions would be:
>
> - A way to query home screen cell size used by the launcher that created
> the widget;
>
> - A sizing unit that equals one cell in the appropriate dimension, which
> could be used in widget layout xml's.
>
> -- Kostya
>
> 10.01.2011 0:39, Dianne Hackborn пишет:
>
>
>
>
>
> > This is not simple.  Even for a single widget instance in a specific
> > widget host, its dimensions can (and typically do) change slightly
> > when the screen switches between landscape and portrait.
>
> > On Sun, Jan 9, 2011 at 1:26 PM, Kostya Vasilyev  > > wrote:
>
> >     That's not it, this is backwards - the widget telling the home
> >     screen its minimal size.
>
> >     The size here is specified in units that are independent of
> >     launcher version or its actual implementation (replacement).
>
> >     -- Kostya
>
> >     10.01.2011 0:21, String пишет:
> >>     On Sunday, January 9, 2011 12:30:07 PM UTC, Kostya Vasilyev wrote:
>
> >>         It's really too bad there is no way to query widget cell size
> >>         or use it
>
> >>    http://developer.android.com/reference/android/appwidget/AppWidgetPro...
>
> >>     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
>
> >     --
> >     Kostya Vasilyev -- WiFi Manager + pretty widget 
> > --http://kmansoft.wordpress.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
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com 
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support, and so won't reply to such e-mails.  All
> > such questions should be posted on public forums, where I and others
> > can see and answer them.
>
> > --
> > 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
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.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


Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Kostya Vasilyev

Exactly.

Causing even more trouble if you're trying to make widgets that:

- Fit into the home screen grid;
- Look good;
- Don't take up the entire screen width.

Replacement home screens and different Android versions add even more 
uncertainty (Mark posted exact numbers on how 2.3 vs. previous versions 
allocate real estate for widgets vs. other home screen elements).


I think this has gotten to the point where some assistance from the 
framework is needed.


My suggestions would be:

- A way to query home screen cell size used by the launcher that created 
the widget;


- A sizing unit that equals one cell in the appropriate dimension, which 
could be used in widget layout xml's.


-- Kostya

10.01.2011 0:39, Dianne Hackborn пишет:
This is not simple.  Even for a single widget instance in a specific 
widget host, its dimensions can (and typically do) change slightly 
when the screen switches between landscape and portrait.


On Sun, Jan 9, 2011 at 1:26 PM, Kostya Vasilyev > wrote:


That's not it, this is backwards - the widget telling the home
screen its minimal size.

The size here is specified in units that are independent of
launcher version or its actual implementation (replacement).

-- Kostya

10.01.2011 0:21, String пишет:

On Sunday, January 9, 2011 12:30:07 PM UTC, Kostya Vasilyev wrote:

It's really too bad there is no way to query widget cell size
or use it



http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html#minHeight

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 



-- 
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.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




--
Dianne Hackborn
Android framework engineer
hack...@android.com 

Note: please don't send private questions to me, as I don't have time 
to provide private support, and so won't reply to such e-mails.  All 
such questions should be posted on public forums, where I and others 
can see and answer them.


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



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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: Change the background of an AppWidget

2011-01-09 Thread Mark
I am fine with that. I have different images and layouts for each
orientation.
But please tell me if there is a way to determine the exact size.
Would be glad to have different values for portrait/landscape.

On 9 Jan., 22:39, Dianne Hackborn  wrote:
> This is not simple.  Even for a single widget instance in a specific widget
> host, its dimensions can (and typically do) change slightly when the screen
> switches between landscape and portrait.
>
>
>
>
>
>
>
>
>
> On Sun, Jan 9, 2011 at 1:26 PM, Kostya Vasilyev  wrote:
> >  That's not it, this is backwards - the widget telling the home screen its
> > minimal size.
>
> > The size here is specified in units that are independent of launcher
> > version or its actual implementation (replacement).
>
> > -- Kostya
>
> > 10.01.2011 0:21, String пишет:
>
> > On Sunday, January 9, 2011 12:30:07 PM UTC, Kostya Vasilyev wrote:
>
> > It's really too bad there is no way to query widget cell size or use it
>
> >http://developer.android.com/reference/android/appwidget/AppWidgetPro...
>
> > 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
>
> > --
> > Kostya Vasilyev -- WiFi Manager + pretty widget 
> > --http://kmansoft.wordpress.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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Dianne Hackborn
This is not simple.  Even for a single widget instance in a specific widget
host, its dimensions can (and typically do) change slightly when the screen
switches between landscape and portrait.

On Sun, Jan 9, 2011 at 1:26 PM, Kostya Vasilyev  wrote:

>  That's not it, this is backwards - the widget telling the home screen its
> minimal size.
>
> The size here is specified in units that are independent of launcher
> version or its actual implementation (replacement).
>
> -- Kostya
>
> 10.01.2011 0:21, String пишет:
>
> On Sunday, January 9, 2011 12:30:07 PM UTC, Kostya Vasilyev wrote:
>
> It's really too bad there is no way to query widget cell size or use it
>>
>
>
> http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html#minHeight
>
> 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
>
>
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget -- 
> http://kmansoft.wordpress.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
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Kostya Vasilyev
That's not it, this is backwards - the widget telling the home screen 
its minimal size.


The size here is specified in units that are independent of launcher 
version or its actual implementation (replacement).


-- Kostya

10.01.2011 0:21, String ?:

On Sunday, January 9, 2011 12:30:07 PM UTC, Kostya Vasilyev wrote:

It's really too bad there is no way to query widget cell size or
use it


http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html#minHeight

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 



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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

Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread String
On Sunday, January 9, 2011 12:30:07 PM UTC, Kostya Vasilyev wrote:

It's really too bad there is no way to query widget cell size or use it 
>

http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html#minHeight

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

Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Kostya Vasilyev


It's really too bad there is no way to query widget cell size or use it 
as a sizing unit.


-- Kostya

09.01.2011 15:17, Mark пишет:

The problem is it does NOT look good because the scaling is
unpredictably uneven.
480/678 1:1.41
480/633 1:1.32
So what is round on one screen is elongated on an other.

On Jan 9, 1:12 pm, Kumar Bibek  wrote:

Hmm, IF you are generating the Bitmap at runtime, and setting it as the
source to an ImageView, whose scale type is fitXY, that should be ok I
guess. The images will stretch and might look odd. So, you can select the
maximum resolution of the image and use it.

For smaller sizes, the ImageView will shrink it to fit.

I can't think of any other approach.

Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com

On Sun, Jan 9, 2011 at 5:32 PM, Markwrote:








setBitmap()

I think I tried that already, but it's the same problem as using it
with file URIs. It doesn't stretch properly because it's not a
NinePatch, just a flat image.
There is something mentioned about NinePatchChunk but I never saw
anyone getting it to work.
Assigning NinePatch PNGs via URI or setBitmap just results in the
image being read as a normal PNG (including the black indicators) and
then being stretched ignoring the NinePatch info.
On Jan 9, 12:53 pm, Kumar Bibek  wrote:

I am not sure, but have you tried this method?
http://developer.android.com/reference/android/widget/RemoteViews.htm...
Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
On Sun, Jan 9, 2011 at 5:21 PM, Mark
As written in my Approach 2, I don't see a way to use any of the
RemoteViews.set...() methods with a NinePatch.

As far as I see it only works with resource IDs which point to
drawables in the apk.
But I have files outside the apk.
--
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
cr...@googlegroups.com>

For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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: Change the background of an AppWidget

2011-01-09 Thread Mark
The problem is it does NOT look good because the scaling is
unpredictably uneven.
480/678 1:1.41
480/633 1:1.32
So what is round on one screen is elongated on an other.

On Jan 9, 1:12 pm, Kumar Bibek  wrote:
> Hmm, IF you are generating the Bitmap at runtime, and setting it as the
> source to an ImageView, whose scale type is fitXY, that should be ok I
> guess. The images will stretch and might look odd. So, you can select the
> maximum resolution of the image and use it.
>
> For smaller sizes, the ImageView will shrink it to fit.
>
> I can't think of any other approach.
>
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
> On Sun, Jan 9, 2011 at 5:32 PM, Mark wrote:
>
>
>
>
>
>
>
> > >setBitmap()
> > I think I tried that already, but it's the same problem as using it
> > with file URIs. It doesn't stretch properly because it's not a
> > NinePatch, just a flat image.
> > There is something mentioned about NinePatchChunk but I never saw
> > anyone getting it to work.
> > Assigning NinePatch PNGs via URI or setBitmap just results in the
> > image being read as a normal PNG (including the black indicators) and
> > then being stretched ignoring the NinePatch info.
>
> > On Jan 9, 12:53 pm, Kumar Bibek  wrote:
> > > I am not sure, but have you tried this method?
>
> > >http://developer.android.com/reference/android/widget/RemoteViews.htm...
>
> > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
> > > On Sun, Jan 9, 2011 at 5:21 PM, Mark  > >wrote:
>
> > > > > As written in my Approach 2, I don't see a way to use any of the
> > > > > RemoteViews.set...() methods with a NinePatch.
>
> > > > As far as I see it only works with resource IDs which point to
> > > > drawables in the apk.
> > > > But I have files outside the apk.
>
> > > > --
> > > > 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 > > >  cr...@googlegroups.com> > cr...@googlegroups.com>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Kumar Bibek
Hmm, IF you are generating the Bitmap at runtime, and setting it as the
source to an ImageView, whose scale type is fitXY, that should be ok I
guess. The images will stretch and might look odd. So, you can select the
maximum resolution of the image and use it.

For smaller sizes, the ImageView will shrink it to fit.

I can't think of any other approach.

Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Sun, Jan 9, 2011 at 5:32 PM, Mark wrote:

> >setBitmap()
> I think I tried that already, but it's the same problem as using it
> with file URIs. It doesn't stretch properly because it's not a
> NinePatch, just a flat image.
> There is something mentioned about NinePatchChunk but I never saw
> anyone getting it to work.
> Assigning NinePatch PNGs via URI or setBitmap just results in the
> image being read as a normal PNG (including the black indicators) and
> then being stretched ignoring the NinePatch info.
>
> On Jan 9, 12:53 pm, Kumar Bibek  wrote:
> > I am not sure, but have you tried this method?
> >
> > http://developer.android.com/reference/android/widget/RemoteViews.htm...
> >
> > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
> >
> > On Sun, Jan 9, 2011 at 5:21 PM, Mark  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > > As written in my Approach 2, I don't see a way to use any of the
> > > > RemoteViews.set...() methods with a NinePatch.
> >
> > > As far as I see it only works with resource IDs which point to
> > > drawables in the apk.
> > > But I have files outside the apk.
> >
> > > --
> > > 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 cr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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
>

-- 
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: Change the background of an AppWidget

2011-01-09 Thread Mark
>setBitmap()
I think I tried that already, but it's the same problem as using it
with file URIs. It doesn't stretch properly because it's not a
NinePatch, just a flat image.
There is something mentioned about NinePatchChunk but I never saw
anyone getting it to work.
Assigning NinePatch PNGs via URI or setBitmap just results in the
image being read as a normal PNG (including the black indicators) and
then being stretched ignoring the NinePatch info.

On Jan 9, 12:53 pm, Kumar Bibek  wrote:
> I am not sure, but have you tried this method?
>
> http://developer.android.com/reference/android/widget/RemoteViews.htm...
>
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
> On Sun, Jan 9, 2011 at 5:21 PM, Mark wrote:
>
>
>
>
>
>
>
> > > As written in my Approach 2, I don't see a way to use any of the
> > > RemoteViews.set...() methods with a NinePatch.
>
> > As far as I see it only works with resource IDs which point to
> > drawables in the apk.
> > But I have files outside the apk.
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
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: Change the background of an AppWidget

2011-01-09 Thread Mark
Yes, this is my Approach 1.
For that you also need to know the size, at least roughly.
But it does not look nice because I can only assume the correct size
so it will get stretched unevenly.
Just using the emulators for 2.1 and 2.3 using the WVGA resolution I
have a change from 480x678 to 480x633. Using other home apps can
provide even extremer differences.
Round corners are not round anymore, etc.

On Jan 9, 12:44 pm, Kumar Bibek  wrote:
> Oh, sorry about that. I missed those few lines. In that case, you might try
> setting the scale type of the image view to perhaps fitXY. But I guess, you
> would have tried that too. Any problems with that?
>
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
> On Sun, Jan 9, 2011 at 5:11 PM, Mark wrote:
>
>
>
>
>
>
>
> > They would, if there were a way to use them.
> > As written in my Approach 2, I don't see a way to use any of the
> > RemoteViews.set...() methods with a NinePatch.
> > Do you?
>
> > On Jan 9, 12:05 pm, Kumar Bibek  wrote:
> > > 9 patch pngs should solve you problem, if I understand your problem
> > > correctly.
>
> > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
> > > On Sun, Jan 9, 2011 at 3:51 PM, Pent  wrote:
> > > > I have a similar problem, would be nice if there was a standard way to
> > > > query the launcher for the widget dimensions for a particular cell
> > > > width/height wouldn't it ?
>
> > > > Pent
>
> > > > On Jan 9, 12:38 am, Mark  wrote:
> > > > > I want to set the background of an appwidget at runtime with a
> > > > > dynamically generated image (skin) (which must fill the entire space
> > > > > of the widget).
>
> > > > > Approach 1:
> > > > > Use an ImageView and remoteViews.setImageViewUri()
> > > > > Problem:
> > > > > For the image to fit and look properly I need to know the exact pixel
> > > > > size of the widget and I have not found a way to do that.
> > > > > The minWidth/Height of the widget does not help. The space taken by
> > > > > the cells also varies from Android version to version e.g. comparing
> > > > > 2.1 (480x678) with 2.3 (480x633) for 4x4 cells on WVGA. And this is
> > > > > only the default Home app. LauncherPro, ADW etc. have different
> > status
> > > > > bar heights etc. Also the image get's really big which slows down the
> > > > > system, lags, is prone to crashes in low mem situation.
>
> > > > > Approach 2:
> > > > > Use a NinePatch image which adjusts to whatever size the widget has.
> > > > > Problem:
> > > > > I couldn't find a way to set a NinePatch image. This only works with
> > > > > resources which are inside the apk. Not with dynamically created
> > > > > files.
>
> > > > > Any suggestions would be welcome.
>
> > > > --
> > > > 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 > > >  cr...@googlegroups.com> > cr...@googlegroups.com>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Kumar Bibek
I am not sure, but have you tried this method?

http://developer.android.com/reference/android/widget/RemoteViews.html#setBitmap%28int,%20java.lang.String,%20android.graphics.Bitmap%29

Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Sun, Jan 9, 2011 at 5:21 PM, Mark wrote:

> > As written in my Approach 2, I don't see a way to use any of the
> > RemoteViews.set...() methods with a NinePatch.
>
> As far as I see it only works with resource IDs which point to
> drawables in the apk.
> But I have files outside the apk.
>
> --
> 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
>

-- 
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: Change the background of an AppWidget

2011-01-09 Thread Mark
> As written in my Approach 2, I don't see a way to use any of the
> RemoteViews.set...() methods with a NinePatch.

As far as I see it only works with resource IDs which point to
drawables in the apk.
But I have files outside the apk.

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


Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Kumar Bibek
Oh, sorry about that. I missed those few lines. In that case, you might try
setting the scale type of the image view to perhaps fitXY. But I guess, you
would have tried that too. Any problems with that?


Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Sun, Jan 9, 2011 at 5:11 PM, Mark wrote:

> They would, if there were a way to use them.
> As written in my Approach 2, I don't see a way to use any of the
> RemoteViews.set...() methods with a NinePatch.
> Do you?
>
> On Jan 9, 12:05 pm, Kumar Bibek  wrote:
> > 9 patch pngs should solve you problem, if I understand your problem
> > correctly.
> >
> > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Jan 9, 2011 at 3:51 PM, Pent  wrote:
> > > I have a similar problem, would be nice if there was a standard way to
> > > query the launcher for the widget dimensions for a particular cell
> > > width/height wouldn't it ?
> >
> > > Pent
> >
> > > On Jan 9, 12:38 am, Mark  wrote:
> > > > I want to set the background of an appwidget at runtime with a
> > > > dynamically generated image (skin) (which must fill the entire space
> > > > of the widget).
> >
> > > > Approach 1:
> > > > Use an ImageView and remoteViews.setImageViewUri()
> > > > Problem:
> > > > For the image to fit and look properly I need to know the exact pixel
> > > > size of the widget and I have not found a way to do that.
> > > > The minWidth/Height of the widget does not help. The space taken by
> > > > the cells also varies from Android version to version e.g. comparing
> > > > 2.1 (480x678) with 2.3 (480x633) for 4x4 cells on WVGA. And this is
> > > > only the default Home app. LauncherPro, ADW etc. have different
> status
> > > > bar heights etc. Also the image get's really big which slows down the
> > > > system, lags, is prone to crashes in low mem situation.
> >
> > > > Approach 2:
> > > > Use a NinePatch image which adjusts to whatever size the widget has.
> > > > Problem:
> > > > I couldn't find a way to set a NinePatch image. This only works with
> > > > resources which are inside the apk. Not with dynamically created
> > > > files.
> >
> > > > Any suggestions would be welcome.
> >
> > > --
> > > 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 cr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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
>

-- 
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: Change the background of an AppWidget

2011-01-09 Thread Mark
They would, if there were a way to use them.
As written in my Approach 2, I don't see a way to use any of the
RemoteViews.set...() methods with a NinePatch.
Do you?

On Jan 9, 12:05 pm, Kumar Bibek  wrote:
> 9 patch pngs should solve you problem, if I understand your problem
> correctly.
>
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
>
>
>
>
>
>
> On Sun, Jan 9, 2011 at 3:51 PM, Pent  wrote:
> > I have a similar problem, would be nice if there was a standard way to
> > query the launcher for the widget dimensions for a particular cell
> > width/height wouldn't it ?
>
> > Pent
>
> > On Jan 9, 12:38 am, Mark  wrote:
> > > I want to set the background of an appwidget at runtime with a
> > > dynamically generated image (skin) (which must fill the entire space
> > > of the widget).
>
> > > Approach 1:
> > > Use an ImageView and remoteViews.setImageViewUri()
> > > Problem:
> > > For the image to fit and look properly I need to know the exact pixel
> > > size of the widget and I have not found a way to do that.
> > > The minWidth/Height of the widget does not help. The space taken by
> > > the cells also varies from Android version to version e.g. comparing
> > > 2.1 (480x678) with 2.3 (480x633) for 4x4 cells on WVGA. And this is
> > > only the default Home app. LauncherPro, ADW etc. have different status
> > > bar heights etc. Also the image get's really big which slows down the
> > > system, lags, is prone to crashes in low mem situation.
>
> > > Approach 2:
> > > Use a NinePatch image which adjusts to whatever size the widget has.
> > > Problem:
> > > I couldn't find a way to set a NinePatch image. This only works with
> > > resources which are inside the apk. Not with dynamically created
> > > files.
>
> > > Any suggestions would be welcome.
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Change the background of an AppWidget

2011-01-09 Thread Kumar Bibek
9 patch pngs should solve you problem, if I understand your problem
correctly.

Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Sun, Jan 9, 2011 at 3:51 PM, Pent  wrote:

> I have a similar problem, would be nice if there was a standard way to
> query the launcher for the widget dimensions for a particular cell
> width/height wouldn't it ?
>
> Pent
>
> On Jan 9, 12:38 am, Mark  wrote:
> > I want to set the background of an appwidget at runtime with a
> > dynamically generated image (skin) (which must fill the entire space
> > of the widget).
> >
> > Approach 1:
> > Use an ImageView and remoteViews.setImageViewUri()
> > Problem:
> > For the image to fit and look properly I need to know the exact pixel
> > size of the widget and I have not found a way to do that.
> > The minWidth/Height of the widget does not help. The space taken by
> > the cells also varies from Android version to version e.g. comparing
> > 2.1 (480x678) with 2.3 (480x633) for 4x4 cells on WVGA. And this is
> > only the default Home app. LauncherPro, ADW etc. have different status
> > bar heights etc. Also the image get's really big which slows down the
> > system, lags, is prone to crashes in low mem situation.
> >
> > Approach 2:
> > Use a NinePatch image which adjusts to whatever size the widget has.
> > Problem:
> > I couldn't find a way to set a NinePatch image. This only works with
> > resources which are inside the apk. Not with dynamically created
> > files.
> >
> > Any suggestions would be welcome.
>
> --
> 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

-- 
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: Change the background of an AppWidget

2011-01-09 Thread Pent
I have a similar problem, would be nice if there was a standard way to
query the launcher for the widget dimensions for a particular cell
width/height wouldn't it ?

Pent

On Jan 9, 12:38 am, Mark  wrote:
> I want to set the background of an appwidget at runtime with a
> dynamically generated image (skin) (which must fill the entire space
> of the widget).
>
> Approach 1:
> Use an ImageView and remoteViews.setImageViewUri()
> Problem:
> For the image to fit and look properly I need to know the exact pixel
> size of the widget and I have not found a way to do that.
> The minWidth/Height of the widget does not help. The space taken by
> the cells also varies from Android version to version e.g. comparing
> 2.1 (480x678) with 2.3 (480x633) for 4x4 cells on WVGA. And this is
> only the default Home app. LauncherPro, ADW etc. have different status
> bar heights etc. Also the image get's really big which slows down the
> system, lags, is prone to crashes in low mem situation.
>
> Approach 2:
> Use a NinePatch image which adjusts to whatever size the widget has.
> Problem:
> I couldn't find a way to set a NinePatch image. This only works with
> resources which are inside the apk. Not with dynamically created
> files.
>
> Any suggestions would be welcome.

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