Commit c357bb44 authored by wanglei's avatar wanglei

...

parent cfd8ca08
......@@ -19,11 +19,16 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn javax.annotation.Nullable
-keep class com.base.locationsharewhite.bean.** { *; }
-keep class com.google.gson.reflect.** { *; }
-keep class * extends com.google.gson.reflect.TypeToken
-keep class com.google.gson.stream.** { *; }
-keep class com.squareup.okhttp.** { *; }
-keepattributes *Annotation*
-keep class * extends com.google.gson.TypeAdapter
-keep class * extends com.google.gson.JsonSerializer
-keep class * extends com.google.gson.Deserializer
-keep class com.google.gson.TypeAdapters{*;}
\ No newline at end of file
-keep class com.google.gson.TypeAdapters{*;}
-keep class com.bytedance.sdk.** { *; }
......@@ -17,8 +17,8 @@ import com.base.locationsharewhite.ads.applovin.AdMaxEvent
import com.base.locationsharewhite.ads.applovin.MaxInsertMgr
import com.base.locationsharewhite.ads.applovin.MaxNativeMgr
import com.base.locationsharewhite.ads.applovin.MaxOpenMgr
import com.base.locationsharewhite.config.AdConfigBean
import com.base.locationsharewhite.config.ConfigBean.Companion.configBean
import com.base.locationsharewhite.bean.config.AdConfigBean
import com.base.locationsharewhite.bean.config.ConfigBean.Companion.configBean
import com.base.locationsharewhite.helper.EventUtils
import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx
......
......@@ -21,15 +21,15 @@ object ConstConfig {
//admob test id
const val OPEN_ADMOB_ID_TEST = "ca-app-pub-3940256099942544/9257395921"
const val BANNER_ADMOB_ID_TEST = "ca-app-pub-3940256099942544/9214589741"
const val INTER_ADMOB_ID_TEST = "ca-app-pub-3940256099942544/1033173712"
const val NATIVE_ADMOB_ID_TEST = "ca-app-pub-3940256099942544/2247696110"
const val BANNER_ADMOB_ID_TEST = "ca-app-pub-3940256099942544/9214589741"
// admob广告id
const val INTER_ADMOB_ID = "ca-app-pub-7560983767776658/7069786941"
const val NATIVE_ADMOB_ID = "ca-app-pub-7560983767776658/5561264154"
const val OPEN_ADMOB_ID = "ca-app-pub-7560983767776658/9504378590"
const val BANNER_ADMOB_ID = "ca-app-pub-7560983767776658/7704383208"
const val OPEN_ADMOB_ID = "ca-app-pub-3940256099942544/9257395921"
const val INTER_ADMOB_ID = "ca-app-pub-3940256099942544/1033173712"
const val NATIVE_ADMOB_ID = "ca-app-pub-3940256099942544/2247696110"
const val BANNER_ADMOB_ID = "ca-app-pub-3940256099942544/9214589741"
const val MAX_SDK_KEY =
......
......@@ -76,7 +76,7 @@ class AdInsertMgr {
override fun onAdShowedFullScreenContent() {
super.onAdShowedFullScreenContent()
adState.onAdDisplayed()
this@AdInsertMgr.showCallBack?.show()
showCallBack?.show()
(adEvent as AdmobEvent).showAd(responseInfo, activity)
LimitUtils.addDisplayNum()
}
......
package com.base.locationsharewhite.config
package com.base.locationsharewhite.bean.config
class AdConfigBean(
var adSwitch: Boolean = true,//true 走admob,false走max
......
package com.base.locationsharewhite.config
package com.base.locationsharewhite.bean.config
class PopupConfigBean(
......
package com.base.locationsharewhite.fcm
import com.base.locationsharewhite.config.PopupConfigBean
import com.base.locationsharewhite.bean.config.PopupConfigBean
object PopupConstObject {
......
......@@ -8,7 +8,7 @@ import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import com.base.locationsharewhite.config.ConfigBean
import com.base.locationsharewhite.bean.config.ConfigBean
import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.bean.ConstObject.appLanguageCountrySp
import com.base.locationsharewhite.bean.ConstObject.appLanguageSp
......
......@@ -52,6 +52,7 @@ object LocationShareUtils {
LogEx.logDebug(TAG, "paramJson=$paramJson")
runCatching {
val result = ReportUtils.doPost(url, HashMap(), paramJson)
LogEx.logDebug(TAG, "result=$result")
val responseData = extractData(result)
if (responseData != null) {
val state = AESHelper.decrypt(responseData).toInt()
......
......@@ -11,6 +11,8 @@ import androidx.activity.addCallback
import androidx.lifecycle.lifecycleScope
import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.R
import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.bean.ConstObject
import com.base.locationsharewhite.bean.ViewingBean
import com.base.locationsharewhite.databinding.ActivityLocationMapBinding
......@@ -106,10 +108,10 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
LocationShareListUtils.deleteShare(viewingBean.device) { result ->
runOnUiThread {
if (result) {
toast("delete success")
toast("delete success", true)
binding.ivRefresh.callOnClick()
} else {
toast("delete failed")
toast("delete failed", true)
}
}
}
......@@ -220,18 +222,34 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
changeMyLocation(locationPresenter.getMyLocation(), true, true, true)
}
binding.ivRefresh.setOnClickListener {
startRefreshAnimation()
lifecycleScope.launch(Dispatchers.Main) {
delay(2000)
stopRefreshAnimation()
}
initViewingData()
AdsMgr.showInsert(this, false, object : AdsShowCallBack() {
override fun close(where: Int) {
startRefresh()
}
override fun failed(where: Int) {
startRefresh()
}
override fun googleFailed(where: Int) {
startRefresh()
}
})
}
binding.bottomSheet.setOnClickListener { }
binding.ivPermission.setOnClickListener {
requestLocationAllowAllTime(launcher, jumpOutAction = {}, permissionAllowAction = {})
}
}
fun startRefresh() {
startRefreshAnimation()
lifecycleScope.launch(Dispatchers.Main) {
delay(2000)
stopRefreshAnimation()
}
initViewingData()
}
private var valueAnimator: ValueAnimator? = null
......
......@@ -4,6 +4,7 @@ import android.graphics.Color
import androidx.activity.addCallback
import androidx.core.view.updatePadding
import com.base.locationsharewhite.R
import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.databinding.ActivityLocationCodeBinding
import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.location.LocationLoginUtils
......@@ -29,6 +30,7 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
copyText("MyLocationCode", binding.tvCode.text.toString())
toast(resources.getString(R.string.copy))
}
AdsMgr.showNative(binding.flAd,R.layout.layout_admob_app_exit,)
}
override fun initListener() {
......
......@@ -3,10 +3,14 @@ package com.base.locationsharewhite.ui.main
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.activity.addCallback
import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.locationsharewhite.R
import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.bean.ViewerBean
import com.base.locationsharewhite.databinding.ActivityLocationShareBinding
import com.base.locationsharewhite.helper.BaseActivity
......@@ -28,6 +32,7 @@ import com.base.locationsharewhite.utils.ToastUtils.toast
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
/**
* 添加谁可以看我
*/
......@@ -71,7 +76,7 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
showViewerMoreDialog(anchorView, deleteAction = {
LocationShareListUtils.deleteShare(viewerBean.device) {
runOnUiThread {
toast(it.toString())
toast(it.toString(), true)
}
}
}, renameAction = {
......@@ -84,7 +89,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
}
binding.rv.adapter = adapter
initShareData()
}
......@@ -100,35 +104,64 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
binding.tvShare.setOnClickListener {
val code = binding.editCode.text.toString()
if (code.isEmpty()) {
toast("code is empty")
toast("code is empty", true)
return@setOnClickListener
}
if (code.length >= 8) {
LocationShareUtils.shareMyLocationByInvitationCode(code) { status ->
runOnUiThread {
when (status) {
SHARE_STATE_FAILED -> {
toast("Code verification failed")
}
hideKeyBoard()
AdsMgr.showInsert(this, false, object : AdsShowCallBack() {
override fun close(where: Int) {
shareLocationCode(code)
}
SHARE_STATE_SUCCESS -> {
toast("Code verification success")
initShareData()
}
override fun failed(where: Int) {
shareLocationCode(code)
}
SHARE_STATE_SHARED -> {
toast("Sharing code has been added")
}
override fun googleFailed(where: Int) {
shareLocationCode(code)
}
SHARE_STATE_MYSELF -> {
toast("Sharing code is yourself code")
}
}
})
} else {
toast("code verification failed", true)
}
}
}
fun hideKeyBoard() {
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
if (currentFocus != null) {
imm.hideSoftInputFromWindow(currentFocus!!.windowToken, 0)
}
binding.editCode.clearFocus()
}
private fun shareLocationCode(code: String) {
LocationShareUtils.shareMyLocationByInvitationCode(code) { status ->
LogEx.logDebug(TAG, "status=$status")
runOnUiThread {
toast("status=$status", true)
when (status) {
SHARE_STATE_FAILED -> {
toast("Code verification failed", true)
}
SHARE_STATE_SUCCESS -> {
toast("Code verification success", true)
initShareData()
}
SHARE_STATE_SHARED -> {
toast("Sharing code has been added", true)
}
SHARE_STATE_MYSELF -> {
toast("Sharing code is yourself code", true)
}
}
} else {
toast("code verification failed")
}
}
}
......@@ -138,6 +171,12 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
val nickList = SpStringUtils.getSpStringList(VIEWER_NICKNAME_KEY)
it.forEach { viewer -> changeLocalNickName(viewer, nickList) }
runOnUiThread {
if (it.isEmpty()) {
binding.flAd.visibility = View.VISIBLE
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit)
} else {
binding.flAd.visibility = View.GONE
}
adapter.submitList(it)
}
})
......
......@@ -15,7 +15,7 @@ import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.ads.admob.AdBannerMgr
import com.base.locationsharewhite.ads.admob.AdInsertMgr
import com.base.locationsharewhite.config.ConfigBean
import com.base.locationsharewhite.bean.config.ConfigBean
import com.base.locationsharewhite.databinding.ActivityMainBinding
import com.base.locationsharewhite.fcm.NotificationUiUtil.sendAllAllowedNotification
import com.base.locationsharewhite.helper.BaseActivity
......
......@@ -108,7 +108,7 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
val sp = device + _DEVICE_NICKNAME_ + newName
SpStringUtils.addSpString(VIEWER_NICKNAME_KEY, sp)
toast("Rename success")
toast("Rename success", true)
finish()
}
......@@ -126,7 +126,7 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
val sp = device + _DEVICE_NICKNAME_ + newName
SpStringUtils.addSpString(VIEWING_NICKNAME_KEY, sp)
toast("Rename success")
toast("Rename success", true)
finish()
}
......@@ -139,9 +139,9 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
LocationNameUtils.renameNickName(newName) { flag ->
runOnUiThread {
if (flag) {
toast("Rename success")
toast("Rename success", true)
} else {
toast("Rename failed")
toast("Rename failed", true)
}
finish()
}
......
......@@ -5,8 +5,8 @@ import android.widget.Toast
import com.base.locationsharewhite.BuildConfig
object ToastUtils {
fun Context.toast(content: String) {
if (BuildConfig.DEBUG) {
fun Context.toast(content: String, isMust: Boolean = false) {
if (BuildConfig.DEBUG || isMust) {
Toast.makeText(this, content, Toast.LENGTH_SHORT).show()
}
}
......
......@@ -101,6 +101,11 @@
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<com.base.locationsharewhite.ads.NativeParentView
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -121,13 +121,24 @@
android:textStyle="bold" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/ll"
tools:listitem="@layout/item_viewer" />
app:layout_constraintTop_toBottomOf="@id/ll">
<com.base.locationsharewhite.ads.NativeParentView
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_viewer" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
......
File added
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