If you just change the brightness directly to what you want, the window
manager will do a smooth ramp from the current to your new brightness (as
much as it can with the hardware, many devices don't have a lot of possible
screen brightness levels).

On Wed, Jul 15, 2009 at 6:00 AM, LD <[email protected]> wrote:

>
> Hi,
>
> I am trying to resolve following task: smooth change of brightness
> from 100% to 0%, but can't gain effect of smoothness.
>
> Want to emphasize that I am using following approach of brightness
> change. The recommended one.
>
> WindowManager.LayoutParams lp = window.getAttributes();
> lp.screenBrightness = floatPercent;  // 0 - 1
> window.setAttributes(lp);
>
> Well, it obviously works, but not smooth.
> I will describe logic:
>
> I have a thread that changes brightness:
>
>                while (isRunning()) {
>                    Thread.sleep(sleepTime);
>                    spentTime+=sleepTime;
>                    view.post(new Runnable() {
>                        public void run() {
>                            changeBrightness();
>                        }
>                    });
>                }
>
> We have duration of brightness change, for example 10 seconds.
> I calculate next value of floatPercent (see code snippet above) the
> way, sleepTime should always be less than 50ms.
> So looks like it had to be smooth.
>
> But I always get not smooth transition. It relates specially the range
> of 0% - 5% of brightness. Smoothness is completely lost on this
> brightness range.
> What can you propose?
>
> Thanks,
> Lyubomyr
>
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to