![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
com.github.kaichunlin.transition:transition
Advanced tools
Allows the easy creation of animated transition effects when the state of Android UI has changed
Android-Transition allows the easy creation of view transitions that reacts to user inputs. The library is designed to be general enough such that the same transition can be applied to differnt UI components like Drawer, SlidingUpPanel, ViewPager, ObservableScrollView (work in progress), etc., as long as appropriate adapter is used.
Core module has been updated to 0.8.1 to fix incorrect position on some devices when transiting MenuItem. On Android Studio update Gradle dependency to:
compile 'com.github.kaichunlin.transition:core:0.8.1'
The app on Google Play may not be the latest version.
View and MenuItem Transition
view transition
MenuItem transition
Interpolator
It's very easy to apply standard Android Interpolator to the transition:
(AccelerateDecelerateInterpolator v.s. AnticipateInterpolator)
Custom Adapters
The simplest way to integrate Android-Transition is to grab them from Maven Central or jCenter. On Android Studio, add the code below to Gradle dependencies:
compile 'com.github.kaichunlin.transition:core:0.8.1'
Adapters that adapts to UI components not found in Android framework or Android Support Library are provided as their own libraries, the table below is the list of libraries:
Library | Function | Description in build.gradle |
---|---|---|
core | Provides core transition function and adapters | com.github.kaichunlin.transition:core:0.8.1 |
slidinguppanel | AndroidSlidingUpPanel Adapter | com.github.kaichunlin.transition:slidinguppanel:0.8.0 |
As an example, if an app requires both the core & slidinguppanel libraries, then build.gradle will look like below:
dependencies {
//other dependencies
...
compile 'com.github.kaichunlin.transition:core:0.8.1'
compile 'com.github.kaichunlin.transition:slidinguppanel:0.8.0'
}
The app/ folder is a sample app containing dozens of examples.
DrawerListenerAdapter mDrawerListenerAdapter = new DrawerListenerAdapter(mDrawerToggle, R.id.drawerList);
mDrawerListenerAdapter.setDrawerLayout(mDrawerLayout);
mDrawerListenerAdapter.addTransition(
ViewTransitionBuilder.transit(findViewById(R.id.big_icon)).rotation(0f, 360f).scaleX(1f, 0.2f).scaleY(1f, 0f).translationX(200f));
DrawerListenerAdapter mDrawerListenerAdapter = new DrawerListenerAdapter(mDrawerToggle, R.id.drawerList);
mDrawerListenerAdapter.setDrawerLayout(mDrawerLayout);
@Override
public boolean onCreateOptionsMenu(Menu menu) {
mDrawerListenerAdapter.onCreateOptionsMenu(this, menu);
return super.onCreateOptionsMenu(menu);
}
//shared configuration
MenuItemTransitionBuilder builder = MenuItemTransitionBuilder.transit(toolbar).alpha(1f, 0.5f).scale(1f, 0f).cascade(0.3f).visibleOnStartAnimation(true).invalidateOptionOnStopTransition(this, true);
// create a transition to be used when the drawer transits from the closed state to the opened state
// notice that in most situations clone() should be used, i.e. builder.clone(), to prevent builder picking up effects that should only apply to a single transition
MenuItemTransition mShrinkClose = builder.translationX(0, 30).build();
// create a reverse transition to be used when the drawer transits from the opened state to the closed state
MenuItemTransition mShrinkOpen = builder.reverse().translationX(0, 30).build();
//tells adapter the transition and the menu options for both the opened and closed states
mDrawerListenerAdapter.setupOptions(this, new MenuOptionConfiguration(mShrinkOpen, R.menu.drawer), new MenuOptionConfiguration(mShrinkClose, R.menu.main));
To clear all transitions from an adapter:
mDrawerListenerAdapter.clearTransition();
Share a common builder (sample code):
//calling adapter(mSlidingUpPanelLayoutAdapter) means that when builder.build() is called, the resultant transition will automatically be added to mSlidingUpPanelLayoutAdapter
ViewTransitionBuilder baseBuilder = ViewTransitionBuilder.transit().interpolator(mInterpolator).adapter(mSlidingUpPanelLayoutAdapter).rotationX(42f).scale(0.8f).translationYAsFractionOfHeight(-0.5f);
//calls clone() so any modification will not be propagated to other transitions build from the same builder
//adds a transition to view R.id.content_bg
baseBuilder.clone().target(findViewById(R.id.content_bg)).build();
//apply the same transition effect to a different view (R.id.content)
baseBuilder.clone().target(findViewById(R.id.content)).build();
Delay transition evaluation until layout is complete, this is required if a view's position/dimension is used in the evaluation, in such a case ViewUtil provides a helper function (sample code):
ViewUtil.executeOnGlobalLayout(findViewById(R.id.rotate_slide), new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
//create ViewTransitionBuilder here
}
});
FAQs
Allows the easy creation of animated transition effects when the state of Android UI has changed
We found that com.github.kaichunlin.transition:transition demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.