sorry im new to android.i need to use the api boolean return value to decide the swipe left to delete function is enable or disable in recyclerview. can someone give me some example using ItemTouchHelper or any other choice tq.
i had do some researchers on internet but don't have any is enable or disable swipe left to delete base on conditions from api.
Related
How to detect Android SWIPE LEFT AND RIGHT, when Talkback is enabled ?
I want to detect the number of swipes it takes to reach a particular element(for data analysis purposes). But How do I receive left or right swipes(Or any gestures that I want, including double click etc) ?
I have tried looking for AccessibilityService, but it looks like a customisable Service, All I want is default talkback enabled, and I need to be able to receive talkback gestures programmatically.
Attached screenshot of netflix app with left side menu I am able to develop a side menu with customized icon and header in it. I want, when the focus comes on header fragment it should expand on top of row fragment, that is not collapsing the row fragment, the same as Netflix and hotstar are doing. How can I achieve it?
unfortunately, the HeaderSupportFragment used in the BrowseSupportFragment is not configurable enough to achieve this kind of design. Leanback is great to build quickly and easily media browser app but when it comes to "complex" design, it's easier to use custom component.
The major difference also here, is that the left menu of the BrowseSupportFragment show each rows header name displayed in the screen (that's why it's called HeaderSupportFragment). Here you want to show different entries like search, home, settings, etc.
To make this kind of view, I would suggest creating your own custom view and use a basic Fragment. I followed this tutorial which can be useful to handle menu open/close animation (I mixed it with a ConstraintLayout to simplify the animation and I made the menu overlap the rest of the screen instead of moving everything.)
See the tutorial: https://medium.com/building-for-android-tv/building-for-android-tv-episode-3-381e041dfec7
I am trying to use this method of viewing details of a list item in my own development, but I cannot seem to figure out the right words to Google. I was hoping to get some help on replicating this behaviour.
My current idea is to have a fragment with a higher z than the list and put a swipe listener in the fragment. Then when it reaches a certain height make it a full screen fragment, but I'm not sure if this is the proper​way
I am developing an App that has a lock screen widget where it has a play, pause, prev and next. When I connect my phone to an Android wear, it automatically shows this buttons and it works fine. I would like to add a "Like" button that would automatically be shown on the lock screen and the android wear. I know that I can create a Notification and add action for the like. But I want to know if is it possible to achieve that using only RemoteControlClient?
Have you tried using rating with the flag FLAG_KEY_MEDIA_RATING ? It seems that it's the only way to maintain generic methods and avoid having to set custom code on the wear side (or through notifications).
This flag can be set with setTransportControlFlags
Flag indicating a RemoteControlClient supports ratings. This flag must
be set in order for components that display the RemoteControlClient
information, to display ratings information, and, if ratings are
declared editable (by calling addEditableKey(int) with the
RATING_KEY_BY_USER key), it will enable the user to rate the media,
with values being received through the interface set with
setMetadataUpdateListener(OnMetadataUpdateListener).
Unfortunately, few or not example exists on the web. I discovered only one (unanswered) question relative to this on SO :
Android 4.4 KitKat Rating API
I was viewing a different question Google Maps Android API v2 - Interactive InfoWindow (like in original android google maps) and as you can see he's using the requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); to make the map v2 use the full screen. I tried this but the my location button is partially covered by the action bar on mine unlike his. Does anyone know how to move it down slightly?
Thanks!
Unfortunately you don't have any control over this button. Obviously, you can search for this button id in android sources and change layout params manually from the code, but I definitely wouldn't do that.
This button is super easy to implement yourself. So I recommend to disable built-in "locate me" button and implement your own which will be positioned right below the action bar.
To disable it use:
googleMap.setMyLocationEnabled(false);
New button onClick method content:
googleMap.animateCamera(CameraUpdateFactory.newLatLng(new LatLng(googleMap.getMyLocation().getLatitude(),
googleMap.getMyLocation().getLongitude())));
You can just get the view by its id and re-set the top margin Apparently the id is always 2, but this isn't documented and your app will break when/if the id ever changes. Like Pavel said, it's safer to make your own location button and wire it up.
Unfortunately, calling ActionBar.getHeight() in your onCreate will always return 0 since layout hasn't finished. The way to get the real heigh is by using a listener on the ViewTreeObserver:
mainLayout.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
int actionBarHeight = getActionBar().getHeight();
// TODO: set margin of views dependent on actionbar height
// remove the listener
mainLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
}
}