Compare commits
No commits in common. "ddc1755c6f0bbbd1822f9c2aca536558aa75fb5c" and "af9da4c8ce22e6fb13bcc58335cf6c4873c6c5d8" have entirely different histories.
ddc1755c6f
...
af9da4c8ce
@ -154,7 +154,6 @@ internal class LauncherActivity : AppCompatActivity() {
|
|||||||
val longTimePeriod = 600L
|
val longTimePeriod = 600L
|
||||||
val midTimePeriod = 300L
|
val midTimePeriod = 300L
|
||||||
var isOpendFold = false
|
var isOpendFold = false
|
||||||
val qDayPeriod = 60L * 8L
|
|
||||||
|
|
||||||
@JvmStatic var lActivity: LauncherActivity? = null
|
@JvmStatic var lActivity: LauncherActivity? = null
|
||||||
@JvmStatic var appWidgetManager: AppWidgetManager? = null
|
@JvmStatic var appWidgetManager: AppWidgetManager? = null
|
||||||
|
|||||||
@ -206,7 +206,6 @@ internal class AppDrawer : Fragment() {
|
|||||||
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
|
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
|
||||||
pakage?.let {
|
pakage?.let {
|
||||||
mapIntent.setPackage(pakage)
|
mapIntent.setPackage(pakage)
|
||||||
WorkersDb.updateAppUse(pakage)
|
|
||||||
}
|
}
|
||||||
startActivity(mapIntent)
|
startActivity(mapIntent)
|
||||||
}
|
}
|
||||||
@ -215,8 +214,7 @@ internal class AppDrawer : Fragment() {
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
binding.searchInput.setOnKeyListener { v, keyCode, event ->
|
binding.searchInput.setOnKeyListener { v, keyCode, event ->
|
||||||
//contactList.size < 1 && packageList.size < 1 &&
|
if (keyCode == 66 && contactList.size < 1 && packageList.size < 1 && event.action == KeyEvent.ACTION_UP) {
|
||||||
if (keyCode == 66 && event.action == KeyEvent.ACTION_UP) {
|
|
||||||
checkResult(binding.searchInput.text.toString())
|
checkResult(binding.searchInput.text.toString())
|
||||||
true
|
true
|
||||||
}else {
|
}else {
|
||||||
@ -231,85 +229,85 @@ internal class AppDrawer : Fragment() {
|
|||||||
|
|
||||||
fun checkResult(keyword: String) {
|
fun checkResult(keyword: String) {
|
||||||
|
|
||||||
// if(!isAdded || !isResumed || keyword.length < 1) return
|
if(!isAdded || !isResumed || keyword.length < 1) return
|
||||||
// var dialog : AlertDialog.Builder? = null
|
var dialog : AlertDialog.Builder? = null
|
||||||
// var filted = packageList.filter { it.appName.equals(keyword) }
|
var filted = packageList.filter { it.appName.equals(keyword) }
|
||||||
// BLog.LOGE("filted >> ${filted.size}")
|
BLog.LOGE("filted >> ${filted.size}")
|
||||||
// var filtedContact = contactList.filter { it.name.equals(keyword) }
|
var filtedContact = contactList.filter { it.name.equals(keyword) }
|
||||||
// BLog.LOGE("filtedContact >> ${filtedContact.size}")
|
BLog.LOGE("filtedContact >> ${filtedContact.size}")
|
||||||
// if (keyword.length > 0 && (packageList.size == 1 || filted.size > 0)) {
|
if (keyword.length > 0 && (packageList.size == 1 || filted.size > 0)) {
|
||||||
// dialog = AlertDialog.Builder(requireContext())
|
dialog = AlertDialog.Builder(requireContext())
|
||||||
// dialog?.setTitle("앱 실행 확인")
|
dialog?.setTitle("앱 실행 확인")
|
||||||
// if (packageList.size == 1) {
|
if (packageList.size == 1) {
|
||||||
// dialog?.setMessage("${keyword} 검색 결과 '${packageList[0].appName}' 준비됨")
|
dialog?.setMessage("${keyword} 검색 결과 '${packageList[0].appName}' 준비됨")
|
||||||
// dialog?.setPositiveButton("실행") { s, d ->
|
dialog?.setPositiveButton("실행") { s, d ->
|
||||||
// runonUi {
|
runonUi {
|
||||||
// startActivity(packageManager?.getLaunchIntentForPackage(packageList[0].pkgName!!))
|
startActivity(packageManager?.getLaunchIntentForPackage(packageList[0].pkgName!!))
|
||||||
// s.dismiss()
|
s.dismiss()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// } else if (filted.size > 0) {
|
} else if (filted.size > 0) {
|
||||||
// dialog?.setMessage("${keyword} 검색 결과 '${filted[0].appName}' 준비됨")
|
dialog?.setMessage("${keyword} 검색 결과 '${filted[0].appName}' 준비됨")
|
||||||
// dialog?.setPositiveButton("${filted[0].appName} 실행") { s, d ->
|
dialog?.setPositiveButton("${filted[0].appName} 실행") { s, d ->
|
||||||
// runonUi {
|
runonUi {
|
||||||
// startActivity(packageManager?.getLaunchIntentForPackage(filted[0].pkgName!!))
|
startActivity(packageManager?.getLaunchIntentForPackage(filted[0].pkgName!!))
|
||||||
// s.dismiss()
|
s.dismiss()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// if(filted.size > 1) {
|
if(filted.size > 1) {
|
||||||
// dialog?.setNeutralButton("${filted[1].appName} 실행") { s, d ->
|
dialog?.setNeutralButton("${filted[1].appName} 실행") { s, d ->
|
||||||
// runonUi {
|
runonUi {
|
||||||
// startActivity(packageManager?.getLaunchIntentForPackage(filted[1].pkgName!!))
|
startActivity(packageManager?.getLaunchIntentForPackage(filted[1].pkgName!!))
|
||||||
// s.dismiss()
|
s.dismiss()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// dialog?.setCancelable(false)
|
dialog?.setCancelable(false)
|
||||||
// dialog?.setNegativeButton("취소") { s, d ->
|
dialog?.setNegativeButton("취소") { s, d ->
|
||||||
// runonUi { s.dismiss() }
|
runonUi { s.dismiss() }
|
||||||
// }
|
}
|
||||||
// dialog?.setOnDismissListener { registCancelSearch() }
|
dialog?.setOnDismissListener { registCancelSearch() }
|
||||||
// dialog?.show()
|
dialog?.show()
|
||||||
// } else if (contactList.size == 1 || filtedContact.size > 0) {
|
} else if (contactList.size == 1 || filtedContact.size > 0) {
|
||||||
// dialog = AlertDialog.Builder(requireContext())
|
dialog = AlertDialog.Builder(requireContext())
|
||||||
// dialog?.setTitle("연락처 실행 확인")
|
dialog?.setTitle("연락처 실행 확인")
|
||||||
// dialog?.setCancelable(false)
|
dialog?.setCancelable(false)
|
||||||
// dialog?.setNegativeButton("취소") { s, d ->
|
dialog?.setNegativeButton("취소") { s, d ->
|
||||||
// runonUi { s.dismiss() }
|
runonUi { s.dismiss() }
|
||||||
// }
|
}
|
||||||
// if (contactList.size == 1) {
|
if (contactList.size == 1) {
|
||||||
// dialog?.setMessage("${keyword} 검색 결과 '${contactList[0].name}' 준비됨")
|
dialog?.setMessage("${keyword} 검색 결과 '${contactList[0].name}' 준비됨")
|
||||||
// dialog?.setPositiveButton("자세히 보기") { s, d ->
|
dialog?.setPositiveButton("자세히 보기") { s, d ->
|
||||||
// runonUi {
|
runonUi {
|
||||||
// ContactMenu().show(childFragmentManager, contactList[0].id.toString())
|
ContactMenu().show(childFragmentManager, contactList[0].id.toString())
|
||||||
// s.dismiss()
|
s.dismiss()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// } else if(filtedContact.size > 0) {
|
} else if(filtedContact.size > 0) {
|
||||||
// dialog?.setMessage("${keyword} 검색 결과 '${filtedContact[0].name}' 준비됨")
|
dialog?.setMessage("${keyword} 검색 결과 '${filtedContact[0].name}' 준비됨")
|
||||||
// dialog?.setPositiveButton("'${filtedContact[0].name},\n${filtedContact[0].phoneNumber}'\n자세히 보기") { s, d ->
|
dialog?.setPositiveButton("'${filtedContact[0].name},\n${filtedContact[0].phoneNumber}'\n자세히 보기") { s, d ->
|
||||||
// runonUi {
|
runonUi {
|
||||||
// ContactMenu().show(childFragmentManager, filtedContact[0].id.toString())
|
ContactMenu().show(childFragmentManager, filtedContact[0].id.toString())
|
||||||
// s.dismiss()
|
s.dismiss()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// if (filtedContact.size > 1) {
|
if (filtedContact.size > 1) {
|
||||||
// dialog?.setNeutralButton("'${filtedContact[1].name},\n${filtedContact[1].phoneNumber}'\n자세히 보기") { s, d ->
|
dialog?.setNeutralButton("'${filtedContact[1].name},\n${filtedContact[1].phoneNumber}'\n자세히 보기") { s, d ->
|
||||||
// runonUi {
|
runonUi {
|
||||||
// ContactMenu().show(childFragmentManager, filtedContact[1].id.toString())
|
ContactMenu().show(childFragmentManager, filtedContact[1].id.toString())
|
||||||
// s.dismiss()
|
s.dismiss()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// dialog?.setOnDismissListener { registCancelSearch() }
|
dialog?.setOnDismissListener { registCancelSearch() }
|
||||||
// dialog?.show()
|
dialog?.show()
|
||||||
// } else {
|
} else {
|
||||||
lActivity?.openSearchMenus(keyword) {
|
lActivity?.openSearchMenus(keyword) {
|
||||||
registCancelSearch()
|
registCancelSearch()
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,12 +39,16 @@ import android.view.ViewGroup
|
|||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.appcompat.widget.LinearLayoutCompat.LayoutParams
|
||||||
import androidx.appcompat.widget.PopupMenu
|
import androidx.appcompat.widget.PopupMenu
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.work.ExistingPeriodicWorkPolicy
|
||||||
|
import androidx.work.PeriodicWorkRequestBuilder
|
||||||
import com.google.android.material.button.MaterialButtonToggleGroup
|
import com.google.android.material.button.MaterialButtonToggleGroup
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
@ -58,8 +62,9 @@ import rasel.lunar.launcher.CommadCallabck
|
|||||||
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetHost
|
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetHost
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetManager
|
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetManager
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
||||||
|
import rasel.lunar.launcher.LauncherActivity.Companion.refreshCalls
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.refreshFeeds
|
import rasel.lunar.launcher.LauncherActivity.Companion.refreshFeeds
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.refreshDeviceData
|
import rasel.lunar.launcher.LauncherActivity.Companion.refreshSms
|
||||||
import rasel.lunar.launcher.R
|
import rasel.lunar.launcher.R
|
||||||
import rasel.lunar.launcher.databinding.FeedsBinding
|
import rasel.lunar.launcher.databinding.FeedsBinding
|
||||||
import rasel.lunar.launcher.feeds.rss.RssAdapter
|
import rasel.lunar.launcher.feeds.rss.RssAdapter
|
||||||
@ -77,11 +82,13 @@ import rasel.lunar.launcher.model.MostItem
|
|||||||
import rasel.lunar.launcher.model.RssData
|
import rasel.lunar.launcher.model.RssData
|
||||||
import rasel.lunar.launcher.model.RssDataInterface
|
import rasel.lunar.launcher.model.RssDataInterface
|
||||||
import rasel.lunar.launcher.model.RssDataType
|
import rasel.lunar.launcher.model.RssDataType
|
||||||
|
import rasel.lunar.launcher.model.RssItem
|
||||||
import rasel.lunar.launcher.model.RssTagItem
|
import rasel.lunar.launcher.model.RssTagItem
|
||||||
import rasel.lunar.launcher.model.dateFormat
|
import rasel.lunar.launcher.model.dateFormat
|
||||||
import rasel.lunar.launcher.model.getRssData
|
import rasel.lunar.launcher.model.getRssData
|
||||||
import rasel.lunar.launcher.utils.BLog
|
import rasel.lunar.launcher.utils.BLog
|
||||||
import rasel.lunar.launcher.utils.RssList.jGuruMain
|
import rasel.lunar.launcher.utils.RssList.jGuruMain
|
||||||
|
import rasel.lunar.launcher.workers.RecentCallGetter
|
||||||
import rasel.lunar.launcher.workers.WorkersDb
|
import rasel.lunar.launcher.workers.WorkersDb
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
@ -308,7 +315,8 @@ internal class Feeds : Fragment() , CommadCallabck {
|
|||||||
|
|
||||||
"req" -> {
|
"req" -> {
|
||||||
refreshFeeds()
|
refreshFeeds()
|
||||||
refreshDeviceData()
|
refreshCalls()
|
||||||
|
refreshSms()
|
||||||
consoleLog("excute refreshFeeds()")
|
consoleLog("excute refreshFeeds()")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,36 +19,42 @@
|
|||||||
package rasel.lunar.launcher.home
|
package rasel.lunar.launcher.home
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.ContentUris
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import android.os.PatternMatcher
|
||||||
import android.provider.AlarmClock
|
import android.provider.AlarmClock
|
||||||
import android.provider.MediaStore
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.View.OnScrollChangeListener
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
|
import android.widget.RadioGroup
|
||||||
import android.widget.TableRow
|
import android.widget.TableRow
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.biometric.BiometricPrompt
|
import androidx.biometric.BiometricPrompt
|
||||||
import androidx.core.net.toUri
|
import androidx.core.content.ContextCompat.RECEIVER_EXPORTED
|
||||||
|
import androidx.core.content.ContextCompat.registerReceiver
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||||
|
import com.google.gson.Gson
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
import io.realm.kotlin.notifications.InitialResults
|
import io.realm.kotlin.notifications.InitialResults
|
||||||
import io.realm.kotlin.notifications.ResultsChange
|
import io.realm.kotlin.notifications.ResultsChange
|
||||||
@ -59,12 +65,16 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
import org.jsoup.Jsoup
|
||||||
|
import rasel.lunar.launcher.CommadCallabck
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.CALL_WORK_TAG
|
import rasel.lunar.launcher.LauncherActivity.Companion.CALL_WORK_TAG
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.SMS_WORK_TAG
|
import rasel.lunar.launcher.LauncherActivity.Companion.SMS_WORK_TAG
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
||||||
|
import rasel.lunar.launcher.LauncherActivity.Companion.refreshFeeds
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.workmanager
|
import rasel.lunar.launcher.LauncherActivity.Companion.workmanager
|
||||||
import rasel.lunar.launcher.R
|
import rasel.lunar.launcher.R
|
||||||
import rasel.lunar.launcher.databinding.LauncherHomeBinding
|
import rasel.lunar.launcher.databinding.LauncherHomeBinding
|
||||||
@ -76,19 +86,21 @@ import rasel.lunar.launcher.helpers.UniUtils.Companion.biometricPromptInfo
|
|||||||
import rasel.lunar.launcher.helpers.UniUtils.Companion.canAuthenticate
|
import rasel.lunar.launcher.helpers.UniUtils.Companion.canAuthenticate
|
||||||
import rasel.lunar.launcher.helpers.UniUtils.Companion.expandNotificationPanel
|
import rasel.lunar.launcher.helpers.UniUtils.Companion.expandNotificationPanel
|
||||||
import rasel.lunar.launcher.helpers.UniUtils.Companion.lockMethod
|
import rasel.lunar.launcher.helpers.UniUtils.Companion.lockMethod
|
||||||
import rasel.lunar.launcher.model.CurrentPlayItem
|
import rasel.lunar.launcher.home.weather.WeatherExecutor
|
||||||
|
import rasel.lunar.launcher.model.CiliMagnet
|
||||||
import rasel.lunar.launcher.model.NotificationItem
|
import rasel.lunar.launcher.model.NotificationItem
|
||||||
import rasel.lunar.launcher.model.RssData
|
import rasel.lunar.launcher.model.RssData
|
||||||
import rasel.lunar.launcher.model.RssDataInterface
|
|
||||||
import rasel.lunar.launcher.model.RssDataType
|
|
||||||
import rasel.lunar.launcher.qaccess.QuickAccess
|
import rasel.lunar.launcher.qaccess.QuickAccess
|
||||||
import rasel.lunar.launcher.settings.SettingsActivity
|
import rasel.lunar.launcher.settings.SettingsActivity
|
||||||
import rasel.lunar.launcher.todos.MissedCallsAdapter
|
import rasel.lunar.launcher.todos.MissedCallsAdapter
|
||||||
|
import rasel.lunar.launcher.model.RssDataInterface
|
||||||
|
import rasel.lunar.launcher.model.RssDataType
|
||||||
import rasel.lunar.launcher.todos.NotificationItemAdapter
|
import rasel.lunar.launcher.todos.NotificationItemAdapter
|
||||||
import rasel.lunar.launcher.todos.RssItemAdapter
|
import rasel.lunar.launcher.todos.RssItemAdapter
|
||||||
import rasel.lunar.launcher.todos.SmsLogsAdapter
|
import rasel.lunar.launcher.todos.SmsLogsAdapter
|
||||||
import rasel.lunar.launcher.utils.BLog
|
import rasel.lunar.launcher.utils.BLog
|
||||||
import rasel.lunar.launcher.utils.JamoUtils
|
import rasel.lunar.launcher.utils.JamoUtils
|
||||||
|
import rasel.lunar.launcher.utils.RssList.jGuruMain
|
||||||
import rasel.lunar.launcher.utils.SimpleFingerGestures
|
import rasel.lunar.launcher.utils.SimpleFingerGestures
|
||||||
import rasel.lunar.launcher.utils.beforeDay
|
import rasel.lunar.launcher.utils.beforeDay
|
||||||
import rasel.lunar.launcher.view.TableRadioGroup
|
import rasel.lunar.launcher.view.TableRadioGroup
|
||||||
@ -96,6 +108,8 @@ import rasel.lunar.launcher.workers.RecentCall
|
|||||||
import rasel.lunar.launcher.workers.RecentSms
|
import rasel.lunar.launcher.workers.RecentSms
|
||||||
import rasel.lunar.launcher.workers.WorkersDb
|
import rasel.lunar.launcher.workers.WorkersDb
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
import java.nio.charset.Charset
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
@ -208,34 +222,9 @@ internal class LauncherHome : Fragment() {
|
|||||||
it.clear()
|
it.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalScope.launch {
|
// nReceiver = NotificationReceiver()
|
||||||
WorkersDb.getRealm().apply {
|
// val filter = IntentFilter()
|
||||||
query<CurrentPlayItem>().find().asFlow().collect { changes: ResultsChange<CurrentPlayItem> ->
|
// registerReceiver(requireContext(),nReceiver, filter,RECEIVER_EXPORTED)
|
||||||
binding.currentMusic?.postDelayed({
|
|
||||||
if (changes.list.size > 0) {
|
|
||||||
changes.list?.first()?.let {
|
|
||||||
binding.currentMusic.visibility = View.VISIBLE
|
|
||||||
binding.artist.text = it.artists
|
|
||||||
binding.title.text = it.title
|
|
||||||
|
|
||||||
val albumArtUri = it.albumArt?.toUri()
|
|
||||||
var bitmap: Bitmap? = null
|
|
||||||
try {
|
|
||||||
bitmap = MediaStore.Images.Media.getBitmap(
|
|
||||||
requireContext().contentResolver,
|
|
||||||
albumArtUri
|
|
||||||
)
|
|
||||||
binding.albumArt.setImageBitmap(bitmap)
|
|
||||||
} catch (exception: java.lang.Exception) {
|
|
||||||
// log error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
binding.currentMusic.visibility = View.GONE
|
|
||||||
}}, 150L)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BLog.LOGE("onCreateView()")
|
BLog.LOGE("onCreateView()")
|
||||||
|
|
||||||
@ -616,7 +605,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
} else if(binding.recentSms.isSelected){
|
} else if(binding.recentSms.isSelected){
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
val result = query<RecentSms>().query("rcvDate >= $0 OR pstDate >= $0 ", dateParam)
|
val result = query<RecentSms>().query("rcvDate >= $0 OR pstDate >= $0 ", dateParam)
|
||||||
.sort("rcvDate",Sort.DESCENDING).find()
|
.sort(Pair("pstDate",Sort.DESCENDING),Pair("rcvDate", Sort.DESCENDING)).find()
|
||||||
if (result.size > 0) {
|
if (result.size > 0) {
|
||||||
try {
|
try {
|
||||||
BLog.LOGE("observeForever smsList.size >>> ${result.size}")
|
BLog.LOGE("observeForever smsList.size >>> ${result.size}")
|
||||||
@ -624,8 +613,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.smsList.visibility = View.VISIBLE
|
binding.smsList.visibility = View.VISIBLE
|
||||||
smsList.clear()
|
smsList.clear()
|
||||||
smsList.addAll(copyFromRealm(result))
|
smsList.addAll(copyFromRealm(result))
|
||||||
mSmsLogsAdapter.
|
mSmsLogsAdapter.updateData(smsList)
|
||||||
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
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
package rasel.lunar.launcher.model
|
|
||||||
|
|
||||||
import io.realm.kotlin.types.RealmObject
|
|
||||||
import io.realm.kotlin.types.annotations.PrimaryKey
|
|
||||||
|
|
||||||
class CurrentPlayItem : RealmObject {
|
|
||||||
@PrimaryKey
|
|
||||||
var uniqId = "RPrimaryKey"
|
|
||||||
var title : String? = ""
|
|
||||||
var artists : String? = ""
|
|
||||||
var albumArt : String? = ""
|
|
||||||
var state : Int = 0
|
|
||||||
}
|
|
||||||
@ -1,22 +1,17 @@
|
|||||||
package rasel.lunar.launcher.utils
|
package rasel.lunar.launcher.utils
|
||||||
|
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.ComponentName
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.media.MediaMetadata
|
|
||||||
import android.media.session.MediaSessionManager
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.service.notification.NotificationListenerService
|
import android.service.notification.NotificationListenerService
|
||||||
import android.service.notification.StatusBarNotification
|
import android.service.notification.StatusBarNotification
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.content.getSystemService
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
import rasel.lunar.launcher.model.CurrentPlayItem
|
|
||||||
import rasel.lunar.launcher.model.NotificationItem
|
import rasel.lunar.launcher.model.NotificationItem
|
||||||
import rasel.lunar.launcher.workers.WorkersDb
|
import rasel.lunar.launcher.workers.WorkersDb
|
||||||
import java.security.AccessController.getContext
|
import java.security.AccessController.getContext
|
||||||
@ -61,56 +56,6 @@ class NLService : NotificationListenerService() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val m = getSystemService<MediaSessionManager>()!!
|
|
||||||
val component = ComponentName(this, NLService::class.java)
|
|
||||||
val sessions = m.getActiveSessions(component)
|
|
||||||
BLog.LOGE("Sessions", "count: ${sessions.size}")
|
|
||||||
if (sbn.packageName.contains("youtube")) {
|
|
||||||
sessions.forEach { session ->
|
|
||||||
WorkersDb.getRealm().writeBlocking {
|
|
||||||
if (session.playbackState?.isActive == true) {
|
|
||||||
val result = query<CurrentPlayItem>().find()
|
|
||||||
var current : CurrentPlayItem? = null
|
|
||||||
if (result.size > 0) {
|
|
||||||
current = result.first()
|
|
||||||
} else {
|
|
||||||
current = CurrentPlayItem()
|
|
||||||
copyToRealm(current)
|
|
||||||
}
|
|
||||||
BLog.LOGE(
|
|
||||||
"Sessions",
|
|
||||||
"$session -- " + (session.playbackState?.state)
|
|
||||||
)
|
|
||||||
BLog.LOGE(
|
|
||||||
"Sessions",
|
|
||||||
"$session -- " + (session?.metadata?.keySet()?.joinToString())
|
|
||||||
)
|
|
||||||
BLog.LOGE(
|
|
||||||
"Sessions",
|
|
||||||
"$session -- " + (session?.metadata?.getString(MediaMetadata.METADATA_KEY_ARTIST))
|
|
||||||
)
|
|
||||||
if (session?.metadata?.containsKey(MediaMetadata.METADATA_KEY_ALBUM_ART) == true) {
|
|
||||||
BLog.LOGE(
|
|
||||||
"Sessions",
|
|
||||||
"$session -- " + (session?.metadata?.getBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
BLog.LOGE(
|
|
||||||
"Sessions",
|
|
||||||
"$session -- " + (session?.metadata?.getString(MediaMetadata.METADATA_KEY_TITLE))
|
|
||||||
)
|
|
||||||
current.title = session?.metadata?.getString(MediaMetadata.METADATA_KEY_TITLE)
|
|
||||||
current.artists = session?.metadata?.getString(MediaMetadata.METADATA_KEY_ARTIST)
|
|
||||||
|
|
||||||
// current.albumArt = session?.metadata?.getBitmap(MediaMetadata.METADATA_KEY_ALBUM)
|
|
||||||
} else {
|
|
||||||
delete(query<CurrentPlayItem>().find())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// val i = Intent("com.kpbird.nlsexample.NOTIFICATION_LISTENER_EXAMPLE")
|
// val i = Intent("com.kpbird.nlsexample.NOTIFICATION_LISTENER_EXAMPLE")
|
||||||
// i.putExtra("notification_event", "onNotificationPosted :" + sbn.packageName + "\n")
|
// i.putExtra("notification_event", "onNotificationPosted :" + sbn.packageName + "\n")
|
||||||
// sendBroadcast(i)
|
// sendBroadcast(i)
|
||||||
|
|||||||
@ -4,12 +4,10 @@ import com.google.gson.Gson
|
|||||||
import io.realm.kotlin.Realm
|
import io.realm.kotlin.Realm
|
||||||
import io.realm.kotlin.RealmConfiguration
|
import io.realm.kotlin.RealmConfiguration
|
||||||
import io.realm.kotlin.UpdatePolicy
|
import io.realm.kotlin.UpdatePolicy
|
||||||
import io.realm.kotlin.ext.query
|
|
||||||
import io.realm.kotlin.types.BaseRealmObject
|
import io.realm.kotlin.types.BaseRealmObject
|
||||||
import io.realm.kotlin.types.TypedRealmObject
|
import io.realm.kotlin.types.TypedRealmObject
|
||||||
import rasel.lunar.launcher.apps.SimpleContact
|
import rasel.lunar.launcher.apps.SimpleContact
|
||||||
import rasel.lunar.launcher.model.AppInfo
|
import rasel.lunar.launcher.model.AppInfo
|
||||||
import rasel.lunar.launcher.model.CurrentPlayItem
|
|
||||||
import rasel.lunar.launcher.model.NotificationItem
|
import rasel.lunar.launcher.model.NotificationItem
|
||||||
import rasel.lunar.launcher.model.RssData
|
import rasel.lunar.launcher.model.RssData
|
||||||
import rasel.lunar.launcher.model.RssDataInterface
|
import rasel.lunar.launcher.model.RssDataInterface
|
||||||
@ -19,8 +17,7 @@ import kotlin.reflect.KClass
|
|||||||
|
|
||||||
object WorkersDb {
|
object WorkersDb {
|
||||||
|
|
||||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class)
|
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class)
|
||||||
|
|
||||||
val schemaVersion : Long = 0L
|
val schemaVersion : Long = 0L
|
||||||
|
|
||||||
private var pRealm : Realm? = null
|
private var pRealm : Realm? = null
|
||||||
@ -125,16 +122,4 @@ object WorkersDb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateAppUse(pkg : String) {
|
|
||||||
getRealm().writeBlocking {
|
|
||||||
val result = query<AppInfo>().query("pkgName == $0",pkg).find()
|
|
||||||
if(result.size > 0) {
|
|
||||||
val appInfo = result.first()
|
|
||||||
appInfo.clickCount = appInfo.clickCount + 1
|
|
||||||
appInfo.lastUseDate = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -96,37 +96,6 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/time"
|
app:layout_constraintTop_toBottomOf="@+id/time"
|
||||||
app:layout_constraintVertical_bias="0.100" />
|
app:layout_constraintVertical_bias="0.100" />
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/current_music"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/weather"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<ImageView
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:id="@+id/album_art"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_alignLeft="@id/album_art"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:id="@+id/artist"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_alignLeft="@id/album_art"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@id/artist"
|
|
||||||
android:id="@+id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
@ -138,7 +107,7 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/current_music"
|
app:layout_constraintTop_toBottomOf="@+id/weather"
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user