Log in or register to post comments

Why set bounding box on CloudReco sample

October 1, 2013 - 7:19pm #1

// Creates a Bounding box for detecting touches

                float screenLeft = mScreenWidth / 8.0f;

                float screenRight = mScreenWidth * 0.8f;

                float screenUp = mScreenHeight / 7.0f;

                float screenDown = mScreenHeight * 0.7f;

 

I don't understand why you set touchable area for some action (startWebView) like this.

Why don't you link with onClickListener or onTouchListener or something similar for each elements in the layout of book_data_layout ?

Thank you, just wondering.

Why set bounding box on CloudReco sample

October 2, 2013 - 1:26am #4

Could you please share us how to detect touch on rendered book info based on the CloudReco sample ?

Why set bounding box on CloudReco sample

October 2, 2013 - 12:10am #3

This is sample code, you are absolutely free to rewrite it differently if you think there is a better way.

 

Why set bounding box on CloudReco sample

October 1, 2013 - 7:26pm #2

for a clearer explanation, this is original code on that statement

 
                float x = e.getX(0);
                float y = e.getY(0);
 
                // Creates a Bounding box for detecting touches
                float screenLeft = mScreenWidth / 8.0f;
                float screenRight = mScreenWidth * 0.8f;
                float screenUp = mScreenHeight / 7.0f;
                float screenDown = mScreenHeight * 0.7f;
 
                // Checks touch inside the bounding box
                if (x < screenRight && x > screenLeft && y < screenDown
                        && y > screenUp)
                {
                    // Starts the webView
                    startWebView(0);
                }
Log in or register to post comments