Skip to content

Commit

Permalink
Fix bug: lose props when use in viewpager+fragment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ittianyu committed Feb 20, 2019
1 parent a9f9243 commit 5af83a9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ allprojects {
def support_version = '28.0.0'
def lifecycle_version = '1.1.1'
implementation 'com.github.ittianyu:relight:0.2.1'
implementation 'com.github.ittianyu:relight:0.2.2'
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:design:$support_version"
Expand Down
4 changes: 2 additions & 2 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 21
versionName "0.2.1"
versionCode 22
versionName "0.2.2"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public abstract class BaseAndroidWidget<V extends View, T extends BaseAndroidWid
public Integer weight;
private OnClickListener onClick;
private RelativeLayout.LayoutParams relativeParams;
private boolean addOnAttachListener;
private OnAttachStateChangeListener onAttachStateChangeListener = new OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
Expand All @@ -71,18 +70,11 @@ public void onViewDetachedFromWindow(View v) {

public BaseAndroidWidget(Context context, Lifecycle lifecycle) {
super(context, lifecycle);
view.addOnAttachStateChangeListener(onAttachStateChangeListener);
}

protected abstract void initProps();

@Override
public void onStart() {
if (!addOnAttachListener) {
addOnAttachListener = true;
view.addOnAttachStateChangeListener(onAttachStateChangeListener);
}
}

@Override
public void onDestroy() {
super.onDestroy();
Expand Down

0 comments on commit 5af83a9

Please sign in to comment.