Commit 9294c03d authored by wanglei's avatar wanglei

...

parent 92fa8770
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name=".fcm.alarm.AlarmJobReceiver" android:name=".fcm.alarm.AlarmReceiver"
android:enabled="true" android:enabled="true"
android:exported="true" android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"> android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
...@@ -163,6 +163,35 @@ ...@@ -163,6 +163,35 @@
<data android:scheme="file" /> <data android:scheme="file" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver
android:name=".fcm.receiver.FileJobReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
<intent-filter>
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
<action android:name="android.net.wifi.STATE_CHANGE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MEDIA_EJECT" />
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<data android:scheme="file" />
</intent-filter>
</receiver>
<meta-data <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID" android:name="com.google.android.gms.ads.APPLICATION_ID"
......
...@@ -28,11 +28,11 @@ class AdInsertMgr { ...@@ -28,11 +28,11 @@ class AdInsertMgr {
fun show(activity: Activity, isUnLimit: Boolean, adEvent: AdEvent, showCallBack: AdsShowCallBack?) { fun show(activity: Activity, isUnLimit: Boolean, adEvent: AdEvent, showCallBack: AdsShowCallBack?) {
if (activity.isFinishing || activity.isDestroyed) { if (activity.isFinishing || activity.isDestroyed) {
showCallBack?.failed() showCallBack?.failed(0)
return return
} }
if (adState.showingAd) { if (adState.showingAd) {
showCallBack?.failed() showCallBack?.failed(1)
return return
} }
...@@ -49,11 +49,11 @@ class AdInsertMgr { ...@@ -49,11 +49,11 @@ class AdInsertMgr {
if (!isUnLimit) { if (!isUnLimit) {
if (!LimitUtils.isAdShow(AdsType.INSERT, adEvent)) { if (!LimitUtils.isAdShow(AdsType.INSERT, adEvent)) {
showCallBack?.failed() showCallBack?.failed(2)
return return
} }
if (LimitUtils.isIntervalLimited(adState.lastShowTime, adEvent)) { if (LimitUtils.isIntervalLimited(adState.lastShowTime, adEvent)) {
showCallBack?.failed() showCallBack?.failed(3)
return return
} }
} }
...@@ -116,7 +116,7 @@ class AdInsertMgr { ...@@ -116,7 +116,7 @@ class AdInsertMgr {
if (!isUnLimit) { if (!isUnLimit) {
if (!LimitUtils.isAdShow(AdsType.INSERT, adEvent)) { if (!LimitUtils.isAdShow(AdsType.INSERT, adEvent)) {
this.showCallBack?.close() this.showCallBack?.close(4)
this.showCallBack = null this.showCallBack = null
return return
} }
......
...@@ -158,7 +158,4 @@ class AdMaxEvent : AdEvent { ...@@ -158,7 +158,4 @@ class AdMaxEvent : AdEvent {
} }
} }
fun adShowError(reason: String) {
}
} }
\ No newline at end of file
...@@ -7,4 +7,6 @@ class AdConfigBean( ...@@ -7,4 +7,6 @@ class AdConfigBean(
var numClickLimit: Int = -1, var numClickLimit: Int = -1,
var timeInterval: Int = 1, var timeInterval: Int = 1,
var openAdLoading: Int = 15, var openAdLoading: Int = 15,
var functionBackShowAd: Boolean = true,
var functionInShowAd: Boolean = true,
) )
\ No newline at end of file
...@@ -14,16 +14,16 @@ class FcmReceiver : BroadcastReceiver() { ...@@ -14,16 +14,16 @@ class FcmReceiver : BroadcastReceiver() {
private val TAG = "FcmReceiver" private val TAG = "FcmReceiver"
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
event("FCM_Received", null, null, false) event("FCM_Received", "FcmReceiver", null, false)
sendNotificationIfCan(context, PopupConstObject.POPUP_WHERE_FCM, null) sendNotificationIfCan(context, PopupConstObject.POPUP_WHERE_FCM, null)
if (BuildConfig.DEBUG) { // if (BuildConfig.DEBUG) {
runOnUiThread { // runOnUiThread {
runCatching { // runCatching {
MyApplication.appContext.toast("FcmReceiver fcm") // MyApplication.appContext.toast("FcmReceiver fcm")
} // }
} // }
} // }
} }
} }
...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint ...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import com.applovin.sdk.AppLovinSdkUtils.runOnUiThread import com.applovin.sdk.AppLovinSdkUtils.runOnUiThread
import com.base.locationsharewhite.BuildConfig import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan
import com.base.locationsharewhite.helper.EventUtils
import com.base.locationsharewhite.helper.EventUtils.event import com.base.locationsharewhite.helper.EventUtils.event
import com.base.locationsharewhite.helper.MyApplication import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.utils.ToastUtils.toast import com.base.locationsharewhite.utils.ToastUtils.toast
...@@ -16,31 +17,32 @@ import org.json.JSONObject ...@@ -16,31 +17,32 @@ import org.json.JSONObject
class MessagingService : FirebaseMessagingService() { class MessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) { override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage) super.onMessageReceived(remoteMessage)
val id = remoteMessage.messageId // val id = remoteMessage.messageId
val ext = JSONObject() // val ext = JSONObject()
try { // try {
ext.put("getMessageType", remoteMessage.messageType) // ext.put("getMessageType", remoteMessage.messageType)
ext.put("getData", remoteMessage.data) // ext.put("getData", remoteMessage.data)
ext.put("getCollapseKey", remoteMessage.collapseKey) // ext.put("getCollapseKey", remoteMessage.collapseKey)
ext.put("getFrom", remoteMessage.from) // ext.put("getFrom", remoteMessage.from)
ext.put("getPriority", remoteMessage.priority) // ext.put("getPriority", remoteMessage.priority)
ext.put("getSenderId", remoteMessage.senderId) // ext.put("getSenderId", remoteMessage.senderId)
ext.put("getSentTime", remoteMessage.sentTime) // ext.put("getSentTime", remoteMessage.sentTime)
} catch (e: JSONException) { // } catch (e: JSONException) {
event("FCM_Received_Error", id, ext, false) // event("FCM_Received_Error", id, ext, false)
throw RuntimeException(e) // throw RuntimeException(e)
} finally { // } finally {
} // }
event("FCM_Received", id, ext, false) val data = JSONObject(remoteMessage.data.toString())
event("FCM_Received", "MessagingService", data, false)
sendNotificationIfCan(this, PopupConstObject.POPUP_WHERE_FCM, null) sendNotificationIfCan(this, PopupConstObject.POPUP_WHERE_FCM, null)
if (BuildConfig.DEBUG) { // if (BuildConfig.DEBUG) {
runOnUiThread { // runOnUiThread {
runCatching { // runCatching {
MyApplication.appContext.toast("MessagingService fcm") // MyApplication.appContext.toast("MessagingService fcm")
} // }
} // }
} // }
} }
} }
\ No newline at end of file
...@@ -26,6 +26,9 @@ import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_LOCK ...@@ -26,6 +26,9 @@ import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_LOCK
import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_PACKAGE import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_PACKAGE
import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_TIMBER import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_TIMBER
import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean
import com.base.locationsharewhite.fcm.receiver.BatteryStatusReceiver
import com.base.locationsharewhite.fcm.receiver.PackageStatusReceiver
import com.base.locationsharewhite.fcm.receiver.ScreenStatusReceiver
import com.base.locationsharewhite.helper.EventUtils import com.base.locationsharewhite.helper.EventUtils
import com.base.locationsharewhite.helper.MyApplication import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.ui.main.MainActivity import com.base.locationsharewhite.ui.main.MainActivity
...@@ -343,7 +346,7 @@ object NotificationUiUtil { ...@@ -343,7 +346,7 @@ object NotificationUiUtil {
builder.setSmallIcon(smallIcon) builder.setSmallIcon(smallIcon)
} }
builder.setContentTitle(context.resources.getString(R.string.app_name)) builder.setContentTitle(context.resources.getString(R.string.app_name))
.setContentText("notification") // .setContentText("notification")
val requestCode = Random.nextInt(1000) val requestCode = Random.nextInt(1000)
val pendingIntent = PendingIntent.getActivity(context, requestCode, intent, PendingIntent.FLAG_IMMUTABLE) val pendingIntent = PendingIntent.getActivity(context, requestCode, intent, PendingIntent.FLAG_IMMUTABLE)
......
...@@ -12,6 +12,7 @@ object PopupConstObject { ...@@ -12,6 +12,7 @@ object PopupConstObject {
const val POPUP_WHERE_BATTERY = "battery" const val POPUP_WHERE_BATTERY = "battery"
const val POPUP_WHERE_PACKAGE = "package" const val POPUP_WHERE_PACKAGE = "package"
const val POPUP_WHERE_WORK_MANAGER = "workmanager" const val POPUP_WHERE_WORK_MANAGER = "workmanager"
const val POPUP_WHERE_FILE_JOB = "FileJob"
const val ACTION_STAY_HOME = "action_stay_home" const val ACTION_STAY_HOME = "action_stay_home"
......
...@@ -2,6 +2,7 @@ package com.base.locationsharewhite.fcm ...@@ -2,6 +2,7 @@ package com.base.locationsharewhite.fcm
import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan
import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean
import com.base.locationsharewhite.fcm.receiver.ScreenStatusReceiver
import com.base.locationsharewhite.helper.MyApplication import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.utils.LogEx.logDebug import com.base.locationsharewhite.utils.LogEx.logDebug
import java.util.Timer import java.util.Timer
......
...@@ -6,11 +6,12 @@ import android.content.Context ...@@ -6,11 +6,12 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan
import com.base.locationsharewhite.fcm.PopupConstObject import com.base.locationsharewhite.fcm.PopupConstObject
import com.base.locationsharewhite.fcm.work.RepeatingWorker.Companion.schedulePeriodicWork
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
class AlarmJobReceiver : BroadcastReceiver() { class AlarmReceiver : BroadcastReceiver() {
private val TAG = "AlarmJobReceiver" private val TAG = "AlarmJobReceiver"
...@@ -24,6 +25,7 @@ class AlarmJobReceiver : BroadcastReceiver() { ...@@ -24,6 +25,7 @@ class AlarmJobReceiver : BroadcastReceiver() {
sendNotificationIfCan(context, PopupConstObject.POPUP_WHERE_ALARM) sendNotificationIfCan(context, PopupConstObject.POPUP_WHERE_ALARM)
AppPreferences.getInstance().put("lastAlarmTime", System.currentTimeMillis()) AppPreferences.getInstance().put("lastAlarmTime", System.currentTimeMillis())
} }
schedulePeriodicWork(context)
return return
} }
} }
\ No newline at end of file
...@@ -17,7 +17,7 @@ object AlarmUtils { ...@@ -17,7 +17,7 @@ object AlarmUtils {
//闹钟定时任务 //闹钟定时任务
val alarmManager = context.getSystemService(JobService.ALARM_SERVICE) as AlarmManager val alarmManager = context.getSystemService(JobService.ALARM_SERVICE) as AlarmManager
val pendingIntent = PendingIntent.getBroadcast( val pendingIntent = PendingIntent.getBroadcast(
context, 1, Intent(context, AlarmJobReceiver::class.java), context, 1, Intent(context, AlarmReceiver::class.java),
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
) )
val calendar = Calendar.getInstance() val calendar = Calendar.getInstance()
......
package com.base.locationsharewhite.fcm package com.base.locationsharewhite.fcm.receiver
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
...@@ -6,6 +6,7 @@ import android.content.Intent ...@@ -6,6 +6,7 @@ import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.os.BatteryManager import android.os.BatteryManager
import android.os.Build import android.os.Build
import com.base.locationsharewhite.fcm.NotificationUiUtil
import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_BATTERY import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_BATTERY
import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean
import com.base.locationsharewhite.helper.EventUtils import com.base.locationsharewhite.helper.EventUtils
......
package com.base.locationsharewhite.fcm.receiver
import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan
import com.base.locationsharewhite.fcm.PopupConstObject
import com.base.locationsharewhite.service.StayJobService.Companion.startJob
class FileJobReceiver : BroadcastReceiver() {
@SuppressLint("UnsafeProtectedBroadcastReceiver")
override fun onReceive(context: Context?, intent: Intent?) {
context?.startJob()
context?.let {
sendNotificationIfCan(context, PopupConstObject.POPUP_WHERE_FILE_JOB)
}
}
}
\ No newline at end of file
package com.base.locationsharewhite.fcm package com.base.locationsharewhite.fcm.receiver
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.os.Build import android.os.Build
import com.base.locationsharewhite.fcm.NotificationUiUtil
import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_PACKAGE import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_PACKAGE
import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean import com.base.locationsharewhite.fcm.PopupConstObject.popupConfigBean
import com.base.locationsharewhite.helper.EventUtils import com.base.locationsharewhite.helper.EventUtils
......
package com.base.locationsharewhite.fcm package com.base.locationsharewhite.fcm.receiver
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
......
...@@ -8,6 +8,7 @@ import com.base.locationsharewhite.utils.AppPreferences ...@@ -8,6 +8,7 @@ import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import org.json.JSONException import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
import java.util.TimeZone
object EventUtils { object EventUtils {
private val TAG = "EventUtils" private val TAG = "EventUtils"
...@@ -48,6 +49,8 @@ object EventUtils { ...@@ -48,6 +49,8 @@ object EventUtils {
.put("${pkg}_14", BuildConfig.VERSION_CODE) .put("${pkg}_14", BuildConfig.VERSION_CODE)
.put("${pkg}_8", BuildConfig.VERSION_NAME) .put("${pkg}_8", BuildConfig.VERSION_NAME)
.put("${pkg}_24", BuildConfig.BUILD_TYPE) .put("${pkg}_24", BuildConfig.BUILD_TYPE)
.put("${pkg}_34", TimeZone.getDefault().getID())
val data = JSONObject() val data = JSONObject()
.put("data", s) .put("data", s)
.put("bp", s2) .put("bp", s2)
......
...@@ -12,10 +12,10 @@ import com.base.locationsharewhite.bean.config.ConfigBean ...@@ -12,10 +12,10 @@ 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
import com.base.locationsharewhite.fcm.BatteryStatusReceiver import com.base.locationsharewhite.fcm.receiver.BatteryStatusReceiver
import com.base.locationsharewhite.fcm.PackageStatusReceiver import com.base.locationsharewhite.fcm.receiver.PackageStatusReceiver
import com.base.locationsharewhite.fcm.PopupConstObject import com.base.locationsharewhite.fcm.PopupConstObject
import com.base.locationsharewhite.fcm.ScreenStatusReceiver import com.base.locationsharewhite.fcm.receiver.ScreenStatusReceiver
import com.base.locationsharewhite.fcm.TimerManager.Companion.changeTimer import com.base.locationsharewhite.fcm.TimerManager.Companion.changeTimer
import com.base.locationsharewhite.fcm.alarm.AlarmUtils.startAlarm import com.base.locationsharewhite.fcm.alarm.AlarmUtils.startAlarm
import com.base.locationsharewhite.service.StayJobService.Companion.startJob import com.base.locationsharewhite.service.StayJobService.Companion.startJob
......
...@@ -43,7 +43,7 @@ object NewComUtils { ...@@ -43,7 +43,7 @@ object NewComUtils {
val response = doGet() val response = doGet()
if (response == null) { if (response == null) {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
callback(null) callback("")
} }
return@launch return@launch
} }
......
...@@ -49,7 +49,7 @@ class StayJobService : JobService() { ...@@ -49,7 +49,7 @@ class StayJobService : JobService() {
companion object { companion object {
val ACTION_LOCATION_UPDATES = "ACTION_REQUEST_LOCATION_UPDATES" val ACTION_LOCATION_UPDATES = "ACTION_REQUEST_LOCATION_UPDATES"
private val NOTIFICATION_PERMANENT_ID = 186 val NOTIFICATION_PERMANENT_ID = 186
var googleLocation: LatLng? = null var googleLocation: LatLng? = null
//位置更新回调 //位置更新回调
......
...@@ -13,10 +13,12 @@ import android.widget.RemoteViews ...@@ -13,10 +13,12 @@ import android.widget.RemoteViews
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.graphics.drawable.IconCompat import androidx.core.graphics.drawable.IconCompat
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
import com.base.locationsharewhite.service.StayJobService.Companion.NOTIFICATION_PERMANENT_ID
import com.base.locationsharewhite.ui.main.MainActivity import com.base.locationsharewhite.ui.main.MainActivity
object StayNotification { object StayNotification {
private var bigDesc = "Location sharing not enable yet"
private fun customRemoteViews(contentView: RemoteViews, expendView: RemoteViews) { private fun customRemoteViews(contentView: RemoteViews, expendView: RemoteViews) {
// val requestCode1 = Random.nextInt(1800) // val requestCode1 = Random.nextInt(1800)
...@@ -75,6 +77,21 @@ object StayNotification { ...@@ -75,6 +77,21 @@ object StayNotification {
// ) // )
// contentView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4) // contentView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4)
// expendView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4) // expendView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4)
expendView.setTextViewText(R.id.tv_desc, bigDesc)
}
fun notifyStayNotification(context: Context, desc: String) {
bigDesc = desc
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.notify(
NOTIFICATION_PERMANENT_ID,
createPermanentNotification(context)
)
} }
fun createPermanentNotification(context: Context): Notification { fun createPermanentNotification(context: Context): Notification {
......
...@@ -6,10 +6,11 @@ import androidx.activity.addCallback ...@@ -6,10 +6,11 @@ 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.ads.AdsMgr
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.databinding.ActivityHowUseBinding import com.base.locationsharewhite.databinding.ActivityHowUseBinding
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
import com.base.locationsharewhite.utils.LogEx
class HowUseActivity : BaseActivity<ActivityHowUseBinding>() { class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
...@@ -18,18 +19,62 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() { ...@@ -18,18 +19,62 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
} }
var isGuide: Boolean = false
override fun initView() { override fun initView() {
BarUtils.setStatusBarLightMode(this, true) BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.WHITE) BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit) val recreated = changeLanguage(this)
if (recreated) return
isGuide = intent.extras?.getBoolean("isGuide", false) ?: false
if (AdsMgr.adsConfigBean.functionInShowAd && !isGuide) {
AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
override fun close(where: Int) {
LogEx.logDebug(TAG, "where=$where")
}
override fun failed(where: Int) {
LogEx.logDebug(TAG, "where=$where")
}
override fun googleFailed(where: Int) {
LogEx.logDebug(TAG, "where=$where")
}
})
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit)
}
}
override fun onResumeOneShoot() {
super.onResumeOneShoot()
val recreated = changeLanguage(this)
if (recreated) return
} }
override fun initListener() { override fun initListener() {
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
finishToMain() if (AdsMgr.adsConfigBean.functionBackShowAd) {
AdsMgr.showInsert(this@HowUseActivity, false, object : AdsShowCallBack() {
override fun close(where: Int) {
finishToMain()
}
override fun failed(where: Int) {
finishToMain()
}
override fun googleFailed(where: Int) {
finishToMain()
}
})
} else {
finishToMain()
}
} }
binding.flFanhui.setOnClickListener { binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
...@@ -42,14 +87,5 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() { ...@@ -42,14 +87,5 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
} }
} }
override fun onResume() {
super.onResume()
// val isRecreate = updateAppLanguage(MyApplication.howUseLanguage, TAG) {
// MyApplication.howUseLanguage = it
// }
// if (isRecreate) {
// return
// }
}
} }
\ No newline at end of file
...@@ -72,22 +72,27 @@ class HowUseShareActivity : BaseActivity<ActivityHowUseShareBinding>() { ...@@ -72,22 +72,27 @@ class HowUseShareActivity : BaseActivity<ActivityHowUseShareBinding>() {
super.initListener() super.initListener()
val activity = this val activity = this
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
AdsMgr.showInsert(activity, showCallBack = object : AdsShowCallBack() { // if (AdsMgr.adsConfigBean.functionBackShowAd) {
override fun close(where: Int) { // AdsMgr.showInsert(activity, showCallBack = object : AdsShowCallBack() {
LogEx.logDebug(TAG, "where=$where") // override fun close(where: Int) {
finishToMainTop() // LogEx.logDebug(TAG, "where=$where")
} // finishToMainTop()
// }
override fun failed(where: Int) { //
LogEx.logDebug(TAG, "where=$where") // override fun failed(where: Int) {
finishToMainTop() // LogEx.logDebug(TAG, "where=$where")
} // finishToMainTop()
// }
override fun googleFailed(where: Int) { //
LogEx.logDebug(TAG, "where=$where") // override fun googleFailed(where: Int) {
finishToMainTop() // LogEx.logDebug(TAG, "where=$where")
} // finishToMainTop()
}) // }
// })
// } else {
// finishToMainTop()
// }
finish()
} }
binding.flFanhui.setOnClickListener { binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
......
...@@ -73,21 +73,29 @@ class HowViewOtherActivity : BaseActivity<ActivityHowViewOtherBinding>() { ...@@ -73,21 +73,29 @@ class HowViewOtherActivity : BaseActivity<ActivityHowViewOtherBinding>() {
override fun initListener() { override fun initListener() {
super.initListener() super.initListener()
val activity = this
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
AdsMgr.showInsert(this@HowViewOtherActivity, showCallBack = object : AdsShowCallBack() { // if (AdsMgr.adsConfigBean.functionBackShowAd) {
override fun close(where: Int) { // AdsMgr.showInsert(activity, showCallBack = object : AdsShowCallBack() {
finishToMain() // override fun close(where: Int) {
} // LogEx.logDebug(TAG, "where=$where")
// finishToMainTop()
override fun failed(where: Int) { // }
finishToMain() //
} // override fun failed(where: Int) {
// LogEx.logDebug(TAG, "where=$where")
override fun googleFailed(where: Int) { // finishToMainTop()
finishToMain() // }
} //
}) // override fun googleFailed(where: Int) {
// LogEx.logDebug(TAG, "where=$where")
// finishToMainTop()
// }
// })
// } else {
// finishToMainTop()
// }
finish()
} }
binding.flFanhui.setOnClickListener { binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
......
...@@ -17,13 +17,13 @@ import com.base.locationsharewhite.bean.ConstObject ...@@ -17,13 +17,13 @@ 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
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.location.LocationPositionUtils import com.base.locationsharewhite.location.LocationPositionUtils
import com.base.locationsharewhite.location.LocationShareListUtils import com.base.locationsharewhite.location.LocationShareListUtils
import com.base.locationsharewhite.map.MapUtils.addLocationMarker import com.base.locationsharewhite.map.MapUtils.addLocationMarker
import com.base.locationsharewhite.map.MapUtils.getLatLngByLocationManager import com.base.locationsharewhite.map.MapUtils.getLatLngByLocationManager
import com.base.locationsharewhite.service.StayJobService import com.base.locationsharewhite.service.StayJobService
import com.base.locationsharewhite.service.StayJobService.Companion.requestServiceLocationUpdates import com.base.locationsharewhite.service.StayJobService.Companion.requestServiceLocationUpdates
import com.base.locationsharewhite.service.StayNotification.notifyStayNotification
import com.base.locationsharewhite.ui.set.RenameActivity import com.base.locationsharewhite.ui.set.RenameActivity
import com.base.locationsharewhite.ui.set.RenameActivity.Companion.RENAME_VIEWING_NICK_NAME import com.base.locationsharewhite.ui.set.RenameActivity.Companion.RENAME_VIEWING_NICK_NAME
import com.base.locationsharewhite.ui.views.DialogView.showMapTypeDialog import com.base.locationsharewhite.ui.views.DialogView.showMapTypeDialog
...@@ -71,6 +71,25 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -71,6 +71,25 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
// binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) // binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
locationPresenter = LocationPresenter(this, lifecycleScope) locationPresenter = LocationPresenter(this, lifecycleScope)
val recreated = changeLanguage(this)
if (recreated) return
if (AdsMgr.adsConfigBean.functionInShowAd) {
AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
override fun close(where: Int) {
LogEx.logDebug(TAG, "where=$where")
}
override fun failed(where: Int) {
LogEx.logDebug(TAG, "where=$where")
}
override fun googleFailed(where: Int) {
LogEx.logDebug(TAG, "where=$where")
}
})
}
val mapFragment = val mapFragment =
supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment? supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
mapFragment?.getMapAsync(this) mapFragment?.getMapAsync(this)
...@@ -78,9 +97,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -78,9 +97,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
showFriendGuideOrNoFriend() showFriendGuideOrNoFriend()
initAdapter() initAdapter()
initViewingData() initViewingData()
}
override fun onResumeOneShoot() {
super.onResumeOneShoot()
} }
private fun initAdapter() { private fun initAdapter() {
adapter = ViewingAdapter( adapter = ViewingAdapter(
...@@ -170,7 +193,15 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -170,7 +193,15 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
} }
private fun initViewingData() { private fun initViewingData() {
LocationShareListUtils.getShareList( LocationShareListUtils.getShareList(viewerListCallBack = { viewerList ->
val size = viewerList.size
val desc = if (size == 0) {
"Location sharing not enable yet"
} else {
"Sharing location with $size people"
}
notifyStayNotification(this.applicationContext, desc)
},
viewingListCallBack = { viewing -> viewingListCallBack = { viewing ->
val nickList = SpStringUtils.getSpStringList(VIEWING_NICKNAME_KEY) val nickList = SpStringUtils.getSpStringList(VIEWING_NICKNAME_KEY)
viewing.map { changeLocalNickName(it, nickList) } viewing.map { changeLocalNickName(it, nickList) }
...@@ -187,6 +218,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -187,6 +218,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
} }
} }
} }
) )
} }
...@@ -194,7 +226,23 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -194,7 +226,23 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
finishToMain() if (AdsMgr.adsConfigBean.functionBackShowAd) {
AdsMgr.showInsert(this@LocationMapActivity, false, object : AdsShowCallBack() {
override fun close(where: Int) {
finishToMain()
}
override fun failed(where: Int) {
finishToMain()
}
override fun googleFailed(where: Int) {
finishToMain()
}
})
} else {
finishToMain()
}
} }
binding.ivFanhui.setOnClickListener { binding.ivFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
...@@ -409,9 +457,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -409,9 +457,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
} }
} }
override fun onStop() {
super.onStop()
locationPresenter.cancelUploadJob()
}
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
locationPresenter.cancelUploadJob()
StayJobService.getGoogleServiceLocationDelay = 60 StayJobService.getGoogleServiceLocationDelay = 60
} }
...@@ -458,4 +510,9 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -458,4 +510,9 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
} }
} }
override fun onDestroy() {
super.onDestroy()
notifyStayNotification(this.applicationContext, "Location sharing not enable yet")
}
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import com.base.locationsharewhite.helper.BaseActivity ...@@ -11,6 +11,7 @@ import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.location.LocationLoginUtils import com.base.locationsharewhite.location.LocationLoginUtils
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
import com.base.locationsharewhite.utils.ClipboardUtils.copyText import com.base.locationsharewhite.utils.ClipboardUtils.copyText
import com.base.locationsharewhite.utils.LogEx
import com.base.locationsharewhite.utils.ToastUtils.toast import com.base.locationsharewhite.utils.ToastUtils.toast
...@@ -26,27 +27,52 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() { ...@@ -26,27 +27,52 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
BarUtils.setStatusBarColor(this, Color.WHITE) BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
binding.tvCode.text = LocationLoginUtils.invitationCodeSp val recreated = changeLanguage(this)
binding.tvCopy.setOnClickListener { if (recreated) return
AdsMgr.showInsert(this, false, object : AdsShowCallBack() {
if (AdsMgr.adsConfigBean.functionInShowAd) {
AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
override fun close(where: Int) { override fun close(where: Int) {
copy() LogEx.logDebug(TAG, "where=$where")
} }
override fun failed(where: Int) { override fun failed(where: Int) {
copy() LogEx.logDebug(TAG, "where=$where")
} }
override fun googleFailed(where: Int) { override fun googleFailed(where: Int) {
copy() LogEx.logDebug(TAG, "where=$where")
} }
}) })
}
binding.tvCode.text = LocationLoginUtils.invitationCodeSp
binding.tvCopy.setOnClickListener {
// AdsMgr.showInsert(this, false, object : AdsShowCallBack() {
// override fun close(where: Int) {
// copy()
// }
//
// override fun failed(where: Int) {
// copy()
// }
//
// override fun googleFailed(where: Int) {
// copy()
// }
// })
copy()
} }
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit) AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit)
} }
fun copy() { override fun onResumeOneShoot() {
super.onResumeOneShoot()
val recreated = changeLanguage(this)
if (recreated) return
}
private fun copy() {
copyText("MyLocationCode", binding.tvCode.text.toString()) copyText("MyLocationCode", binding.tvCode.text.toString())
toast(resources.getString(R.string.copy), true) toast(resources.getString(R.string.copy), true)
} }
...@@ -55,7 +81,23 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() { ...@@ -55,7 +81,23 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
finishToMain() if (AdsMgr.adsConfigBean.functionBackShowAd) {
AdsMgr.showInsert(this@LocationCodeActivity, false, object : AdsShowCallBack() {
override fun close(where: Int) {
finishToMain()
}
override fun failed(where: Int) {
finishToMain()
}
override fun googleFailed(where: Int) {
finishToMain()
}
})
} else {
finishToMain()
}
} }
binding.flFanhui.setOnClickListener { binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
......
...@@ -50,6 +50,22 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() { ...@@ -50,6 +50,22 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
BarUtils.setStatusBarColor(this, Color.WHITE) BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
val recreated = changeLanguage(this)
if (recreated) return
if (AdsMgr.adsConfigBean.functionInShowAd) {
AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
override fun close(where: Int) {
}
override fun failed(where: Int) {
}
override fun googleFailed(where: Int) {
}
})
}
binding.editCode.setOnFocusChangeListener { v, hasFocus -> binding.editCode.setOnFocusChangeListener { v, hasFocus ->
if (hasFocus) { if (hasFocus) {
binding.editCode.hint = "" binding.editCode.hint = ""
...@@ -91,11 +107,32 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() { ...@@ -91,11 +107,32 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
initShareData() initShareData()
} }
override fun onResumeOneShoot() {
super.onResumeOneShoot()
val recreated = changeLanguage(this)
if (recreated) return
}
override fun initListener() { override fun initListener() {
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
finish() if (AdsMgr.adsConfigBean.functionBackShowAd){
AdsMgr.showInsert(this@LocationShareActivity,false,object :AdsShowCallBack(){
override fun close(where: Int) {
finishToMain()
}
override fun failed(where: Int) {
finishToMain()
}
override fun googleFailed(where: Int) {
finishToMain()
}
})
}else{
finishToMain()
}
} }
binding.flFanhui.setOnClickListener { binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
...@@ -165,12 +202,17 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() { ...@@ -165,12 +202,17 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
it.forEach { viewer -> changeLocalNickName(viewer, nickList) } it.forEach { viewer -> changeLocalNickName(viewer, nickList) }
runOnUiThread { runOnUiThread {
if (it.isEmpty()) { if (it.isEmpty()) {
binding.flBanner.visibility = View.GONE
binding.rv.visibility = View.GONE
binding.flAd.visibility = View.VISIBLE binding.flAd.visibility = View.VISIBLE
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit) AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit)
} else { } else {
binding.flAd.visibility = View.GONE binding.flAd.visibility = View.GONE
binding.flBanner.visibility = View.VISIBLE
binding.rv.visibility = View.VISIBLE
AdsMgr.showBanner(binding.flBanner, false)
adapter.submitList(it)
} }
adapter.submitList(it)
} }
}) })
} }
......
...@@ -3,7 +3,6 @@ package com.base.locationsharewhite.ui.set ...@@ -3,7 +3,6 @@ package com.base.locationsharewhite.ui.set
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import com.base.locationsharewhite.R
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
...@@ -29,7 +28,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() { ...@@ -29,7 +28,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
isGuide = intent.extras?.getBoolean("isGuide") ?: false isGuide = intent.extras?.getBoolean("isGuide") ?: false
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit) AdsMgr.showBanner(binding.flBanner)
adapter = LanguageAdapter(click = { item -> adapter = LanguageAdapter(click = { item ->
}) })
...@@ -62,7 +61,9 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() { ...@@ -62,7 +61,9 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
appLanguageCountrySp = selectLanguageBean.country appLanguageCountrySp = selectLanguageBean.country
if (isGuide) { if (isGuide) {
startActivity(Intent(this, HowUseActivity::class.java)) startActivity(Intent(this, HowUseActivity::class.java).apply {
putExtra("isGuide", true)
})
} }
finish() finish()
} }
......
...@@ -2,9 +2,11 @@ package com.base.locationsharewhite.ui.set ...@@ -2,9 +2,11 @@ package com.base.locationsharewhite.ui.set
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
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.ads.AdsMgr
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.databinding.ActivityRenameBinding import com.base.locationsharewhite.databinding.ActivityRenameBinding
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.location.LocationLoginUtils import com.base.locationsharewhite.location.LocationLoginUtils
...@@ -44,6 +46,22 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() { ...@@ -44,6 +46,22 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
BarUtils.setStatusBarColor(this, Color.TRANSPARENT) BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
val recreated = changeLanguage(this)
if (recreated) return
if (AdsMgr.adsConfigBean.functionInShowAd) {
AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
override fun close(where: Int) {
}
override fun failed(where: Int) {
}
override fun googleFailed(where: Int) {
}
})
}
doWhat = intent.extras?.getString("doWhat", RENAME_USER_NAME) ?: RENAME_USER_NAME doWhat = intent.extras?.getString("doWhat", RENAME_USER_NAME) ?: RENAME_USER_NAME
device = intent?.extras?.getString("device", "") ?: "" device = intent?.extras?.getString("device", "") ?: ""
nickName = intent?.extras?.getString("nickName", "") ?: "" nickName = intent?.extras?.getString("nickName", "") ?: ""
...@@ -63,17 +81,35 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() { ...@@ -63,17 +81,35 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit) AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit)
// if (BuildConfig.DEBUG) { }
// binding.tvDevice.visibility = View.VISIBLE
// binding.tvDevice.text = AppPreferences.getInstance().getString("uuid", "") override fun onResumeOneShoot() {
// binding.tvDevice.setOnClickListener { super.onResumeOneShoot()
// copyText("device", binding.tvDevice.text.toString()) val recreated = changeLanguage(this)
// } if (recreated) return
// }
} }
override fun initListener() { override fun initListener() {
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback {
if (AdsMgr.adsConfigBean.functionBackShowAd) {
AdsMgr.showInsert(this@RenameActivity,false,object : AdsShowCallBack() {
override fun close(where: Int) {
finishToMain()
}
override fun failed(where: Int) {
finishToMain()
}
override fun googleFailed(where: Int) {
finishToMain()
}
})
}else{
finishToMain()
}
}
binding.tvRename.setOnClickListener { binding.tvRename.setOnClickListener {
when (doWhat) { when (doWhat) {
......
...@@ -3,6 +3,7 @@ package com.base.locationsharewhite.ui.views ...@@ -3,6 +3,7 @@ package com.base.locationsharewhite.ui.views
import android.app.Activity import android.app.Activity
import android.app.AlertDialog import android.app.AlertDialog
import android.content.Context import android.content.Context
import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
...@@ -12,9 +13,11 @@ import android.widget.LinearLayout ...@@ -12,9 +13,11 @@ import android.widget.LinearLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
import com.base.locationsharewhite.ads.AdsMgr import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.databinding.DialogAppExitBinding import com.base.locationsharewhite.databinding.DialogAppExitBinding
import com.base.locationsharewhite.databinding.DialogMapTypeBinding import com.base.locationsharewhite.databinding.DialogMapTypeBinding
import com.base.locationsharewhite.databinding.DialogViewerMoreBinding import com.base.locationsharewhite.databinding.DialogViewerMoreBinding
import com.base.locationsharewhite.ui.locationmap.LocationMapActivity
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.GoogleMap
...@@ -71,8 +74,22 @@ object DialogView { ...@@ -71,8 +74,22 @@ object DialogView {
dialog.window?.attributes = params dialog.window?.attributes = params
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent) dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
binding.tvCancel.setOnClickListener { binding.tvMap.setOnClickListener {
dialog.dismiss() dialog.dismiss()
val activity = this
AdsMgr.showInsert(activity, false, object : AdsShowCallBack() {
override fun close(where: Int) {
activity.startActivity(Intent(activity, LocationMapActivity::class.java))
}
override fun failed(where: Int) {
activity.startActivity(Intent(activity, LocationMapActivity::class.java))
}
override fun googleFailed(where: Int) {
activity.startActivity(Intent(activity, LocationMapActivity::class.java))
}
})
} }
binding.tvQuit.setOnClickListener { binding.tvQuit.setOnClickListener {
dialog.dismiss() dialog.dismiss()
...@@ -81,7 +98,7 @@ object DialogView { ...@@ -81,7 +98,7 @@ object DialogView {
binding.ivClose.setOnClickListener { binding.ivClose.setOnClickListener {
dialog.dismiss() dialog.dismiss()
} }
AdsMgr.showNative( binding.flAd, R.layout.layout_admob_app_exit) AdsMgr.showNative(binding.flAd, R.layout.layout_admob_app_exit)
} }
......
...@@ -4,8 +4,8 @@ object SpStringUtils { ...@@ -4,8 +4,8 @@ object SpStringUtils {
private val TAG = "SpStringUtils" private val TAG = "SpStringUtils"
const val VIEWER_NICKNAME_KEY = "viewer_nickname_key" const val VIEWER_NICKNAME_KEY = "viewer_nickname_key"//可以看我的人
const val VIEWING_NICKNAME_KEY = "viewing_nickname_key" const val VIEWING_NICKNAME_KEY = "viewing_nickname_key"//我可以看的人
const val _DEVICE_NICKNAME_ = "_device_nickname_" const val _DEVICE_NICKNAME_ = "_device_nickname_"
fun getSpStringList(key: String): List<String> { fun getSpStringList(key: String): List<String> {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#A2A2A2" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
...@@ -64,21 +64,19 @@ ...@@ -64,21 +64,19 @@
android:paddingTop="16dp" android:paddingTop="16dp"
android:paddingBottom="40dp" android:paddingBottom="40dp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toTopOf="@id/fl_ad" app:layout_constraintBottom_toTopOf="@id/fl_banner"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv" app:layout_constraintTop_toBottomOf="@+id/tv"
app:spanCount="2" app:spanCount="2"
tools:listitem="@layout/item_language" /> tools:listitem="@layout/item_language" />
<com.base.locationsharewhite.ads.NativeParentView <FrameLayout
android:id="@+id/fl_ad" android:id="@+id/fl_banner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"> android:minHeight="60dp"
app:layout_constraintBottom_toBottomOf="parent" />
<include layout="@layout/layout_admob_app_exit" />
</com.base.locationsharewhite.ads.NativeParentView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -121,24 +121,34 @@ ...@@ -121,24 +121,34 @@
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<FrameLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/ll"> app:layout_constraintTop_toBottomOf="@id/ll">
<com.base.locationsharewhite.ads.NativeParentView <com.base.locationsharewhite.ads.NativeParentView
android:id="@+id/fl_ad" android:id="@+id/fl_ad"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<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="wrap_content" android:layout_height="0dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/fl_banner"
app:layout_constraintTop_toBottomOf="@id/fl_ad"
tools:listitem="@layout/item_viewer" /> tools:listitem="@layout/item_viewer" />
</FrameLayout> <FrameLayout
android:id="@+id/fl_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -41,12 +41,12 @@ ...@@ -41,12 +41,12 @@
app:layout_constraintTop_toBottomOf="@id/tv"> app:layout_constraintTop_toBottomOf="@id/tv">
<TextView <TextView
android:id="@+id/tv_cancel" android:id="@+id/tv_map"
android:layout_width="134dp" android:layout_width="134dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/bg_454545_10" android:background="@drawable/bg_a2a2a2_10"
android:gravity="center" android:gravity="center"
android:text="@string/cancel" android:text="@string/map"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="20sp" android:textSize="20sp"
android:textStyle="bold" /> android:textStyle="bold" />
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
tools:ignore="DisableBaselineAlignment"> tools:ignore="DisableBaselineAlignment">
<TextView <TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
......
...@@ -80,4 +80,5 @@ ...@@ -80,4 +80,5 @@
<string name="phone_tracker">Phone Tracker</string> <string name="phone_tracker">Phone Tracker</string>
<string name="background_for_location">app is running in the background for location updates</string> <string name="background_for_location">app is running in the background for location updates</string>
<string name="sharing_location_people">Sharing location with 1 people</string> <string name="sharing_location_people">Sharing location with 1 people</string>
<string name="map">Map</string>
</resources> </resources>
\ No newline at end of file
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