Skip to content

Commit

Permalink
优化BaseProgressDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
jenly1314 committed Jan 18, 2018
1 parent 8c55498 commit adb05f7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ MVPFrame for Android 是一个集合了 Retrofit2 + RXJava2 + OkHttp3 + Mosby3
<dependency>
<groupId>com.king.frame</groupId>
<artifactId>mvpframe</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<type>pom</type>
</dependency>
```
### Gradle:
```gradle
compile 'com.king.frame:mvpframe:1.0.3'
compile 'com.king.frame:mvpframe:1.0.4'
```
### Lvy:
```lvy
<dependency org='com.king.frame' name='mvpframe' rev='1.0.3'>
<dependency org='com.king.frame' name='mvpframe' rev='1.0.4'>
<artifact name='$AID' ext='pom'></artifact>
</dependency>
```
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/com/king/mvpframe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.widget.Toast;

import com.king.frame.mvp.base.BaseActivity;
import com.king.frame.mvp.base.QuickActivity;
import com.king.mvpframe.bean.IPAddress;
import com.king.mvpframe.mvp.presenter.IPAddrPresenter;
import com.king.mvpframe.mvp.view.IIPAddrView;
Expand All @@ -25,7 +26,7 @@
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends BaseActivity<IIPAddrView, IPAddrPresenter> implements IIPAddrView {
public class MainActivity extends QuickActivity<IIPAddrView, IPAddrPresenter> implements IIPAddrView {

@BindView(R.id.pb)
ProgressBar pb;
Expand All @@ -38,6 +39,8 @@ public class MainActivity extends BaseActivity<IIPAddrView, IPAddrPresenter> imp

private Toast mToast;



@NonNull
@Override
public IPAddrPresenter createPresenter() {
Expand Down Expand Up @@ -112,16 +115,19 @@ public void onViewClicked() {

@Override
public void showProgress() {
super.showProgress();
pb.setVisibility(View.VISIBLE);
}

@Override
public void onCompleted() {
// super.onCompleted();
pb.setVisibility(View.INVISIBLE);
}

@Override
public void onError(Throwable e) {
// super.onError(e);
tvAddr.setText("获取失败!");
}

Expand Down
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ publish {
userOrg = 'jenly'//bintray.com用户名
groupId = 'com.king.frame'//jcenter上的路径
artifactId = 'mvpframe'//项目名称
publishVersion = '1.0.3'//版本号
publishVersion = '1.0.4'//版本号
desc = 'MVPFrame for Android'//描述
website = 'https://github.com/jenly1314/MVPFrame'//网站
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,18 @@ public <T extends View> T findView(@IdRes int id){
return (T)mRootView.findViewById(id);
}


@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initData();
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated( savedInstanceState );
super.getDialog().getWindow().getAttributes().windowAnimations = R.style.dialog_animation;
initData();

}

public void replaceFragment(@IdRes int id, Fragment fragment) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/king/frame/mvp/base/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public <T extends View> T findView(@IdRes int id){
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated( savedInstanceState );
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public BaseProgressDialog(Context context, int themeResId) {
initUI();
}

protected BaseProgressDialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
public BaseProgressDialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
initUI();
}
Expand All @@ -46,7 +46,7 @@ public void setContentView(@NonNull View view) {

private void initUI() {
getWindow().getAttributes().gravity = Gravity.CENTER;
setCanceledOnTouchOutside(true);
setCanceledOnTouchOutside(false);
}

}

0 comments on commit adb05f7

Please sign in to comment.