Commit df84dd49 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

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