fix: 增加对话框依赖为DialogX

This commit is contained in:
xiaoyan 2023-02-21 15:11:12 +08:00
parent 3e6f8997fb
commit 54358b2ef0
11 changed files with 2075 additions and 43 deletions

View File

@ -1,11 +1,16 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
//apply plugin: 'com.android.application'
//apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-kapt'
//apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 32
buildToolsVersion '29.0.2'
compileSdkVersion 31
// buildToolsVersion '29.0.2'
//ndkVersion '23.0.7123448'
defaultConfig {
@ -53,6 +58,9 @@ android {
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
buildFeatures {
viewBinding true
}
}
//efs {
// //使
@ -96,7 +104,6 @@ dependencies {
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0'
//
implementation 'com.lzy.net:okgo:3.0.4'
implementation 'com.lzy.net:okrx2:2.0.2'
@ -123,6 +130,8 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
// https://github.com/kongzue/DialogV3
implementation 'com.kongzue.dialog_v3x:dialog:3.2.4'
implementation "com.kongzue.dialogx:DialogX:0.0.47"
implementation "com.kongzue.dialogx.style:DialogXMIUIStyle:0.0.47"
//xRecyclerview下拉刷新控件
implementation project(':xrecyclerview')
// https://github.com/natario1/CameraView

View File

@ -145,8 +145,13 @@
<activity
android:name=".activity.VideoActivity"
android:screenOrientation="portrait" /> <!-- 自动拍照界面 -->
<!-- 自动捕捉道路任务 -->
<activity
android:name=".activity.AutoTakePictureActivity"
android:screenOrientation="landscape" />
<!-- 自动捕捉POI录像任务 -->
<activity
android:name=".activity.AutoTakePicture4PoiVideoActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.UserActivity"

View File

@ -49,12 +49,11 @@ import com.github.lazylibrary.util.NetWorkUtils;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.CustomDialog;
import com.kongzue.dialog.v3.MessageDialog;
import com.kongzue.dialog.v3.WaitDialog;
import com.kongzue.dialogx.dialogs.CustomDialog;
import com.kongzue.dialogx.dialogs.MessageDialog;
import com.kongzue.dialogx.interfaces.BaseDialog;
import com.kongzue.dialogx.interfaces.OnBindView;
import com.kongzue.dialogx.interfaces.OnDialogButtonClickListener;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
@ -269,7 +268,6 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
EventBus.getDefault().register(this);
}
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
layerChange = findViewById(R.id.layer_change);
systemTTS = SystemTTS.getInstance(AutoTakePictureActivity.this);
tvMapView = findViewById(R.id.text_map_view);
@ -361,7 +359,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
btnSetting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CustomDialog.show(AutoTakePictureActivity.this, R.layout.camera_setting, new CustomDialog.OnBindView() {
CustomDialog.show(new OnBindView<CustomDialog>(R.layout.camera_setting) {
@Override
public void onBind(CustomDialog dialog, View v) {
EditText startDistance = v.findViewById(R.id.edt_camera_setting_start_distance);
@ -405,7 +403,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
MATCH_CONFIRM_FINISH_BUFFER = Float.parseFloat(matchPecent.getText().toString());
}
Toast.makeText(AutoTakePictureActivity.this, "设置完成", Toast.LENGTH_SHORT).show();
dialog.doDismiss();
dialog.dismiss();
}
});
}
@ -1406,18 +1404,19 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
if (hasError) {
dialogMessage.append("(注意,其中有部分任务处理失败)");
}
MessageDialog.show(AutoTakePictureActivity.this, "退出当前界面", dialogMessage)
.setOkButton("确定", new OnDialogButtonClickListener() {
MessageDialog.show("退出当前界面", dialogMessage)
.setOkButton("确定", new OnDialogButtonClickListener<MessageDialog>() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
public boolean onClick(MessageDialog dialog, View v) {
dialog.dismiss();
AutoTakePictureActivity.this.finish();
return false;
}
})
.setCancelButton("取消", new OnDialogButtonClickListener() {
.setCancelButton("取消", new OnDialogButtonClickListener<MessageDialog>() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
baseDialog.doDismiss();
public boolean onClick(MessageDialog dialog, View v) {
dialog.dismiss();
wantBack = false;
return false;
}
@ -1732,13 +1731,13 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
@Override
public void onBackPressed() {
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
if (finishTaskCount>0) {
MessageDialog.show(this, "提示", "后台正在处理已拍摄完成的任务,请稍后再退出当前界面");
MessageDialog.show("提示", "后台正在处理已拍摄完成的任务,请稍后再退出当前界面");
wantBack = true;
return;
}
MessageDialog.show(this, "提示", "退出自动采集模式?", "", "").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
MessageDialog.show("提示", "退出自动采集模式?", "", "")
.setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
stopRecordLocation();

View File

@ -10,6 +10,9 @@ import android.util.Log;
import androidx.lifecycle.ProcessLifecycleOwner;
import com.kongzue.dialogx.DialogX;
import com.kongzue.dialogx.style.MIUIStyle;
import com.kongzue.dialogx.style.MaterialStyle;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheEntity;
import com.lzy.okgo.cache.CacheMode;
@ -62,7 +65,10 @@ public class UserApplication extends Application {
config.setDeviceId(deviceID);
// 或者设置开发者自己的的设备号config.setDeviceId(xxxxxxxx);
TencentNavi.init(this, config);
// 初始化对话框组件
DialogX.init(this);
DialogX.globalStyle = new MIUIStyle();
DialogX.globalTheme = DialogX.THEME.LIGHT;
}
public static UserApplication getUserApplication() {

View File

@ -23,15 +23,8 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.navinfo.outdoor.R;
import com.kongzue.dialog.interfaces.OnBackClickListener;
import com.kongzue.dialog.v3.WaitDialog;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.HomeActivity;
import com.navinfo.outdoor.activity.WebActivity;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.util.BackHandlerHelper;
import com.navinfo.outdoor.util.FragmentBackHandler;
import com.navinfo.outdoor.util.NetWorkUtils;
import java.util.HashMap;
import java.util.Map;
@ -82,7 +75,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
}
protected <T extends View> T findViewById(@IdRes int id) {
return Objects.requireNonNull(getView()).findViewById(id);
return requireView().findViewById(id);
}
protected void debounce(View view) {
@ -99,7 +92,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
if (alertDialog != null) {
alertDialog.dismiss();
}
alertDialog = new AlertDialog.Builder(Objects.requireNonNull(getActivity())).create();
alertDialog = new AlertDialog.Builder(requireActivity()).create();
Objects.requireNonNull(alertDialog.getWindow()).setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {

View File

@ -53,9 +53,13 @@ import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.kongzue.dialog.v3.ShareDialog;
import com.kongzue.dialogx.dialogs.PopMenu;
import com.kongzue.dialogx.interfaces.OnIconChangeCallBack;
import com.kongzue.dialogx.interfaces.OnMenuItemClickListener;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Progress;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.AutoTakePicture4PoiVideoActivity;
import com.navinfo.outdoor.activity.AutoTakePictureActivity;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.WebActivity;
@ -313,8 +317,37 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onClick(View v) {
Intent autoMatchIntent = new Intent(getContext(), AutoTakePictureActivity.class);
startActivity(autoMatchIntent);
PopMenu.show(v, new String[]{"道路任务", "POI录像"})
.setOverlayBaseView(true)
.setAlignGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL)
.setOnIconChangeCallBack(new OnIconChangeCallBack<PopMenu>() {
@Override
public int getIcon(PopMenu dialog, int index, String menuText) {
switch (index){
case 0:
return R.drawable.marker_road_show;
case 1:
return R.drawable.marker_poi_video_show;
default:
break;
}
return 0;
}
})
.setOnMenuItemClickListener(new OnMenuItemClickListener<PopMenu>() {
@Override
public boolean onClick(PopMenu dialog, CharSequence text, int index) {
if (index == 0) { // 自动捕捉道路任务
Intent autoMatchIntent = new Intent(getContext(), AutoTakePictureActivity.class);
startActivity(autoMatchIntent);
} else if (index == 1) {
Intent autoMatchIntent = new Intent(getContext(), AutoTakePicture4PoiVideoActivity.class);
startActivity(autoMatchIntent);
}
return false;
}
});
// // 设置亮度和摄像机刷新率
// CustomDialog.show((AppCompatActivity) getActivity(), R.layout.camera_setting_pre, new CustomDialog.OnBindView() {
// @Override

View File

@ -132,7 +132,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/btn_switch"
android:background="@color/whiteAlpha50"
android:background="@color/white50"
android:padding="@dimen/default_widget_padding"
android:textColor="@color/colorRead"
android:format="00:00:00"

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dialogButtonMIUITextGray"
android:background="@color/colorGrey"
android:padding="@dimen/fab_margin"
android:orientation="vertical">
<LinearLayout

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dialogButtonMIUITextGray"
android:background="@color/colorGrey"
android:padding="@dimen/fab_margin"
android:orientation="vertical">
<LinearLayout

View File

@ -2,11 +2,11 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 30
buildToolsVersion '29.0.2'
compileSdkVersion 29
// buildToolsVersion '29.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 29
versionCode 1
versionName "1.0"
}