Right way to set OSM fullscreen - java

I'm trying to set OSM fullscreen adding a onTouchListener on the MapView, calculating the time between touch down and up, and setting a FLAG_FULLSCREEN. but this is not working well since other views on the activity and some items of ItemizedOverlay type are triggering the OnTouch.
Well, i really tried to make this work this way, but everything i tried i had the same result. Other items in screen triggers the OnTouch. There is some other way to make a fullscreen OSM?
Don't know exactly what to show about my code, because it's very simple and explained above. But if needed, i post here.

Related

Enable/Disable Touch Screen on Android

Is there any way of disabling / enabling the touch events in a certain activity
without disabling certain buttons. like if the phone is "frozen" on a certain activity page for limited time?
I need that the user wont be able to go back on page, slide out or any other events.
Is it possible? (I'm using android studio, java)
Thanks in advance!
Any answer would help :)
It's possible.
Actually there is no special function to make it.
To make it, you can make a full screen button with transparent background.
And you will define a function of the button.
Of course, it will be an empty function.
Well, you can do nothing on the screen.
and then you can hide or visible the button according to your necessary.

How to dynamically adjust View position in onResume (Android / Java)

I am attempting move a Button around in an Android app I'm making (Java). Under certain circumstances in onResume(), I get margin information about the button, then attempt to place the button at the left edge of the screen with that margin as a slight gap so it looks nice. See below.
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) button.getLayoutParams(); button.setX(lp.leftMargin);
However, apparently the information in my xml layout file gets read AFTER I programmatically set the button position. So, my button is getting placed exactly in the middle of the screen (as stated in xml file) PLUS 8 dp to the right. I need a way to reorder these positioning commands -- Anyone know how to queue up a dynamic view placement in onResume so it delays just enough to occur immediately after the button is done being placed by my layout file?
Found it!! I guess it was a duplicate question, I couldn't find it searching before:
https://stackoverflow.com/a/24035591/14116101

How to make Right To Left Translation animation with ViewPropertyAnimation?

I am trying to show a fragment with right to left animation, as though it is coming from the right side of the screen but my code does exactly the opposite.
flBackground.animate().setDuration(250).x(0).translationX(0).alpha(1).start();
flBackground here is the id of the root view in my fragment.
I played with 'translationX' method. I gave the screen width in pixels, but my fragment got off screen. Is there a way in ViewPropertyAnimation that I can set initial positioning of a view to animate from?
I only want to use ViewPropertyAnimation, not other Animation objects. Other ones are quite big and I want simple code for my project.
You can use FragmentTransaction.setCustomAnimations(). It's the best way.
Example:
getFragmentManager().beginTransaction()
.setCustomAnimations(R.animator.slide_right, R.animator.slide_left)
.add(R.id.list_fragment_container, YourFragment.instance())
.commit()
More: https://developer.android.com/reference/android/app/FragmentTransaction#setCustomAnimations(int,%20int,%20int,%20int)

How android detect button positions and call appropriate handler?

I know this may not be an appropriate question, but I want to know how a touch enabled OS like
android detects a button in an app and calls the appropriate handler? When programming an app we just give the alignment information of a particular button. So, how android keeps the mapping between a button and screen position? I think this is kindof dynamic because if you change the screen orientation or use zoom or something like that the button positions are changed dynamically. So, android must look at the touch position and decide whether a button is there or not and call the appropriate handler. How this all things put together?
I appreciate any reply.

Android button latency?

I've been working on a drum machine app, and the latency between the time you press the button and the time the sound plays is unbearable. I have seen some people use multitouch and gridviews, and make several buttons able to be pressed at the same time, but I honestly have no knowledge of those. How could I set up multitouch or gridviews to reduce the latency?
I would guess the multitouchable buttons are a very custom implementation. You won't ever be able to touch two ordinary buttons simultaneosly, since they are made for single touch and are based on focus gain etc.
Here's my idea behind a multitouchable implementation:
You create a very custom view which will draw all buttons you need. This view should override onTouchEvent and react on multitouch. I never tried that, but this is the only option I can think of.

Categories