Using Android Drag and Drop framework in My custom Launcher app - android

I am trying to develop custom launcher app (with unlimited number of home pages)and i need to implement Drag and Drop as done in Launcher2(android 4.2).
So i found two approaches
1) Drag and Drop framework
2) Use the android launcher2 way like implementation DragController, DragSource as explained here.
But i am struggling to understand why didn't Android guys didn't use the Drag and Drop framework developed by them in their own application. Can anyone brief regarding possible rationale behind their approach?( i mean in terms of memory/performance)
Thanks in advance.

The Android drag and drop framework is very basic as compared to the one used in the Launcher app.
The Launcher app has a myriad of "layers" and the drag and drop occurs accross these layers, namely the DragLayer, Workspace and the All Apps view etc. It uses window flags and dynamically adds/removes views to the DragLayer when a drag is in progress and a multitude of activities monitor the drag. For more details look at the DragLayer.java and Workspace.java files particularly.

Drag and Drop in Android Launcher is done as Overlay drawing within the same ViewGroup and in same window . But android drag and drop approach creates a separate window with a separate window type altogether .
Resource and memory wise standard android drag and drop approach is costlier.
If performance is very critical my suggestion is go as per Android launcher way else prefer standard android approach its easy and simple.

Drag and Drop framework is sice api 11.
My guess is, lot of code for launcher was written before that, and noone had time to refactor it yet. But api works similar like second approach.

http://javapapers.com/android/android-drag-and-drop/. This is the best drag and drop example since i have implemented the same in my application. Note: It will support versions only above 11. The drag and drop feature will not support for version 10. Instead u have to move the fields in a absolute layout by settin X and Y positons. But Absolute layout is completely deprecated...

You should use WindowManaager to control Drag And Drop if in case your Application is not so much complex. This is easy to implement and work on Position changed. get the code Here

Related

Simple and compact chat user-interface

I am developing a multiplayer android game and I am trying to add a chat UI for players to talk to eachother.
I don't want this chat UI always visible because of space issues, I'd like there to be a tab that you can press or slide that will bring the chat menu up. I have a sketch so you can see what I mean...
How can I go about implementing this in android.
I know I am going to need to use EditText and TextView etc but How can I get the sliding thing to work.
EDIT: I'm not looking for a flat out answer. I just need guidance. What widgets, methods etc should I be studying
There used to be a SlidingDrawer in the Android SDK. It is officially deprecated and, to be honest, was never that good.
There is nothing in the Android SDK that directly replaces the old SlidingDrawer. The leading third-party implementation seems to be AndroidSlidingUpPanel, though there are probably others floating around.

Android simple drag & drop library

Is there a library for moving views by dragging & dropping on Android? I don't want any fancy animations or anything, just users can drag the ImageButtons to anywhere in the screen and they will stay where they are dropped.
I googled it and searched for it but I couldn't find anything ready to use, will I be required to implement it using onTouch and stuff?
By the way, my API level is 8.
Check out this Drag and Drop tutorial in the API Guides.

What do they utilize to build android apps with custom graphics and controls ?

What I mean to say while you're just getting started with the development and say you add a slider theres a predefined skin for that and you can place it somewhere on the screen, but in some apps there are things like a knob in a place of slider which you can rotate to do the same stuff what the slider does . How do they do that, does it require openGL or something I am not asking for a complete tutorial or something just curious on what stuff goes into building such thing
Mostly, if something is not provided out of the box, you will have to build your own control.
For example, you mention a Knob. That isn't available in the Android SDK. Such a control could prove to be useful.
Here is a tutorial to build such a custom Control: http://go-lambda.blogspot.in/2012/02/rotary-knob-widget-on-android.html
This is an image of the final result from the tutorial linked above:
Here is an example of a custom slider / seek bar: http://permadi.com/blog/2011/11/android-sdk-custom-slider-bar-seekbar/
This should give you a rough idea on how to go about creating your own custom views.
And finally, what I personally find the best possible resource for keeping track of almost all good Custom Views is here: http://www.androidviews.net/
The androidviews.net website has shut down. Android Arsenal is a new website that lists several third party Android libraries.

How to drag and drop views in Android tablet app?

I want to show a dashboard like interface in my Android tablet app where the user can drag and drop listviews using touch. Is there a library that i can use to give d&d to my app?
For android 3.0 and up, which is usually in all Android tablets. You can use this:
http://developer.android.com/guide/topics/ui/drag-drop.html
You do not necessarily need a library to give the drag and drop functionality. It is already in Android 3.0 and up. If you want the code, the best way is to write it yourself as it will suit you to what you want. To learn about it, look at several examples and read them. It is pretty simple and acts much like OnTouchListener and MotionEvent.

Titanium Mobile: Slide to switch between the views

I am developing a mobile app using Titanium. I came across the Google Plus, Tweetdeck, Market Apps for Android. To switch between the tabs they use the slide gesture. Its like the next view simply slides in based on your swipe/drag. I would also like to add the same kind to behavior for my app I would like to have it work on both Android and iOS platforms. How can I have it?
I have tried Ti.UI.scrollableView. The problems I faced were
The sliding was not as responsive as seen in the above apps.
The view does not move along with the finger drag. It moves after the finger drag is finished.
It seems to take more memory as the application response slows drastically and animations dont appear to be smooth.
Kindly let me know if there is any other alternative to implement this kind of experience in the app.
Thanks!!
What you basically need is a Ti.UI.ScrollableView which implements the native Android ViewPager. Those other Apps are binding their Tabs to the ViewPager. You can't do this with a Ti.UI.TabGroup but you can either use your own Tab views or some other module that provides this functionality like this. You could also have a look at my Alloy widget here - it provides a custom tab-indicator for Ti.UI.ScrollableView (without another module).
For Android you should consider using a third-party library to implement such functionality.
Personally I use PagerSlidingTabStrip which I have found that works really well.

Categories

Resources