This commit is contained in:
lunaticbum 2024-09-19 14:24:40 +09:00
parent ea3858ba1f
commit 9342628677
8 changed files with 92 additions and 104 deletions

View File

@ -70,6 +70,7 @@ import androidx.core.view.updatePadding
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2
import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.OneTimeWorkRequest
import androidx.work.PeriodicWorkRequestBuilder import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager import androidx.work.WorkManager
import com.google.android.material.color.DynamicColors import com.google.android.material.color.DynamicColors
@ -186,15 +187,18 @@ internal class LauncherActivity : AppCompatActivity() {
.build()) .build())
}, delay, TimeUnit.SECONDS) }, delay, TimeUnit.SECONDS)
delay = delay + 3L delay = delay + 3L
// Executors.newSingleThreadScheduledExecutor().schedule({
// mWorkManager?.cancelAllWorkByTag(AppInfoGetter.TAG)
// mWorkManager?.enqueueUniquePeriodicWork(
// AppInfoGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
// PeriodicWorkRequestBuilder<AppInfoGetter>(12, TimeUnit.HOURS)
// .addTag(AppInfoGetter.TAG)
// .build())
// }, delay, TimeUnit.SECONDS)
// delay = delay + 3L
Executors.newSingleThreadScheduledExecutor().schedule({ Executors.newSingleThreadScheduledExecutor().schedule({
mWorkManager?.cancelAllWorkByTag(AppInfoGetter.TAG) mWorkManager?.enqueue(OneTimeWorkRequest.from(AppInfoGetter::class.java))
mWorkManager?.enqueueUniquePeriodicWork( }, 5, TimeUnit.SECONDS)
AppInfoGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
PeriodicWorkRequestBuilder<AppInfoGetter>(12, TimeUnit.HOURS)
.addTag(AppInfoGetter.TAG)
.build())
}, delay, TimeUnit.SECONDS)
delay = delay + 3L
} }
@ -1097,4 +1101,3 @@ fun openOpera(schemeString : String) {
lActivity?.startActivity(mapIntent) lActivity?.startActivity(mapIntent)
} }

View File

@ -118,11 +118,6 @@ internal class AppsAdapter(
} }
} }
data class Packages (
val packageName: String,
val appName: String,
val category : String
)
internal class AppsDiffUtil( internal class AppsDiffUtil(
private val oldList: List<AppInfo>, private val newList: List<AppInfo> private val oldList: List<AppInfo>, private val newList: List<AppInfo>

View File

@ -115,8 +115,8 @@ internal class LauncherHome : Fragment() {
var home : LauncherHome? = null var home : LauncherHome? = null
var lastedFinishedPageUrl : String = "" var lastedFinishedPageUrl : String = ""
// var recentCalls = arrayListOf<RecentCall>() // var recentCalls = arrayListOf<RecentCall>()
var callList = arrayListOf<RecentCall>() // var callList = arrayListOf<RecentCall>()
var smsList = arrayListOf<RecentSms>() // var smsList = arrayListOf<RecentSms>()
var listTags = arrayListOf<RssDataInterface>() var listTags = arrayListOf<RssDataInterface>()
} }
@ -164,8 +164,8 @@ internal class LauncherHome : Fragment() {
fragManager = lActivity!!.supportFragmentManager fragManager = lActivity!!.supportFragmentManager
settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0) settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0)
batteryReceiver = BatteryReceiver(binding.batteryProgress) batteryReceiver = BatteryReceiver(binding.batteryProgress)
mRecentCallsAdapter = RecentCallsAdapter(callList, requireContext()) mRecentCallsAdapter = RecentCallsAdapter(arrayListOf(), requireContext())
mSmsLogsAdapter = SmsLogsAdapter(smsList, requireContext()) mSmsLogsAdapter = SmsLogsAdapter(arrayListOf(), requireContext())
mNotiAdapter = NotificationItemAdapter(requireContext()) mNotiAdapter = NotificationItemAdapter(requireContext())
mRssAdapter = RssItemAdapter(requireContext()) mRssAdapter = RssItemAdapter(requireContext())
@ -173,7 +173,7 @@ internal class LauncherHome : Fragment() {
binding.notiList.addItemDecoration(decoration) binding.notiList.addItemDecoration(decoration)
binding.infoList.addItemDecoration(decoration) binding.infoList.addItemDecoration(decoration)
binding.missedCalls.isSelected = true
binding.smsList.visibility = View.GONE binding.smsList.visibility = View.GONE
binding.infoList.visibility = View.GONE binding.infoList.visibility = View.GONE
@ -198,16 +198,12 @@ internal class LauncherHome : Fragment() {
try{binding.notiList.removeOnScrollListener(onScrChanged)}catch (e : Exception){e.printStackTrace()} try{binding.notiList.removeOnScrollListener(onScrChanged)}catch (e : Exception){e.printStackTrace()}
binding.notiList.addOnScrollListener(onScrChanged) binding.notiList.addOnScrollListener(onScrChanged)
workmanager()?.getWorkInfosByTagLiveData(SMS_WORK_TAG)?.observeForever { binding.currentMusic?.setOnClickListener {
commandHandler.removeCallbacks(smsUpdate) lActivity?.apply {
commandHandler.postDelayed(smsUpdate,UPDATE_DELAY) packageManager?.apply {
it.clear() startActivity(getLaunchIntentForPackage("com.google.android.apps.youtube.music"))
} }
}
workmanager()?.getWorkInfosByTagLiveData(CALL_WORK_TAG)?.observeForever {
commandHandler.removeCallbacks(callUpdate)
commandHandler.postDelayed(callUpdate,UPDATE_DELAY)
it.clear()
} }
GlobalScope.launch { GlobalScope.launch {
@ -238,7 +234,7 @@ internal class LauncherHome : Fragment() {
} }
} }
BLog.LOGE("onCreateView()") // BLog.LOGE("onCreateView()")
binding.nextBtn.setOnClickListener { binding.nextBtn.setOnClickListener {
val mAudioManager = val mAudioManager =
requireContext().getSystemService(AUDIO_SERVICE) as AudioManager requireContext().getSystemService(AUDIO_SERVICE) as AudioManager
@ -275,10 +271,14 @@ internal class LauncherHome : Fragment() {
} }
val hideListView = { val hideListView = {
// binding.notiList.visibility = View.GONE binding.notiList.visibility = View.GONE
// binding.mainList.visibility = View.GONE binding.mainList.visibility = View.GONE
// binding.infoList.visibility = View.GONE binding.infoList.visibility = View.GONE
// binding.smsList.visibility = View.GONE binding.smsList.visibility = View.GONE
binding.otherCheck.isSelected = false
binding.recentSms.isSelected = false
binding.missedCalls.isSelected = false
binding.notice.isSelected = false
} }
@ -287,7 +287,7 @@ internal class LauncherHome : Fragment() {
super.onScrollStateChanged(recyclerView, newState) super.onScrollStateChanged(recyclerView, newState)
when (newState) { when (newState) {
RecyclerView.SCROLL_STATE_IDLE -> { RecyclerView.SCROLL_STATE_IDLE -> {
commandHandler.postDelayed(hideListView, UPDATE_DELAY * 5) commandHandler.postDelayed(hideListView, UPDATE_DELAY * 20)
} }
RecyclerView.SCROLL_STATE_DRAGGING -> { RecyclerView.SCROLL_STATE_DRAGGING -> {
} }
@ -315,10 +315,10 @@ internal class LauncherHome : Fragment() {
mNotificationResult = WorkersDb.getRealm().query<NotificationItem>().sort("postTime",Sort.DESCENDING).find() mNotificationResult = WorkersDb.getRealm().query<NotificationItem>().sort("postTime",Sort.DESCENDING).find()
noticeJob = CoroutineScope(Dispatchers.Default).launch { noticeJob = CoroutineScope(Dispatchers.Default).launch {
mNotificationResult?.asFlow()?.collect { changes: ResultsChange<NotificationItem> -> mNotificationResult?.asFlow()?.collect { changes: ResultsChange<NotificationItem> ->
BLog.LOGE("changes >>> ${changes}") // BLog.LOGE("changes >>> ${changes}")
when (changes) { when (changes) {
is UpdatedResults -> { is UpdatedResults -> {
BLog.LOGE("ResultsChange onNotificationPosted") // BLog.LOGE("ResultsChange onNotificationPosted")
WorkersDb.getRealm().apply { WorkersDb.getRealm().apply {
lastedNoti = copyFromRealm(changes.list) lastedNoti = copyFromRealm(changes.list)
} }
@ -336,7 +336,6 @@ internal class LauncherHome : Fragment() {
} }
fun queryInfos(filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU,RssDataType.Most,RssDataType.REDDIT_nsfw)) { fun queryInfos(filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU,RssDataType.Most,RssDataType.REDDIT_nsfw)) {
BLog.LOGE("${this} ::::: queryInfos >>>> ${filter}")
try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()} try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()}
mRssDataResult = null mRssDataResult = null
try { try {
@ -346,7 +345,6 @@ internal class LauncherHome : Fragment() {
WorkersDb.getRealm().apply { writeBlocking { WorkersDb.getRealm().apply { writeBlocking {
delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.Most.name).find()) delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.Most.name).find())
}} }}
BLog.LOGE("${this} ::::: queryInfos after delete >>>> ")
var rQ = WorkersDb.getRealm().query<RssData>().query("pubDate > $0", beforeDay(Date(),3)) var rQ = WorkersDb.getRealm().query<RssData>().query("pubDate > $0", beforeDay(Date(),3))
filter!!.forEach { filter!!.forEach {
rQ = rQ.query("category != $0", it.name) rQ = rQ.query("category != $0", it.name)
@ -379,7 +377,6 @@ internal class LauncherHome : Fragment() {
} }
fun queryInfos(keyword : String, category : ArrayList<String> = arrayListOf()) { fun queryInfos(keyword : String, category : ArrayList<String> = arrayListOf()) {
BLog.LOGE("${this} ::::: queryInfos >>>> ${keyword}")
try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()} try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()}
mRssDataResult = null mRssDataResult = null
try { try {
@ -389,7 +386,6 @@ internal class LauncherHome : Fragment() {
WorkersDb.getRealm().apply { writeBlocking { WorkersDb.getRealm().apply { writeBlocking {
delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.Most.name).find()) delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.Most.name).find())
}} }}
BLog.LOGE("${this} ::::: queryInfos after delete >>>> ")
var rQ = WorkersDb.getRealm().query<RssData>().query("pubDate > $0", beforeDay(Date(),3)) var rQ = WorkersDb.getRealm().query<RssData>().query("pubDate > $0", beforeDay(Date(),3))
if(keyword.length > 0) { if(keyword.length > 0) {
BLog.LOGE("queryInfos it >>> ${keyword}") BLog.LOGE("queryInfos it >>> ${keyword}")
@ -425,17 +421,14 @@ internal class LauncherHome : Fragment() {
rQ = rQ.query(queryString) rQ = rQ.query(queryString)
} }
BLog.LOGE("queryInfos rQ.description() >>>>> ${rQ.description()}")
//limit(1000)
mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find() mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find()
BLog.LOGE("${this} ::::: queryInfos after query find >>>> ")
infosJob = CoroutineScope(Dispatchers.Default).launch { infosJob = CoroutineScope(Dispatchers.Default).launch {
mRssDataResult?.asFlow()?.collect { changes: ResultsChange<RssData> -> mRssDataResult?.asFlow()?.collect { changes: ResultsChange<RssData> ->
commandHandler.removeCallbacks(infoUpdate) commandHandler.removeCallbacks(infoUpdate)
when (changes) { when (changes) {
is InitialResults -> { is InitialResults -> {
BLog.LOGE("${this} ::::: queryInfos after changes size >>>> ${changes.list.size}")
WorkersDb.getRealm().apply { WorkersDb.getRealm().apply {
lasted = copyFromRealm(changes.list) lasted = copyFromRealm(changes.list)
} }
@ -649,11 +642,10 @@ internal class LauncherHome : Fragment() {
if (binding.missedCalls.isSelected) { if (binding.missedCalls.isSelected) {
WorkersDb.getRealm().apply { WorkersDb.getRealm().apply {
val result = query<RecentCall>().query("callDayTime >= $0", dateParam).sort("callDayTime", Sort.DESCENDING).find() val result = query<RecentCall>().query("callDayTime >= $0", dateParam).sort("callDayTime", Sort.DESCENDING).find()
callList.clear() val list = copyFromRealm(result)
callList.addAll(copyFromRealm(result)) binding.missedCalls.text = "최근 통화 [${list.size}]"
binding.missedCalls.text = "최근 통화 [${callList.size}]"
binding.mainList.visibility = View.VISIBLE binding.mainList.visibility = View.VISIBLE
mRecentCallsAdapter.updateData(callList) mRecentCallsAdapter.updateData(list)
binding.recentSms.isSelected = false binding.recentSms.isSelected = false
binding.otherCheck.isSelected = false binding.otherCheck.isSelected = false
binding.notice.isSelected = false binding.notice.isSelected = false
@ -664,13 +656,10 @@ internal class LauncherHome : Fragment() {
.sort("rcvDate",Sort.DESCENDING).find() .sort("rcvDate",Sort.DESCENDING).find()
if (result.size > 0) { if (result.size > 0) {
try { try {
// BLog.LOGE("observeForever smsList.size >>> ${result.size}")
binding.recentSms.text = "최근 문자 [${result.size}]" binding.recentSms.text = "최근 문자 [${result.size}]"
binding.smsList.visibility = View.VISIBLE binding.smsList.visibility = View.VISIBLE
smsList.clear() val list = copyFromRealm(result)
smsList.addAll(copyFromRealm(result)) mSmsLogsAdapter.updateData(list)
mSmsLogsAdapter.
updateData(smsList)
binding.missedCalls.isSelected = false binding.missedCalls.isSelected = false
binding.otherCheck.isSelected = false binding.otherCheck.isSelected = false
binding.notice.isSelected = false binding.notice.isSelected = false
@ -695,7 +684,7 @@ internal class LauncherHome : Fragment() {
binding.notice.text = "알림 센터[${lastedNoti?.size ?: "-"}]" binding.notice.text = "알림 센터[${lastedNoti?.size ?: "-"}]"
lastedNoti?.let { mNotiAdapter.updateData(it)} lastedNoti?.let { mNotiAdapter.updateData(it)}
} }
commandHandler.postDelayed(hideListView, UPDATE_DELAY * 5) commandHandler.postDelayed(hideListView, UPDATE_DELAY * 20)
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()

View File

@ -55,29 +55,34 @@ internal class NotificationItemAdapter (
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: NotiHolder, position: Int) { override fun onBindViewHolder(holder: NotiHolder, position: Int) {
val todo = notiItems[position] val appInfo = notiItems[position]
try { try {
holder.view.circlePreview.visibility = View.VISIBLE holder.view.circlePreview.visibility = View.VISIBLE
var param = holder.view.circlePreview.layoutParams var param = holder.view.circlePreview.layoutParams
holder.view.circlePreview.layoutParams = ConstraintLayout.LayoutParams(120,param.height) holder.view.circlePreview.layoutParams = ConstraintLayout.LayoutParams(120,param.height)
val d: Drawable = context.packageManager.getApplicationIcon(todo.pkgName!!) val d: Drawable = context.packageManager.getApplicationIcon(appInfo.pkgName!!)
holder.view.circlePreview.setImageDrawable(d) holder.view.circlePreview.setImageDrawable(d)
holder.view.title.text = todo.tikerMsg holder.view.title.text = appInfo.tikerMsg
holder.view.desc.text = todo.pkgName holder.view.desc.text = appInfo.pkgName
holder.view.date.text = dateFormat.format(Date(todo.postTime)) holder.view.date.text = dateFormat.format(Date(appInfo.postTime))
holder.view.circlePreview.setOnLongClickListener { holder.view.circlePreview.setOnLongClickListener {
WorkersDb.getRealm().writeBlocking { WorkersDb.getRealm().writeBlocking {
delete(query<NotificationItem>(NotificationItem::class).query("pkgName == $0",todo.pkgName).find()) delete(query<NotificationItem>(NotificationItem::class).query("pkgName == $0",appInfo.pkgName).find())
} }
true true
} }
lActivity?.packageManager?.apply {
context.startActivity(getLaunchIntentForPackage(appInfo.pkgName!!))
}
} catch (e: PackageManager.NameNotFoundException) { } catch (e: PackageManager.NameNotFoundException) {
return return
} }
} }
fun openOpera(schemeString : String) { fun openOpera(schemeString : String) {
val gmmIntentUri = Uri.parse(schemeString) val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
@ -101,44 +106,10 @@ internal class NotificationItemAdapter (
e.printStackTrace() e.printStackTrace()
} }
} }
fun openNews(schemeString : String) {
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.setPackage("com.android.chrome")
lActivity?.startActivity(mapIntent)
}
fun openYouTube(schemeString : String) {
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.setPackage("com.google.android.youtube")
lActivity?.startActivity(mapIntent)
}
fun openReddit(schemeString : String) {
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.setPackage("com.reddit.frontpage")
lActivity?.startActivity(mapIntent)
}
fun openDotax(schemeString : String) {
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW)
mapIntent.setPackage("net.daum.android.cafe")
mapIntent.setData(gmmIntentUri)
lActivity?.startActivity(mapIntent)
}
} }
//fun dp2px(dp: Float): Float {
// val resources: Resources = this.getResources()
// val metrics = resources.displayMetrics
// val px = dp * (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)
// return px
//}
internal class NotiHolder(var view: ListItemWithBinding) : RecyclerView.ViewHolder(view.root) internal class NotiHolder(var view: ListItemWithBinding) : RecyclerView.ViewHolder(view.root)
internal class NotiItemDiffUtil( internal class NotiItemDiffUtil(
var oldList: List<NotificationItem>, var newList: List<NotificationItem> var oldList: List<NotificationItem>, var newList: List<NotificationItem>

View File

@ -136,8 +136,8 @@ internal class RecentCallsAdapter(
this.recyclerView = recyclerView this.recyclerView = recyclerView
} }
fun updateData(newList: ArrayList<RecentCall>) { fun updateData(newList: Collection<RecentCall>) {
val diffUtilResult = DiffUtil.calculateDiff(RecentCallDiffUtil(callList, newList)) val diffUtilResult = DiffUtil.calculateDiff(RecentCallDiffUtil(callList, newList.toList()))
diffUtilResult.dispatchUpdatesTo(this).apply { diffUtilResult.dispatchUpdatesTo(this).apply {
val visibleItemCount = (layoutManager?.findLastVisibleItemPosition() ?: 0) - (layoutManager?.findFirstVisibleItemPosition() ?: 0) val visibleItemCount = (layoutManager?.findLastVisibleItemPosition() ?: 0) - (layoutManager?.findFirstVisibleItemPosition() ?: 0)
if (visibleItemCount > 0) { if (visibleItemCount > 0) {
@ -145,8 +145,8 @@ internal class RecentCallsAdapter(
recyclerView?.scrollToPosition(0) recyclerView?.scrollToPosition(0)
} }
} }
// callList.clear() callList.clear()
// callList.addAll(newList) callList.addAll(newList)
} }
} }

View File

@ -111,8 +111,8 @@ internal class SmsLogsAdapter(
fun updateData(newList: List<RecentSms>) { fun updateData(newList: List<RecentSms>) {
val diffUtilResult = DiffUtil.calculateDiff(SmsDiffUtil(smsList, newList)) val diffUtilResult = DiffUtil.calculateDiff(SmsDiffUtil(smsList, newList))
diffUtilResult.dispatchUpdatesTo(this) diffUtilResult.dispatchUpdatesTo(this)
// smsList.clear() smsList.clear()
// smsList.addAll(newList) smsList.addAll(newList)
} }
/* update dialog */ /* update dialog */

View File

@ -3,7 +3,15 @@ package rasel.lunar.launcher.receiver
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 androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import io.realm.kotlin.ext.query
import rasel.lunar.launcher.model.AppInfo
import rasel.lunar.launcher.utils.BLog import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.AppInfoGetter
import rasel.lunar.launcher.workers.WorkersDb
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
class PackageEventReceiver : BroadcastReceiver() { class PackageEventReceiver : BroadcastReceiver() {
@ -12,8 +20,32 @@ class PackageEventReceiver : BroadcastReceiver() {
val action = intent.action val action = intent.action
BLog.LOGE("action >>>> ${action}") BLog.LOGE("action >>>> ${action}")
if (action == Intent.ACTION_PACKAGE_ADDED) { when(action) {
Intent.ACTION_PACKAGE_ADDED,Intent.ACTION_PACKAGE_INSTALL -> {
startAppInfoGetter(context)
}
Intent.ACTION_PACKAGE_REMOVED -> {
val packageName = intent.data?.schemeSpecificPart
if (packageName?.length ?: 0 > 0) {
WorkersDb.getRealm().writeBlocking {
val result = query<AppInfo>("pkgName == $0", packageName).find()
if (result.size == 1) {
delete(result)
}
}
}
startAppInfoGetter(context)
}
else -> {
}
} }
} }
fun startAppInfoGetter(context: Context) {
var mWorkManager = WorkManager.getInstance(context)
Executors.newSingleThreadScheduledExecutor().schedule({
mWorkManager.enqueue(OneTimeWorkRequest.from(AppInfoGetter::class.java))
}, 5, TimeUnit.SECONDS)
}
} }

View File

@ -15,7 +15,6 @@ import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.Ignore import io.realm.kotlin.types.annotations.Ignore
import io.realm.kotlin.types.annotations.PrimaryKey import io.realm.kotlin.types.annotations.PrimaryKey
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.home.LauncherHome.Companion.smsList
import rasel.lunar.launcher.utils.BLog import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.beforeDay import rasel.lunar.launcher.utils.beforeDay
import rasel.lunar.launcher.utils.getContactName import rasel.lunar.launcher.utils.getContactName
@ -51,7 +50,6 @@ class RecentSmsGetter : BaseGetter {
), Telephony.Sms.DATE + "> ${dateParam}", null, Telephony.Sms.DEFAULT_SORT_ORDER) ), Telephony.Sms.DATE + "> ${dateParam}", null, Telephony.Sms.DEFAULT_SORT_ORDER)
if (managedCursor != null && managedCursor.isClosed == false) { if (managedCursor != null && managedCursor.isClosed == false) {
try { try {
smsList.clear()
val tid = managedCursor.getColumnIndex(Telephony.Sms.THREAD_ID) val tid = managedCursor.getColumnIndex(Telephony.Sms.THREAD_ID)
val address = managedCursor.getColumnIndex(Telephony.Sms.ADDRESS) val address = managedCursor.getColumnIndex(Telephony.Sms.ADDRESS)
val type = managedCursor.getColumnIndex(Telephony.Sms.TYPE) val type = managedCursor.getColumnIndex(Telephony.Sms.TYPE)