Android fragment shared element transition implementation - android

I have an Android app that provides navigation through online folders (like Google Drive). I have implemented the folder navigation with fragments. The main activity has a toolbar and the remaining space is used for fragments. One fragment represents one folder. Subfolders and files are displayed using a RecyclerView and when a new folder is opened, the old fragment gets hidden and a new fragment for the opened folder is added.
Now i want to add animations to my application, specifically, for opening and closing of folders. When a folder in the list is clicked i want the background view of the clicked item to expand to become the background of the new fragment. When back is pressed, the opposite should happen.
Here is a video i found of something similar to what i want to achieve: https://youtu.be/xvy7KUe492g
However in the video the clicked view expands over the toolbar, whereas i want the toolbar to remain visible.
Could you help me out by writing an example, or pointing me to the right direction?

This link is pretty clear and has many examples
http://developer.android.com/training/material/animations.html#Reveal

Related

How can you have multiple instances of the same fragment in multiple pages of a ViewPager2?

I am creating an app in Kotlin. The desired operation is that when the user opens the app, the user will be presented with a menu offering navigation options. Upon tapping one of the icons, the user will then be presented with another menu. From that menu, several things can happen. This works fine in my app. The problem comes when I add ViewPager2. I would like the user to have multiple "pages" open at the same time that the user can switch between. Each page will start at the Main Menu and then move on as stated above. To simplify this, I'm trying to build something similar to a web browser. The user can have multiple pages, tabs, or whatever open which are independent of each other and can switch between them at will
Scrolling between pages in ViewPager2 is where most of my problems have happened. Here is what I have tried so far:
Loading each fragment into a "holder" fragment - The Fragment disappeared when scrolling to another fragment.
Letting the Main Activity load the Main Menu Fragment without a "holder" fragment. This worked for scrolling between pages, but when I tap on a menu icon on any page, it changed the data on the first page.
I tried using SupportFragmentManager and ChildFragmentManager. I tried to mix the two with varied results. None of which create the desired behavior.
Am I using ViewPager2 as it was intended or is there something else that I should be using to accomplish what I'm trying to do?

Custom Android View slides onto screen by user gesture

I have fitted my app with a NavDrawer following the Android Material Design spec.
But initially the idea I had for my App's Navigation Drawer was different, I would like to maintain that design, but I need advice with the approach.
I have uploaded an image of what I would like to achieve.
http://i.stack.imgur.com/uzRBe.jpg
The user can click on button 2 and due to the nature of button 2, only that portion of the NavDrawer will slide out, or the user can slide the drawer out manually using a finger, and the drawer slides out and snaps to the edge of the screen just like the Android notification menu that u can slide from the top of your device.
Clicking on button four will slide the entire Group of buttons (due to the nature of content on button 4), button two would remain on the right if it were already there to start with.
Button 1 which would be the home button would check that all other buttons are in place (to the left) otherwise it draws them in then loads the home content into the main view.
I am not sure which way to approach this, using the Material Spec NavDrawer, or I custom design multiple linear layouts that follow the user's Xposition gestures.
Currently, I have a Material Spec NavDrawer, so the code is standard
Better to use the default Android Drawer Actvitity that comes with Android studio 2.0 and modify it.
it will save you allot of bugs
if you still want to create a cosutm one
you can either use what was suggested here >
http://simonvt.github.io/android-menudrawer/
or you can just choose one from this site >
https://android-arsenal.com/search?q=Drawer
it has some open library drawer helpers to help you write one.
i woul'd suggest against writing everything from scrach, it looks like allot of works and introduce allot of bugs, as to what needs to be on top of what every time, that you can fix by either using a library or taking the default one.

How to save and load state of an application during change of screen orientation in android

I have been trying to make an application, and since I am new to android development I am stuck with this small problem. The application which when opened shows this layout as the first page.
Then after choosing the content from the list view a fragment transaction occurs and this page is opened.
I have used fragments because I have used drawer layout and tabbed layout using action bar sherlock theme.
The problem I am facing is after the screen is rotated the previous fragment is loaded, i.e. it takes me back to the list view page from the information page.
I have read that we have to save and load the state of the application but as I am new to this I don't know how to implement it. Please help!!!

Close Button for Button - Possible?

I am making an app that has a couple list view menus that lead to a file display. When the user opens a file (in a webview), I want to create a tab bar so that they can quickly refer back to this file even after going back through the menu and viewing a different file. I planned on creating a fragment activity that housed a horiz scroll view that housed buttons that referenced the file that they viewed. Then, when they move on to a different file, they can just hit the tab and return to the file referenced on the tab.
Couple things:
-the tab bar, once created, needs to persist across activities until closed by the user
-the tab bar needs to refresh itself every time the user opens a new file
-it would be really nice to have a little close button (like the red x in the corner in apple stuff) on the tab buttons, so that the user can close individual tabs.
Is this possible?
any suggestions, tips, etc ?
Is android's built in tabs a better way to go than horiz scroll view with buttons?
thanks in advance

Transition when switching Activity out of SlidingMenu (J.Feinstein)

I am an android newbie and I am trying to create an Android App with three Activities: a Homescreen, a listview and a detailview.
I integrated J. Feinstein's Sliding Menu in my Homescreen and filled it with a ListView to display my different categories (Restaurants, Bars, Culture, whatever). When I click one of my List Items, the new Activity gets created and Pops up. However, I want the Activity to replace the old one while the SlidingMenu stays on top and then gently slides away. I saw this behaviour in the Example App but I cant quite find the bit of code that holds the answer to my question. Hope anyone can help :)
The sample app uses fragment transactions instead of starting new activities to change the content. As far as I know, that is the only way to do the two actions – close sliding menu and change content – simultaneously.

Categories

Resources