优化细节

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
androidTestImplementation deps.test.runner
androidTestImplementation deps.test.espresso
//support
compileOnly deps.support.appcompat
//androidx
compileOnly deps.androidx.appcompat
}

@ -10,13 +10,12 @@ import android.view.WindowManager;
import com.king.app.dialog.fragment.AppDialogFragment;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.fragment.app.DialogFragment;
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 {
@ -28,19 +27,6 @@ public enum AppDialog {
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}
*/
public void showDialog(AppDialogConfig config){
showDialog(config,true);
showDialog(config.getContext(),config);
}
/**
* 显示弹框 请使用{@link #showDialog(AppDialogConfig)}
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public void showDialog(Context context,AppDialogConfig config){
showDialog(config,true);
showDialog(context,config,true);
}
/**
@ -139,11 +123,9 @@ public enum AppDialog {
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
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)}
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
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 config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
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;
/**
* @author Jenly <a href="mailto:jenly1314@gmail.com">Jenly</a>
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
public class AppDialogConfig extends BaseDialogConfig{
@ -38,7 +38,7 @@ public class AppDialogConfig extends BaseDialogConfig{
/**
* use {@link #getDialogView()}
*
* @param context
* @return
* @deprecated 即将废弃下一个版本可能会移除此方法
@ -48,7 +48,7 @@ public class AppDialogConfig extends BaseDialogConfig{
return getDialogView();
}
public View getDialogView(){
private View getDialogView(){
if(view == null){
view = LayoutInflater.from(context).inflate(getLayoutId(),null);
}

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

@ -27,9 +27,9 @@ dependencies {
testImplementation deps.test.junit
androidTestImplementation deps.test.runner
androidTestImplementation deps.test.espresso
//support
implementation deps.support.appcompat
implementation deps.support.constraintlayout
//androidx
implementation deps.androidx.appcompat
implementation deps.androidx.constraintlayout
implementation deps.okhttp
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
def versions = [:]
//support
versions.supportLibrary = "1.1.0"
//androidx
versions.appcompat = "1.1.0"
versions.constraintLayout = "1.1.3"
//test
@ -30,11 +30,11 @@ ext.versions = versions
ext.deps = [:]
//support
def support = [:]
support.appcompat = "androidx.appcompat:appcompat:$versions.supportLibrary"
support.constraintlayout = "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
deps.support = support
//androidx
def androidx = [:]
androidx.appcompat = "androidx.appcompat:appcompat:$versions.appcompat"
androidx.constraintlayout = "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
deps.androidx = androidx
//test
def test = [:]

Loading…
Cancel
Save