How to add panels in android using cocos2d - android

I want to add a sliding panel view using cocos2d for android. Any suggestions.

The way i've achieved this in one of my previous android market apps for paintball field designing is to have a separate CCLayer class added as a child to the main scene, and have the main scene responding to the CCTouchesBegan. if the location of the touch is within the co-ords of the visible panel, then call a 'touched' method inside it passing the touch co-ords, so that it can deal with it's own content.
On another panel at the bottom I had a button, which showed or hid the side panel, so it didn't 'slide' or support being 'flung' across the screen, but rather was shown or hidden.
Sliding it or flinging it on/off the screen could be written relatively simply i believe, using a combination of CCTouchesMoved and CCTouchesEnded to track the slide/fling and perform translation on the layer co-ords.
There's nothing to have prevented me implementing a slide in/out using some simple animation, but I had no requirement for it in the app, and hence didn't implement it.
Hope this is at least of some use,sorry i can't provide some worked examples right now, busy with work.

Related

Drag & drop animated indicator between carousel elements

I'm quite new to the Android development world, and need some ideas regarding some ways (if it's possible) in which I can implement the following:
Starting from a central element, I want to display other elements (icons) in a carousel style around it, and be able to initiate an action by a drag & drop gesture between the central element towards one of its satellites, and this action should be displayed as an animated arrow that is spawned upon starting the drag & drop gesture, follows the user movement, and is destroyed upon dropping on one of the satellites.
Is there a library or engine that allows such behavior? I looked it up on Google but with no success.
Many thanks!

Android slide out view

I am wondering how to achieve some kind of draggable view. I am not speaking about the navigation drawer!
Several other applications implement this kind of views, for example the new stock Android Lollipop Calculator application. There you can drag out the extended symbols view from the right hand corner.
Another application is Google maps. When checking out a location, it's possible to extend the location information by dragging up the bottom information view.
It appears that there are two points where the view is able to lock in, meaning that when pulling the view up to a specific point and releasing, will result in the drawer not closing entirely but to align to the specific locking points.
How is that achieved or is a library required?
Thanks in advance
The stock calculator app appears to use ViewPager to achieve the slideout numberpad. It's a part of android, no libraries so that would be a good starting point.
Here's the class in question (Rest of the code to the left)

How can i create a pulse-like settings view? See photo

As topic. Does any one know how to create that snap-settings-view the pulse app uses to its left?
I.e. When you swipe your finger from the left edge, the settings start to show from behind. See the left part of the image below. After a certain amount of movement, the settings menu snaps almost all the way to the right, but still shows the underlying view.
Any help is much appreciated
Regards
You have two options:
you can either do yourself with two fragments (one in front and one behind) and some touch even listener translating the drawer to open and close.
or use a library that is probably doing the same thing I've described. Something like this one: http://www.androidviews.net/2012/11/sliding-menu/

Android launcher home screen

In the android home screen, we have the ability to slide the screen left and right and display multiple pages. Each of these pages has a different set of icons. In the Mac world these would be called "spaces". What are they called in the Android world?
More importantly is there a standard control that can be used to achieve this effect?
There is no such control to achieve this. Once I was digging through the Launcher's source code and this effect is done by creating few LinearLayouts and placing them side by side in the code. Sliding through the "spaces" is done by handlig touch events. Also the grid that handles widgets is created using aviable API.
Unfortunately, there isn't a standard control for that sliding effect.
This is another question about the effect which also contains a few pointers about implementing it.

Android Scroll Pagination

Is there something for the Android OS with which you can implement scroll pagination?
*Edit
With scroll pagination I mean pagination like on the homescreen, you can swipe right and left and go to the next or previous page.
You can take example on the source code of Launcher at android.git.kernel.org. Look for the classes called Workspace and CellLayout.
According to Apple, UIPageControl does not implement "scroll pagination", at least how I would interpret that phrase. UIPageControl tracks a number of pages, shows dots based on the page count/current page, and fires events when the user taps it. It does not actually implement "pagination" (you have to handle that yourself) and has nothing to do with scrolling.
All that being said, there is no "show a bunch of dots" widget built into Android with the same or similar API to UIPageControl. Creating one for your application would be fairly simple, using a set of ImageViews, watching for taps, replacing image resources to change dot colors, and firing events to registered listeners.

Categories

Resources