Commit 36aae74d by 霍志良

feat:倾诉优化专项

parent 5a0d8ea3
......@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.37",
"m-confide" : "0.0.49.39",
"m-consultant" : "0.0.60.03",
"m-fm" : "0.0.30.04",
"m-user" : "0.0.61.94",
......@@ -39,7 +39,7 @@ ext {
"ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.42",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.58",
"m-audioim" : "0.0.49.29.59",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
......@@ -88,7 +88,7 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.37",
"m-confide" : "0.0.49.39",
"m-consultant" : "0.0.60.03",
"m-fm" : "0.0.30.07",
"m-user" : "0.0.61.94",
......@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.42",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.58",
"m-audioim" : "0.0.49.29.59",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
......
......@@ -35,6 +35,7 @@ import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.utils.AudioLogUtils
import com.ydl.audioim.utils.DateUtils
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.audioim.widget.ZDialog
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.RefreshWebEvent
......@@ -201,6 +202,7 @@ class AudioHomeActivity :
*/
private var dialStatus: String? = null
private var mStorageDialog: ZDialog? = null
/**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
......@@ -656,12 +658,7 @@ class AudioHomeActivity :
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "拒绝请求音频权限")
uploadLog()
ToastHelper.show(getString(R.string.audioim_need_storage_permission_hint))
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null)
intent.data = uri
startActivity(intent)
showStorageDialog()
finish()
}
})
......@@ -675,7 +672,27 @@ class AudioHomeActivity :
}
}
private fun showStorageDialog() {
if (mStorageDialog == null) {
mStorageDialog = ZDialog.Builder(this)
.setContentView(R.layout.audioim_activity_permission_dialog)
.setOnClickListener(R.id.cancel_dialog) {
mStorageDialog?.dismiss()
mStorageDialog=null
}
.setAnimation(0)//取消动画
.setOnClickListener(R.id.dial_right_now) {
mStorageDialog?.dismiss()
mStorageDialog=null
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null)
intent.data = uri
startActivity(intent)
}
.show()
}
}
@SuppressLint("CheckResult", "SetTextI18n")
private fun init() {
wave_view.start()
......@@ -708,8 +725,10 @@ class AudioHomeActivity :
val remainTime = 50 - it / 10
if (remainTime <= 0) {
waittingStatus()
audio_hangup_text.text="挂断"
} else {
tv_change_time_counter.text = "${remainTime}s"
audio_hangup_text.text="挂断${remainTime}s"
}
var result = it.toFloat() / 2.5f
progress_view.setProgress(result)
......
package com.ydl.audioim.widget;
import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import androidx.annotation.NonNull;
import com.ydl.audioim.R;
/**
* Created on 2018/1/18 11:24
*
* @author Z
* @version : 1.0.0
* 利用Builder模式构建一个通用的Dialog,现在暂时不支持在ZDialog中自定义加载图片
* use like this:
* new ZDialog.Builder(this)
* .setContentView(R.layout.zdialog_normal)
* .setFullScreen()
* .setCancelAble(true)
* .setGravity(ZDialogDirection.FROM_BOTTOM)
* .setText(R.id.tv_normal_test,"哈哈哈哈")
* .setOnClickListener(R.id.btn_normal, ...)
*
*/
public class ZDialog extends Dialog {
private ZDialogController mDialogController;
public ZDialog( Context context) {
super(context, R.style.audioim_ZDialogDefaultStyle);
init();
}
private void init() {
mDialogController = new ZDialogController(this, getWindow());
}
public ZDialog(@NonNull Context context, int themeResId) {
super(context, themeResId);
init();
}
public void setOnClickListener(int viewId, View.OnClickListener listener) {
mDialogController.setOnClickListener(viewId, listener);
}
public EditText getEditText(int viewId) {
return mDialogController.getEditText(viewId);
}
public View findDialogView(int viewId) {
return mDialogController.findView(viewId);
}
public static class Builder {
private ZDialogController.ZDialogParams mDialogParams;
public Builder(Context context) {
this(context, R.style.audioim_ZDialogDefaultStyle);
}
public Builder(Context context, int themeResId) {
mDialogParams = new ZDialogController.ZDialogParams(context, themeResId);
//设置一个默认的动画
mDialogParams.animation = R.style.audioim_ZDialogDefaultAnimation;
}
public Builder setContentView(View contentView) {
mDialogParams.contentView = contentView;
mDialogParams.contentResId = 0;
return this;
}
public Builder setContentView(int contentViewResId) {
mDialogParams.contentResId = contentViewResId;
mDialogParams.contentView = null;
return this;
}
public Builder setText(int viewId, CharSequence charSequence) {
mDialogParams.textArray.put(viewId, charSequence);
return this;
}
public Builder setText(int viewId, int strId) {
mDialogParams.textArray.put(viewId, mDialogParams.context.get().getResources().getString(strId));
return this;
}
public Builder setOnClickListener(int viewId, View.OnClickListener onClickListener) {
mDialogParams.clickViewArray.put(viewId, onClickListener);
return this;
}
public Builder setOnDismissListener(OnDismissListener onDismissListener) {
mDialogParams.onDismissListener = onDismissListener;
return this;
}
public Builder setOnCancelListener(OnCancelListener onCancelListener) {
mDialogParams.onCancelListener = onCancelListener;
return this;
}
public Builder setOnKeyListener(OnKeyListener onKeyListener) {
mDialogParams.onKeyListener = onKeyListener;
return this;
}
public Builder setFullScreen() {
mDialogParams.defaultWidth = ViewGroup.LayoutParams.MATCH_PARENT;
return this;
}
public Builder setGravity(@ZDialogDirection.ZGravity int direction) {
switch (direction) {
case ZDialogDirection.FROM_TOP:
mDialogParams.direction = Gravity.TOP;
break;
case ZDialogDirection.FROM_BOTTOM:
mDialogParams.direction = Gravity.BOTTOM;
default:
break;
}
return this;
}
public Builder setAnimation(int animationRes) {
mDialogParams.animation = animationRes;
return this;
}
public Builder setCancelAble(boolean cancelAble) {
mDialogParams.cancelable = cancelAble;
return this;
}
public ZDialog show() {
ZDialog zDialog = create();
zDialog.show();
return zDialog;
}
private ZDialog create() {
ZDialog dialog = new ZDialog(mDialogParams.context.get(), mDialogParams.themeResId);
mDialogParams.apply(dialog.mDialogController);
dialog.setCancelable(mDialogParams.cancelable);
dialog.setOnCancelListener(mDialogParams.onCancelListener);
dialog.setOnDismissListener(mDialogParams.onDismissListener);
return dialog;
}
}
}
package com.ydl.audioim.widget;
import android.content.Context;
import android.content.DialogInterface;
import android.util.SparseArray;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import java.lang.ref.WeakReference;
/**
* Created on 2018/1/18 11:32
*
* @author Z
* @version : 1.0.0
*/
public class ZDialogController {
private ZDialog mZDialog;
private Window mWindow;
private ZDialogViewHelper mZDialogViewHelper;
public ZDialogController(ZDialog ZDialog, Window window) {
mZDialog = ZDialog;
mWindow = window;
}
public ZDialog getZDialog() {
return mZDialog;
}
public Window getWindow() {
return mWindow;
}
public void setZDialogViewHelper(ZDialogViewHelper ZDialogViewHelper) {
mZDialogViewHelper = ZDialogViewHelper;
}
public void setText(int viewId, CharSequence charSequence) {
mZDialogViewHelper.setText(viewId, charSequence);
}
public EditText getEditText(int viewId) {
return mZDialogViewHelper.getEditText(viewId);
}
public View findView(int viewId) {
return mZDialogViewHelper.findView(viewId);
}
public void setOnClickListener(int viewId, View.OnClickListener onClickListener) {
mZDialogViewHelper.setOnClickListener(viewId, onClickListener);
}
/**
* ZDialog 显示出来可能需要的一些参数
*/
public static class ZDialogParams {
public WeakReference<Context> context;
public int themeResId;// dialog 的style
public boolean cancelable;
public View contentView;
public int contentResId;
public int defaultWidth = ViewGroup.LayoutParams.WRAP_CONTENT;
public int defaultHeight = ViewGroup.LayoutParams.WRAP_CONTENT;
public int direction = Gravity.CENTER;
public int animation = 0;
public SparseArray<CharSequence> textArray = new SparseArray<>();
public SparseArray<View.OnClickListener> clickViewArray = new SparseArray<>();
public DialogInterface.OnCancelListener onCancelListener;
public DialogInterface.OnDismissListener onDismissListener;
public DialogInterface.OnKeyListener onKeyListener;
public ZDialogParams(Context context, int themeResId) {
this.context = new WeakReference<>(context);
this.themeResId = themeResId;
}
public void apply(ZDialogController controller) {
//创建ZDialogViewHelper
ZDialogViewHelper viewHelper = null;
if (contentResId != 0) {
viewHelper = new ZDialogViewHelper(context.get(), contentResId);
}
if (contentView != null) {
viewHelper = new ZDialogViewHelper();
viewHelper.setContentView(contentView);
}
if (viewHelper == null) {
throw new IllegalArgumentException("please do setContentView() first");
}
//添加布局到dialog
if (viewHelper.getContentView() != null) {
controller.getZDialog().setContentView(viewHelper.getContentView());
}
controller.setZDialogViewHelper(viewHelper);
for (int i = 0; i < textArray.size(); i++) {
controller.setText(textArray.keyAt(i), textArray.valueAt(i));
}
for (int i = 0; i < clickViewArray.size(); i++) {
controller.setOnClickListener(clickViewArray.keyAt(i), clickViewArray.valueAt(i));
}
Window window = controller.getWindow();
window.setGravity(direction);
if (animation != 0) {
window.setWindowAnimations(animation);
}
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = defaultWidth;
attributes.height = defaultHeight;
window.setAttributes(attributes);
}
}
}
package com.ydl.audioim.widget;
import androidx.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Created on 2018/1/18 16:34
*
* @author Z
* @version : 1.0.0
* ZDialog的方向
*/
public class ZDialogDirection {
@IntDef({FROM_TOP, FROM_BOTTOM})
@Retention(RetentionPolicy.SOURCE)
public @interface ZGravity {
}
public static final int FROM_TOP = 0;
public static final int FROM_BOTTOM = 1;
}
package com.ydl.audioim.widget;
import android.content.Context;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import java.lang.ref.WeakReference;
/**
* Created on 2018/1/18 13:02
*
* @author Z
* @version : 1.0.0
* 辅助给ZDialog的布局文件设置属性
*/
public class ZDialogViewHelper {
private View mContentView;
private SparseArray<WeakReference<View>> mViews;
private Context mContext;
public ZDialogViewHelper(Context context, int contentResId) {
this();
mContext = context;
mContentView = LayoutInflater.from(mContext).inflate(contentResId, null);
}
public ZDialogViewHelper() {
mViews = new SparseArray<>();
}
public View getContentView() {
return mContentView;
}
public void setContentView(View contentView) {
this.mContentView = contentView;
}
/**
* @param viewId viewId
* @param strId strId
*/
public void setText(int viewId, int strId) {
setText(viewId, mContext.getResources().getString(strId));
}
/**
* 通过id 给控件设置文本
*
* @param viewId viewId
* @param charSequence 文本类容
*/
public void setText(int viewId, CharSequence charSequence) {
TextView view = getView(viewId);
if (charSequence != null && charSequence.length() > 0) {
view.setText(charSequence);
}
}
/**
* 通过id 找到相应的控件
*
* @param viewId viewId
* @param <T> 具体的类型
* @return view
*/
@SuppressWarnings("unchecked")
private <T extends View> T getView(int viewId) {
WeakReference<View> weakReference = mViews.get(viewId);
View view = null;
if (weakReference != null) {
view = weakReference.get();
}
if (view == null) {
view = mContentView.findViewById(viewId);
if (view != null) {
mViews.put(viewId, new WeakReference<>(view));
}
}
return (T) view;
}
public EditText getEditText(int viewId) {
return getView(viewId);
}
public View findView(int viewId) {
return getView(viewId);
}
/**
* 设置点击事件
*
* @param viewId viewId
* @param onClickListener onClickListener
*/
public void setOnClickListener(int viewId, View.OnClickListener onClickListener) {
View view = getView(viewId);
if (view != null) {
view.setOnClickListener(onClickListener);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
......@@ -177,7 +177,7 @@
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:pa_progressWidth="2dp" />
app:pa_progressWidth="4dp" />
<ImageView
android:id="@+id/iv_hang_up"
......@@ -195,6 +195,7 @@
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="挂断"
android:id="@+id/audio_hangup_text"
android:textColor="@color/white"
android:textSize="12sp" />
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/platform_dp_38"
android:layout_marginEnd="@dimen/platform_dp_38"
android:background="@drawable/shape_bg_white_fillet8"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/third_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="App正常工作需要内部存储使用权限,请开启"
android:textColor="@color/platform_color_242424"
android:textSize="15sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/platform_dp_20"
tools:layout_editor_absoluteY="85dp" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/platform_color_D8D8D8"
app:layout_constraintTop_toBottomOf="@id/third_title"
android:layout_marginTop="@dimen/platform_dp_28"
android:id="@+id/line"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/line"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="稍后"
android:textSize="17sp"
android:paddingTop="@dimen/platform_dp_15"
android:paddingBottom="@dimen/platform_dp_15"
android:gravity="center"
android:textColor="@color/platform_color_666666"
android:id="@+id/cancel_dialog"
/>
<View
android:layout_width="0.5dp"
android:background="@color/platform_color_D8D8D8"
android:layout_height="match_parent"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="立即去设置"
android:textSize="17sp"
android:gravity="center"
android:textColor="@color/platform_color_1DA1F2"
android:id="@+id/dial_right_now"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<resources>
<style name="user_new_divide_color_style">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">0.5dp</item>
<item name="android:background">@color/platform_color_F0F0F0</item>
</style>
<!-- 仿ios普通对话框 -->
<style name="user_normaldialog_style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="audioim_ZDialogDefaultStyle" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<!--显示区域以外是否使用黑色半透明-->
<item name="android:backgroundDimEnabled">true</item>
<!--用来控制dialog显示区域以外的灰度值,默认是0.5,值为1是,完全看不到dialog以外的内容-->
<item name="android:backgroundDimAmount">0.6</item>
</style>
<!--ZDialog的默认动画效果-->
<style name="audioim_ZDialogDefaultAnimation">
<item name="android:windowEnterAnimation">@anim/common_dialog_default_in</item>
<item name="android:windowExitAnimation">@anim/common_dialog_default_out</item>
</style>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment