Commit e95f51cb authored by wanglei's avatar wanglei

...

parent cbb8aa8d
......@@ -5,6 +5,7 @@ import android.content.Context
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.ads.BaseAdMgr
import com.base.locationsharewhite.helper.config.ConstConfig
import com.base.locationsharewhite.utils.LogEx
import com.google.android.gms.ads.AdError
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.FullScreenContentCallback
......@@ -17,6 +18,8 @@ import java.lang.ref.WeakReference
*/
class AdOpenMgr : BaseAdMgr<AppOpenAd>() {
private val TAG = "AdOpenMgr"
private var lastOpenDate: Long = 0
private val adLoadCallback = object : AppOpenAd.AppOpenAdLoadCallback() {
......@@ -64,6 +67,7 @@ class AdOpenMgr : BaseAdMgr<AppOpenAd>() {
lastOpenDate
)
) {
LogEx.logDebug(TAG, "failed 1")
showCallBack?.failed()
return
}
......@@ -82,6 +86,7 @@ class AdOpenMgr : BaseAdMgr<AppOpenAd>() {
loadAd(activity.applicationContext)
} else {
activityRef = null
LogEx.logDebug(TAG, "failed 2")
this.showCallBack?.failed()
this.showCallBack = null
}
......
......@@ -5,9 +5,13 @@ import android.app.Application
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.widget.RemoteViews
import com.base.locationsharewhite.R
import com.base.locationsharewhite.bean.ConstObject.topic_number
import com.base.locationsharewhite.fcm.MsgConfig
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.helper.config.ConstConfig
import com.base.locationsharewhite.notification.NotificationBean
import com.base.locationsharewhite.ui.splash.SplashActivity
import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.KotlinExt.toFormatMinute
......@@ -148,53 +152,44 @@ class MyApplication : Application() {
GoogleSdkMgr.init(
this, this.packageName, MsgConfig.Builder()
//设置自己的自定义通知栏
// .addRemoteBean(
// //自定义的通知事件id,可以自己添加
// ConstConfig.ACTION_0, com.base.locationsharewhite.notification.NotificationBean(
// Intent(this, MainActivity::class.java).apply {
// //悬停点击标记,用来进入当相关页面进行悬停关闭
// putExtra("hover", true)
// },
// RemoteViews(packageName, R.layout.notification_message).apply {
// setTextViewText(R.id.tv_tittle, "大标题0")
// setTextViewText(R.id.tv_desc, "大内容0")
// },
// RemoteViews(packageName, R.layout.notification_message).apply {
// setTextViewText(R.id.tv_tittle, "小标题0")
// setTextViewText(R.id.tv_desc, "小内容0")
// }
// )
// )
// .addRemoteBean(
// ConstConfig.ACTION_1, com.base.locationsharewhite.notification.NotificationBean(
// Intent(this, MainActivity::class.java).apply {
// putExtra("hover", true)
// },
// RemoteViews(packageName, R.layout.notification_message).apply {
// setTextViewText(R.id.tv_tittle, "大标题1")
// setTextViewText(R.id.tv_desc, "大内容1")
// },
// RemoteViews(packageName, R.layout.notification_message).apply {
// setTextViewText(R.id.tv_tittle, "小标题1")
// setTextViewText(R.id.tv_desc, "小内容1")
// }
// )
// )
// .addRemoteBean(
// ConstConfig.ACTION_2, com.base.locationsharewhite.notification.NotificationBean(
// Intent(this, MainActivity::class.java).apply {
// putExtra("hover", true)
// },
// RemoteViews(packageName, R.layout.notification_junk_big).apply {
// setTextViewText(R.id.tv_size, "大标题2")
// setTextViewText(R.id.tv_desc, "大内容2")
// },
// RemoteViews(packageName, R.layout.notification_junk_small).apply {
// setTextViewText(R.id.tv_size, "小标题2")
// setTextViewText(R.id.tv_desc, "小内容2")
// }
// )
// )
.addRemoteBean(
//自定义的通知事件id,可以自己添加
ConstConfig.ACTION_SHARE_LOCATION, NotificationBean(
Intent(this, SplashActivity::class.java).apply {
//悬停点击标记,用来进入当相关页面进行悬停关闭
putExtra("hover", true)
putExtra("actionId", ConstConfig.ACTION_SHARE_LOCATION)
},
RemoteViews(packageName, R.layout.notification_share_location).apply {
},
RemoteViews(packageName, R.layout.notification_share_location).apply {
}
)
)
.addRemoteBean(
ConstConfig.ACTION_ENABLE_LOCATION, NotificationBean(
Intent(this, SplashActivity::class.java).apply {
putExtra("hover", true)
putExtra("actionId", ConstConfig.ACTION_ENABLE_LOCATION)
},
RemoteViews(packageName, R.layout.notification_enable_location).apply {
},
RemoteViews(packageName, R.layout.notification_enable_location).apply {
}
)
)
.addRemoteBean(
ConstConfig.ACTION_COPY_CODE, NotificationBean(
Intent(this, SplashActivity::class.java).apply {
putExtra("hover", true)
putExtra("actionId", ConstConfig.ACTION_COPY_CODE)
},
RemoteViews(packageName, R.layout.notification_copy_code).apply {
},
RemoteViews(packageName, R.layout.notification_copy_code).apply {
}
)
)
.build()
)
}
......
......@@ -43,5 +43,8 @@ object ConstConfig {
const val ACTION_STAY_MY_CODE = 1
const val ACTION_STAY_SHARE = 2
const val ACTION_STAY_SETTING = 3
const val ACTION_SHARE_LOCATION = 4
const val ACTION_ENABLE_LOCATION = 5
const val ACTION_COPY_CODE = 6
}
\ No newline at end of file
......@@ -8,10 +8,13 @@ import android.view.LayoutInflater
import androidx.activity.addCallback
import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.R
import com.base.locationsharewhite.databinding.ActivityMainBinding
import com.base.locationsharewhite.fcm.MsgMgr
import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.helper.config.ConstConfig
import com.base.locationsharewhite.location.LocationLoginUtils
import com.base.locationsharewhite.map.MapUtils.addLocationMarker
import com.base.locationsharewhite.ui.howuse.HowUseActivity
......@@ -110,6 +113,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
binding.flSettings.setOnClickListener {
startActivity(Intent(this, SettingActivity::class.java))
}
binding.tvTittle.setOnClickListener {
if (BuildConfig.DEBUG) {
MsgMgr.sendNotification(this, ConstConfig.ACTION_SHARE_LOCATION)
}
}
}
......
......@@ -151,6 +151,22 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
})
}
ConstConfig.ACTION_SHARE_LOCATION -> {
startActivity(Intent(this, LocationShareActivity::class.java).apply {})
}
ConstConfig.ACTION_ENABLE_LOCATION -> {
startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId)
})
}
ConstConfig.ACTION_COPY_CODE -> {
startActivity(Intent(this, LocationCodeActivity::class.java).apply {
putExtra("actionId", actionId)
})
}
else -> {
startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId)
......
......@@ -19,6 +19,7 @@
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tv_tittle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_ffffff_10"
......@@ -18,6 +19,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/tv_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
......@@ -33,5 +35,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/lan_shezhi" />
android:src="@mipmap/lan_shezhi"
tools:ignore="ContentDescription" />
</LinearLayout>
\ 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