Commit 8e11824f authored by wanglei's avatar wanglei

...处理问题

parent 3fc5c003
...@@ -22,7 +22,6 @@ object ConstObject { ...@@ -22,7 +22,6 @@ object ConstObject {
const val MIME_TYPE_APK = "application/vnd.android.package-archive" const val MIME_TYPE_APK = "application/vnd.android.package-archive"
const val MIME_TYPE_ZIP = "application/zip" const val MIME_TYPE_ZIP = "application/zip"
const val DO_SPLIT_PDF = "do_split_pdf" const val DO_SPLIT_PDF = "do_split_pdf"
const val DO_SAVE_PDF = "do_save_pdf" const val DO_SAVE_PDF = "do_save_pdf"
const val DO_MERGE_PDF = "do_merge_pdf" const val DO_MERGE_PDF = "do_merge_pdf"
...@@ -51,9 +50,9 @@ object ConstObject { ...@@ -51,9 +50,9 @@ object ConstObject {
const val NOTIFICATION_ACTION_READ_DOCUMENTS = "notification_action_read_documents" const val NOTIFICATION_ACTION_READ_DOCUMENTS = "notification_action_read_documents"
const val NOTIFICATION_ACTION_UN_VIEW_FILES = "notification_action_un_view_files" const val NOTIFICATION_ACTION_UN_VIEW_FILES = "notification_action_un_view_files"
const val NOTIFICATION_ACTION_IMPORTANT_DOCUMENT = "notification_action_important_document" const val NOTIFICATION_ACTION_IMPORTANT_DOCUMENT = "notification_action_important_document"
const val NOTIFICATION_ACTION_APP_PROCESS = "notification_action_app_process" // const val NOTIFICATION_ACTION_APP_PROCESS = "notification_action_app_process"
const val NOTIFICATION_ACTION_CLEAN_JUNK = "notification_action_clean_junk" // const val NOTIFICATION_ACTION_CLEAN_JUNK = "notification_action_clean_junk"
const val NOTIFICATION_ACTION_WEATHER = "notification_action_weather" // const val NOTIFICATION_ACTION_WEATHER = "notification_action_weather"
const val SHORTCUT_SCAN_PDF = "shortcut_scan_pdf" const val SHORTCUT_SCAN_PDF = "shortcut_scan_pdf"
const val SHORTCUT_SPLIT_PDF = "shortcut_split_pdf" const val SHORTCUT_SPLIT_PDF = "shortcut_split_pdf"
......
...@@ -13,15 +13,11 @@ import androidx.core.app.NotificationCompat ...@@ -13,15 +13,11 @@ import androidx.core.app.NotificationCompat
import androidx.core.graphics.drawable.IconCompat import androidx.core.graphics.drawable.IconCompat
import com.base.pdfreaderallpdfreader.BuildConfig import com.base.pdfreaderallpdfreader.BuildConfig
import com.base.pdfreaderallpdfreader.R import com.base.pdfreaderallpdfreader.R
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_APP_PROCESS
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_CLEAN_JUNK
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_IMPORTANT_DOCUMENT import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_NEW_IMAGE_PDF import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_NEW_IMAGE_PDF
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_READ_DOCUMENTS import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_READ_DOCUMENTS
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_READ_PDF import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_READ_PDF
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_UN_VIEW_FILES import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_UN_VIEW_FILES
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_WEATHER
import com.base.pdfreaderallpdfreader.bean.WeatherBean
import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_FCM import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_FCM
import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_LOCK import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_LOCK
import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_TIMBER import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_TIMBER
...@@ -35,12 +31,9 @@ import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_status ...@@ -35,12 +31,9 @@ import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_status
import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_timer_interval import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_timer_interval
import com.base.pdfreaderallpdfreader.helper.EventUtils import com.base.pdfreaderallpdfreader.helper.EventUtils
import com.base.pdfreaderallpdfreader.helper.MyApplication import com.base.pdfreaderallpdfreader.helper.MyApplication
import com.base.pdfreaderallpdfreader.helper.WeatherUtils
import com.base.pdfreaderallpdfreader.ui.splash.MyStartActivity import com.base.pdfreaderallpdfreader.ui.splash.MyStartActivity
import com.base.pdfreaderallpdfreader.utils.AppPreferences import com.base.pdfreaderallpdfreader.utils.AppPreferences
import com.base.pdfreaderallpdfreader.utils.LogEx import com.base.pdfreaderallpdfreader.utils.LogEx
import com.base.pdfreaderallpdfreader.utils.TimeUtils.formatATime
import com.base.pdfreaderallpdfreader.utils.TimeUtils.isDayOrNight
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Calendar import java.util.Calendar
import java.util.Locale import java.util.Locale
...@@ -138,6 +131,11 @@ object NotificationUiUtil { ...@@ -138,6 +131,11 @@ object NotificationUiUtil {
if (!canSendNotification(where, actionId)) return if (!canSendNotification(where, actionId)) return
if (MyApplication.PAUSED_VALUE == 1) {
LogEx.logDebug(TAG, "APP Resumed")
return
}
//发送通知 //发送通知
setActionNotification(context, actionId) setActionNotification(context, actionId)
...@@ -211,7 +209,7 @@ object NotificationUiUtil { ...@@ -211,7 +209,7 @@ object NotificationUiUtil {
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews) sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
} }
NOTIFICATION_ACTION_APP_PROCESS -> { // NOTIFICATION_ACTION_APP_PROCESS -> {
// val pair = MyApplication.context.ramPair() // val pair = MyApplication.context.ramPair()
// val percent = (pair.first * 100 / pair.second).toInt() // val percent = (pair.first * 100 / pair.second).toInt()
// //
...@@ -228,9 +226,9 @@ object NotificationUiUtil { ...@@ -228,9 +226,9 @@ object NotificationUiUtil {
// val bigRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_memory_big) // val bigRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_memory_big)
// //
// sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar) // sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar)
} // }
NOTIFICATION_ACTION_CLEAN_JUNK -> { // NOTIFICATION_ACTION_CLEAN_JUNK -> {
// var size = fastGetJunkSize(context) // var size = fastGetJunkSize(context)
// if (size == 0L) { // if (size == 0L) {
// size = Random.nextLong(1024 * 5, 1024 * 10) // size = Random.nextLong(1024 * 5, 1024 * 10)
...@@ -242,51 +240,51 @@ object NotificationUiUtil { ...@@ -242,51 +240,51 @@ object NotificationUiUtil {
// smallRemoteViewsVar.setTextViewText(R.id.tv_size, size.toFormatSize()) // smallRemoteViewsVar.setTextViewText(R.id.tv_size, size.toFormatSize())
// //
// sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar) // sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar)
} // }
NOTIFICATION_ACTION_WEATHER -> { // NOTIFICATION_ACTION_WEATHER -> {
val weatherBean: WeatherBean = WeatherUtils.getWeatherEntity() ?: return // val weatherBean: WeatherBean = WeatherUtils.getWeatherEntity() ?: return
if (weatherBean.list.isEmpty()) return // if (weatherBean.list.isEmpty()) return
//
val subBean = weatherBean.list[0] // val subBean = weatherBean.list[0]
val smallRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_weather_small) // val smallRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_weather_small)
smallRemoteViewsVar.setTextViewText(R.id.tv_city, weatherBean.city) // smallRemoteViewsVar.setTextViewText(R.id.tv_city, weatherBean.city)
val min = subBean.tempMin.toInt() // val min = subBean.tempMin.toInt()
val max = subBean.tempMax.toInt() // val max = subBean.tempMax.toInt()
smallRemoteViewsVar.setTextViewText(R.id.tv_wendu_now, Random.nextInt(min, max).toString()) // smallRemoteViewsVar.setTextViewText(R.id.tv_wendu_now, Random.nextInt(min, max).toString())
val icon = when (WeatherUtils.getWeatherType(subBean.iconDay.toInt())) { // val icon = when (WeatherUtils.getWeatherType(subBean.iconDay.toInt())) {
"Sunny day" -> R.mipmap.d_qing // "Sunny day" -> R.mipmap.d_qing
"Cloudy day" -> R.mipmap.d_yin // "Cloudy day" -> R.mipmap.d_yin
"Rainy day" -> R.mipmap.d_dayu // "Rainy day" -> R.mipmap.d_dayu
"Snowy day" -> R.mipmap.d_xiaxue // "Snowy day" -> R.mipmap.d_xiaxue
"Greasy day" -> R.mipmap.d_wumaishachengbao // "Greasy day" -> R.mipmap.d_wumaishachengbao
"Unknown" -> R.mipmap.d_qing // "Unknown" -> R.mipmap.d_qing
else -> R.mipmap.d_qing // else -> R.mipmap.d_qing
} // }
//
smallRemoteViewsVar.setImageViewResource(R.id.iv_weather, icon) // smallRemoteViewsVar.setImageViewResource(R.id.iv_weather, icon)
smallRemoteViewsVar.setTextViewText(R.id.tv_wendu_range, "$min℃/$max℃") // smallRemoteViewsVar.setTextViewText(R.id.tv_wendu_range, "$min℃/$max℃")
//
val bigRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_weather_big) // val bigRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_weather_big)
bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_11h, icon) // bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_11h, icon)
bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_14h, icon) // bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_14h, icon)
bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_17h, icon) // bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_17h, icon)
bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_20h, icon) // bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_20h, icon)
bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_23h, icon) // bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_23h, icon)
bigRemoteViewsVar.setImageViewResource(R.id.iv_weather, icon) // bigRemoteViewsVar.setImageViewResource(R.id.iv_weather, icon)
//
bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_11h, Random.nextInt(min, max).toString()) // bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_11h, Random.nextInt(min, max).toString())
bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_14h, Random.nextInt(min, max).toString()) // bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_14h, Random.nextInt(min, max).toString())
bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_17h, Random.nextInt(min, max).toString()) // bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_17h, Random.nextInt(min, max).toString())
bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_20h, Random.nextInt(min, max).toString()) // bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_20h, Random.nextInt(min, max).toString())
bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_23h, Random.nextInt(min, max).toString()) // bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_23h, Random.nextInt(min, max).toString())
//
bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_now, Random.nextInt(min, max).toString()) // bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_now, Random.nextInt(min, max).toString())
bigRemoteViewsVar.setTextViewText(R.id.tv_day_desc, if (isDayOrNight()) subBean.textDay else subBean.textNight) // bigRemoteViewsVar.setTextViewText(R.id.tv_day_desc, if (isDayOrNight()) subBean.textDay else subBean.textNight)
bigRemoteViewsVar.setTextViewText(R.id.tv_weather_info, "$min℃/$max℃ ${formatATime()}") // bigRemoteViewsVar.setTextViewText(R.id.tv_weather_info, "$min℃/$max℃ ${formatATime()}")
//
sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar) // sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar)
} // }
else -> { else -> {
...@@ -363,7 +361,7 @@ object NotificationUiUtil { ...@@ -363,7 +361,7 @@ object NotificationUiUtil {
NOTIFICATION_ACTION_IMPORTANT_DOCUMENT, NOTIFICATION_ACTION_IMPORTANT_DOCUMENT,
// NOTIFICATION_ACTION_APP_PROCESS, // NOTIFICATION_ACTION_APP_PROCESS,
// NOTIFICATION_ACTION_CLEAN_JUNK, // NOTIFICATION_ACTION_CLEAN_JUNK,
NOTIFICATION_ACTION_WEATHER // NOTIFICATION_ACTION_WEATHER
) )
var actionIdList = arrayListOf<String>() var actionIdList = arrayListOf<String>()
......
...@@ -22,8 +22,11 @@ import androidx.core.app.NotificationCompat ...@@ -22,8 +22,11 @@ import androidx.core.app.NotificationCompat
import androidx.core.graphics.drawable.IconCompat import androidx.core.graphics.drawable.IconCompat
import androidx.work.Configuration import androidx.work.Configuration
import com.base.pdfreaderallpdfreader.R import com.base.pdfreaderallpdfreader.R
import com.base.pdfreaderallpdfreader.bean.ConstObject
import com.base.pdfreaderallpdfreader.ui.main.MainActivity import com.base.pdfreaderallpdfreader.ui.main.MainActivity
import com.base.pdfreaderallpdfreader.ui.splash.MyStartActivity
import com.base.pdfreaderallpdfreader.utils.LogEx import com.base.pdfreaderallpdfreader.utils.LogEx
import kotlin.random.Random
/** /**
...@@ -63,6 +66,63 @@ class StayJobService : JobService() { ...@@ -63,6 +66,63 @@ class StayJobService : JobService() {
val contentView = RemoteViews(context.packageName, R.layout.stay_notification_big) val contentView = RemoteViews(context.packageName, R.layout.stay_notification_big)
val expendView = RemoteViews(context.packageName, R.layout.stay_notification_big) val expendView = RemoteViews(context.packageName, R.layout.stay_notification_big)
val requestCode1 = Random.nextInt(1800)
val intent1 = Intent(context, MyStartActivity::class.java).apply {
putExtra("actionId", ConstObject.NOTIFICATION_ACTION_LOG)
}
val pendingIntent1 =
PendingIntent.getActivity(
context,
requestCode1,
intent1,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.fl_1, pendingIntent1)
expendView.setOnClickPendingIntent(R.id.fl_1, pendingIntent1)
val requestCode2 = Random.nextInt(1800)
val intent2 = Intent(context, MyStartActivity::class.java).apply {
putExtra("actionId", ConstObject.NOTIFICATION_ACTION_DOCUMENT)
}
val pendingIntent2 =
PendingIntent.getActivity(
context,
requestCode2,
intent2,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.ll_2, pendingIntent2)
expendView.setOnClickPendingIntent(R.id.ll_2, pendingIntent2)
val requestCode3 = Random.nextInt(1800)
val intent3 = Intent(context, MyStartActivity::class.java).apply {
putExtra("actionId", ConstObject.NOTIFICATION_ACTION_BOOKMARK)
}
val pendingIntent3 =
PendingIntent.getActivity(
context,
requestCode3,
intent3,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.ll_3, pendingIntent3)
expendView.setOnClickPendingIntent(R.id.ll_3, pendingIntent3)
val requestCode4 = Random.nextInt(1800)
val intent4 = Intent(context, MyStartActivity::class.java).apply {
putExtra("actionId", ConstObject.NOTIFICATION_ACTION_NEW_IMAGE_PDF)
}
val pendingIntent4 =
PendingIntent.getActivity(
context,
requestCode4,
intent4,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4)
expendView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4)
val builder = NotificationCompat.Builder(context, channelId) val builder = NotificationCompat.Builder(context, channelId)
val smallIcon = IconCompat.createFromIcon( val smallIcon = IconCompat.createFromIcon(
......
...@@ -23,6 +23,7 @@ class DocumentActivity : BaseActivity<ActivityDocumentBinding>() { ...@@ -23,6 +23,7 @@ class DocumentActivity : BaseActivity<ActivityDocumentBinding>() {
private lateinit var documentViewModel: DocumentViewModel private lateinit var documentViewModel: DocumentViewModel
private var tittle: String? = null private var tittle: String? = null
private var initTab: Int? = null
override val binding: ActivityDocumentBinding by lazy { override val binding: ActivityDocumentBinding by lazy {
ActivityDocumentBinding.inflate(layoutInflater) ActivityDocumentBinding.inflate(layoutInflater)
...@@ -44,8 +45,6 @@ class DocumentActivity : BaseActivity<ActivityDocumentBinding>() { ...@@ -44,8 +45,6 @@ class DocumentActivity : BaseActivity<ActivityDocumentBinding>() {
DocumentFragment(DocumentBean.TYPE_PPT) DocumentFragment(DocumentBean.TYPE_PPT)
} }
private var initTab: Int? = null
private val fragments by lazy { private val fragments by lazy {
mutableListOf(allPage, pdfPage, wordPage, excelPage, pptPage) mutableListOf(allPage, pdfPage, wordPage, excelPage, pptPage)
} }
......
package com.base.pdfreaderallpdfreader.ui.main package com.base.pdfreaderallpdfreader.ui.main
import android.Manifest import android.Manifest
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.net.Uri
...@@ -16,12 +17,17 @@ import androidx.lifecycle.ViewModelProvider ...@@ -16,12 +17,17 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController import androidx.navigation.NavController
import androidx.navigation.findNavController import androidx.navigation.findNavController
import com.base.pdfreaderallpdfreader.BuildConfig
import com.base.pdfreaderallpdfreader.R import com.base.pdfreaderallpdfreader.R
import com.base.pdfreaderallpdfreader.ads.AdmobHelper import com.base.pdfreaderallpdfreader.ads.AdmobHelper
import com.base.pdfreaderallpdfreader.ads.AdmobHelper.lastScanShowAd import com.base.pdfreaderallpdfreader.ads.AdmobHelper.lastScanShowAd
import com.base.pdfreaderallpdfreader.ads.admob.AdmobBannerUtils import com.base.pdfreaderallpdfreader.ads.admob.AdmobBannerUtils
import com.base.pdfreaderallpdfreader.base.BaseActivity import com.base.pdfreaderallpdfreader.base.BaseActivity
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_BOOKMARK
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_NEW_IMAGE_PDF
import com.base.pdfreaderallpdfreader.databinding.ActivityMainBinding import com.base.pdfreaderallpdfreader.databinding.ActivityMainBinding
import com.base.pdfreaderallpdfreader.fcm.NotificationUiUtil
import com.base.pdfreaderallpdfreader.fcm.NotificationUiUtil.getNextActionId
import com.base.pdfreaderallpdfreader.helper.ConfigHelper import com.base.pdfreaderallpdfreader.helper.ConfigHelper
import com.base.pdfreaderallpdfreader.ui.feedback.FeedbackActivity import com.base.pdfreaderallpdfreader.ui.feedback.FeedbackActivity
import com.base.pdfreaderallpdfreader.ui.language.LanguageActivity import com.base.pdfreaderallpdfreader.ui.language.LanguageActivity
...@@ -110,15 +116,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() { ...@@ -110,15 +116,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
addDeskShortCut() addDeskShortCut()
handleActionFunction()
}
private fun handleActionFunction() {
actionId = intent.extras?.getString(actionId) ?: ""
LogEx.logDebug(TAG, "actionId=$actionId")
when (actionId) {
}
} }
override fun onResume() { override fun onResume() {
...@@ -200,7 +198,33 @@ class MainActivity : BaseActivity<ActivityMainBinding>() { ...@@ -200,7 +198,33 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding.llShare.setOnClickListener { binding.llShare.setOnClickListener {
} }
binding.includeMain.tvTittle.setOnClickListener {
if (BuildConfig.DEBUG) {
NotificationUiUtil.sendNotificationIfCan(this, "test", getNextActionId())
}
}
handleActionFunction()
}
@SuppressLint("MissingSuperCall")
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleActionFunction()
}
private fun handleActionFunction() {
actionId = intent.extras?.getString("actionId") ?: ""
LogEx.logDebug(TAG, "handleActionFunction actionId=$actionId")
when (actionId) {
NOTIFICATION_ACTION_BOOKMARK -> {
changeBookMarkUI()
}
NOTIFICATION_ACTION_NEW_IMAGE_PDF -> {
mainViewModel.starGmsScan(this)
}
}
} }
private fun jumpUriPdf(uri: Uri) { private fun jumpUriPdf(uri: Uri) {
......
...@@ -18,6 +18,7 @@ import com.base.pdfreaderallpdfreader.ui.main.MainActivity ...@@ -18,6 +18,7 @@ import com.base.pdfreaderallpdfreader.ui.main.MainActivity
import com.base.pdfreaderallpdfreader.ui.main.getPdfFastSize import com.base.pdfreaderallpdfreader.ui.main.getPdfFastSize
import com.base.pdfreaderallpdfreader.ui.pdf.PdfActivity import com.base.pdfreaderallpdfreader.ui.pdf.PdfActivity
import com.base.pdfreaderallpdfreader.ui.pdf.PdfSelectActivity import com.base.pdfreaderallpdfreader.ui.pdf.PdfSelectActivity
import com.base.pdfreaderallpdfreader.ui.pdf.PdfSelectActivity.Companion.jumpPdfSelect
import com.base.pdfreaderallpdfreader.utils.PermissionUtils.checkStorePermission import com.base.pdfreaderallpdfreader.utils.PermissionUtils.checkStorePermission
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
...@@ -63,14 +64,10 @@ class HomeFragment : Fragment() { ...@@ -63,14 +64,10 @@ class HomeFragment : Fragment() {
PdfActivity.jumpMerge(requireActivity()) PdfActivity.jumpMerge(requireActivity())
} }
binding.llSplitPdf.setOnClickListener { binding.llSplitPdf.setOnClickListener {
startActivity(Intent(requireContext(), PdfSelectActivity::class.java).apply { jumpPdfSelect(requireContext(),DO_SPLIT_PDF)
putExtra("doWhat", DO_SPLIT_PDF)
})
} }
binding.llLockPdf.setOnClickListener { binding.llLockPdf.setOnClickListener {
startActivity(Intent(requireContext(), PdfSelectActivity::class.java).apply { jumpPdfSelect(requireContext(),DO_LOCK_PDF)
putExtra("doWhat", DO_LOCK_PDF)
})
} }
binding.llWord.setOnClickListener { binding.llWord.setOnClickListener {
startActivity(Intent(requireContext(), DocumentActivity::class.java).apply { startActivity(Intent(requireContext(), DocumentActivity::class.java).apply {
......
package com.base.pdfreaderallpdfreader.ui.pdf package com.base.pdfreaderallpdfreader.ui.pdf
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.view.View import android.view.View
...@@ -61,7 +62,6 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() { ...@@ -61,7 +62,6 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
doWhat = intent.extras?.getString("doWhat", "") ?: "" doWhat = intent.extras?.getString("doWhat", "") ?: ""
LogEx.logDebug(TAG, "doWhat=$doWhat") LogEx.logDebug(TAG, "doWhat=$doWhat")
initAdapter() initAdapter()
when (doWhat) { when (doWhat) {
...@@ -88,6 +88,9 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() { ...@@ -88,6 +88,9 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
getPdfData(3) getPdfData(3)
} }
else -> {
}
} }
} }
...@@ -197,4 +200,11 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() { ...@@ -197,4 +200,11 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
} }
companion object {
fun jumpPdfSelect(context: Context, doWhat: String) {
context.startActivity(Intent(context, PdfSelectActivity::class.java).apply {
putExtra("doWhat", doWhat)
})
}
}
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import android.text.Spannable ...@@ -9,6 +9,7 @@ import android.text.Spannable
import android.text.SpannableString import android.text.SpannableString
import android.text.style.ForegroundColorSpan import android.text.style.ForegroundColorSpan
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContentProviderCompat.requireContext
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
...@@ -17,6 +18,11 @@ import com.base.pdfreaderallpdfreader.ads.AdmobHelper.initAdmobAd ...@@ -17,6 +18,11 @@ import com.base.pdfreaderallpdfreader.ads.AdmobHelper.initAdmobAd
import com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils import com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils
import com.base.pdfreaderallpdfreader.ads.admob.AdmobOpenUtils import com.base.pdfreaderallpdfreader.ads.admob.AdmobOpenUtils
import com.base.pdfreaderallpdfreader.base.BaseActivity import com.base.pdfreaderallpdfreader.base.BaseActivity
import com.base.pdfreaderallpdfreader.bean.ConstObject.DO_SPLIT_PDF
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_DOCUMENT
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_READ_PDF
import com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_UN_VIEW_FILES
import com.base.pdfreaderallpdfreader.bean.ConstObject.ifAgreePrivacy import com.base.pdfreaderallpdfreader.bean.ConstObject.ifAgreePrivacy
import com.base.pdfreaderallpdfreader.bean.ConstObject.isFirstStart import com.base.pdfreaderallpdfreader.bean.ConstObject.isFirstStart
import com.base.pdfreaderallpdfreader.databinding.ActivitySplashBinding import com.base.pdfreaderallpdfreader.databinding.ActivitySplashBinding
...@@ -27,7 +33,10 @@ import com.base.pdfreaderallpdfreader.helper.UmpUtils.requestUMP ...@@ -27,7 +33,10 @@ import com.base.pdfreaderallpdfreader.helper.UmpUtils.requestUMP
import com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCalled import com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCalled
import com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCanAd import com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCanAd
import com.base.pdfreaderallpdfreader.helper.WeatherUtils import com.base.pdfreaderallpdfreader.helper.WeatherUtils
import com.base.pdfreaderallpdfreader.ui.document.DocumentActivity
import com.base.pdfreaderallpdfreader.ui.main.MainActivity import com.base.pdfreaderallpdfreader.ui.main.MainActivity
import com.base.pdfreaderallpdfreader.ui.pdf.PdfSelectActivity
import com.base.pdfreaderallpdfreader.ui.pdf.PdfSelectActivity.Companion.jumpPdfSelect
import com.base.pdfreaderallpdfreader.utils.BarUtils import com.base.pdfreaderallpdfreader.utils.BarUtils
import com.base.pdfreaderallpdfreader.utils.LogEx import com.base.pdfreaderallpdfreader.utils.LogEx
import com.base.pdfreaderallpdfreader.utils.MyAnimationUtils import com.base.pdfreaderallpdfreader.utils.MyAnimationUtils
...@@ -231,7 +240,22 @@ class MyStartActivity : BaseActivity<ActivitySplashBinding>() { ...@@ -231,7 +240,22 @@ class MyStartActivity : BaseActivity<ActivitySplashBinding>() {
LogEx.logDebug(TAG, "jumpNext actionId=$actionId") LogEx.logDebug(TAG, "jumpNext actionId=$actionId")
when (actionId) { when (actionId) {
NOTIFICATION_ACTION_READ_PDF -> {
startActivity(Intent(this, DocumentActivity::class.java).apply {
putExtra("initTab", 1)
})
}
NOTIFICATION_ACTION_DOCUMENT,
NOTIFICATION_ACTION_UN_VIEW_FILES,
NOTIFICATION_ACTION_IMPORTANT_DOCUMENT -> {
startActivity(Intent(this, DocumentActivity::class.java).apply {
putExtra("initTab", 0)
})
}
else -> { else -> {
LogEx.logDebug(TAG, "show main handle actionId $actionId")
startActivity(Intent(this, MainActivity::class.java).apply { startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId) putExtra("actionId", actionId)
}) })
......
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