Skip to content

Commit

Permalink
update to v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanhua committed Mar 6, 2018
1 parent c8ff16a commit 22c6a3c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 42 deletions.
63 changes: 29 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Skeleton

[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http:https://www.apache.org/licenses/LICENSE-2.0)
The library provides an easy way to show skeleton loading view like Facebook and Alipay.
It now uses a memory optimised version of shimmer animation so it is even faster and you can animate bigger layouts as well.

Expand Down Expand Up @@ -27,57 +27,52 @@ you can scan the qrcode for download demo apk
# Getting started

In your build.gradle:

dependencies {
implementation 'com.ethanhua:skeleton:1.0.1'
implementation 'io.supercharge:shimmerlayout:1.0.2'
```
dependencies {
implementation 'com.ethanhua:skeleton:1.1.0'
implementation 'io.supercharge:shimmerlayout:2.0.0'
}
```



# Usage
For RecyclerView:

skeletonScreen = Skeleton.bind(recyclerView)
```java
skeletonScreen = Skeleton.bind(recyclerView)
.adapter(adapter)
.load(R.layout.item_skeleton_news)
.show();
```
 For View: 
skeletonScreen = Skeleton.bind(rootView)
 For View:
```java
skeletonScreen = Skeleton.bind(rootView)
.load(R.layout.layout_img_skeleton)
.show();
```
More Config:

.shimmer(true) // whether show shimmer animation. default is true
.count(10) // the recycler view item count. default is 10
.color(color) // the shimmer color. default is #a2878787
.angle(20) // the shimmer angle. default is 20;
.duration(1000) // the shimmer animation duration. default is 1000;
.frozen(false) // whether frozen recyclerView during skeleton showing default is true;
```java
.shimmer(true) // whether show shimmer animation. default is true
.count(10) // the recycler view item count. default is 10
.color(color) // the shimmer color. default is #a2878787
.angle(20) // the shimmer angle. default is 20;
.duration(1000) // the shimmer animation duration. default is 1000;
.frozen(false) // whether frozen recyclerView during skeleton showing default is true;
```
when data return you can call the method to hide skeleton loading view

skeletonScreen.hide()
```java
skeletonScreen.hide()
```
# Thanks

https://github.com/team-supercharge/ShimmerLayout

# License

Copyright 2017, ethanhua

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:https://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.
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 7
versionName "1.0.1"
versionCode 8
versionName "1.1.0"
}
buildTypes {
release {
Expand All @@ -18,7 +18,7 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'io.supercharge:shimmerlayout:1.0.2'
implementation 'io.supercharge:shimmerlayout:2.0.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
}
Expand All @@ -27,7 +27,7 @@ publish {
userOrg = 'ethanhua'
groupId = 'com.ethanhua'
artifactId = 'skeleton'
publishVersion = '1.0.1'
publishVersion = '1.1.0'
bintrayUser = 'ethanhua'
bintrayKey = ''
desc = 'a library provider a easy way to show skeleton loading view'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,23 @@ private ViewSkeletonScreen(Builder builder) {
}

private ShimmerLayout generateShimmerContainerLayout(ViewGroup parentView) {
ShimmerLayout shimmerLayout = (ShimmerLayout) LayoutInflater.from(mActualView.getContext()).inflate(R.layout.layout_shimmer, parentView, false);
final ShimmerLayout shimmerLayout = (ShimmerLayout) LayoutInflater.from(mActualView.getContext()).inflate(R.layout.layout_shimmer, parentView, false);
shimmerLayout.setShimmerColor(mShimmerColor);
shimmerLayout.setShimmerAngle(mShimmerAngle);
shimmerLayout.setShimmerAnimationDuration(mShimmerDuration);
View innerView = LayoutInflater.from(mActualView.getContext()).inflate(mSkeletonResID, shimmerLayout, false);
shimmerLayout.addView(innerView);
shimmerLayout.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
shimmerLayout.startShimmerAnimation();
}

@Override
public void onViewDetachedFromWindow(View v) {
shimmerLayout.stopShimmerAnimation();
}
});
shimmerLayout.startShimmerAnimation();
return shimmerLayout;
}
Expand Down
6 changes: 3 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':library')
// implementation 'com.ethanhua:skeleton:1.0.1'
// implementation 'io.supercharge:shimmerlayout:1.0.2'
//implementation project(':library')
implementation 'com.ethanhua:skeleton:1.1.0'
implementation 'io.supercharge:shimmerlayout:2.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
Expand Down

0 comments on commit 22c6a3c

Please sign in to comment.