优化细节

pull/27/head
Jenly 4 years ago
parent 3a685c958f
commit 898b3912b6
  1. 4
      app-dialog/build.gradle
  2. 34
      app-dialog/src/main/java/com/king/app/dialog/AppDialog.java
  3. 6
      app-dialog/src/main/java/com/king/app/dialog/AppDialogConfig.java
  4. 1
      app-dialog/src/main/java/com/king/app/dialog/BaseDialogConfig.java
  5. 6
      app/build.gradle
  6. 2
      app/src/main/java/com/king/appupdater/MainActivity.java
  7. 14
      versions.gradle

@ -35,8 +35,8 @@ dependencies {
testImplementation deps.test.junit testImplementation deps.test.junit
androidTestImplementation deps.test.runner androidTestImplementation deps.test.runner
androidTestImplementation deps.test.espresso androidTestImplementation deps.test.espresso
//support //androidx
compileOnly deps.support.appcompat compileOnly deps.androidx.appcompat
} }

@ -10,13 +10,12 @@ import android.view.WindowManager;
import com.king.app.dialog.fragment.AppDialogFragment; import com.king.app.dialog.fragment.AppDialogFragment;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes; import androidx.annotation.StyleRes;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
/** /**
* @author Jenly <a href="mailto:jenly1314@gmail.com">Jenly</a> * @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/ */
public enum AppDialog { public enum AppDialog {
@ -28,19 +27,6 @@ public enum AppDialog {
private String mTag; private String mTag;
//-------------------------------------------
/**
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @return
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public View createAppDialogView(@NonNull Context context,@NonNull AppDialogConfig config){
return config.buildAppDialogView();
}
//------------------------------------------- //-------------------------------------------
@ -120,18 +106,16 @@ public enum AppDialog {
* @param config 弹框配置 {@link AppDialogConfig} * @param config 弹框配置 {@link AppDialogConfig}
*/ */
public void showDialog(AppDialogConfig config){ public void showDialog(AppDialogConfig config){
showDialog(config,true); showDialog(config.getContext(),config);
} }
/** /**
* 显示弹框 请使用{@link #showDialog(AppDialogConfig)} * 显示弹框 请使用{@link #showDialog(AppDialogConfig)}
* @param context * @param context
* @param config 弹框配置 {@link AppDialogConfig} * @param config 弹框配置 {@link AppDialogConfig}
* @deprecated 即将废弃下一个版本可能会移除此方法
*/ */
@Deprecated
public void showDialog(Context context,AppDialogConfig config){ public void showDialog(Context context,AppDialogConfig config){
showDialog(config,true); showDialog(context,config,true);
} }
/** /**
@ -139,11 +123,9 @@ public enum AppDialog {
* @param context * @param context
* @param config 弹框配置 {@link AppDialogConfig} * @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键 * @param isCancel 是否可取消默认为truefalse则拦截back键
* @deprecated 即将废弃下一个版本可能会移除此方法
*/ */
@Deprecated
public void showDialog(Context context,AppDialogConfig config,boolean isCancel){ public void showDialog(Context context,AppDialogConfig config,boolean isCancel){
showDialog(config,isCancel); showDialog(context,config.buildAppDialogView(),isCancel);
} }
/** /**
@ -246,11 +228,9 @@ public enum AppDialog {
* 创建弹框请使用{@link #createDialog(AppDialogConfig)} * 创建弹框请使用{@link #createDialog(AppDialogConfig)}
* @param context * @param context
* @param config 弹框配置 {@link AppDialogConfig} * @param config 弹框配置 {@link AppDialogConfig}
* @deprecated 即将废弃下一个版本可能会移除此方法
*/ */
@Deprecated
public Dialog createDialog(Context context,AppDialogConfig config){ public Dialog createDialog(Context context,AppDialogConfig config){
return createDialog(config,true); return createDialog(context,config,true);
} }
/** /**
@ -258,11 +238,9 @@ public enum AppDialog {
* @param context * @param context
* @param config 弹框配置 {@link AppDialogConfig} * @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键 * @param isCancel 是否可取消默认为truefalse则拦截back键
* @deprecated 即将废弃下一个版本可能会移除此方法
*/ */
@Deprecated
public Dialog createDialog(Context context,AppDialogConfig config,boolean isCancel){ public Dialog createDialog(Context context,AppDialogConfig config,boolean isCancel){
return createDialog(config,isCancel); return createDialog(context,config.buildAppDialogView(),isCancel);
} }
/** /**

@ -12,7 +12,7 @@ import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
/** /**
* @author Jenly <a href="mailto:jenly1314@gmail.com">Jenly</a> * @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/ */
public class AppDialogConfig extends BaseDialogConfig{ public class AppDialogConfig extends BaseDialogConfig{
@ -38,7 +38,7 @@ public class AppDialogConfig extends BaseDialogConfig{
/** /**
* use {@link #getDialogView()} *
* @param context * @param context
* @return * @return
* @deprecated 即将废弃下一个版本可能会移除此方法 * @deprecated 即将废弃下一个版本可能会移除此方法
@ -48,7 +48,7 @@ public class AppDialogConfig extends BaseDialogConfig{
return getDialogView(); return getDialogView();
} }
public View getDialogView(){ private View getDialogView(){
if(view == null){ if(view == null){
view = LayoutInflater.from(context).inflate(getLayoutId(),null); view = LayoutInflater.from(context).inflate(getLayoutId(),null);
} }

@ -90,6 +90,7 @@ public class BaseDialogConfig {
} }
/** /**
* 此方法即将废弃请通过构造{@link #BaseDialogConfig(int)}来初始化
* @param layoutId * @param layoutId
* @return * @return
* @deprecated 即将废弃下一个版本可能会移除此方法 * @deprecated 即将废弃下一个版本可能会移除此方法

@ -27,9 +27,9 @@ dependencies {
testImplementation deps.test.junit testImplementation deps.test.junit
androidTestImplementation deps.test.runner androidTestImplementation deps.test.runner
androidTestImplementation deps.test.espresso androidTestImplementation deps.test.espresso
//support //androidx
implementation deps.support.appcompat implementation deps.androidx.appcompat
implementation deps.support.constraintlayout implementation deps.androidx.constraintlayout
implementation deps.okhttp implementation deps.okhttp
implementation project(':app-updater') implementation project(':app-updater')

@ -195,7 +195,7 @@ public class MainActivity extends AppCompatActivity {
} }
}); });
//强制升级,拦截返回 //强制升级,拦截返回
AppDialog.INSTANCE.showDialog(getContext(),AppDialog.INSTANCE.createAppDialogView(getContext(),config),false); AppDialog.INSTANCE.showDialog(getContext(),config,false);
} }
/** /**

@ -14,8 +14,8 @@ ext.build_versions = build_versions
// App dependencies // App dependencies
def versions = [:] def versions = [:]
//support //androidx
versions.supportLibrary = "1.1.0" versions.appcompat = "1.1.0"
versions.constraintLayout = "1.1.3" versions.constraintLayout = "1.1.3"
//test //test
@ -30,11 +30,11 @@ ext.versions = versions
ext.deps = [:] ext.deps = [:]
//support //androidx
def support = [:] def androidx = [:]
support.appcompat = "androidx.appcompat:appcompat:$versions.supportLibrary" androidx.appcompat = "androidx.appcompat:appcompat:$versions.appcompat"
support.constraintlayout = "androidx.constraintlayout:constraintlayout:$versions.constraintLayout" androidx.constraintlayout = "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
deps.support = support deps.androidx = androidx
//test //test
def test = [:] def test = [:]

Loading…
Cancel
Save