0

I need to create a magnifier like feature in my app. Like the "loupe" effect on the iphone ! The problem is that I need to do that inside a popup window and I don't get how to make it work !

The popup window display a grid of colors that I generate and draw one by one using shapeDrawables. What I want is to display that color bigger, zoom on it when the user touch and move his finger around the popup window (color grid). The idea is to create a tracking-zooming effect on the colors so the user can see more clearly under wich color his finger is currently located.

Problems are :

  • I can't seem to create another popup window on top of this one, Android limitation I think ?
  • If I modify the current shapeDrawable, resize it, change the boundaries, It needs to re-display the popup window before it takes effect (which is not acceptable of course)

So, anyone knows of a way I could draw over that popup window ?

EDIT :

I've tried solving this issue using a Custom Toast object...But it doesn't quite do the trick. It works, but toast object appears slowly and so the touch motion is not in sync at all with the user movement over the color grid.

oberthelot
  • 1,310
  • 1
  • 11
  • 23
  • Hello, I am also trying to implement the same you specified here. Did you find any solution how to do it. – Dory Apr 19 '13 at 17:19

1 Answers1

0

I'm not sure if this will help you or not, but you might be able to accomplish this by using a second Activity... this second Activity would use Android's translucent theme if you include the following attribute in your manifest:
    <activity android:theme="@android:style/Theme.Translucent">
This second activity will now only contain what you place in your layout. That is... the "real" activity you're running will still be visible behind it (anywhere you don't cover it up with views in the new layout).

You also might prefer Theme.Dialog if you really want to resemble a popup.

Something to keep in mind if you take this approach is you will probably want to override onWindowFocusChanged() in the new activity, and finish() in the event of you losing focus. Additionally, you'll need to figure out how to share your data between the two activities.

mah
  • 39,056
  • 9
  • 76
  • 93
  • That doesn't look like a good approach to me ! It would complexify the application way to much, just to display an overlay item....Thanks for trying though ! – oberthelot May 26 '11 at 16:27
  • Another alternative is to wrap your entire existing layout within an AbsoluteLayout, and also add the magnifier view to this AbsoluteLayout. When the user touches and drags their finger, you can adjust the location of the magnifier view. If considering this approach, you need to know that AbsoluteLayout is a deprecated class (though RelativeLayout might be able to do the same thing)... however hackbod has implied that the class is unlikely to disappear because of the number of apps that would break. – mah May 27 '11 at 00:52