Commit a2f21b05 authored by wanglei's avatar wanglei

...

parent 769d25a1
...@@ -13,9 +13,13 @@ import androidx.core.app.NotificationCompat ...@@ -13,9 +13,13 @@ import androidx.core.app.NotificationCompat
import androidx.core.graphics.drawable.IconCompat import androidx.core.graphics.drawable.IconCompat
import com.base.locationsharewhite.BuildConfig import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_COPY_CODE import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_1
import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_ENABLE_LOCATION import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_2
import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_SHARE_LOCATION import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_3
import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_4
import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_5
import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_6
import com.base.locationsharewhite.fcm.PopupConstObject.ACTION_7
import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_BATTERY import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_BATTERY
import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_FCM import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_FCM
import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_LOCK import com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_LOCK
...@@ -30,6 +34,7 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_status ...@@ -30,6 +34,7 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_status
import com.base.locationsharewhite.fcm.PopupConstObject.popup_timer_interval import com.base.locationsharewhite.fcm.PopupConstObject.popup_timer_interval
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.splash.SplashActivity
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
...@@ -181,12 +186,95 @@ object NotificationUiUtil { ...@@ -181,12 +186,95 @@ object NotificationUiUtil {
} }
fun setActionNotification(context: Context, actionId: String) { fun setActionNotification(context: Context, actionId: String) {
// val bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.notification_message) val bigRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.notification_style_1)
// val smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.notification_message) val smallRemoteViews = RemoteViews(MyApplication.appContext.packageName, R.layout.notification_style_1)
// val intent = Intent(context, MyStartActivity::class.java)
// intent.putExtra("actionId", actionId)
val intent = Intent(context, SplashActivity::class.java)
intent.putExtra("actionId", actionId)
// //
when (actionId) { when (actionId) {
ACTION_1 -> {
val desc = "Your journey awaits! Share your adventures and reconnect with friends."
val btnString = "Resume Your Trip"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
bigRemoteViews.setTextViewText(R.id.tv_btn, btnString)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_btn, btnString)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
ACTION_2 -> {
val desc = "Explore new places and create unforgettable moments with us."
val btnString = "Start Exploring"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
bigRemoteViews.setTextViewText(R.id.tv_btn, btnString)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_btn, btnString)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
ACTION_3 -> {
val desc = "Don't miss out on what your friends are up to. Join the fun!"
val btnString = "Catch Up Now"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
bigRemoteViews.setTextViewText(R.id.tv_btn, btnString)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_btn, btnString)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
ACTION_4 -> {
val desc = "We've made it easier to share safely. Check out our new privacy features."
val btnString = "Update Now"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
bigRemoteViews.setTextViewText(R.id.tv_btn, btnString)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_btn, btnString)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
ACTION_5->{
val desc = "Celebrate with us! Special events and giveaways are happening now."
val btnString = "Join the Celebration"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
bigRemoteViews.setTextViewText(R.id.tv_btn, btnString)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_btn, btnString)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
ACTION_6->{
val desc = "Based on your travel history, we've found new places just for you."
val btnString = "Discover New Places"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
bigRemoteViews.setTextViewText(R.id.tv_btn, btnString)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_btn, btnString)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
ACTION_7->{
val desc = "Ensure your travels are secure. Update your privacy settings."
val btnString = "Secure My Trip"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
bigRemoteViews.setTextViewText(R.id.tv_btn, btnString)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_btn, btnString)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
else -> { else -> {
EventUtils.event("Notification_Error", "unKnow actionId actionId=$actionId") EventUtils.event("Notification_Error", "unKnow actionId actionId=$actionId")
...@@ -254,9 +342,13 @@ object NotificationUiUtil { ...@@ -254,9 +342,13 @@ object NotificationUiUtil {
} }
val looper_actionId = listOf( val looper_actionId = listOf(
ACTION_SHARE_LOCATION, ACTION_1,
ACTION_ENABLE_LOCATION, ACTION_2,
ACTION_COPY_CODE, ACTION_3,
ACTION_4,
ACTION_5,
ACTION_6,
ACTION_7,
) )
var actionIdList = arrayListOf<String>() var actionIdList = arrayListOf<String>()
......
...@@ -54,9 +54,15 @@ object PopupConstObject { ...@@ -54,9 +54,15 @@ object PopupConstObject {
const val ACTION_STAY_MY_CODE = "action_stay_my_code" const val ACTION_STAY_MY_CODE = "action_stay_my_code"
const val ACTION_STAY_SHARE = "action_stay_share" const val ACTION_STAY_SHARE = "action_stay_share"
const val ACTION_STAY_SETTING = "action_stay_setting" const val ACTION_STAY_SETTING = "action_stay_setting"
const val ACTION_SHARE_LOCATION = "action_share_location"
const val ACTION_ENABLE_LOCATION = "action_enable_location"
const val ACTION_COPY_CODE = "action_copy_code" const val ACTION_1 = "action_1"
const val ACTION_2 = "action_2"
const val ACTION_3 = "action_3"
const val ACTION_4 = "action_4"
const val ACTION_5 = "action_5"
const val ACTION_6 = "action_6"
const val ACTION_7 = "action_7"
fun createDefaultPopupJson(): JSONObject { fun createDefaultPopupJson(): JSONObject {
val json = JSONObject() val json = JSONObject()
......
package com.base.locationsharewhite.ui.locationmap package com.base.locationsharewhite.ui.locationmap
import android.Manifest
import android.animation.ValueAnimator import android.animation.ValueAnimator
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.net.Uri
import android.provider.Settings
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.animation.LinearInterpolator import android.view.animation.LinearInterpolator
...@@ -27,14 +24,10 @@ import com.base.locationsharewhite.ui.set.RenameActivity ...@@ -27,14 +24,10 @@ 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
import com.base.locationsharewhite.ui.views.DialogView.showViewerMoreDialog import com.base.locationsharewhite.ui.views.DialogView.showViewerMoreDialog
import com.base.locationsharewhite.ui.views.LocationPermissionDialog.showLocationAllowAllTimeDialog
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
import com.base.locationsharewhite.utils.IntentUtils.intentAppDetailsSettings
import com.base.locationsharewhite.utils.IntentUtils.intentLocationSetting
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import com.base.locationsharewhite.utils.PermissionUtils.checkBackgroundLocationPermission import com.base.locationsharewhite.utils.PermissionUtils.checkBackgroundLocationPermission
import com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermission import com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermission
import com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermissionDeniedByUser
import com.base.locationsharewhite.utils.PermissionUtils.requestLocationAllowAllTime import com.base.locationsharewhite.utils.PermissionUtils.requestLocationAllowAllTime
import com.base.locationsharewhite.utils.SpStringUtils import com.base.locationsharewhite.utils.SpStringUtils
import com.base.locationsharewhite.utils.SpStringUtils.VIEWING_NICKNAME_KEY import com.base.locationsharewhite.utils.SpStringUtils.VIEWING_NICKNAME_KEY
......
package com.base.locationsharewhite.ui.locationmap
//import android.graphics.Color
//import android.view.LayoutInflater
//import androidx.lifecycle.lifecycleScope
//import com.base.locationsharewhite.R
//import com.base.locationsharewhite.map.MapUtils.cameraMovePointsBounds
//import com.base.locationsharewhite.utils.BitmapUtils
//import com.google.android.gms.maps.model.LatLng
//import com.google.android.gms.maps.model.Marker
//import com.google.android.gms.maps.model.MarkerOptions
//import com.google.android.gms.maps.model.PolylineOptions
//import kotlinx.coroutines.Job
//import kotlinx.coroutines.delay
//import kotlinx.coroutines.isActive
//import kotlinx.coroutines.launch
//val friendTestLine = listOf(
// LatLng(30.65988197028939, 104.07775588286886),//總府皇冠假日酒店
// LatLng(30.658174607262318, 104.06581096754789),//天府广场
// LatLng(30.6531557462031, 104.06660595172475),//航天科技大廈
// LatLng(30.64867742925485, 104.06548317653692),//錦江賓館
// LatLng(30.654908885860806, 104.08053620625755),//ifs
//)
//
//fun rotateMarker() {
//
// val myAvatar = LayoutInflater.from(this).inflate(R.layout.avatar_me, null)
//
// val myPair: LatLng = getLastKnowLatLng()
// val bitmapDescriptor = BitmapUtils.getBitmapDescriptorFromLayoutResId(myAvatar)
//
// val marker: Marker? = map?.addMarker(
// MarkerOptions()
// .icon(bitmapDescriptor)
// .position(myPair)
// .anchor(0.5f, 0.5f) // 设置锚点为中心
// .rotation(90.0f) // 设置旋转角度
// .flat(true)
// ) // 设置为平面Marker
//
// lifecycleScope.launch {
// for (i in 0..360) {
// marker?.rotation = i.toFloat()
// delay(200)
// }
// }
//}
//
//fun addFriendPolyline(list: List<LatLng>) {
// map?.addPolyline(PolylineOptions().apply {
// list.forEach { add(it) }
// width(5.toFloat())
// color(Color.BLUE)
// geodesic(true)
// clickable(true)
// })
//}
//private fun upDateMeAndFriendLocation(friendLatLng: LatLng) {
// val myLatLng: LatLng = getLastKnowLatLng()
// myMarker?.position = myLatLng
// friendMarker?.position = friendLatLng
// val padding = resources.getDimensionPixelOffset(R.dimen.dp_150)
// map?.cameraMovePointsBounds(myLatLng, friendLatLng, padding)
//}
//private var sharingJob: Job? = null
//fun sharingLocationJob() {
// if (sharingJob == null) {
//
// myMarker ?: return
// friendMarker ?: return
//
// var i = 0f
// var j = 0f
// sharingJob = lifecycleScope.launch {
// while (isActive) {
// i += 0.001f
// j += 0.001f
//
// val myLatLng = getLastKnowLatLng()
// myMarker?.position = myLatLng
// //上传我的位置,获取friend位置
// val friendLatLng = LatLng(30.655782251943407 + i, 104.07701072527895 + j)
// friendMarker?.position = friendLatLng
//
// delay(1 * 1000L)
// }
// }
// }
//}
//private fun cancelSharingJob() {
// sharingJob?.cancel()
// sharingJob = null
//}
\ No newline at end of file
...@@ -148,22 +148,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -148,22 +148,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
}) })
} }
PopupConstObject.ACTION_SHARE_LOCATION -> {
startActivity(Intent(this, LocationShareActivity::class.java).apply {})
}
PopupConstObject.ACTION_ENABLE_LOCATION -> {
startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId)
})
}
PopupConstObject.ACTION_COPY_CODE -> {
startActivity(Intent(this, LocationCodeActivity::class.java).apply {
putExtra("actionId", actionId)
})
}
else -> { else -> {
startActivity(Intent(this, MainActivity::class.java).apply { startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId) putExtra("actionId", actionId)
......
...@@ -8,18 +8,21 @@ ...@@ -8,18 +8,21 @@
<TextView <TextView
android:id="@+id/tv_desc"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_weight="1" android:layout_weight="1"
android:maxLines="2"
android:text="@string/sharing_location_with_1_people" android:text="@string/sharing_location_with_1_people"
android:textColor="#010101" android:textColor="#010101"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold"
tools:lines="2" />
<TextView <TextView
android:id="@+id/tv_view" android:id="@+id/tv_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
...@@ -29,12 +32,4 @@ ...@@ -29,12 +32,4 @@
android:text="@string/view" android:text="@string/view"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" /> android:textSize="14sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/lan_shezhi"
tools:ignore="ContentDescription" />
</LinearLayout> </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