Commit e537abad authored by wanglei's avatar wanglei

同步代码

parent ad8c266f
Pipeline #1179 canceled with stages
...@@ -21,7 +21,7 @@ android { ...@@ -21,7 +21,7 @@ android {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64' abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
} }
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "easyjunkcleaner-v${versionName}") setProperty("archivesBaseName", "easyfilemanager-v${versionName}")
} }
signingConfigs { signingConfigs {
......
...@@ -26,6 +26,7 @@ class MyApplication : BaseApplication() { ...@@ -26,6 +26,7 @@ class MyApplication : BaseApplication() {
companion object { companion object {
var PAUSED_VALUE = 0 var PAUSED_VALUE = 0
var isDeleteNotification = false
} }
var uuid = "" var uuid = ""
......
...@@ -105,6 +105,7 @@ class NetWorkActivity : BaseActivity<ActivityLayoutNetworkBinding>() { ...@@ -105,6 +105,7 @@ class NetWorkActivity : BaseActivity<ActivityLayoutNetworkBinding>() {
BarUtils.setStatusBarLightMode(this, true) BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.TRANSPARENT) BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
AdmobUtils.showNativeAd(this, binding.idFlAd)
binding.idTvThisMonth.isSelected = true binding.idTvThisMonth.isSelected = true
playLottie() playLottie()
} }
......
...@@ -12,11 +12,13 @@ import com.base.easyfilemanager.fragment.FileCategoryFragment ...@@ -12,11 +12,13 @@ import com.base.easyfilemanager.fragment.FileCategoryFragment
import com.base.easyfilemanager.fragment.HomeFragment import com.base.easyfilemanager.fragment.HomeFragment
import com.base.easyfilemanager.fragment.ToolsFragment import com.base.easyfilemanager.fragment.ToolsFragment
import com.base.easyfilemanager.helps.BaseActivity import com.base.easyfilemanager.helps.BaseActivity
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.utils.BarUtils import com.base.easyfilemanager.utils.BarUtils
import com.base.easyfilemanager.view.RateStarPop import com.base.easyfilemanager.view.RateStarPop
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.json.JSONObject
class NewMainActivity : BaseActivity<ActivityMainBinding>() { class NewMainActivity : BaseActivity<ActivityMainBinding>() {
...@@ -76,6 +78,7 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() { ...@@ -76,6 +78,7 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).listFiles()?.map { it.absolutePath } Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).listFiles()?.map { it.absolutePath }
?.toTypedArray() ?.toTypedArray()
) )
testEvent()
} }
private fun setPage(p: Int) { private fun setPage(p: Int) {
...@@ -114,4 +117,20 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() { ...@@ -114,4 +117,20 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
RateStarPop.show(this@NewMainActivity) RateStarPop.show(this@NewMainActivity)
} }
} }
fun testEvent() = lifecycleScope.launch(Dispatchers.IO) {
EventHelper.event("click_start_to_use")
EventHelper.event("install_referrer")
EventHelper.event("ad_pull_start")
EventHelper.event("ad_prepare_show")
EventHelper.event("notification_jump")
EventHelper.event("ad_pull")
EventHelper.event("ad_show")
EventHelper.event("ad_click")
EventHelper.event("bigimage_ad_click")
EventHelper.event("bigimage_ad_show")
EventHelper.event("ad_price")
EventHelper.event("fcm_receiver")
EventHelper.event("fcm_message_received")
}
} }
...@@ -18,6 +18,7 @@ import com.base.easyfilemanager.helps.ConfigHelper ...@@ -18,6 +18,7 @@ import com.base.easyfilemanager.helps.ConfigHelper
import com.base.easyfilemanager.helps.LogEx import com.base.easyfilemanager.helps.LogEx
import com.base.easyfilemanager.helps.ads.AdmobUtils import com.base.easyfilemanager.helps.ads.AdmobUtils
import com.base.easyfilemanager.utils.BarUtils import com.base.easyfilemanager.utils.BarUtils
import com.base.easyfilemanager.utils.SPUtils
@SuppressLint("CustomSplashScreen") @SuppressLint("CustomSplashScreen")
class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(), class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
...@@ -146,7 +147,12 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(), ...@@ -146,7 +147,12 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
if (jumpType != 0) { if (jumpType != 0) {
val cancelIntent = Intent(this, CloseNotificationReceiver::class.java) val cancelIntent = Intent(this, CloseNotificationReceiver::class.java)
cancelIntent.action = CloseNotificationReceiver.action cancelIntent.action = CloseNotificationReceiver.action
cancelIntent.putExtra("notificationId", NotificationHelper.notificationId) val actionS = SPUtils.getInstance().getInt("notification_actionS", 0)
if(actionS==1){
cancelIntent.putExtra("notificationId", jumpType)
}else{
cancelIntent.putExtra("notificationId", NotificationHelper.notificationId)
}
sendBroadcast(cancelIntent) sendBroadcast(cancelIntent)
} }
} }
......
...@@ -4,6 +4,8 @@ import android.app.NotificationManager ...@@ -4,6 +4,8 @@ import android.app.NotificationManager
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.text.TextUtils
import com.base.easyfilemanager.MyApplication
import com.base.easyfilemanager.helps.EventHelper import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.helps.LogEx import com.base.easyfilemanager.helps.LogEx
...@@ -21,8 +23,14 @@ class CloseNotificationReceiver : BroadcastReceiver() { ...@@ -21,8 +23,14 @@ class CloseNotificationReceiver : BroadcastReceiver() {
LogEx.logDebug(TAG, "notificationId=$notificationId action=$action") LogEx.logDebug(TAG, "notificationId=$notificationId action=$action")
if (notificationId != -1 && it.action != "DELETE_NOTIFICATION") { if (notificationId != -1 && it.action != "DELETE_NOTIFICATION") {
val notificationManager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager MyApplication.isDeleteNotification = true
val notificationManager =
context?.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager
notificationManager?.cancel(NotificationUtils.NOTIFICATION_TAG, notificationId) notificationManager?.cancel(NotificationUtils.NOTIFICATION_TAG, notificationId)
} else if (TextUtils.equals(it.action, "DELETE_NOTIFICATION")) {
MyApplication.isDeleteNotification = true
} else {
} }
} }
} }
......
...@@ -117,7 +117,7 @@ object NotificationHelper { ...@@ -117,7 +117,7 @@ object NotificationHelper {
* @param extra 额外参数 * @param extra 额外参数
*/ */
@SuppressLint("RemoteViewLayout") @SuppressLint("RemoteViewLayout")
fun Context.postActionNotification(actionId: Int, extra: Int? = null, pushStayTime: Long? = null) { fun Context.postActionNotification(actionId: Int, extra: Int? = null, pushStayTime: Long? = null, actionS: Int) {
val remoteViews = RemoteViews(packageName, R.layout.notification_common_notify) val remoteViews = RemoteViews(packageName, R.layout.notification_common_notify)
when (actionId) { when (actionId) {
ID_JUNK_CLEAN_PUSH -> { ID_JUNK_CLEAN_PUSH -> {
...@@ -173,7 +173,8 @@ object NotificationHelper { ...@@ -173,7 +173,8 @@ object NotificationHelper {
remoteViews.setTextViewText(R.id.tv_desc, "Detected lots of screenshots? Free up your storage space now!") remoteViews.setTextViewText(R.id.tv_desc, "Detected lots of screenshots? Free up your storage space now!")
remoteViews.setTextViewText(R.id.tv_btn, "Clean up") remoteViews.setTextViewText(R.id.tv_btn, "Clean up")
} }
ID_BATTERY_PUSH->{
ID_BATTERY_PUSH -> {
} }
//==================================下面是被动推送的情况=============================================== //==================================下面是被动推送的情况===============================================
...@@ -222,13 +223,10 @@ object NotificationHelper { ...@@ -222,13 +223,10 @@ object NotificationHelper {
val requestCode = Random.nextInt(0, 1000) val requestCode = Random.nextInt(0, 1000)
val pendingIntent = PendingIntent.getActivity(applicationContext, requestCode, intent, FLAG_UPDATE_CURRENT or FLAG_MUTABLE) val pendingIntent = PendingIntent.getActivity(applicationContext, requestCode, intent, FLAG_UPDATE_CURRENT or FLAG_MUTABLE)
val nId = if (actionS == 1) actionId else notificationId
NotificationUtils.showNotification( NotificationUtils.showNotification(
applicationContext, applicationContext, nId, remoteViews, R.id.fl_cancel, pendingIntent, pushStayTime ?: 0
notificationId,
remoteViews,
R.id.fl_cancel,
pendingIntent,
pushStayTime ?: 0
) )
} }
......
...@@ -9,11 +9,14 @@ import android.content.ComponentName ...@@ -9,11 +9,14 @@ import android.content.ComponentName
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Build import android.os.Build
import android.os.Handler
import android.os.HandlerThread
import android.service.notification.StatusBarNotification import android.service.notification.StatusBarNotification
import android.util.Log import android.util.Log
import android.widget.RemoteViews import android.widget.RemoteViews
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat import androidx.core.app.NotificationManagerCompat
import com.base.easyfilemanager.MyApplication
import com.base.easyfilemanager.R import com.base.easyfilemanager.R
import com.base.easyfilemanager.activity.AppManagerActivity import com.base.easyfilemanager.activity.AppManagerActivity
import com.base.easyfilemanager.activity.BatteryInfoActivity import com.base.easyfilemanager.activity.BatteryInfoActivity
...@@ -24,6 +27,7 @@ import com.base.easyfilemanager.helps.BaseApplication ...@@ -24,6 +27,7 @@ import com.base.easyfilemanager.helps.BaseApplication
import com.base.easyfilemanager.helps.EventHelper import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.helps.KotlinExt.string import com.base.easyfilemanager.helps.KotlinExt.string
import com.base.easyfilemanager.service.FlashlightService import com.base.easyfilemanager.service.FlashlightService
import com.base.easyfilemanager.utils.SPUtils
object NotificationUtils { object NotificationUtils {
...@@ -179,7 +183,12 @@ object NotificationUtils { ...@@ -179,7 +183,12 @@ object NotificationUtils {
return notification return notification
} }
fun sendTimerPush(s: Long) { fun sendTimerPush() {
val open = SPUtils.getInstance().getInt("notification_open", 0)
val num = SPUtils.getInstance().getInt("notification_num", 0)
val delay = SPUtils.getInstance().getLong("notification_delay", 0)
val s = SPUtils.getInstance().getLong("notification_push_stay_time", 0)
val actionS = SPUtils.getInstance().getInt("notification_actionS", 0)
Log.d(TAG, "sendTimerPush") Log.d(TAG, "sendTimerPush")
val id = NotificationHelper.getPresentPushId() val id = NotificationHelper.getPresentPushId()
val isPush = PushStrategy.isPush(id) val isPush = PushStrategy.isPush(id)
...@@ -187,11 +196,30 @@ object NotificationUtils { ...@@ -187,11 +196,30 @@ object NotificationUtils {
Log.d(TAG, log) Log.d(TAG, log)
EventHelper.event("pushCircleOrder_isPush", log) EventHelper.event("pushCircleOrder_isPush", log)
if (isPush) { if (isPush) {
// var extra: Int? = null BaseApplication.context.postActionNotification(id, null, s, actionS)
// if (id == ID_PHONE_ACCELERATE) {
// extra = RamMemoryEx.getMemoryUsage(BaseApplication.context).toInt() if (open == 1) {
// } val handlerThread = HandlerThread("MyHandlerThread")
BaseApplication.context.postActionNotification(id, null, s) handlerThread.start()
val handler = Handler(handlerThread.looper)
for (i in 1..num) {
val time = i * delay
handler.postDelayed({
if (MyApplication.PAUSED_VALUE == 1 || MyApplication.isDeleteNotification) {
handler.removeCallbacksAndMessages(null)
MyApplication.isDeleteNotification = false
return@postDelayed
}
if (MyApplication.PAUSED_VALUE != 1 && !MyApplication.isDeleteNotification) {
Log.d("glc", "发推送")
BaseApplication.context.postActionNotification(id, null, s, actionS)
} else {
}
}, time)
}
}
} }
} }
......
...@@ -15,7 +15,7 @@ class MyFirebaseMessagingService : FirebaseMessagingService() { ...@@ -15,7 +15,7 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
Log.d(TAG, "onMessageReceived: " + remoteMessage.from) Log.d(TAG, "onMessageReceived: " + remoteMessage.from)
val pushStayTime = remoteMessage.data["push_stay_time"]?.toLongOrNull() ?: 0 val pushStayTime = remoteMessage.data["push_stay_time"]?.toLongOrNull() ?: 0
EventHelper.event("fcm_message_received", pushStayTime.toString()) EventHelper.event("fcm_message_received", pushStayTime.toString())
NotificationUtils.sendTimerPush(pushStayTime) NotificationUtils.sendTimerPush()
// FcmHelper.startFCMCheckAlarm(this) // FcmHelper.startFCMCheckAlarm(this)
......
...@@ -93,9 +93,10 @@ ...@@ -93,9 +93,10 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/id_coord_layout" android:id="@+id/id_coord_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:background="@color/white" android:background="@color/white"
app:layout_constraintBottom_toTopOf="@id/id_fl_ad"
app:layout_constraintTop_toBottomOf="@+id/id_ll_top_option"> app:layout_constraintTop_toBottomOf="@+id/id_ll_top_option">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
...@@ -285,4 +286,10 @@ ...@@ -285,4 +286,10 @@
</LinearLayout> </LinearLayout>
<FrameLayout
android:id="@+id/id_fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ 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