Commit c357bb44 authored by wanglei's avatar wanglei

...

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