https://github.com/omega-r/omegaroundingimageview
RoundingImageView that supports any transitions
https://github.com/omega-r/omegaroundingimageview
android circle imageview library round transition
Last synced: 12 months ago
JSON representation
RoundingImageView that supports any transitions
- Host: GitHub
- URL: https://github.com/omega-r/omegaroundingimageview
- Owner: Omega-R
- License: apache-2.0
- Created: 2017-07-13T14:23:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-14T13:50:54.000Z (almost 9 years ago)
- Last Synced: 2025-03-30T07:51:14.135Z (about 1 year ago)
- Topics: android, circle, imageview, library, round, transition
- Language: Java
- Homepage: https://omega-r.github.io/OmegaRoundingImageView/
- Size: 26.6 MB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://jitpack.io/#Omega-R/OmegaRoundingImageView)
[](http://www.apache.org/licenses/LICENSE-2.0.html)
# RoundingImageView
Installation
------------
To get a Git project into your build:
**Step 1.** Add the JitPack repository to your build file
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
**Step 2.** Add the dependency
```
dependencies {
compile 'com.github.Omega-R:OmegaRoundingImageView:v1.0'
}
```
Usage
-----
Use com.omega_r.rounding_imageview.RoundingImageView in place of ImageView. The `rounding` value can be set using `app:rounding` attribute. Value must be within [0,1] - **0** for no rounding, **1** for perfect rounding. Set `android:transitionName` attribute.
```
```
Transition
----------
Provide `@transition/image_transition` as the value for `android:windowSharedElementEnterTransition` & `android:windowSharedElementExitTransition` under your Activity theme in `styles.xml`:
```
<item name="colorPrimary">...</item>
<item name="colorPrimaryDark">...</item>
<item name="colorAccent">...</item>
....
....
<!-- @transition/image_transition is provided by ImageTransition library -->
<item name="android:windowSharedElementEnterTransition">@transition/image_transition</item>
<item name="android:windowSharedElementExitTransition">@transition/image_transition</item>
```
To transfer transition values between activity's you should extent `BaseTransitionActivity` and override `Bundle getTransitionsArguments()` & `void updateTransitionsArguments(Bundle bundle)`:
```
public class SecondActivity extends BaseTransitionActivity {
....
....
/*If transition starts from this Activity,
you need to return Bundle with start and end transition parameters (see sample)*/
@Override
protected Bundle getTransitionsArguments() {
return null;
}
/*If transition ends in this Activity,
you need to create RoundingImageTransitionValues and set it to callback (see sample) */
@Override
protected void updateTransitionsArguments(Bundle bundle) {
...
setEnterSharedElementCallback(RoundingImageTransitionUtil.getCallback(values));
}
....
....
@Override
public void onBackPressed() {
supportFinishAfterTransition();
super.onBackPressed();
}
}
```
The sample app shows this approach.
If you'd like to change the duration of the transition, or use the transition within your own set of transitions, or use a different interpolator, include the following:
```
//Set duration
// Provides bounds transition
// Provides transition between different scale types
// Provides rounding transition
```
API version requirements
------------------------
For image transition between activities, version 21 or above is required.
License
-------
```
Copyright 2017 Omega-R
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```