Create UI like Chrome for Android - android

I want to implement this behaviour [https://github.com/gleue/TGLStackedViewController] in an app that I am trying to make.
The closest thing/the effect that I want to achieve is how the Google Chrome browser behaves.
Tile/card interface
Be able to access a form of navigation (access other tabs) when user pulls down the address bar
Be able to re-arrange the tabs in any order the user wishes
Photo taken from this Android Layout : How to implement a UI similar to deck of cards? SO question
Is there anyone out there who has tried to implement this kind of behavior? Do you guys know any libraries that can help achieve this effect? It would be very helpful! Thank you

systemUI/Recents package, as mentioned by Andrei, can be your starting point. It adds a little more to the flat rendition of chrome tabs.
I have been meaning to refactor systemUI/Recents package ever since I got the L update. I finally got to it.
A sample project is hosted at: Link
Even though the viewgroup recycles, it updates the progress map (child properties) for all children on each scroll step. This will lead to lags with large data sets. For a few hundred, it should be fine.
The sample project uses Picasso for loading and caching images from LoremPixel. Since these are random images & may repeat, you can verify that they are bound correctly by looking at bottom left of the image.

If you feel like looking through the AOSP code, the functionality you are looking for is actually open-source and you can find it in Android 5.0 in the recent apps screen. This is the code you want to look at on github.
The view you want to extract from AOSP is the RecentsView. This would be the best approach.
You could also consider extending StackView and overriding onLayout() so you get the children to lineup.
One other option is to extend ListView, override drawChild or layout methots and try to shift the views according to their position. You can find some inspiration here and here

Related

Nativescript Vertical Screen Slide / ViewPager

What is the easiest way to implement a screen slide in Nativescript like shown in Android Viewpager , but in a vertical direction ? Another example of this functionality would be the rss reader feedly where you can change rss feeds by swiping up/down.
The page should allow vertical scrolling to the top/bottom and then transition after a certain treshold.
I already encountered nativescript-slides, which can only do horizontally sliding.
So is there a "nativescript" way or do i have to implement it as native android/ios feature (for example by this) ? In either case a sample on how to integrate it in nativescript would be great.
Update
Recorded an example:
taken from this Repo with Android native code. The outstanding PR made changes to offer vertical scrolling in the list. But the repo seems to be outdated and a bit buggy.
I can provide more info later but there's a new plugin implementing the native controls for android and iOS for slides/carousel her https://github.com/alexrainman/nativescript-carousel-view and vertical swiping is on his radar, I think he might even be close to completing that.
To give an answer for anybody interested in above nested scrolling animation:
For Android I had to implement the native ReyclerView in Nativescript in favor of the NS buildin ListView. It is an optimized view structure which among other things allows nested (vertical) scrolling and can be used as replacement for an ordinary list.
Together with https://github.com/alexrainman/nativescript-carousel-view works like a charm!
Anyone that ends up here still looking for ways to achieve this.
I spent a lot of time trying to figure out a way to achieve this and tried to find ready plugins for this. Also tried to use the plugin from Alexrainman but eventually gave up since the plugin was not up to date with the current nativescript-version.
My solution:
I used radListView as a basis for this implementation and leveraged the methods and events on the radListView.
By using scrolled-event I gathered data for the use of the scrolling feature: scroll Speed and scroll direction. (These might be also taken from the event data, but since I did not find the event details from the Nativescript-documentation I gave up trying to guess where to find this data on the event-model).
Then I also saved the fixed height of one item on my list (The height I fixed to screenHeight-200).
With all this info, I managed to hook the event "ScrollDragEnded" and add logic that makes my list behave like a vertical slider. Moving on the list by method "scrollToIndex" and figuring out which index to scroll and when by leveraging all the data mentioned above.
This is the way I managed to make a pretty good vertical slide.
Good luck!

Need help figuring out how to implement UI

Essentially I'm asking what techniques to use in Eclipse/Android Studio to make a UI that looks like the FaceBook UI withtabs on the bottom and their typical action bar on the top with content in the middle.
I've been kind of dealing with this issue for quite some time now and as I have a project deadline coming up figured it was finally time to get stackoverflow's opinion. What would be the best way of creating a social media app that models FaceBook's user interface. By this I am referring to something with the four tabs on bottom and search/back and profile buttons at the top, with some sort of fragment changing in the middle.
The solutions I have currently tried are using a split actionbar by forcing the top into a custom layout and the bottom into an options menu; however, this resulted in giving the options menu the drop down option instead of tabs (if there's a quick fix for this like setting a custom layout to it please lmk because this is my current setup).
For the main content view I originally tried using fragments and then switching between fragments by using functions and buttons inside the fragment class to switch views; however, this required childfragment manager, and for some reason that never worked properly, so instead I ended up switching activities instead of fragments which was horribly slow.
If you guys have any suggestions on how to do this properly please please either tell me how I would go about this, or better yet please show me some very good examples on how to do these things.
Thanks :)
u can use any proto typing tools to create UI . Some tools include Proto.io , Fluid ui etc

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.

Swipe for activities in Android

I am trying to build an app in which I want to go to a new page through swipe-say. I have about 10 different pages and I want to go to these pages by swiping. Can I implement these pages as separate activities? Can I swipe from one activity to another? I strongly like to implement these pages in seperate xml files rather than creating everything in a single xml page. But as far as I have searched, there are no proper tutorials or blogs giving an appropriate example of a program implementing swipe. If possible, provide some working codes.
Thanks in advance.
It seems that a FragmentPager is what you want.
Examples and code on the linked page.
If you build for earlier versions of Android, the necessary code is included in the Android Support Package.
In Android, swipe is not identified as a particular gesture.
You can use a OnTouchListener registered on your view, and animate your view if the gesture exeeds a certain threshold.
You can then launch a new activity, or in a simpler way, use a viewFlipper.
Please try the attached link View flow.
I feel it will fit your needs perfectly. You can even create different xmls and inflate them into different view objects and then use the "view flow" to switch between them.
The "view flow" is perfect for handling both simple & complicated views. The flow indicator on the top of the screen is optional.
I hope it helps..

How to Add ViewPager Indicator Headings Like Google+ App

My goal is to create a screen similar in function to the Stream page in the Google+ app (picture below for those unfamiliar). For the paging, I am using a custom ViewGroup so that it has smooth transitions that "follow your finger" rather than just snapping to the destination after the fling gesture has been made.
Question
Currently, I am going the route of using some TranslateAnimations to move the headings ("Nearby," "All circles," and "Incoming" in the screenshot) once a new page has been selected. This creates a couple of problems: the center heading doesn't follow the user's finger (as you can see the "All circles" heading does in the screenshot), and if the user begins on a page other than the middle one, I have not found an easy way to offset all of the animations temporarily without running them first since the animations do not move the actual views.
Am I going about this the correct way, or is there a much simpler way of accomplishing this that I am overlooking?
Thanks
After hours of searching and a little luck with search terms, I came across A Google+ like ViewPager page indicator.
I also came across Android ViewPager Indicator, created by the same developer who wrote ActionBarSherlock. Has a ton of examples, and is pretty easy to integrate with the FragmentPagerAdapter.
Google has published his own solution in support library.
Check:
PagerTitleStrip,
PagerTabStrip
Have just used ViewPagerIndicator solution and its very nice and smooth. You can demo the effect by looking at the demo from the Android Market here
I am not 100% sure, but I think it uses the new ViewPager.
Maybe you should look at the API 4+ Support Demos:
FragmentStatePagerSupport.java
FragmentPagerSupport.java

Categories

Resources