Commit e441a352 authored by wanglei's avatar wanglei

...

parent d672f7a6
......@@ -69,4 +69,7 @@ dependencies {
implementation("com.google.firebase:firebase-messaging")
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics")
//facebook
implementation("com.facebook.android:facebook-android-sdk:[8,9)")
}
\ No newline at end of file
......@@ -49,4 +49,13 @@ object ConstObject {
AppPreferences.getInstance().put("changeLanguageSp", value, true)
}
var topic_number = ""
get() {
return AppPreferences.getInstance().getString("topic_number", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("topic_number", value, true)
}
}
\ No newline at end of file
......@@ -5,9 +5,12 @@ import android.app.Application
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import com.base.locationsharewhite.bean.ConstObject.topic_number
import com.base.locationsharewhite.ui.splash.SplashActivity
import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.KotlinExt.toFormatMinute
import com.base.locationsharewhite.utils.LogEx
import com.facebook.FacebookSdk
import java.util.Locale
import java.util.UUID
......@@ -50,20 +53,20 @@ class MyApplication : Application() {
}
fun initApp() {
// FacebookSdk.sdkInitialize(applicationContext)
// var topicNumber = System.currentTimeMillis().toFormatMinute()
// LogEx.logDebug(TAG, "topicNumber=$topicNumber")
// if (topic_number.isNotEmpty()) {
// topicNumber = topic_number
// } else {
// topic_number = topicNumber
// }
// val topic = ConfigHelper.packageName + "_push_$topicNumber"
// LogEx.logDebug(TAG, "topic=${topic}")
FacebookSdk.sdkInitialize(applicationContext)
var topicNumber = System.currentTimeMillis().toFormatMinute()
LogEx.logDebug(TAG, "topicNumber=$topicNumber")
if (topic_number.isNotEmpty()) {
topicNumber = topic_number
} else {
topic_number = topicNumber
}
val topic = ConfigHelper.packageName + "_push_$topicNumber"
LogEx.logDebug(TAG, "topic=${topic}")
// FCMManager.initFirebase(this)
// FCMManager.subscribeToTopic(topic)
// InstallHelps.init()
// initLifeListener()
initLifeListener()
// ScreenStatusReceiver.setupScreenStatusListener(this)
}
......
package com.base.locationsharewhite.utils
import java.text.SimpleDateFormat
import java.util.Locale
object KotlinExt {
fun Number.toFormatSize(count: Int = 1): String {
var suffix = "B"
var fSize = this.toDouble()
if (fSize > 1024) {
suffix = "KB"
fSize /= 1024.0
}
if (fSize > 1024) {
suffix = "MB"
fSize /= 1024.0
}
if (fSize > 1024) {
suffix = "GB"
fSize /= 1024.0
}
return String.format("%.${count}f %s", fSize, suffix)
}
fun Long.toFormatTime(): String {
return SimpleDateFormat("MMM dd,yyyy", Locale.ENGLISH).format(this)
}
fun Long.toFormatTime2(): String {
return SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ENGLISH).format(this)
}
fun Long.toFormatTime3(): String {
return SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).format(this)
}
fun Long.toFormatTime4(): String {
return SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).format(this)
}
fun Long.toFormatMinute(): String {
return SimpleDateFormat("mm", Locale.ENGLISH).format(this)
}
fun Array<String>.array2String(): String {
val stringBuilder = StringBuilder()
forEach {
stringBuilder.append(it)
}
return stringBuilder.toString()
}
}
\ 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