feat:完成反馈功能

This commit is contained in:
max
2024-07-03 16:47:14 +08:00
parent e9e4da8d60
commit 2af7cec8dd
39 changed files with 1060 additions and 329 deletions

View File

@@ -943,6 +943,10 @@
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustNothing" />
<activity
android:windowSoftInputMode="adjustPan"
android:name=".ui.feedback.FeedbackActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@@ -17,7 +17,6 @@ import com.chwl.app.databinding.PhotoDialogBinding
import com.chwl.app.ui.widget.dialog.CommonTipDialog
import com.chwl.library.common.base.BaseDialogFragment
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.photo.PhotoProviderNew
import com.chwl.library.common.util.PhotoCompressCallback
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.common.util.PhotosCompressCallback
@@ -84,7 +83,7 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
PhotoProviderNew.photoProvider(this, resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER)
PhotoProvider.photoProvider(this, resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER)
}
}
@@ -118,7 +117,7 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
PhotoProviderNew.photoCamera(this, REQUEST_CODE_OPEN_CAMERA_PROVIDER)
PhotoProvider.photoCamera(this, REQUEST_CODE_OPEN_CAMERA_PROVIDER)
}
}

View File

@@ -0,0 +1,61 @@
package com.chwl.app.ui.feedback
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.view.WindowManager
import com.chwl.app.R
import com.chwl.app.base.BaseBindingDialog
import com.chwl.app.databinding.FeedbackCustomerServiceDialogBinding
import com.chwl.app.ui.widget.recyclerview.decoration.SpacingDecoration
import com.chwl.library.annatation.ActLayoutRes
import com.chwl.library.utils.SingleToastUtil
@ActLayoutRes(R.layout.feedback_customer_service_dialog)
class CustomerServiceDialog(context: Context, val map: Map<String, String?>) :
BaseBindingDialog<FeedbackCustomerServiceDialogBinding>(context, R.style.dialog) {
private val adapter = CustomerServiceItemAdapter()
override fun onStart() {
width = WindowManager.LayoutParams.MATCH_PARENT
super.onStart()
}
override fun init() {
binding.layoutRoot.setOnClickListener {
dismiss()
}
binding.tvNext.setOnClickListener {
dismiss()
}
binding.recyclerView.addItemDecoration(
SpacingDecoration(
0,
context.resources.getDimensionPixelOffset(R.dimen.dp_10),
false
)
)
binding.recyclerView.adapter = adapter
val list = map.map {
it
}
adapter.setNewData(list)
adapter.setOnItemChildClickListener { adapter, view, position ->
val text = this.adapter.getItem(position)?.value
if (text != null) {
copyText(text)
}
}
}
private fun copyText(text: String) {
try {
val cm =
context?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
cm.setPrimaryClip(ClipData.newPlainText("text", text))
SingleToastUtil.showToast(R.string.have_copy)
} catch (e: Exception) {
SingleToastUtil.showToast(e.toString())
}
}
}

View File

@@ -0,0 +1,21 @@
package com.chwl.app.ui.feedback
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
class CustomerServiceItemAdapter :
BaseQuickAdapter<Map.Entry<String, String?>, BaseViewHolder>(R.layout.feedback_customer_service_item) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
return super.onCreateViewHolder(parent, viewType).apply {
this.addOnClickListener(R.id.layout_copy)
}
}
override fun convert(helper: BaseViewHolder, item: Map.Entry<String, String?>) {
helper.setText(R.id.tv_content, "${item.key}: ${item.value ?: ""}")
}
}

View File

@@ -0,0 +1,346 @@
package com.chwl.app.ui.feedback
import android.Manifest
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Build
import android.widget.ImageView.ScaleType
import androidx.activity.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.chwl.app.R
import com.chwl.app.base.BaseViewBindingActivity
import com.chwl.app.databinding.FeedbackActivityBinding
import com.chwl.app.ui.utils.load
import com.chwl.app.ui.widget.dialog.CommonTipDialog
import com.chwl.core.file.FileModel
import com.chwl.core.home.bean.FeedbackTypeBean
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.photo.PhotoProvider.photoProvider
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.common.util.PhotosCompressCallback
import com.chwl.library.easypermisssion.EasyPermissions
import com.chwl.library.easyphoto.utils.settings.SettingsUtils
import com.chwl.library.utils.ResUtil
import com.chwl.library.utils.SingleToastUtil
import com.example.lib_utils.SolveEditTextScrollClash
import com.example.lib_utils.ktx.getColorById
import com.example.lib_utils.ktx.setOnInputChangedListener
import com.example.lib_utils.ktx.singleClick
import com.example.lib_utils.spannable.SpannableTextBuilder
import com.google.android.flexbox.FlexDirection
import com.google.android.flexbox.FlexWrap
import com.google.android.flexbox.FlexboxLayoutManager
import com.google.android.flexbox.JustifyContent
import com.hjq.toast.ToastUtils
import com.netease.nim.uikit.StatusBarUtil
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
class FeedbackActivity : BaseViewBindingActivity<FeedbackActivityBinding>(),
EasyPermissions.PermissionCallbacks {
private val PERMISSION_CODE_STORAGE = 12
private val REQUEST_CODE_OPEN_PHOTO_PROVIDER = 111 // 从相册中选择
private val viewModel: FeedbackViewModel by viewModels()
private val adapter = FeedbackTypeAdapter()
private var compressJob: Job? = null
private var wantShowCustomerService = false
private var imagePath: String? = null
private var imageUrl: String? = null
override fun init() {
initWhiteTitleBar(ResUtil.getString(R.string.feedback_title))
initView()
initEvent()
initObserve()
refreshSubmitState()
}
private fun initView() {
val flexBoxLayoutManager = FlexboxLayoutManager(context)
flexBoxLayoutManager.flexDirection = FlexDirection.ROW
flexBoxLayoutManager.flexWrap = FlexWrap.WRAP
flexBoxLayoutManager.justifyContent = JustifyContent.FLEX_START
binding.recyclerViewType.layoutManager = flexBoxLayoutManager
binding.recyclerViewType.adapter = adapter
binding.etContent.setOnTouchListener(SolveEditTextScrollClash(binding.etContent))
}
private fun initEvent() {
adapter.setOnItemClickListener { adapter, view, position ->
this.adapter.selectItem(this.adapter.getItem(position))
refreshSubmitState()
}
binding.tvSubmit.singleClick {
dialogManager.showProgressDialog(this)
submit()
}
binding.ivImage.singleClick {
checkStoragePermission()
}
binding.ivCustomerService.singleClick {
showCustomerServiceDialog()
}
binding.etContent.setOnInputChangedListener {
updateContentInputTips(this)
refreshSubmitState()
true
}
}
private fun initObserve() {
viewModel.loadingLiveData.observe(this) {
if (it) dialogManager.showProgressDialog(this)
else dialogManager.dismissDialog()
}
viewModel.configLiveData.observe(this) {
if (it?.isSuccess == true) {
loadTypeList(it.data?.typeEnumList)
if (wantShowCustomerService) {
showCustomerServiceDialog(it.data?.customContactMap)
}
} else if (it?.message != null) {
toast(it.message ?: "")
}
wantShowCustomerService = false
}
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
viewModel.submitStateFlow.collectLatest {
dialogManager.dismissDialog()
if (it.isSuccess) {
toast(R.string.home_model_homemodel_01)
finish()
} else if (it.message != null) {
toast(it.message)
}
}
}
}
}
private fun updateContentInputTips(length: Int) {
if (length > 0) {
SpannableTextBuilder(binding.tvContentCount)
.appendText(
text = length.toString(),
textColor = getColorById(R.color.color_3FDDAC)
)
.appendText(text = "/300")
.apply()
} else {
binding.tvContentCount.text = "${length}/300"
}
}
private fun showCustomerServiceDialog() {
val config = viewModel.configLiveData.value?.data
if (config == null) {
wantShowCustomerService = true
viewModel.getConfig()
return
}
showCustomerServiceDialog(config.customContactMap)
}
private fun showCustomerServiceDialog(info: Map<String, String>?) {
if (info.isNullOrEmpty()) {
return
}
CustomerServiceDialog(this, info).show()
}
private fun loadTypeList(type: List<FeedbackTypeBean>?) {
adapter.setNewData(type)
}
private fun onAddImage(path: String?) {
if (path.isNullOrEmpty()) {
imagePath = null
imageUrl = null
binding.ivImage.scaleType = ScaleType.CENTER_INSIDE
binding.ivImage.setImageResource(R.drawable.feedback_ic_add)
} else {
imagePath = path
imageUrl = null
binding.ivImage.load(path)
binding.ivImage.scaleType = ScaleType.CENTER_CROP
}
refreshSubmitState()
}
private fun refreshSubmitState() {
binding.tvSubmit.isEnabled = canSubmit()
}
private fun canSubmit(): Boolean {
if (binding.etContent.text.isNullOrEmpty()) {
return false
}
if (adapter.getSelectItem() == null) {
return false
}
return true
}
private fun submit() {
val content = binding.etContent.text.trim().toString()
val contact = binding.etContact.text.trim().toString()
val type = adapter.getSelectItem()?.type ?: ""
val imagePath = imagePath
if (imagePath != null && imageUrl == null) {
uploadImage(imagePath, {
imageUrl = it
submit()
}, {
if (it != null) {
toast(ResUtil.getString(R.string.ui_user_userinfomodifyactivity_08) + ":${it.message}")
}
dialogManager.dismissDialog()
})
} else {
viewModel.submitFeedback(
type = type,
content = content,
image = imageUrl ?: "",
contact = contact
)
}
}
@SuppressLint("CheckResult")
private fun uploadImage(path: String, success: (String) -> Unit, failed: (Throwable?) -> Unit) {
FileModel.get()
.uploadFile(path)
.compose(bindToLifecycle())
.subscribe { url: String?, throwable: Throwable? ->
if (url != null) {
success.invoke(url)
} else {
failed.invoke(throwable)
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_CODE_OPEN_PHOTO_PROVIDER) {
if (data == null) {
return
}
PhotoProvider.getResultPathListAsync(data) { list ->
if (list.isNullOrEmpty()) {
SingleToastUtil.showToastShort(com.netease.nim.uikit.R.string.picker_image_error)
return@getResultPathListAsync
}
val paths = list.map { it.path }.toMutableList()
compressPhotos(paths)
}
}
}
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String?>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this)
}
private fun checkStoragePermission() {
if (!EasyPermissions.hasPermissions(
this,
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
) {
EasyPermissions.requestPermissions(
this,
getString(R.string.permission_storage_rationale),
PERMISSION_CODE_STORAGE,
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
photoProvider(
this,
1,
true,
REQUEST_CODE_OPEN_PHOTO_PROVIDER,
true,
true
)
}
}
private fun compressPhotos(paths: MutableList<String>) {
compressJob?.cancel(null)
compressJob = PhotoCompressUtil.compress(
this, paths,
PhotoCompressUtil.getCompressCachePath(),
object : PhotosCompressCallback {
override fun onSuccess(compressedImgList: ArrayList<String>) {
val firstItem = compressedImgList.firstOrNull() ?: return
onAddImage(firstItem)
}
override fun onFail(e: Throwable) {
ToastUtils.show(getString(R.string.picker_image_error))
}
}
)
}
override fun needSteepStateBar(): Boolean {
return true
}
override fun setStatusBar() {
super.setStatusBar()
StatusBarUtil.transparencyBar(this)
StatusBarUtil.StatusBarLightMode(this)
}
override fun onPermissionsGranted(requestCode: Int, perms: MutableList<String>) {
if (requestCode == PERMISSION_CODE_STORAGE) {
checkStoragePermission()
}
}
override fun onPermissionsDenied(requestCode: Int, perms: MutableList<String>) {
if (requestCode == PERMISSION_CODE_STORAGE) {
val requestTip = getString(R.string.permission_storage_denied)
val mPrivacyDialog = CommonTipDialog(context)
mPrivacyDialog.setTipMsg(requestTip)
mPrivacyDialog.setOkText(getString(R.string.room_perform_go_update))
mPrivacyDialog.setOnActionListener(object : CommonTipDialog.OnActionListener {
override fun onOk() {
//同意跳到应用详情页面
SettingsUtils.startMyApplicationDetailsForResult(
this@FeedbackActivity,
packageName
)
}
override fun onCancel() {
super.onCancel()
//取消跳到应用详情页面
ToastUtils.show(getString(R.string.permission_storage_refused))
}
})
mPrivacyDialog.show()
}
}
override fun onResume() {
super.onResume()
if (viewModel.configLiveData.value?.data == null) {
viewModel.getConfig()
}
}
}

View File

@@ -0,0 +1,42 @@
package com.chwl.app.ui.feedback
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.core.home.bean.FeedbackTypeBean
class FeedbackTypeAdapter : BaseQuickAdapter<FeedbackTypeBean, BaseViewHolder>(R.layout.feedback_item_type) {
private var selectItem: FeedbackTypeBean? = null
override fun convertPayloads(
helper: BaseViewHolder,
item: FeedbackTypeBean?,
payloads: MutableList<Any>
) {
super.convertPayloads(helper, item, payloads)
convertState(helper, item)
}
override fun convert(helper: BaseViewHolder, item: FeedbackTypeBean?) {
helper.setText(R.id.tv_name, item?.desc ?: "")
convertState(helper, item)
}
private fun convertState(helper: BaseViewHolder, item: FeedbackTypeBean?) {
if (selectItem == item) {
helper.setBackgroundRes(R.id.tv_name, R.drawable.shape_85f6d3_15dp)
} else {
helper.setBackgroundRes(R.id.tv_name, R.drawable.shape_f3f5fa_15dp)
}
}
fun selectItem(item: FeedbackTypeBean?) {
this.selectItem = item
notifyItemRangeChanged(0, itemCount, true)
}
fun getSelectItem(): FeedbackTypeBean? {
return selectItem
}
}

View File

@@ -0,0 +1,36 @@
package com.chwl.app.ui.feedback
import androidx.lifecycle.MutableLiveData
import com.chwl.app.base.BaseViewModel
import com.chwl.core.bean.response.BeanResult
import com.chwl.core.home.bean.FeedbackConfigBean
import com.chwl.core.home.model.HomeModel
import kotlinx.coroutines.flow.MutableSharedFlow
class FeedbackViewModel : BaseViewModel() {
val configLiveData = MutableLiveData<BeanResult<FeedbackConfigBean>?>()
val submitStateFlow = MutableSharedFlow<BeanResult<Any?>>()
fun getConfig() {
safeLaunch(
needLoading = true,
onError = {
configLiveData.postValue(BeanResult.failed(it))
}) {
val value = HomeModel.getFeedbackConfig()
configLiveData.postValue(BeanResult.success(value))
}
}
fun submitFeedback(type: String, content: String, image: String, contact: String) {
safeLaunch(
needLoading = true,
onError = {
submitStateFlow.emit(BeanResult.failed(it))
}) {
val value = HomeModel.commitFeedback(contact, content, image, type)
submitStateFlow.emit(BeanResult.success(value))
}
}
}

View File

@@ -2,10 +2,12 @@ package com.chwl.app.ui.im;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import com.chwl.app.decoration.view.DecorationStoreActivity;
import com.chwl.app.earn.activity.EarnRecordActivity;
import com.chwl.app.pay.activity.GiveGoldActivity;
import com.chwl.app.ui.feedback.FeedbackActivity;
import com.chwl.core.module_hall.hall.bean.H5FamilyInfo;
import com.chwl.core.module_hall.hall.bean.UserClanInfo;
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
@@ -32,13 +34,11 @@ import com.chwl.app.team.view.NimTeamMessageActivity;
import com.chwl.app.ui.login.BindPhoneActivity;
import com.chwl.app.ui.login.ShowBindPhoneActivity;
import com.chwl.app.ui.pay.ChargeActivity;
import com.chwl.app.ui.setting.FeedbackActivity;
import com.chwl.app.ui.setting.ModifyPwdActivity;
import com.chwl.app.ui.user.activity.UserInfoActivity;
import com.chwl.app.ui.webview.CommonWebViewActivity;
import com.chwl.app.vip.VipMainActivity;
import com.chwl.core.DemoCache;
import com.chwl.core.UriProvider;
import com.chwl.core.auth.AuthModel;
import com.chwl.core.community.event.SquareTaskEvent;
import com.chwl.core.im.custom.bean.RouterType;
@@ -209,7 +209,7 @@ public class RouterHandler {
break;
case RouterType.FEED_BACK:
FeedbackActivity.start(context);
context.startActivity(new Intent(context, FeedbackActivity.class));
break;
case RouterType.SET_PASSWORD:
ModifyPwdActivity.start(context, ModifyPwdActivity.LOGIN_PWD);

View File

@@ -27,6 +27,7 @@ import androidx.core.content.ContextCompat;
import com.chwl.app.BuildConfig;
import com.chwl.app.common.widget.OriginalDrawStatusClickSpan;
import com.chwl.app.ui.feedback.FeedbackActivity;
import com.chwl.app.ui.setting.LabActivity;
import com.chwl.app.ui.webview.CommonWebViewActivity;
import com.chwl.core.UriProvider;
@@ -275,7 +276,9 @@ public class LoginPasswordActivity extends BaseActivity {
});
setProtocol();
findViewById(R.id.layout_google).setOnClickListener(v -> googleLogin());
findViewById(R.id.tv_feedback).setOnClickListener(v -> {
startActivity(new Intent(this, FeedbackActivity.class));
});
if (BuildConfig.DEBUG) {
findViewById(R.id.iv_logo).setOnClickListener(v -> {
startActivity(new Intent(this, LabActivity.class));

View File

@@ -64,7 +64,7 @@ public class LogoutHelper {
String text = ResUtil.getString(R.string.login_helper_logouthelper_09) + simpleDateFormat.format(new Date(exception.getCancelDate()));
int end = text.length();
text += ResUtil.getString(R.string.login_helper_logouthelper_010);
text += ResUtil.getString(R.string.login_helper_logouthelper_010);
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(activity, R.color.appColor)),
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);

View File

@@ -1,100 +0,0 @@
package com.chwl.app.ui.setting;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import com.netease.nim.uikit.StatusBarUtil;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.chwl.app.R;
import com.chwl.app.base.BaseActivity;
import com.chwl.core.auth.AuthModel;
import com.chwl.core.home.model.HomeModel;
import com.chwl.library.utils.ResUtil;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
public class FeedbackActivity extends BaseActivity {
private EditText edtContent;
private EditText edtContact;
private Button btnCommit;
public static void start(Context context) {
Intent intent = new Intent(context, FeedbackActivity.class);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
initWhiteTitleBar(ResUtil.getString(R.string.ui_setting_feedbackactivity_01));
initView();
initData();
SetListener();
}
private void SetListener() {
btnCommit.setOnClickListener(v ->
HomeModel.INSTANCE.commitFeedback(AuthModel.get().getCurrentUid(),
edtContent.getText().toString(),
edtContact.getText().toString()
)
.compose(bindUntilEvent(ActivityEvent.DESTROY))
.subscribe(new SingleObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(String s) {
onCommitFeedback();
}
@Override
public void onError(Throwable e) {
onCommitFeedbackFail(e.getMessage());
}
})
);
}
private void initData() {
}
private void initView() {
edtContent = findViewById(R.id.edt_content);
edtContact = findViewById(R.id.edt_contact);
btnCommit = findViewById(R.id.btn_commit);
}
public void onCommitFeedback(){
getDialogManager().showProgressDialog(FeedbackActivity.this, ResUtil.getString(R.string.ui_setting_feedbackactivity_02));
toast(ResUtil.getString(R.string.ui_setting_feedbackactivity_03));
finish();
}
public void onCommitFeedbackFail(String error){
// toast(error);
}
@Override
protected boolean needSteepStateBar() {
return true;
}
@Override
protected void setStatusBar() {
super.setStatusBar();
StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
}
}

View File

@@ -40,7 +40,7 @@ import com.chwl.core.user.bean.UserInfo
import com.chwl.core.user.bean.UserPhoto
import com.chwl.core.utils.CoreLogger
import com.chwl.library.common.file.FileHelper
import com.chwl.library.common.photo.PhotoProviderNew
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.util.PhotoCompressCallback
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.easypermisssion.EasyPermissions
@@ -371,7 +371,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
)
} else {
mUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${getNowTime()}.jpg")
PhotoProviderNew.photoProvider(
PhotoProvider.photoProvider(
this,
resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER
)
@@ -429,7 +429,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
}
}
REQUEST_CODE_OPEN_PHOTO_PROVIDER -> data?.let {
val photos = PhotoProviderNew.getResultPhotoList(it)
val photos = PhotoProvider.getResultPhotoList(it)
if (!photos.isNullOrEmpty()) {
val photo = photos[0]
crop(photo.uri, photo.size, mUri)

View File

@@ -32,7 +32,7 @@ import com.chwl.core.user.bean.UserPhoto
import com.chwl.core.utils.CoreLogger
import com.chwl.core.utils.net.BeanObserver
import com.chwl.library.common.file.FileHelper
import com.chwl.library.common.photo.PhotoProviderNew
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.util.PhotoCompressCallback
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.easypermisssion.EasyPermissions
@@ -232,7 +232,7 @@ class UserModifyPhotosActivity : TakePhotoActivity(), PhotoItemClickListener,
)
} else {
mUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${getNowTime()}.jpg")
PhotoProviderNew.photoProvider(
PhotoProvider.photoProvider(
this,
resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER
)
@@ -252,7 +252,7 @@ class UserModifyPhotosActivity : TakePhotoActivity(), PhotoItemClickListener,
} else if (resultCode == RESULT_OK) {
when (requestCode) {
REQUEST_CODE_OPEN_PHOTO_PROVIDER -> data?.let {
val photos = PhotoProviderNew.getResultPhotoList(data) ?: return
val photos = PhotoProvider.getResultPhotoList(data) ?: return
if (photos.isNotEmpty()) {
val photo = photos[0]
crop(photo.uri, photo.size, mUri)

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="15dp" />
<solid android:color="#85F6D3" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="15dp" />
<solid android:color="#F3F5FA" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="7dp" />
<solid android:color="#F3F5FA" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp" />
<solid android:color="#F3F5FA" />
</shape>

View File

@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_normal_1c1b22"
android:orientation="vertical"
tools:context="com.chwl.app.ui.setting.FeedbackActivity">
<com.chwl.app.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/line_353548" />
<TextView
android:layout_width="match_parent"
android:layout_height="44dp"
android:drawableStart="@drawable/feedback_point"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:text="@string/layout_activity_feedback_01"
android:textColor="@color/text_title_color"
android:textSize="15sp" />
<EditText
android:id="@+id/edt_content"
android:layout_width="match_parent"
android:layout_height="161dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="@drawable/bg_secondary_radius_15"
android:gravity="start"
android:hint="@string/layout_activity_feedback_02"
android:padding="10dp"
android:textColor="@color/text_normal_c6c6e9"
android:textColorHint="@color/text_hint_555574"
android:textSize="14sp" />
<EditText
android:id="@+id/edt_contact"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:background="@drawable/bg_secondary_radius_15"
android:hint="@string/layout_activity_feedback_03"
android:padding="10dp"
android:textColor="@color/text_normal_c6c6e9"
android:textColorHint="@color/text_hint_555574"
android:textSize="14sp" />
<Button
android:id="@+id/btn_commit"
style="?android:attr/borderlessButtonStyle"
android:layout_width="310dp"
android:layout_height="45dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="45dp"
android:background="@drawable/base_selector_theme_30dp"
android:text="@string/layout_activity_feedback_04"
android:textColor="@color/base_selector_color_theme_btn"
android:textSize="15sp" />
</LinearLayout>

View File

@@ -14,6 +14,19 @@
android:src="@drawable/bg_theme_top"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_feedback"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_15"
android:gravity="center"
android:text="@string/feedback_title"
android:textColor="#000000"
android:textSize="@dimen/dp_14"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_logo"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -0,0 +1,257 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_FFFFFF">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EBECF3"
android:paddingTop="@dimen/dp_30"
app:layout_constraintTop_toTopOf="parent">
<com.chwl.app.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_customer_service"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_9"
android:scaleType="centerInside"
android:src="@drawable/feedback_ic_customer_service"
app:layout_constraintBottom_toBottomOf="@id/title_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/title_bar" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/layout_title_bar">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_type_title_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_29"
android:text="*"
android:textColor="#EB5C2C"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_type_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feedback_type_title"
android:textColor="#000000"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_type_title_prefix"
app:layout_constraintStart_toEndOf="@id/tv_type_title_prefix"
app:layout_constraintTop_toTopOf="@id/tv_type_title_prefix" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_2"
android:layout_marginTop="@dimen/dp_9"
android:overScrollMode="never"
android:scrollbars="none"
app:layout_constraintTop_toBottomOf="@id/tv_type_title"
tools:itemCount="2"
tools:listitem="@layout/feedback_item_type" />
<TextView
android:id="@+id/tv_content_title_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_23"
android:text="*"
android:textColor="#EB5C2C"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/tv_type_title_prefix"
app:layout_constraintTop_toBottomOf="@id/recycler_view_type" />
<TextView
android:id="@+id/tv_content_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feedback_content_title"
android:textColor="#000000"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_content_title_prefix"
app:layout_constraintStart_toEndOf="@id/tv_content_title_prefix"
app:layout_constraintTop_toTopOf="@id/tv_content_title_prefix" />
<EditText
android:id="@+id/et_content"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_149"
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_16"
android:background="@drawable/shape_f3f5fa_7dp"
android:hint="@string/feedback_content_hint"
android:maxLength="300"
android:paddingHorizontal="@dimen/dp_9"
android:paddingTop="@dimen/dp_9"
android:paddingBottom="@dimen/dp_35"
android:textColor="#22252C"
android:textColorHint="#ACB0B7"
android:textSize="@dimen/dp_14"
app:layout_constraintTop_toBottomOf="@id/tv_content_title" />
<TextView
android:id="@+id/tv_content_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_13"
android:layout_marginBottom="@dimen/dp_14"
android:text="0/300"
android:textColor="#A7ACB3"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="@id/et_content"
app:layout_constraintEnd_toEndOf="@id/et_content" />
<TextView
android:id="@+id/tv_image_title_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_23"
android:text="*"
android:textColor="#EB5C2C"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/tv_type_title_prefix"
app:layout_constraintTop_toBottomOf="@id/et_content" />
<TextView
android:id="@+id/tv_image_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feedback_image_title"
android:textColor="#000000"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_image_title_prefix"
app:layout_constraintStart_toEndOf="@id/tv_image_title_prefix"
app:layout_constraintTop_toTopOf="@id/tv_image_title_prefix" />
<TextView
android:id="@+id/tv_image_title_optional"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feedback_optional"
android:textColor="#A7ACB3"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_image_title_prefix"
app:layout_constraintStart_toEndOf="@id/tv_image_title"
app:layout_constraintTop_toTopOf="@id/tv_image_title_prefix" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_image"
android:layout_width="@dimen/dp_76"
android:layout_height="@dimen/dp_76"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_16"
android:background="#F3F5FA"
android:scaleType="centerInside"
android:src="@drawable/feedback_ic_add"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_image_title"
app:shapeAppearance="@style/shape_corner_8dp" />
<TextView
android:id="@+id/tv_contact_title_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:text="*"
android:textColor="#EB5C2C"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/tv_type_title_prefix"
app:layout_constraintTop_toBottomOf="@id/iv_image" />
<TextView
android:id="@+id/tv_contact_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feedback_contact_title"
android:textColor="#000000"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_contact_title_prefix"
app:layout_constraintStart_toEndOf="@id/tv_contact_title_prefix"
app:layout_constraintTop_toTopOf="@id/tv_contact_title_prefix" />
<TextView
android:id="@+id/tv_contact_title_optional"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feedback_optional"
android:textColor="#A7ACB3"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_contact_title_prefix"
app:layout_constraintStart_toEndOf="@id/tv_contact_title"
app:layout_constraintTop_toTopOf="@id/tv_contact_title_prefix" />
<EditText
android:id="@+id/et_contact"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_43"
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_16"
android:background="@drawable/shape_f3f5fa_8dp"
android:gravity="center_vertical"
android:hint="@string/feedback_contact_hint"
android:maxLength="100"
android:maxLines="1"
android:paddingHorizontal="@dimen/dp_9"
android:singleLine="true"
android:textColor="#22252C"
android:textColorHint="#ACB0B7"
android:textSize="@dimen/dp_14"
app:layout_constraintTop_toBottomOf="@id/tv_contact_title" />
<TextView
android:id="@+id/tv_submit"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_49"
android:layout_marginHorizontal="@dimen/dp_36"
android:layout_marginTop="@dimen/dp_58"
android:layout_marginBottom="@dimen/dp_30"
android:background="@drawable/base_selector_theme_26dp"
android:enabled="false"
android:gravity="center"
android:text="@string/layout_activity_modify_pwd_07"
android:textColor="@color/base_selector_color_theme_btn"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/et_contact" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout_root"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_43"
android:background="@drawable/base_shape_ffffff_15o5dp"
android:clickable="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_22"
android:layout_marginTop="@dimen/dp_30"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintHeight_max="@dimen/dp_350"
app:layout_constraintTop_toTopOf="parent"
tools:itemCount="3"
tools:listitem="@layout/feedback_customer_service_item" />
<TextView
android:id="@+id/tv_next"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_38"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_15"
android:background="@drawable/base_shape_theme_19dp"
android:gravity="center"
android:text="@string/login_fragment_adduserinfofragment_04"
android:textColor="@color/base_selector_color_theme_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/recycler_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</layout>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="3"
android:textColor="#333333"
android:textSize="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/layout_copy"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="wrap"
tools:text="meNameNameNaNmeNameNameNaNmeNameNameNaNameNameNameNameNaNameNameNameNameNaameNameNameNameNaNameNameNameNameNameNameNameNaNameNameNameNameNaNameNameNameNameNaameNameNameNameNaNameNameNameNameNa11" />
<FrameLayout
android:id="@+id/layout_copy"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_content"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_copy"
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_13"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:src="@drawable/feedback_ic_copy" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_31"
android:layout_marginHorizontal="@dimen/dp_12"
android:layout_marginVertical="@dimen/dp_7"
android:background="@drawable/shape_85f6d3_15dp"
android:gravity="center"
android:paddingHorizontal="@dimen/dp_10"
android:textColor="#22252C"
android:textSize="@dimen/dp_14"
tools:text="NAME" />

View File

@@ -5314,4 +5314,14 @@
<string name="room_type_revelry">كرنفال صاخب</string>
<string name="room_type_using">قيد الاستخدام</string>
<string name="room_type_use">الاستخدام</string>
<string name="feedback_title">التعليق</string>
<string name="feedback_type_title">اختر نوع المشكلة</string>
<string name="feedback_content_title">صف المشكلة</string>
<string name="feedback_image_title">تحميل لقطة شاشة</string>
<string name="feedback_contact_title">وسيلة تواصل</string>
<string name="feedback_optional">&#160;(اختياري)</string>
<string name="feedback_content_hint">من فضلك ادخل</string>
<string name="feedback_contact_hint"> رقم الهاتف او البريد الالكتروني</string>
</resources>

View File

@@ -5254,4 +5254,13 @@
<string name="room_type_revelry">狂歡</string>
<string name="room_type_using">使用中</string>
<string name="room_type_use">使用</string>
<string name="feedback_title">反饋</string>
<string name="feedback_type_title">選擇問題類型</string>
<string name="feedback_content_title">問題描述</string>
<string name="feedback_image_title">上傳截圖</string>
<string name="feedback_contact_title">聯係方式</string>
<string name="feedback_optional">(可選)</string>
<string name="feedback_content_hint">請輸入…</string>
<string name="feedback_contact_hint">手機號或郵箱</string>
</resources>

View File

@@ -745,4 +745,5 @@
<color name="color_0C1D18">#0C1D18</color>
<color name="color_990C1D18">#990C1D18</color>
<color name="color_002512">#002512</color>
<color name="color_3FDDAC">#3FDDAC</color>
</resources>

View File

@@ -5294,6 +5294,17 @@ You cannot join again within 24 hours after leaving</string>
<string name="room_type_revelry">Carnival</string>
<string name="room_type_using">Using</string>
<string name="room_type_use">Use</string>
<string name="feedback_title">Feedback</string>
<string name="feedback_type_title">Choose the problem type</string>
<string name="feedback_content_title">Describe the problem</string>
<string name="feedback_image_title">Upload screenshot</string>
<string name="feedback_contact_title">Contact information</string>
<string name="feedback_optional">&#160;(Optional)</string>
<string name="feedback_content_hint">Please enter...</string>
<string name="feedback_contact_hint">Mobile phone number or email</string>
</resources>

View File

@@ -1,91 +0,0 @@
package com.chwl.app.treasure_box.widget.dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatDialog;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import com.chwl.library.annatation.ActLayoutRes;
/**
* Created by huangmeng1 on 2018/4/12.
*/
public abstract class BaseBindingDialog<T extends ViewDataBinding> extends AppCompatDialog {
protected int width, height;
protected Context context;
protected int gravity;
public BaseBindingDialog(Context context) {
this(context, 0);
}
public BaseBindingDialog(Context context, int theme) {
super(context, theme);
this.context = context;
width = ScreenUtil.getDialogWidth();
height = WindowManager.LayoutParams.WRAP_CONTENT;
gravity = Gravity.CENTER;
}
protected T binding;
@Override
protected void onStart() {
super.onStart();
Window window = getWindow();
if (window != null) {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams windowParams = window.getAttributes();
windowParams.width = width;
windowParams.height = height;
windowParams.dimAmount = 0.5f;
windowParams.gravity = gravity;
windowParams.x = 0;
windowParams.y = 0;
// window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
window.setAttributes(windowParams);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View inflate = LayoutInflater.from(getContext()).inflate(getClass().getAnnotation(ActLayoutRes.class).value(), null);
setContentView(inflate.getRootView());
setCancelable(true);
setCanceledOnTouchOutside(true);
binding = DataBindingUtil.bind(inflate);
init();
}
protected abstract void init();
public void openDialog() {
try {
show();
} catch (Exception e) {
e.printStackTrace();
}
}
public void closeDialog() {
try {
dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -6,6 +6,7 @@ import android.view.Window;
import android.view.WindowManager;
import com.chwl.app.R;
import com.chwl.app.base.BaseBindingDialog;
import com.chwl.app.databinding.DialogBoxMoreBinding;
import com.chwl.app.ui.webview.DialogWebViewActivity;
import com.chwl.app.utils.UserUtils;

View File

@@ -0,0 +1,9 @@
package com.chwl.core.home.bean
import androidx.annotation.Keep
@Keep
data class FeedbackConfigBean(
val customContactMap: HashMap<String, String>? = null,
val typeEnumList: List<FeedbackTypeBean>? = null
)

View File

@@ -0,0 +1,9 @@
package com.chwl.core.home.bean
import androidx.annotation.Keep
@Keep
data class FeedbackTypeBean(
val desc: String? = null,
val type: String? = null
)

View File

@@ -25,31 +25,6 @@ object HomeModel : BaseModel() {
private val api = RxNet.create(Api::class.java)
/**
* 提交反馈
*
* @param uid
* @param feedbackDesc
* @param contact
* @return
*/
fun commitFeedback(uid: Long, feedbackDesc: String, contact: String): Single<String> {
return api.commitFeedback(
uid.toString(),
feedbackDesc,
contact,
AuthModel.get().ticket
)
.flatMap { serviceResult ->
if (serviceResult.isSuccess) {
Single.just(ResUtil.getString(R.string.home_model_homemodel_01))
} else {
Single.error(Throwable(serviceResult.message))
}
}
.compose(RxHelper.handleSchedulers())
}
/**
* 获取新人列表
*
@@ -202,6 +177,28 @@ object HomeModel : BaseModel() {
api.requestMeCenterInfoList()
}
/**
* 获取反馈配置
*/
suspend fun getFeedbackConfig(): FeedbackConfigBean? =
launchRequest {
api.getFeedbackConfig()
}
/**
* 提交反馈
*/
suspend fun commitFeedback(
contact: String,
desc: String,
imageUrl: String,
type: String
): String? =
launchRequest {
api.commitFeedback(contact, desc, imageUrl, type)
}
private interface Api {
/**
@@ -250,23 +247,6 @@ object HomeModel : BaseModel() {
@Query("pageSize") pageSize: Int?
): ServiceResult<List<DiamondGiveHistoryInfo>>
/**
* 提交反馈
*
* @param uid
* @param feedbackDesc
* @param contact
* @param ticket
* @return
*/
@POST("/feedback")
fun commitFeedback(
@Query("uid") uid: String,
@Query("feedbackDesc") feedbackDesc: String,
@Query("contact") contact: String,
@Query("ticket") ticket: String
): Single<ServiceResult<String>>
/**
* 获取新人列表
*
@@ -420,6 +400,23 @@ object HomeModel : BaseModel() {
*/
@GET("personal/center/list")
suspend fun requestMeCenterInfoList(): ServiceResult<List<MeCenterInfo>>
/**
* 反馈配置
*/
@GET("feedback/getConfig")
suspend fun getFeedbackConfig(): ServiceResult<FeedbackConfigBean>
/**
* 反馈
*/
@POST("feedback/commit")
suspend fun commitFeedback(
@Query("contact") contact: String,
@Query("desc") desc: String,
@Query("screenUrl") screenUrl: String,
@Query("type") type: String?
): ServiceResult<String>
}
}

View File

@@ -18,13 +18,6 @@ import com.chwl.library.utils.TimeUtils.TIME_FORMAT
import com.example.lib_utils.log.LogUtil
import kotlinx.coroutines.*
import java.io.File
/**
* Created by wushaocheng on 2022/11/15
* Desc图片选择二次封装
*/
/**
* Created by wushaocheng on 2022/11/15
* Desc图片选择二次封装

View File

@@ -0,0 +1,39 @@
package com.example.lib_utils
import android.view.MotionEvent
import android.view.View
import android.view.View.OnTouchListener
import android.widget.EditText
class SolveEditTextScrollClash(private val editText: EditText) : OnTouchListener {
override fun onTouch(view: View, event: MotionEvent): Boolean {
//触摸的是EditText而且当前EditText能够滚动则将事件交给EditText处理。否则将事件交由其父类处理
if (view.id == editText.id && canVerticalScroll(editText)) {
view.parent.requestDisallowInterceptTouchEvent(true)
if (event.action == MotionEvent.ACTION_UP) {
view.parent.requestDisallowInterceptTouchEvent(false)
}
}
return false
}
/**
* EditText竖直方向能否够滚动
* @param editText 须要推断的EditText
* @return true能够滚动 false不能够滚动
*/
private fun canVerticalScroll(editText: EditText): Boolean {
//滚动的距离
val scrollY = editText.scrollY
//控件内容的总高度
val scrollRange = editText.layout.height
//控件实际显示的高度
val scrollExtent =
editText.height - editText.compoundPaddingTop - editText.compoundPaddingBottom
//控件内容总高度与实际显示高度的差值
val scrollDifference = scrollRange - scrollExtent
return if (scrollDifference == 0) {
false
} else scrollY > 0 || scrollY < scrollDifference - 1
}
}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#57E193" android:endColor="#14D2A6"/>
<corners android:radius="19dp" />
</shape>

View File

@@ -6,7 +6,7 @@ import com.netease.nim.uikit.R
import com.netease.nim.uikit.business.session.helper.SendImageHelper
import com.chwl.library.common.application.BaseApp
import com.chwl.library.common.base.BaseDialogFragment
import com.chwl.library.common.photo.PhotoProviderNew
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.common.util.PhotosCompressCallback
import com.chwl.library.utils.ResUtil
@@ -33,7 +33,7 @@ abstract class PickImageActionNew protected constructor(
}
private fun checkStoragePermission() {
PhotoProviderNew.photoProvider(
PhotoProvider.photoProvider(
activity,
maxSelect = 9,
resultCode = makeRequestCode(REQUEST_CODE_OPEN_PHOTO_PROVIDER)
@@ -45,8 +45,8 @@ abstract class PickImageActionNew protected constructor(
when (requestCode) {
REQUEST_CODE_OPEN_PHOTO_PROVIDER -> {
if (data == null) return
PhotoProviderNew.getResultPathListAsync(data) { list ->
val paths = list?.toMutableList() ?: ArrayList()
PhotoProvider.getResultPathListAsync(data) { list ->
val paths = list?.map { it.path }?.toMutableList() ?: ArrayList()
if (paths.isEmpty()) {
SingleToastUtil.showToastShort(R.string.picker_image_error)
} else {