Drag and Drop Items from Listview into Activity - android

In my app, I want the user to be able to follow this list of instructions to be able to put a link to their installed android apps into a widget that I am creating.
In the widget, when the user taps the widget it opens up a new activity which contains all of their apps. To add new app links to that activity, I want the user to be able to pull out a kind of scrolling tab that would hold a list of all of their applications they have on their device (I already know how to do this). The user would then be able to press and hold on a app from that listview and then drag it into the droppable area in the widget that would hold their app. Please note the picture below to get a better idea of what I mean (sorry for poor quality):
How could I turn a listview object into something that is able to do this? I would have to make the listview have a touch listener attribute and then make the droppable area have a drag event, that much I am sure of (somewhat from just looking around on how to make things drag and droppable).
How could I do this? Any ideas or comments on improvements are appreciated!

You could use setOnItemLongClickListener to set a listener waiting for a long click then when it is fired begin the drag process.

Related

How to access one app to another app using scrolling?

I create a android app for Auto clicker, that can be used to click the XY position of the window,The click event is done during some interval, Similar that i can implement the scrolling event.I have attached the reference link is -https://play.google.com/store/apps/details?id=com.tafayor.autoscroll2&hl=en, I dont have idea of this.Give me some suggestion for auto Scrolling.

How can I suggest a swipe-to-right gesture in a list on a mobile device?

I have done live user testing for a list in my app, and have come to an interesting puzzle.
A list, specifically a single-column table in iOS, may often have a swipe right gesture for more actions, like the twitter app and mail app, and a million other apps. But when important functionality is embedded in the UI beyond that action, and a user cannot figure it out, the only thing that comes to mind to alleviate that is something like the accessory button, ie. a right-pointing triangle or chevron button.
There is probably another way but it's not coming to me. Maybe making the rows taller than normal?
This was meant as a comment but was rejected as too-long.
So after thinking more about this, the ideal solution is a visual clue, rather than painfully obvious text saying "swipe a row for more options". Perhaps when a list (UITableView, etc) is shown and rows (UITableViewCell, etc) are created and added, then as they appear an animation begins of the main visible content sliding into place in the OPPOSITE direction of the desired swipe animation, with a minimal visual indicator afterward, reminding the user that the content is moveable!
Sound good? Optionally, immediately before the animation begins, any underlying content may be shown for a split second (if its supposed to appear underneath). Sweet!

Android How to make only part of the screen clickable?

I am going to code a walkthrough tutorial for my app.
I wish the user will follow the step of the tutorial. So I want to force the user to click on a specific button but not other parts of the app.
My app has many UI components and some of them are added programmatically so disabling them one by one is not practical.
One immediate solution is that I make a transparent Activity to cover the original Activity.
But I don't know how should I detect the touch event through the overlay Activity to operate the original Activity.
Or are there any better way to make a walkthrough tutorial on android apps without much affects to the original code? Tutorial is an adhoc feature and I dont want these adhoc features to ruin my coding with a lot of if-statement on every Activity.
Thank you.
Activity won't work. Only the one at the top of the stack can process infos.
Simply add a semi-opaque view above the screen using a relativelayout
Then simply monitor the ontouch event of this view. If the touch is in the accepted zone of the tutorial, then let it bubble up to underneath control. If if is outside the accepted zone consume the event.
Button btn = new Button(getActivity());
btn.setText("Next");
// Adding button to bottom
lv.addFooterView(btn);

How to pass data among the screens in sencha touch2.0?

I am working on sencha touch2.0 app and I want to send data from one screen to another. I know this question has already been asked here but I don't find it helpful so I am asking it here again.
I have a checkbox listview in my app and what I want is that when I click on one or more checkboxes and go to next screen, I will get all the 'checked' list items here, means I want to send checked list items data from one screen to another. From my research on net I came to know, this can be done by dispatch() method http://docs.sencha.com/touch/2-0/#!/api/Ext.app.Application-method-dispatch. But I don't how to do it. So, please provide me any suggestion/solution to get rid of these problem.
Ext.dispatch() is deprecated in Sencha Touch 2.0 because of the fact that you can always call any method of any controller at anytime you want through this, right in your views:
yourAppName.getApplication().getController.method(params)
Or even further, you can make it automatic through refs and controls in your controller.

How to implement Android 4.0 like swipe to dismiss functionality in ListView?

I'm working on an app in which I would like to implement swipe-to-dismiss functionality in the ListView - similar to what we see in Android 4.0's notification bar, recent apps list or browser tabs. I want to run the app on the devices running Android 2.2+. See the following image. I also want to change the transparency of the item being swiped-away - just like in ICS.
I checked the source of the ICS web browser on http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.1_r1/com/android/browser/TabScrollView.java?av=f but couldn't figure out which class is particularly responsible for implementing this functionality.
Can anyone point me in the right direction here? Can we do this using Android Compatibility Library? Please let me know. Many thanks.
I've thought about implementing such a feature as well, but I haven't done it yet. So the only thing I can provide are some ideas on how I would approach that problem. If I've eventually written some code I will post it here.
The main class needed is a custom Adapter which extends a ListAdapter (ArrayAdapter, SimpleCursorAdapter etc.).
The adapter applies a View.OnTouchListener to all of its Views.
Whenever that listener detects a horizontal scroll dx, it calls concernedView.offsetLeftAndRight(dx) (which will make the view draggable). Of course the adapter has to save the current horizontal offset for the view. If the user was dragging a view and removes his/her finger from the screen, the touchListener will detect this as well and start a slide back animation. Using the current offset we can also calculate an alpha value, so the view will fade out when it approaches the screen borders.
If one list entry is eventually dismissed by the user, it becomes a bit tricky, and I'm still not sure how I would implement the following action: The list content has to be updated (or the adapter has to ignore the dismissed entries) and the views that were below the one that was dismissed must hover upwards in order to fill the gap. I think it might work to let the ListView load the new content, but that would fill the gap instantly. In order to avoid that, I would then start an animation that lets all the concerned views hover from their old position (where we still had the gap) back to their current position (where the gap is filled).
These are just some of my thoughts on the issue that might help some people getting started on working on the problem. Like I said, I'm probably going to implement that sometime in the future and of course I will post the code here.
I would appreciate any feedback in the comments, but I don't want to thorougly explain every single aspect of my idea, that would take me too much time ;)
I know this is quite an old question, but for anyone still searching for this, you can have a look at Roman Nurik's library here: https://github.com/romannurik/Android-SwipeToDismiss
This shows how to create the required behavior for list-view as well as for normal views.

Categories

Resources