Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Othershe committed Sep 13, 2017
1 parent 43171ff commit d9552f8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ allprojects {
**Step 2. 添加项目依赖**
``` gradle
dependencies {
compile 'com.github.Othershe:NiceDialog:1.1.2'
compile 'com.github.Othershe:NiceDialog:1.1.3'
}
```
**Step 3. 配置、展示dialog**
Expand All @@ -39,7 +39,7 @@ NiceDialog.init()
.setDimAmount(0.3f) //调节灰色背景透明度[0-1],默认0.5f
.setShowBottom(true) //是否在底部显示dialog,默认flase
.setMargin() //dialog左右两边到屏幕边缘的距离(单位:dp),默认0dp
.setWidth() //dialog宽度(单位:dp),默认为屏幕宽度
.setWidth() //dialog宽度(单位:dp),默认为屏幕宽度,-1代表WRAP_CONTENT
.setHeight() //dialog高度(单位:dp),默认为WRAP_CONTENT
.setOutCancel(false) //点击dialog外是否可取消,默认true
.setAnimStyle(R.style.EnterExitAnimation) //设置dialog进入、退出的动画style(底部显示的dialog有默认动画)
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':nicedialog')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ private void initParams() {
//设置dialog宽度
if (width == 0) {
lp.width = Utils.getScreenWidth(getContext()) - 2 * Utils.dp2px(getContext(), margin);
} else if (width == -1) {
lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
} else {
lp.width = Utils.dp2px(getContext(), width);
}

//设置dialog高度
if (height == 0) {
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,10 @@ public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable("listener", convertListener);
}

@Override
public void onDestroyView() {
super.onDestroyView();
convertListener = null;
}
}

0 comments on commit d9552f8

Please sign in to comment.