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)
......
...@@ -67,6 +67,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -67,6 +67,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
private var mStep = 1 private var mStep = 1
private var isEnterFlag = false
private var isWechatQrCodeUrl = false private var isWechatQrCodeUrl = false
private var wechatQrCodeUrl = "" private var wechatQrCodeUrl = ""
private var readAuthImageUrl = "" private var readAuthImageUrl = ""
...@@ -234,9 +235,9 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -234,9 +235,9 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
} }
} }
readyGoForResult( readyGoForResult(
UserLabelActivity::class.java, UserLabelActivity::class.java,
Constant.USER_LABEL_REQUEST_CODE, Constant.USER_LABEL_REQUEST_CODE,
bundle bundle
) )
} }
} }
...@@ -337,11 +338,18 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -337,11 +338,18 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
showToast("请输入您的微信号") showToast("请输入您的微信号")
return return
} }
if (TextUtils.isEmpty(wechatQrCodeUrl)) { if (TextUtils.isEmpty(wechatQrCodeUrl)) {
showToast("请先上传微信二维码") showToast("请先上传微信二维码")
return
}
if (isEnterFlag) {
readyGo(FollowWechatActivity::class.java)
} else { } else {
luban(wechatQrCodeUrl) luban(wechatQrCodeUrl)
} }
} }
else -> {} else -> {}
} }
...@@ -362,24 +370,24 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -362,24 +370,24 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
val pvOptions = OptionsPickerBuilder(this) { options1, options2, _, _ -> val pvOptions = OptionsPickerBuilder(this) { options1, options2, _, _ ->
//返回的分别是三个级别的选中位置 //返回的分别是三个级别的选中位置
val opt1tx = if (jobOptions1Items!!.isNotEmpty()) jobOptions1Items!![options1] val opt1tx = if (jobOptions1Items!!.isNotEmpty()) jobOptions1Items!![options1]
.pickerViewText else "" .pickerViewText else ""
val opt2tx = if (jopOptions2Items!!.size > 0 val opt2tx = if (jopOptions2Items!!.size > 0
&& jopOptions2Items!![options1].size > 0 && jopOptions2Items!![options1].size > 0
) jopOptions2Items!![options1][options2] else "" ) jopOptions2Items!![options1][options2] else ""
val tx = "$opt1tx-$opt2tx" val tx = "$opt1tx-$opt2tx"
userProfileData?.career = tx userProfileData?.career = tx
zyTv.text = tx zyTv.text = tx
} }
.setSelectOptions(provinceIndex, cityIndex) .setSelectOptions(provinceIndex, cityIndex)
.setDividerColor(Color.BLACK) .setDividerColor(Color.BLACK)
.setTextColorCenter(Color.BLACK) //设置选中项文字颜色 .setTextColorCenter(Color.BLACK) //设置选中项文字颜色
.setContentTextSize(20) .setContentTextSize(20)
.build<Any>() .build<Any>()
pvOptions.setPicker( pvOptions.setPicker(
jobOptions1Items as List<Nothing>, jobOptions1Items as List<Nothing>,
jopOptions2Items as List<Nothing> jopOptions2Items as List<Nothing>
) //三级选择器 ) //三级选择器
pvOptions.show() pvOptions.show()
...@@ -391,27 +399,27 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -391,27 +399,27 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
// 弹出选择器 // 弹出选择器
val pvOptions = val pvOptions =
OptionsPickerBuilder(this) { options1, options2, _, v -> //返回的分别是三个级别的选中位置 OptionsPickerBuilder(this) { options1, options2, _, v -> //返回的分别是三个级别的选中位置
val opt1tx = val opt1tx =
if (addressOptions1Items!!.isNotEmpty()) addressOptions1Items!![options1] if (addressOptions1Items!!.isNotEmpty()) addressOptions1Items!![options1]
.pickerViewText else "" .pickerViewText else ""
val opt2tx = if (addressOptions2Items!!.size > 0 val opt2tx = if (addressOptions2Items!!.size > 0
&& addressOptions2Items!![options1].size > 0 && addressOptions2Items!![options1].size > 0
) addressOptions2Items!![options1][options2] else "" ) addressOptions2Items!![options1][options2] else ""
val tx = "$opt1tx-$opt2tx" val tx = "$opt1tx-$opt2tx"
userProfileData?.findCity = tx userProfileData?.findCity = tx
jyfwTv.text = tx jyfwTv.text = tx
} }
.setSelectOptions(provinceIndex, cityIndex) .setSelectOptions(provinceIndex, cityIndex)
.setDividerColor(Color.BLACK) .setDividerColor(Color.BLACK)
.setTextColorCenter(Color.BLACK) //设置选中项文字颜色 .setTextColorCenter(Color.BLACK) //设置选中项文字颜色
.setContentTextSize(20) .setContentTextSize(20)
.build<Any>() .build<Any>()
pvOptions.setPicker( pvOptions.setPicker(
addressOptions1Items as List<Nothing>, addressOptions1Items as List<Nothing>,
addressOptions2Items as List<Nothing> addressOptions2Items as List<Nothing>
) )
pvOptions.show() pvOptions.show()
} }
...@@ -420,13 +428,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -420,13 +428,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
when (pickerType) { when (pickerType) {
UserProfile.PROFILE_SG.str -> { UserProfile.PROFILE_SG.str -> {
mSinglePickDialog = SinglePickDialog( mSinglePickDialog = SinglePickDialog(
this, this,
UserProfile.PROFILE_SG.str, UserProfile.PROFILE_SG.str,
getPickerData(UserProfile.PROFILE_SG.str), getPickerData(UserProfile.PROFILE_SG.str),
defaultValue defaultValue
) )
mSinglePickDialog?.setPickResultListener(object : mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener { SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) { override fun onPickResult(result: String) {
userProfileData?.userHeight = result userProfileData?.userHeight = result
sgTv.text = result sgTv.text = result
...@@ -436,13 +444,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -436,13 +444,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
} }
UserProfile.PROFILE_TZ.str -> { UserProfile.PROFILE_TZ.str -> {
mSinglePickDialog = SinglePickDialog( mSinglePickDialog = SinglePickDialog(
this, this,
UserProfile.PROFILE_TZ.str, UserProfile.PROFILE_TZ.str,
getPickerData(UserProfile.PROFILE_TZ.str), getPickerData(UserProfile.PROFILE_TZ.str),
defaultValue defaultValue
) )
mSinglePickDialog?.setPickResultListener(object : mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener { SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) { override fun onPickResult(result: String) {
userProfileData?.bodyWeight = result userProfileData?.bodyWeight = result
tzTv.text = result tzTv.text = result
...@@ -452,13 +460,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -452,13 +460,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
} }
UserProfile.PROFILE_SX.str -> { UserProfile.PROFILE_SX.str -> {
mSinglePickDialog = SinglePickDialog( mSinglePickDialog = SinglePickDialog(
this, this,
UserProfile.PROFILE_SX.str, UserProfile.PROFILE_SX.str,
getPickerData(UserProfile.PROFILE_SX.str), getPickerData(UserProfile.PROFILE_SX.str),
defaultValue defaultValue
) )
mSinglePickDialog?.setPickResultListener(object : mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener { SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) { override fun onPickResult(result: String) {
userProfileData?.appearance = result userProfileData?.appearance = result
sxTv.text = result sxTv.text = result
...@@ -505,14 +513,14 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -505,14 +513,14 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
override fun getFaceParamSuc(data: FaceParam) { override fun getFaceParamSuc(data: FaceParam) {
FaceVerifyHelper.instance.openCloudFaceService(this, data, FaceVerifyHelper.instance.openCloudFaceService(this, data,
object : FaceVerifyHelper.FaceVerifyCallback { object : FaceVerifyHelper.FaceVerifyCallback {
override fun onFaceVerifyOver(result: FaceResult) { override fun onFaceVerifyOver(result: FaceResult) {
if (result.isSuccess) { if (result.isSuccess) {
changeStepStatus(3) changeStepStatus(3)
}
realAuthPresenter.faceResult(result)
} }
realAuthPresenter.faceResult(result) })
}
})
} }
override fun getFaceParamFail() {} override fun getFaceParamFail() {}
...@@ -553,6 +561,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -553,6 +561,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
} }
override fun setWechatQRCodeSuc() { override fun setWechatQRCodeSuc() {
this.isEnterFlag = true
showToast("恭喜您完成真人认证!") showToast("恭喜您完成真人认证!")
readyGo(FollowWechatActivity::class.java) readyGo(FollowWechatActivity::class.java)
} }
...@@ -562,41 +571,41 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -562,41 +571,41 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
private fun showAlbum() { private fun showAlbum() {
val windowAnimationStyle = PictureWindowAnimationStyle() val windowAnimationStyle = PictureWindowAnimationStyle()
windowAnimationStyle.ofAllAnimation( windowAnimationStyle.ofAllAnimation(
com.luck.picture.lib.R.anim.picture_anim_up_in, com.luck.picture.lib.R.anim.picture_anim_up_in,
com.luck.picture.lib.R.anim.picture_anim_down_out com.luck.picture.lib.R.anim.picture_anim_down_out
) )
PermissionX.init(this) PermissionX.init(this)
.permissions( .permissions(
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE,
// Manifest.permission.WRITE_EXTERNAL_STORAGE, // Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA Manifest.permission.CAMERA
) )
.request { allGranted: Boolean, _: List<String?>?, _: List<String?>? -> .request { allGranted: Boolean, _: List<String?>?, _: List<String?>? ->
if (allGranted) { if (allGranted) {
PictureSelector.create(this) PictureSelector.create(this)
.openGallery(PictureMimeType.ofImage()) .openGallery(PictureMimeType.ofImage())
.theme(R.style.picture_WeChat_style) // 微信主题色 .theme(R.style.picture_WeChat_style) // 微信主题色
.isWeChatStyle(true) // 微信样式 .isWeChatStyle(true) // 微信样式
.isCamera(true) //列表是否显示拍照按钮 .isCamera(true) //列表是否显示拍照按钮
.isZoomAnim(true)//图片选择缩放效果 .isZoomAnim(true)//图片选择缩放效果
.isEnableCrop(true)//是否开启裁剪 .isEnableCrop(true)//是否开启裁剪
.setPictureWindowAnimationStyle(windowAnimationStyle) .setPictureWindowAnimationStyle(windowAnimationStyle)
.withAspectRatio(4, 4) .withAspectRatio(4, 4)
.isCompress(true)//是否压缩 .isCompress(true)//是否压缩
.compressFocusAlpha(false)//压缩后是否保持图片的透明通道 .compressFocusAlpha(false)//压缩后是否保持图片的透明通道
.minimumCompressSize(200)// 小于多少kb的图片不压缩 .minimumCompressSize(200)// 小于多少kb的图片不压缩
.compressQuality(60)//图片压缩后输出质量 .compressQuality(60)//图片压缩后输出质量
.synOrAsy(true)//开启同步or异步压缩 .synOrAsy(true)//开启同步or异步压缩
.maxSelectNum(1) .maxSelectNum(1)
.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)//屏幕旋转方向 .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)//屏幕旋转方向
.selectionMode(PictureConfig.SINGLE)//单选or多选 .selectionMode(PictureConfig.SINGLE)//单选or多选
.imageEngine(GlideEngine.createGlideEngine())// 图片加载引擎 .imageEngine(GlideEngine.createGlideEngine())// 图片加载引擎
.forResult(PictureConfig.CHOOSE_REQUEST) .forResult(PictureConfig.CHOOSE_REQUEST)
} else { } else {
showMissingPermissionDialog("存储") showMissingPermissionDialog("存储")
}
} }
}
} }
/** /**
...@@ -619,13 +628,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -619,13 +628,13 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
@Throws(Exception::class) @Throws(Exception::class)
override fun doInBackground(): List<File> { override fun doInBackground(): List<File> {
return Luban.with(mContext) return Luban.with(mContext)
.loadMediaData<LocalMedia>(arrayListOf(media)) .loadMediaData<LocalMedia>(arrayListOf(media))
.ignoreBy(200) .ignoreBy(200)
.isCamera(false) .isCamera(false)
.setCompressQuality(80) .setCompressQuality(80)
.setTargetDir(null) .setTargetDir(null)
.setFocusAlpha(false) .setFocusAlpha(false)
.setNewCompressFileName(newFileName).get() .setNewCompressFileName(newFileName).get()
} }
override fun onSuccess(files: List<File>) { override fun onSuccess(files: List<File>) {
...@@ -661,8 +670,8 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -661,8 +670,8 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
if (isWechatQrCodeUrl) { if (isWechatQrCodeUrl) {
wechatQrCodeUrl = imgPath!! wechatQrCodeUrl = imgPath!!
realAuthPresenter.setWechatQRCode( realAuthPresenter.setWechatQRCode(
wechatQrCodeUrl, wechatQrCodeUrl,
et_wechat_no.text.toString() et_wechat_no.text.toString()
) )
} else { } else {
readAuthImageUrl = imgPath!! readAuthImageUrl = imgPath!!
...@@ -681,22 +690,22 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -681,22 +690,22 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
// 相册获取图片 // 相册获取图片
PictureConfig.CHOOSE_REQUEST -> { PictureConfig.CHOOSE_REQUEST -> {
val selectList: List<LocalMedia> = val selectList: List<LocalMedia> =
PictureSelector.obtainMultipleResult(data) PictureSelector.obtainMultipleResult(data)
val img = selectList[0] val img = selectList[0]
if (isWechatQrCodeUrl) { if (isWechatQrCodeUrl) {
wechatQrCodeUrl = img.compressPath wechatQrCodeUrl = img.compressPath
GlideUtils.loadImageViewNoAnim2( GlideUtils.loadImageViewNoAnim2(
this@RealAuthActivity, this@RealAuthActivity,
wechatQrCodeUrl, wechatQrCodeUrl,
iv_wechat_qrcode iv_wechat_qrcode
) )
} else { } else {
readAuthImageUrl = img.compressPath readAuthImageUrl = img.compressPath
GlideUtils.loadImageViewNoAnim2( GlideUtils.loadImageViewNoAnim2(
this@RealAuthActivity, this@RealAuthActivity,
readAuthImageUrl, readAuthImageUrl,
iv_auth iv_auth
) )
} }
} }
...@@ -708,7 +717,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -708,7 +717,7 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
userProfileData?.tagsCommon = sbLabel userProfileData?.tagsCommon = sbLabel
if (!TextUtils.isEmpty(userProfileData?.tagsCommon)) { if (!TextUtils.isEmpty(userProfileData?.tagsCommon)) {
val tagsList = val tagsList =
gson.fromJson(userProfileData?.tagsCommon, Array<String>::class.java) gson.fromJson(userProfileData?.tagsCommon, Array<String>::class.java)
gxbqAdapter?.setNewInstance(tagsList.toCollection(ArrayList())) gxbqAdapter?.setNewInstance(tagsList.toCollection(ArrayList()))
gxbqTv.text = "" gxbqTv.text = ""
} }
......
...@@ -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