Commit 165fd975 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

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