Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
TJBeanz
Posts: 39
Registered: ‎06-22-2009
My Device: Torch (9800), Bold (9930)
My Carrier: Verizon
Accepted Solution

ZoomScreen Image

When using a ZoomScreen, is there any way to determine if the image is currently fully displayed on the screen?  For example, I want to be able to determine if the user has zoomed out enough to fit the image in its entirety on the screen (fit to screen), and then close the ZoomScreen.

 

Any help would be greatly appreciated!

 

Thank you in advance!

 

-T

----------------------------------------------------------------------------------
Click "Accept as Solution" if this post was what you needed.
Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
Please use plain text.
Developer
TJBeanz
Posts: 39
Registered: ‎06-22-2009
My Device: Torch (9800), Bold (9930)
My Carrier: Verizon

Re: ZoomScreen Image

Does anyone have any thougts on this?  I've tried several things, but I can't find any way to determine this. 

 

It seems to me that RIM uses this control for things like their image gallery/browsing, so there should be a way to do it.  Hitting 'escape' enough times on those screens gets you out of the ZoomScreen.

 

Thank  you!

-T

----------------------------------------------------------------------------------
Click "Accept as Solution" if this post was what you needed.
Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: ZoomScreen Image

I'd take a deep look into getVirtualHeight() / getVirtualWidth() and how they compare to getHeight() / getWidth().  When the image is fully shown, both virtual dimensions should be less or equal to their real counterparts.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Developer
TJBeanz
Posts: 39
Registered: ‎06-22-2009
My Device: Torch (9800), Bold (9930)
My Carrier: Verizon

Re: ZoomScreen Image

Thank you for your reply.  I had already tried that, but I always get 360x480 for both.

----------------------------------------------------------------------------------
Click "Accept as Solution" if this post was what you needed.
Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
Please use plain text.
Developer
TJBeanz
Posts: 39
Registered: ‎06-22-2009
My Device: Torch (9800), Bold (9930)
My Carrier: Verizon

Re: ZoomScreen Image

It doesn't seem to work.  To test it out, I've tried the following:

 

protected boolean navigationClick(int status, int time)
{
	UiApplication.getUiApplication().invokeLater(new Runnable()
	{
		public void run()
		{
			Dialog.alert("virt width: " + getVirtualWidth() 
				+ "\nvirt height: " + getVirtualHeight() 
				+ "\nwidth: " + getWidth() 
				+ "\nheight: " + getHeight()
					+ "\nhoriz scroll: " + getHorizontalScroll()
					+ "\nvert scroll: " + getVerticalScroll());
		}
	});
	
	return super.navigationClick(status, time);
}

 

And I get the following output:

virt width: 360

virt height: 480

width: 360

height: 480

horiz scroll: 0

vert scroll: 0

 

So unfortunately, getVirtual* doesn't seem to help out, unless I'm missing something...

 

Thanks!

-T

 

----------------------------------------------------------------------------------
Click "Accept as Solution" if this post was what you needed.
Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
Please use plain text.
Developer
TJBeanz
Posts: 39
Registered: ‎06-22-2009
My Device: Torch (9800), Bold (9930)
My Carrier: Verizon

Re: ZoomScreen Image

Does anyone have any other thoughts on this?

 

Thanks!

-T

----------------------------------------------------------------------------------
Click "Accept as Solution" if this post was what you needed.
Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: ZoomScreen Image

Hello, what about using the "getZoomLevel()" method to check to see if the user has in fact zoomed in on the image, and comparing the screen viewport provided by getX() and getY() with the dimensions of the image you are displaying?

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
TJBeanz
Posts: 39
Registered: ‎06-22-2009
My Device: Torch (9800), Bold (9930)
My Carrier: Verizon

Re: ZoomScreen Image

Thank you for your response!

 

Where would I find the getZoomLevel() method?

----------------------------------------------------------------------------------
Click "Accept as Solution" if this post was what you needed.
Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
Please use plain text.
Developer
TJBeanz
Posts: 39
Registered: ‎06-22-2009
My Device: Torch (9800), Bold (9930)
My Carrier: Verizon

Re: ZoomScreen Image

Success!  So I found a method within ZoomScreen that I can use to accomplish this.  (I don't know how I overlooked this).  I hope this helps someone else out in the future:

 

ZoomScreen screen = new ZoomScreen(_img)
{
	public void zoomedOutNearToFit()
	{
		close();
	}
}

 

It appears that zoomedOutNearToFit() gets called when the image contained within the ZoomScreen is zoomed out enough that it fits on the screen -- fitting name, eh? (pun intended).

 

I still wish we had some more control over what is happening in the ZoomScreen. 

 

Any help with other pieces of functionality in ZoomScreen RIM?

 

Thanks!

-T

----------------------------------------------------------------------------------
Click "Accept as Solution" if this post was what you needed.
Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: ZoomScreen Image

Lucky you - apparently you don't have to support OS 5.0 where ZoomScreen is a final class...

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.