Skip to content

Commit

Permalink
update to v0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanhua committed Aug 9, 2017
1 parent e313a1b commit 454e612
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ you can scan the qrcode for download demo apk
In your build.gradle:

dependencies {
compile 'com.ethanhua:skeleton:0.2.1'
compile 'com.ethanhua:skeleton:0.2.2'
}


Expand Down
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 4
versionName "0.2.1"
versionCode 5
versionName "0.2.2"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -35,7 +35,7 @@ publish {
userOrg = 'ethanhua'
groupId = 'com.ethanhua'
artifactId = 'skeleton'
publishVersion = '0.2.1'
publishVersion = '0.2.2'
bintrayUser = 'ethanhua'
bintrayKey = ''
desc = 'a library provider a easy way to show skeleton loading view'
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/ethanhua/skeleton/ViewReplacer.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ public class ViewReplacer {
private ViewGroup mSourceParentView;
private ViewGroup.LayoutParams mSourceViewLayoutParams;
private int mSourceViewIndexInParent = 0;
private int mSourceViewId;

public ViewReplacer(View sourceView) {
mSourceView = sourceView;
mSourceViewLayoutParams = mSourceView.getLayoutParams();
mCurrentView = mSourceView;
mSourceViewId = mSourceView.getId();
}


Expand All @@ -46,6 +48,7 @@ public void replace(View targetView) {
if (init()) {
mTargetView = targetView;
mSourceParentView.removeView(mCurrentView);
mTargetView.setId(mSourceViewId);
mSourceParentView.addView(mTargetView, mSourceViewIndexInParent, mSourceViewLayoutParams);
mCurrentView = mTargetView;
}
Expand All @@ -56,6 +59,8 @@ public void restore() {
mSourceParentView.removeView(mCurrentView);
mSourceParentView.addView(mSourceView, mSourceViewIndexInParent, mSourceViewLayoutParams);
mCurrentView = mSourceView;
mTargetView = null;
mTargetViewResID = -1;
}
}

Expand Down
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.ethanhua.skeleton.sample"
minSdkVersion 15
targetSdkVersion 25
versionCode 4
versionName "0.2.1"
versionCode 5
versionName "0.2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
8 changes: 6 additions & 2 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<Button
android:id="@+id/btn_list"
android:layout_marginTop="10dp"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="List"
Expand All @@ -25,20 +26,23 @@
<Button
android:id="@+id/btn_view"
android:layout_marginTop="10dp"
android:text="view"
android:text="View"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<Button
android:id="@+id/btn_Imgloading"
android:layout_marginTop="10dp"
android:text="imgloading"
android:text="Image"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btn_status"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:textAllCaps="false"
android:text="more usage"
android:layout_height="wrap_content" />
</LinearLayout>
6 changes: 5 additions & 1 deletion sample/src/main/res/layout/activity_status_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="loading"
android:textAllCaps="false"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btn_error"
app:layout_constraintTop_toTopOf="parent" />
Expand All @@ -20,6 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="error"
android:textAllCaps="false"
app:layout_constraintLeft_toRightOf="@+id/btn_loading"
app:layout_constraintRight_toLeftOf="@+id/btn_empty"
app:layout_constraintTop_toTopOf="@+id/btn_loading" />
Expand All @@ -29,12 +31,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="empty"
android:textAllCaps="false"
app:layout_constraintLeft_toRightOf="@+id/btn_error"
app:layout_constraintRight_toLeftOf="@+id/btn_content"
app:layout_constraintTop_toTopOf="@+id/btn_loading" />
<Button
android:id="@+id/btn_content"
android:text="content"
android:textAllCaps="false"
app:layout_constraintLeft_toRightOf="@+id/btn_empty"
app:layout_constraintTop_toTopOf="@+id/btn_loading"
app:layout_constraintRight_toRightOf="parent"
Expand All @@ -53,7 +57,7 @@
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:text="welcome! hope that is useful to you"
android:text="this is content view"
android:layout_gravity="center"
android:layout_height="wrap_content" />
</FrameLayout>
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/layout/layout_empty_view.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="https://schemas.android.com/apk/res/android"
android:text="暂无数据"
android:text="this is empty view"
android:layout_gravity="center"
android:gravity="center"
android:layout_width="wrap_content"
Expand Down
6 changes: 3 additions & 3 deletions sample/src/main/res/layout/layout_error.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="https://schemas.android.com/apk/res/android"
android:id="@+id/txt_search"
android:layout_gravity="center"
android:onClick="gotoSet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="网络不给力,请检查网络设置" />
android:layout_gravity="center"
android:onClick="gotoSet"
android:text="something wrong,please check network setting" />

0 comments on commit 454e612

Please sign in to comment.