Commit df84dd49 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent 165fd975
......@@ -16,8 +16,8 @@ android {
applicationId "com.duben.loveplayletd"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 800
versionName "8.0.0"
versionCode 801
versionName "8.0.1"
flavorDimensions "default"
// dex突破65535的限制
......
......@@ -8,4 +8,4 @@ package com.duben.loveplayletd.mvp.model
data class PickBean(
var title: String = "",
var isChecked: Boolean = false,
)
):java.io.Serializable
......@@ -5,9 +5,11 @@ import android.app.Activity
import android.content.Intent
import android.content.pm.ActivityInfo
import android.graphics.Color
import android.media.AudioManager
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import com.duben.library.utils.GlideUtils
import com.duben.loveplayletd.R
......@@ -82,6 +84,15 @@ class BasicUserProfileActivity : BaseActivity(), View.OnClickListener, BasicUser
initListener()
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> {
return true
}
}
return true
}
private fun initView() {
rg_sex.setOnCheckedChangeListener { _, checkedId ->
sex = if (checkedId == R.id.rb_female) {
......
......@@ -32,7 +32,7 @@ class FollowWechatActivity : BaseActivity(), View.OnClickListener {
when (v?.id) {
R.id.iv_left_icon -> finish()
R.id.tv_submit -> {
finish()
readyGoThenKill(MainActivity::class.java)
}
R.id.tv_save -> {
saveResourceToGallery(this@FollowWechatActivity, R.mipmap.bg_wechat_code)
......
......@@ -67,6 +67,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
private var mStep = 1
private var isEnterFlag = false
private var isWechatQrCodeUrl = false
private var wechatQrCodeUrl = ""
private var readAuthImageUrl = ""
......@@ -337,11 +338,18 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
showToast("请输入您的微信号")
return
}
if (TextUtils.isEmpty(wechatQrCodeUrl)) {
showToast("请先上传微信二维码")
return
}
if (isEnterFlag) {
readyGo(FollowWechatActivity::class.java)
} else {
luban(wechatQrCodeUrl)
}
}
else -> {}
}
......@@ -553,6 +561,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
}
override fun setWechatQRCodeSuc() {
this.isEnterFlag = true
showToast("恭喜您完成真人认证!")
readyGo(FollowWechatActivity::class.java)
}
......
......@@ -32,6 +32,7 @@ import com.duben.loveplayletd.ui.activitys.WebActivity
import com.duben.loveplayletd.ui.adapter.*
import com.duben.loveplayletd.ui.fragment.base.LazyLoadBaseFragment
import com.duben.loveplayletd.utils.AppPreferencesManager
import com.duben.loveplayletd.utils.LogUtil
import com.duben.loveplayletd.utils.PermissionXUtils
import com.duben.loveplayletd.utils.SpanUtils
import com.google.android.material.tabs.TabLayout
......@@ -53,6 +54,7 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
private val tabsData = mutableListOf<String>()
private var vpAdapter: SquarePageAdapter? = null
private var isShowLocationFlag = false
private var isGetCity = false
override fun getContentViewLayoutID() = R.layout.fragment_square
......@@ -101,7 +103,7 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
TrackManager.getInstance().getBaseMsg()
}
if (AppConfig.basicUserProfileFlag||UserManager.getInstance().userHasBasic()) {
if (AppConfig.basicUserProfileFlag || UserManager.getInstance().userHasBasic()) {
initLocation()
}
}
......@@ -286,16 +288,34 @@ class SquareFragment : LazyLoadBaseFragment(), SquareView, View.OnClickListener
private val mapLocationListener = AMapLocationListener { loc ->
if (loc != null && loc.errorCode == 0) {
LogUtil.d("mcg=----->>>mapLocationListener")
// app全局使用
val curLongitude = loc.longitude
val curLatitude = loc.latitude
// val poiName = loc.poiName
val city = loc.city
// val city = "北京市"
squarePresenter.saveGps(curLatitude.toString(), curLongitude.toString(), city)
if (city.isEmpty()) {
} else {
if(!isGetCity){
LogUtil.d("mcg=----->>>mapLocationListener upcity")
vpAdapter?.let {
(it.getFragments()[0] as SquareListFragment).refresh()
}
}
mLocationClient?.stopLocation()
mLocationClient?.setLocationListener(null)
mLocationClient?.onDestroy()
mLocationClient=null
isGetCity=true
}
}
}
......
......@@ -163,9 +163,6 @@ class SquareListFragment : LazyLoadBaseFragment(), SquareView, OnLoadMoreListene
if (hotPage == 1) {
srl_square.finishRefresh(true)
squareAdapter.setNewInstance(data.list)
if (data.list.size < hotPageSize) {
srl_square.finishLoadMoreWithNoMoreData()
}
} else {
if (data.list.size < hotPageSize) {
srl_square.finishLoadMoreWithNoMoreData()
......@@ -178,7 +175,8 @@ class SquareListFragment : LazyLoadBaseFragment(), SquareView, OnLoadMoreListene
}
override fun getHallListFail() {
srl_square.finishRefresh(true)
hotPage = 1
srl_square.finishRefresh(false)
}
override fun toLikeSuc(position: Int) {
......@@ -194,10 +192,14 @@ class SquareListFragment : LazyLoadBaseFragment(), SquareView, OnLoadMoreListene
override fun onRefresh(refreshLayout: RefreshLayout) {
hotPage = 1
srl_square.resetNoMoreData()
squarePresenter.getHallList(mType, hotPage, hotPageSize)
}
fun refresh() {
// hotPage = 1
// srl_square.resetNoMoreData()
// squarePresenter.getHallList(mType, hotPage, hotPageSize)
srl_square.autoRefresh()
}
}
\ No newline at end of file
......@@ -14,9 +14,14 @@ import cn.sharesdk.framework.PlatformActionListener
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import cn.sharesdk.wechat.moments.WechatMoments
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.SimpleTarget
import com.duben.library.utils.ConstantUtil
import com.duben.loveplayletd.MintsApplication
import com.duben.loveplayletd.R
import com.duben.loveplayletd.utils.ImageUtil
import com.duben.loveplayletd.utils.LogUtil
import com.duben.loveplayletd.utils.TimeRender
import com.duben.loveplayletd.utils.ToastUtil
import java.util.*
import kotlin.concurrent.schedule
......@@ -28,8 +33,8 @@ class ShareImageDialog(
shareCode: String,
) : Dialog(context, R.style.dialog) {
private val llDialogShareWx: LinearLayout
private val llDialogShareQq: LinearLayout
private val llDialogShareWx: TextView
private val flPoster: FrameLayout
private val tvDialogShareNext: TextView
private var mOnShareOKListener: OnShareOKListener? = null
......@@ -57,11 +62,11 @@ class ShareImageDialog(
i == KeyEvent.KEYCODE_BACK
}
llDialogShareWx = findViewById<View>(R.id.llDialogShareWx) as LinearLayout
llDialogShareQq = findViewById<View>(R.id.llDialogShareQq) as LinearLayout
llDialogShareWx = findViewById<View>(R.id.llDialogShareWx) as TextView
// llDialogShareQq = findViewById<View>(R.id.llDialogShareQq) as LinearLayout
tvDialogShareNext = findViewById<View>(R.id.tvDialogShareNext) as TextView
val flPoster = findViewById<FrameLayout>(R.id.fl_poster)
flPoster = findViewById<FrameLayout>(R.id.fl_poster)
val layoutParams = flPoster.layoutParams
layoutParams.width = whArr[0]
layoutParams.height = whArr[1]
......@@ -72,18 +77,31 @@ class ShareImageDialog(
findViewById<TextView>(R.id.tv_share_code).text = "邀请码:${shareCode}"
llDialogShareWx.setOnClickListener {
shareWechat()
// shareWechat()
savePhoto()
}
llDialogShareQq.setOnClickListener {
shareWechatFavoite()
}
// llDialogShareQq.setOnClickListener {
// shareWechatFavoite()
// }
tvDialogShareNext.setOnClickListener {
dismiss()
}
}
fun savePhoto() {
flPoster.invalidate()
flPoster.isDrawingCacheEnabled = true
flPoster.drawingCacheQuality = View.DRAWING_CACHE_QUALITY_HIGH
flPoster.buildDrawingCache()
val bitmap: Bitmap = flPoster.drawingCache
var bitName = "COUNT_"
bitName += TimeRender.formatTime(Date()) + ".jpeg"
ImageUtil.saveBitmap(context, bitmap, bitName)
ToastUtil.show(context, "图片已保存至相册")
}
fun setOnShareOKListener(onShareOKListener: OnShareOKListener) {
mOnShareOKListener = onShareOKListener
}
......@@ -121,9 +139,12 @@ class ShareImageDialog(
wechat.platformActionListener = object : PlatformActionListener {
override fun onComplete(p0: Platform?, p1: Int, p2: HashMap<String, Any>?) {
mOnShareCompleteListener?.onShareComplete()
LogUtil.d("mcg-->>shareWechat====suc")
}
override fun onError(p0: Platform?, p1: Int, p2: Throwable?) {
LogUtil.d("mcg-->>shareWechat===="+p2?.printStackTrace())
}
override fun onCancel(p0: Platform?, p1: Int) {
......@@ -155,10 +176,14 @@ class ShareImageDialog(
if (ConstantUtil.isInstall(context, "com.tencent.mm")) {
wechatMoments.platformActionListener = object : PlatformActionListener {
override fun onComplete(p0: Platform?, p1: Int, p2: HashMap<String, Any>?) {
LogUtil.d("mcg-->>wechatMoments====suc")
mOnShareCompleteListener?.onShareComplete()
}
override fun onError(p0: Platform?, p1: Int, p2: Throwable?) {
LogUtil.d("mcg-->>wechatMoments===="+p2?.printStackTrace())
}
override fun onCancel(p0: Platform?, p1: Int) {
......
......@@ -78,18 +78,18 @@
android:layout_height="45dp"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
android:orientation="vertical"
android:gravity="center_horizontal"
android:layout_marginEnd="20dp">
<TextView
android:id="@+id/tv_share_img"
android:layout_width="0dp"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:background="@drawable/shape_share_btn"
android:elevation="2dp"
android:gravity="center"
android:text="分享海报"
android:text="保存图片,邀请朋友"
android:textColor="@color/color_633C1B"
android:textSize="16sp"
android:textStyle="bold" />
......@@ -102,6 +102,7 @@
android:layout_weight="1"
android:background="@drawable/shape_share_btn"
android:elevation="2dp"
android:visibility="gone"
android:gravity="center"
android:text="分享链接"
android:textColor="@color/color_633C1B"
......
......@@ -100,53 +100,65 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/llDialogShareWx"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/ic_share_wechat" />
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="微信"
android:textColor="@color/color_929297"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/llDialogShareQq"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:id="@+id/llDialogShareWx"
android:layout_width="320dp"
android:layout_height="60dp"
android:background="@drawable/shape_share_btn"
android:elevation="2dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:src="@mipmap/ic_wx_friends" />
android:text="保存图片,微信分享"
android:textColor="@color/color_633C1B"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="朋友圈"
android:textColor="@color/color_929297"
android:textSize="14sp" />
</LinearLayout>
<!-- <LinearLayout-->
<!-- android:id="@+id/llDialogShareWx"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_weight="1.0"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical">-->
<!-- <ImageView-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:src="@mipmap/ic_share_wechat" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="10dp"-->
<!-- android:text="微信"-->
<!-- android:textColor="@color/color_929297"-->
<!-- android:textSize="14sp" />-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:id="@+id/llDialogShareQq"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_weight="1.0"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical">-->
<!-- <ImageView-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_gravity="center_horizontal"-->
<!-- android:src="@mipmap/ic_wx_friends" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="10dp"-->
<!-- android:text="朋友圈"-->
<!-- android:textColor="@color/color_929297"-->
<!-- android:textSize="14sp" />-->
<!-- </LinearLayout>-->
</LinearLayout>
<TextView
......
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