When we first saw the new Android L’s new feature called App Shortcuts, we thought it was going to be a quick addition that no one would use. It seems that we were wrong, though, because a lot of developers are already building apps with App Shortcuts. Even popular apps such as Facebook, WhatsApp, Google Maps, and Netflix have already added the feature to their apps.
Life is too short to spend time in an application linked to a wrong activity or task. That’s why we created a small Android library which allows you to: swipe down from an activity to close it.
_Android library which allows you to swipe down from an activity to close it_ I have been working on an Android library that allows you to swipe down from an activity to close it. It is a very simple library that just fades the title and the icon of the activity to the bottom of the screen, so that you can close the activity without leaving the application.. Read more about android animation slide up from bottom github and let us know what you think.
android slider activity
Easily create events that slide vertically across the screen and fit right into the Material Design era.
Characteristics
Slider actions allow you to easily define header content, menus, and data on a slider screen. The library currently supports many custom features to make the screen unique. The following items are currently supported:
- Define the header and collapse the header when scrolling in the toolbar
- Make the toolbar header disappear when you scroll.
- Set the colors that will affect the color of the header and status bar
- Add a floating action button at the bottom of the header that animates and disappears at the right moment.
- Disable the header and show only the scrolling content
- Works with PeekView by default to give a 3D touch effect to your views. See the usage example in the TalonActivity example.
Setting
Add the following to your gradle script:
Dependencies {
compile ‘com.clinkerapps:sliding-activity:1.5.2’
}
and resynchronize the project.
Example of use
Floating events are very easy to implement. Here’s a simple example:
public class NormalActivity extends SlidingActivity {
@Override
public void init(Bundle savedInstanceState) {
setTitle(Title of activity) ;
setPrimaryColors(
getResources().getColor(R.color.primary_color),
getResources().getColor(R.color.primary_color_dark)
) ;
setContent(R.layout.activity_content);}
This creates an activity with the specified title, base colors, and everything in the activity_content format.
You should also include a link to the activity in AndroidManifest.xml :
Read more: First, develop SlidingActivity. Instead of overriding onCreate(), override init() and set all application parameters there. These options include:
- setTitle()
- setImage()
- setContent()
- setPrimaryColors()
- setFab()
- deactivateHeader()
- enable full screen()
More examples of possible actions can be found in the sample application and code snippets are shown below.
You can configure the scroller before it is initialized by overwriting configureScroller(scroller)
@Override
protected void configureScroller(MultiShrinkScroller scroller) {
super.configureScroller(scroller);
scroller.setIntermediateHeaderHeightRatio(1);
}
Activity options
Most of the activity options must be implemented in init(). You can implement setImage() anywhere after init(), but none of the other methods should be outside of it.
setTitle()
It is easy to make the header disappear when you move the toolbar. You can do it:
setTitle(R.string.title) ;
or
setTitle(activity title) ;
setImage()
You can either specify an identifier for a drawable resource, or specify a pixmap as an image:
setImage(R.drawable.header_image) ;
setImage(mBitmap) ;
There are two possibilities to set the image of the photo:
- Set it in init()
- Set it outside init()
The two systems have completely different functions, so it is important to understand the difference.
If your project contains a drawable or already has a bitmap loaded into memory, it is best to set the image in init(). This changes the colors of the activity to match the image, and the image is displayed when you scroll up and down.
If you need to load an image from a url or from memory, you shouldn’t do it in the main thread. This means that you must define it after you have already initialized the activity. This will animate the image with a circular reveal animation (for Lollipop+ users) or a fade-in animation. In this activity, it is also not necessary to look at the image and extract the colors. Instead, the colors you defined as primary colors are used.
setContent()
The installation of the content is done in the same way as a normal activity. You can either use a layout resource ID or a view :
setContent(R.layout.activity_layout);
setContent(mView) ;
Once the content is defined, it can be accessed with findViewById(), as a normal activity.
setPrimaryColors()
The primary color is used for the color of the header when there is no image, and the dark primary color is used for the color of the status bar when the activity has scrolled to the top of the screen.
setPrimaryColors(primaryColor, primaryColorDark) ;
Note that the image definition in init() overrides these colors. If you still want to set your own colors instead of using the extracted image, call setPrimaryColors() AFTER setImage().
setFab()
A floating action button can appear at the bottom of the extended toolbar and be used as needed for your business.
setFab(mBackgroundColor, R.drawable.fab_image, onClickListener) ;
When the user scrolls down the page and the header begins to shrink, the FAB is hidden. When the head is back to its original size, the FOB is displayed again.
If you don’t want to display the header on screen, but only animate the scrolling content, you can call disableHeader() in init().
Turn on full screen()
If you want the scrolling content to not animate on the screen and leave some more space at the top, you can call enableFullscreen() in init(). After that, you can always swipe down to cancel the action.
expandFromPoints(int,int,int)
This feature allows you to create an inbox extension from anywhere on the screen. As with many methods, the Left offset, Top offset, Width and Height parameters describe the size of the field you want to expand.
Intent intent = getIntent();
if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) {
expandFromPoints(
intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0),
intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0),
intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0),
intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0)
);
}
My suggestion: In the SampleActivity.addExpansionArgs(Intent) function, you can see that I pass the expansion parameters as additional Intent parameters. I recommend using this method to switch the activity display under SlidingActivity to SlidingActivity.
Teming
The library contains two themes created especially for SlidingActivity. You can use Theme.Sliding or Theme.Sliding.Light when capturing slider activity in the AndroidManifest.xml file. You can also use these themes as parent themes for your own custom themes and use them instead if you wish.
GitHub
https://github.com/klinker41/android-slidingactivityThe best ways to close an application are probably not the same on every phone. If you’re using an Android phone, you might not be able to do that with a tap. What if you’re on an iPhone? You might not be able to swipe down with two fingers from the lock screen to close an app. That’s where this library comes in. It allows you to swipe down from the top of an activity to close it. So you can press down once on the first activity in your list, swipe down to the bottom, and tap the “X” to close the app.. Read more about android-activity transition animation slide and let us know what you think.
Related Tags:
slide up activity androidswipe down to close activity androidandroid swipe gesture example codeslide up layout androidandroid swipe to dismiss activityandroid swipe down to close fragment,People also search for,Privacy settings,How Search works,android animation slide up from bottom github,slide up activity android,swipe down to close activity android,android swipe gesture example code,android-activity transition animation slide,slide up layout android,android swipe to dismiss activity,android swipe down to close fragment