Commit 165fd975 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent 9a6134c2
...@@ -131,13 +131,13 @@ android { ...@@ -131,13 +131,13 @@ android {
} }
productFlavors { productFlavors {
facai {} // facai {}
vivo {} // vivo {}
baidu {} // baidu {}
oppo {} // oppo {}
huawei {} // huawei {}
xiaomi {} // xiaomi {}
store360 {} // store360 {}
share_mints {} share_mints {}
} }
......
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
android:name=".ui.activitys.BasicUserProfileActivity" android:name=".ui.activitys.BasicUserProfileActivity"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="false" android:exported="false"
android:launchMode="singleTop" android:launchMode="singleTask"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activitys.AlbumActivity" android:name=".ui.activitys.AlbumActivity"
......
...@@ -14,6 +14,7 @@ import com.duben.loveplayletd.common.Constant ...@@ -14,6 +14,7 @@ import com.duben.loveplayletd.common.Constant
import com.duben.loveplayletd.mvp.model.BaseResponse import com.duben.loveplayletd.mvp.model.BaseResponse
import com.duben.loveplayletd.ui.activitys.BasicUserProfileActivity import com.duben.loveplayletd.ui.activitys.BasicUserProfileActivity
import com.duben.loveplayletd.ui.widgets.RealAuthDialog import com.duben.loveplayletd.ui.widgets.RealAuthDialog
import com.duben.loveplayletd.utils.LogUtil
import com.duben.loveplayletd.utils.MateUtils import com.duben.loveplayletd.utils.MateUtils
import com.duben.loveplayletd.utils.ToastUtil import com.duben.loveplayletd.utils.ToastUtil
import com.google.gson.JsonObject import com.google.gson.JsonObject
...@@ -69,6 +70,7 @@ class UserHelper private constructor() { ...@@ -69,6 +70,7 @@ class UserHelper private constructor() {
COMMON_ERROR_CODE_BASIC_PROFILE -> { COMMON_ERROR_CODE_BASIC_PROFILE -> {
// 缺少基础资料 // 缺少基础资料
// ToastUtil.show(MintsApplication.getContext(), "缺少基础资料") // ToastUtil.show(MintsApplication.getContext(), "缺少基础资料")
LogUtil.d("mcg -->>>> COMMON_ERROR_CODE_BASIC_PROFILE"+AppConfig.basicUserProfileFlag)
if (AppConfig.basicUserProfileFlag) return if (AppConfig.basicUserProfileFlag) return
intent = Intent(appContext, BasicUserProfileActivity::class.java) intent = Intent(appContext, BasicUserProfileActivity::class.java)
......
...@@ -83,6 +83,7 @@ class BasicUserProfilePresenter : BasePresenter<BasicUserProfileView>() { ...@@ -83,6 +83,7 @@ class BasicUserProfilePresenter : BasePresenter<BasicUserProfileView>() {
fun initBasicInfo(birthday: String, nickName: String, sex: Int, headerUrl: String) { fun initBasicInfo(birthday: String, nickName: String, sex: Int, headerUrl: String) {
view.showLoading("加载中...")
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["birthday"] = birthday vo["birthday"] = birthday
vo["nickName"] = nickName vo["nickName"] = nickName
......
...@@ -23,6 +23,8 @@ import com.duben.loveplayletd.mvp.presenters.BasicUserProfilePresenter ...@@ -23,6 +23,8 @@ import com.duben.loveplayletd.mvp.presenters.BasicUserProfilePresenter
import com.duben.loveplayletd.mvp.views.BasicUserProfileView import com.duben.loveplayletd.mvp.views.BasicUserProfileView
import com.duben.loveplayletd.ui.widgets.pick.SinglePickDialog import com.duben.loveplayletd.ui.widgets.pick.SinglePickDialog
import com.duben.loveplayletd.utils.GlideEngine import com.duben.loveplayletd.utils.GlideEngine
import com.duben.loveplayletd.utils.LogUtil
import com.duben.loveplayletd.utils.ToastUtil
import com.duben.loveplayletd.utils.UcropUtils import com.duben.loveplayletd.utils.UcropUtils
import com.luck.picture.lib.PictureSelector import com.luck.picture.lib.PictureSelector
import com.luck.picture.lib.compress.Luban import com.luck.picture.lib.compress.Luban
...@@ -184,8 +186,12 @@ class BasicUserProfileActivity : BaseActivity(), View.OnClickListener, BasicUser ...@@ -184,8 +186,12 @@ class BasicUserProfileActivity : BaseActivity(), View.OnClickListener, BasicUser
} }
override fun initBasicSuc() { override fun initBasicSuc() {
LogUtil.d("mcg -->>>> initBasicSuc"+true)
AppConfig.basicUserProfileFlag = true AppConfig.basicUserProfileFlag = true
finish() ToastUtil.showLong(context,"填写完成")
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 1000)
} }
override fun initBasicFail() {} override fun initBasicFail() {}
......
...@@ -2,6 +2,8 @@ package com.duben.loveplayletd.ui.activitys ...@@ -2,6 +2,8 @@ package com.duben.loveplayletd.ui.activitys
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.Editable import android.text.Editable
import android.text.TextUtils import android.text.TextUtils
import android.text.TextWatcher import android.text.TextWatcher
...@@ -17,6 +19,7 @@ import com.duben.loveplayletd.mvp.model.WxPayParamBean ...@@ -17,6 +19,7 @@ import com.duben.loveplayletd.mvp.model.WxPayParamBean
import com.duben.loveplayletd.mvp.presenters.DrawCashPresenter import com.duben.loveplayletd.mvp.presenters.DrawCashPresenter
import com.duben.loveplayletd.mvp.views.DrawCashView import com.duben.loveplayletd.mvp.views.DrawCashView
import com.duben.loveplayletd.ui.activitys.base.BaseActivity import com.duben.loveplayletd.ui.activitys.base.BaseActivity
import com.duben.loveplayletd.utils.ToastUtil
import kotlinx.android.synthetic.main.activity_drawcash.* import kotlinx.android.synthetic.main.activity_drawcash.*
import kotlinx.android.synthetic.main.header_layout.* import kotlinx.android.synthetic.main.header_layout.*
import okhttp3.internal.notify import okhttp3.internal.notify
...@@ -165,8 +168,11 @@ class DrawCashActivity : BaseActivity(), View.OnClickListener, DrawCashView { ...@@ -165,8 +168,11 @@ class DrawCashActivity : BaseActivity(), View.OnClickListener, DrawCashView {
override fun getCashouBaseMsgFail() {} override fun getCashouBaseMsgFail() {}
override fun addCashoutReqSuc() { override fun addCashoutReqSuc() {
showToast("提现成功!") // showToast("提现成功!")
finish() ToastUtil.showLong(context,"提现已申请,请耐心等待!")
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 2500)
} }
override fun addCashoutReqFail() {} override fun addCashoutReqFail() {}
......
...@@ -554,7 +554,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -554,7 +554,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
override fun setWechatQRCodeSuc() { override fun setWechatQRCodeSuc() {
showToast("恭喜您完成真人认证!") showToast("恭喜您完成真人认证!")
readyGoThenKill(FollowWechatActivity::class.java) readyGo(FollowWechatActivity::class.java)
} }
override fun setWechatQRCodeFail() {} override fun setWechatQRCodeFail() {}
......
...@@ -52,13 +52,14 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener ...@@ -52,13 +52,14 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
private val bannerList = mutableListOf<Int>() private val bannerList = mutableListOf<Int>()
private val tabsData = mutableListOf<String>() private val tabsData = mutableListOf<String>()
private var vpAdapter: SquarePageAdapter? = null private var vpAdapter: SquarePageAdapter? = null
private var isShowLocationFlag = false
override fun getContentViewLayoutID() = R.layout.fragment_square override fun getContentViewLayoutID() = R.layout.fragment_square
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
initVp() initVp()
initBanner() initBanner()
initLocation() // initLocation()
tv_location.setOnClickListener(this) tv_location.setOnClickListener(this)
iv_share.setOnClickListener { iv_share.setOnClickListener {
...@@ -72,17 +73,17 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener ...@@ -72,17 +73,17 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
bannerList.add(R.mipmap.bg_banner2) bannerList.add(R.mipmap.bg_banner2)
bannerList.add(R.mipmap.bg_banner3) bannerList.add(R.mipmap.bg_banner3)
banner.addBannerLifecycleObserver(this) banner.addBannerLifecycleObserver(this)
.setAdapter(SquareImageAdapter(bannerList)) .setAdapter(SquareImageAdapter(bannerList))
.setOnBannerListener { data, position -> .setOnBannerListener { data, position ->
if (position == 0 && !UserManager.getInstance().vipFlag) { if (position == 0 && !UserManager.getInstance().vipFlag) {
readyGo(VipActivity::class.java) readyGo(VipActivity::class.java)
} else if (position == 1) { } else if (position == 1) {
val bundle = Bundle() val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, getString(R.string.rule_name)) bundle.putString(WebActivity.WEB_TITLE, getString(R.string.rule_name))
bundle.putString(WebActivity.WEB_URL, Constant.APP_RULE_URL) bundle.putString(WebActivity.WEB_URL, Constant.APP_RULE_URL)
readyGo(WebActivity::class.java, bundle) readyGo(WebActivity::class.java, bundle)
}
} }
}
} }
override fun onFragmentFirstVisible() { override fun onFragmentFirstVisible() {
...@@ -99,6 +100,10 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener ...@@ -99,6 +100,10 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
} else { } else {
TrackManager.getInstance().getBaseMsg() TrackManager.getInstance().getBaseMsg()
} }
if (AppConfig.basicUserProfileFlag||UserManager.getInstance().userHasBasic()) {
initLocation()
}
} }
} }
...@@ -175,16 +180,17 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener ...@@ -175,16 +180,17 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
} }
private fun initLocation() { private fun initLocation() {
this.isShowLocationFlag = true
val permissions: List<String> = if (Build.VERSION.SDK_INT >= 29) { val permissions: List<String> = if (Build.VERSION.SDK_INT >= 29) {
listOf( listOf(
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION Manifest.permission.ACCESS_BACKGROUND_LOCATION
) )
} else { } else {
listOf( listOf(
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION Manifest.permission.ACCESS_COARSE_LOCATION
) )
} }
if (PermissionXUtils.checkLocationPermission(requireContext(), permissions)) { if (PermissionXUtils.checkLocationPermission(requireContext(), permissions)) {
...@@ -197,13 +203,13 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener ...@@ -197,13 +203,13 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
requestPermissions() requestPermissions()
tv_location.text = SpanUtils() tv_location.text = SpanUtils()
.append("未开启") .append("未开启")
.setForegroundColor(ContextCompat.getColor(requireContext(), R.color.color_959595)) .setForegroundColor(ContextCompat.getColor(requireContext(), R.color.color_959595))
.append(" 定位服务 ") .append(" 定位服务 ")
.setForegroundColor(ContextCompat.getColor(requireContext(), R.color.color_E5C565)) .setForegroundColor(ContextCompat.getColor(requireContext(), R.color.color_E5C565))
.append("无法计算你与其他用户的距离") .append("无法计算你与其他用户的距离")
.setForegroundColor(ContextCompat.getColor(requireContext(), R.color.color_959595)) .setForegroundColor(ContextCompat.getColor(requireContext(), R.color.color_959595))
.create() .create()
showLocationTx() showLocationTx()
} }
} }
...@@ -218,29 +224,29 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener ...@@ -218,29 +224,29 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
private fun requestPermissions() { private fun requestPermissions() {
PermissionXUtils.requestLocationPermission( PermissionXUtils.requestLocationPermission(
this, object : PermissionXUtils.Callback { this, object : PermissionXUtils.Callback {
override fun success() { override fun success() {
haveLocationPermission = true haveLocationPermission = true
showLocationTx() showLocationTx()
AppPreferencesManager.get().put(Constant.FIRST_LOCATION, false) AppPreferencesManager.get().put(Constant.FIRST_LOCATION, false)
AppPreferencesManager.get().put(Constant.NEED_REQUEST_LOCATION, true) AppPreferencesManager.get().put(Constant.NEED_REQUEST_LOCATION, true)
// 首次定位提示 // 首次定位提示
if (!isFirstLocation) { if (!isFirstLocation) {
isFirstLocation = true isFirstLocation = true
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
showToast("正在开启定位...") showToast("正在开启定位...")
}, 300) }, 300)
}
startLocation()
} }
startLocation()
}
override fun fail() { override fun fail() {
haveLocationPermission = false haveLocationPermission = false
// showMissingPermissionDialog("位置") // showMissingPermissionDialog("位置")
AppPreferencesManager.get().put(Constant.NEED_REQUEST_LOCATION, false) AppPreferencesManager.get().put(Constant.NEED_REQUEST_LOCATION, false)
}
} }
}
) )
} }
......
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