From adb05f7c7720c272f033cbca239ab5d1eda8a9ce Mon Sep 17 00:00:00 2001 From: Jenly Date: Thu, 18 Jan 2018 09:41:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96BaseProgressDialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- app/src/main/java/com/king/mvpframe/MainActivity.java | 8 +++++++- lib/build.gradle | 2 +- .../java/com/king/frame/mvp/base/BaseDialogFragment.java | 9 ++++++++- .../main/java/com/king/frame/mvp/base/BaseFragment.java | 4 ++-- .../java/com/king/frame/mvp/base/BaseProgressDialog.java | 4 ++-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index db10618..c567ddc 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,17 @@ MVPFrame for Android 是一个集合了 Retrofit2 + RXJava2 + OkHttp3 + Mosby3 com.king.frame mvpframe - 1.0.3 + 1.0.4 pom ``` ### Gradle: ```gradle -compile 'com.king.frame:mvpframe:1.0.3' +compile 'com.king.frame:mvpframe:1.0.4' ``` ### Lvy: ```lvy - + ``` diff --git a/app/src/main/java/com/king/mvpframe/MainActivity.java b/app/src/main/java/com/king/mvpframe/MainActivity.java index 618a6b5..399baf2 100644 --- a/app/src/main/java/com/king/mvpframe/MainActivity.java +++ b/app/src/main/java/com/king/mvpframe/MainActivity.java @@ -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; @@ -25,7 +26,7 @@ import butterknife.ButterKnife; import butterknife.OnClick; -public class MainActivity extends BaseActivity implements IIPAddrView { +public class MainActivity extends QuickActivity implements IIPAddrView { @BindView(R.id.pb) ProgressBar pb; @@ -38,6 +39,8 @@ public class MainActivity extends BaseActivity imp private Toast mToast; + + @NonNull @Override public IPAddrPresenter createPresenter() { @@ -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("获取失败!"); } diff --git a/lib/build.gradle b/lib/build.gradle index 4569f65..d1bf1f9 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -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'//网站 } \ No newline at end of file diff --git a/lib/src/main/java/com/king/frame/mvp/base/BaseDialogFragment.java b/lib/src/main/java/com/king/frame/mvp/base/BaseDialogFragment.java index 2a42ab9..8d03497 100644 --- a/lib/src/main/java/com/king/frame/mvp/base/BaseDialogFragment.java +++ b/lib/src/main/java/com/king/frame/mvp/base/BaseDialogFragment.java @@ -40,11 +40,18 @@ public 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) { diff --git a/lib/src/main/java/com/king/frame/mvp/base/BaseFragment.java b/lib/src/main/java/com/king/frame/mvp/base/BaseFragment.java index 963ac32..97651ee 100644 --- a/lib/src/main/java/com/king/frame/mvp/base/BaseFragment.java +++ b/lib/src/main/java/com/king/frame/mvp/base/BaseFragment.java @@ -35,8 +35,8 @@ public 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(); } diff --git a/lib/src/main/java/com/king/frame/mvp/base/BaseProgressDialog.java b/lib/src/main/java/com/king/frame/mvp/base/BaseProgressDialog.java index 5de0ad9..8b29c71 100644 --- a/lib/src/main/java/com/king/frame/mvp/base/BaseProgressDialog.java +++ b/lib/src/main/java/com/king/frame/mvp/base/BaseProgressDialog.java @@ -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(); } @@ -46,7 +46,7 @@ public void setContentView(@NonNull View view) { private void initUI() { getWindow().getAttributes().gravity = Gravity.CENTER; - setCanceledOnTouchOutside(true); + setCanceledOnTouchOutside(false); } } \ No newline at end of file