This commit is contained in:
lunaticbum 2024-09-19 13:39:49 +09:00
parent 3e8c29346d
commit ea3858ba1f
13 changed files with 238 additions and 107 deletions

View File

@ -136,6 +136,7 @@
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider" android:authorities="${applicationId}.fileprovider"
android:exported="false" android:exported="false"
android:enabled="true"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
@ -151,6 +152,7 @@
</intent-filter> </intent-filter>
</service> </service>
<receiver android:name=".LauncherActivity$EndCallReceiver" <receiver android:name=".LauncherActivity$EndCallReceiver"
android:enabled="true"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.PHONE_STATE" /> <action android:name="android.intent.action.PHONE_STATE" />
@ -158,6 +160,7 @@
</receiver> </receiver>
<receiver android:name=".LauncherActivity$SMSReceiver" <receiver android:name=".LauncherActivity$SMSReceiver"
android:exported="true" android:exported="true"
android:enabled="true"
android:permission="android.permission.BROADCAST_SMS"> android:permission="android.permission.BROADCAST_SMS">
<intent-filter> <intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" /> <action android:name="android.provider.Telephony.SMS_RECEIVED" />
@ -165,6 +168,27 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver
android:exported="true"
android:enabled="true"
android:name=".receiver.PackageEventReceiver"
>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_CHANGED"/>
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/>
<action android:name="android.intent.action.PACKAGE_FIRST_LAUNCH"/>
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
<action android:name="android.intent.action.PACKAGE_NEEDS_VERIFICATION"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<action android:name="android.intent.action.PACKAGE_RESTARTED"/>
<action android:name="android.intent.action.PACKAGE_VERIFIED"/>
<data android:scheme="package" />
</intent-filter>
</receiver>
</application> </application>
</manifest> </manifest>

View File

@ -76,6 +76,7 @@ import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.apps.AppDrawer import rasel.lunar.launcher.apps.AppDrawer
import rasel.lunar.launcher.apps.DismissCalback import rasel.lunar.launcher.apps.DismissCalback
import rasel.lunar.launcher.apps.SearchMenu import rasel.lunar.launcher.apps.SearchMenu
@ -164,7 +165,17 @@ internal class LauncherActivity : AppCompatActivity() {
PeriodicWorkRequestBuilder<RecentSmsGetter>(longTimePeriod, TimeUnit.MINUTES) PeriodicWorkRequestBuilder<RecentSmsGetter>(longTimePeriod, TimeUnit.MINUTES)
.addTag(SMS_WORK_TAG) .addTag(SMS_WORK_TAG)
.build()) .build())
}, 1, TimeUnit.SECONDS) }, 500, TimeUnit.MILLISECONDS)
Executors.newSingleThreadScheduledExecutor().schedule({
mWorkManager?.cancelAllWorkByTag(RecentCallGetter.TAG)
mWorkManager?.enqueueUniquePeriodicWork(
RecentCallGetter.TAG,
ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
PeriodicWorkRequestBuilder<RecentCallGetter>(longTimePeriod, TimeUnit.MINUTES)
.addTag(RecentCallGetter.TAG)
.build())
}, 500, TimeUnit.MILLISECONDS)
var delay = 3L var delay = 3L
Executors.newSingleThreadScheduledExecutor().schedule({ Executors.newSingleThreadScheduledExecutor().schedule({
mWorkManager?.cancelAllWorkByTag(ContactInfoGetter.TAG) mWorkManager?.cancelAllWorkByTag(ContactInfoGetter.TAG)
@ -184,15 +195,7 @@ internal class LauncherActivity : AppCompatActivity() {
.build()) .build())
}, delay, TimeUnit.SECONDS) }, delay, TimeUnit.SECONDS)
delay = delay + 3L delay = delay + 3L
Executors.newSingleThreadScheduledExecutor().schedule({
mWorkManager?.cancelAllWorkByTag(RecentCallGetter.TAG)
mWorkManager?.enqueueUniquePeriodicWork(
RecentCallGetter.TAG,
ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
PeriodicWorkRequestBuilder<RecentCallGetter>(longTimePeriod, TimeUnit.MINUTES)
.addTag(RecentCallGetter.TAG)
.build())
}, delay, TimeUnit.SECONDS)
} }
fun refreshFeeds() { fun refreshFeeds() {
@ -1051,3 +1054,47 @@ interface CommadCallabck {
fun onConsoleLog(log : String) fun onConsoleLog(log : String)
fun collectComplete() fun collectComplete()
} }
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.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
mapIntent.addCategory(Intent.CATEGORY_BROWSABLE)
mapIntent.setPackage("net.daum.android.cafe")
mapIntent.setData(gmmIntentUri)
lActivity?.startActivity(mapIntent)
}
fun openOpera(schemeString : String) {
BLog.LOGE("openOpera ${schemeString}")
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
mapIntent.setPackage("com.opera.browser")
lActivity?.startActivity(mapIntent)
}

View File

@ -51,9 +51,9 @@ internal class ContactAdapter (
override fun onBindViewHolder(holder: ContactViewHolder, i: Int) { override fun onBindViewHolder(holder: ContactViewHolder, i: Int) {
val item = oldList[i] val item = oldList[i]
BLog.LOGE("name >>> ${item.name} :: ${item.touchCount} :: ${RecentCallGetter.dateFormat.format( // BLog.LOGE("name >>> ${item.name} :: ${item.touchCount} :: ${RecentCallGetter.dateFormat.format(
Date(item.lastedTouchDateTime) // Date(item.lastedTouchDateTime)
)}") // )}")
holder.view.apply { holder.view.apply {
name.text = item.name name.text = item.name
@ -67,7 +67,7 @@ internal class ContactAdapter (
/* on long click - open app menu */ /* on long click - open app menu */
setOnLongClickListener { setOnLongClickListener {
BLog.LOGE("item.id.toString() >> ${item.id.toString()}") // BLog.LOGE("item.id.toString() >> ${item.id.toString()}")
ContactMenu().show(fragmentManager, item.id.toString()) ContactMenu().show(fragmentManager, item.id.toString())
true true
} }

View File

@ -82,7 +82,13 @@ import rasel.lunar.launcher.model.jGuruTag
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.JamoUtils
import rasel.lunar.launcher.utils.RssList.jGuruMain import rasel.lunar.launcher.utils.RssList.jGuruMain
import rasel.lunar.launcher.utils.USAGT
import rasel.lunar.launcher.utils.getJ
import rasel.lunar.launcher.workers.BaseGetter
import rasel.lunar.launcher.workers.RecentCallGetter
import rasel.lunar.launcher.workers.RecentSmsGetter
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
@ -199,7 +205,7 @@ internal class Feeds : Fragment() , CommadCallabck {
} }
val USAGT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15"
/* start rss service if network is active and rss url is not empty */ /* start rss service if network is active and rss url is not empty */
private fun startService() { private fun startService() {
try { try {
@ -218,6 +224,7 @@ internal class Feeds : Fragment() , CommadCallabck {
builder.setPositiveButton(android.R.string.ok, builder.setPositiveButton(android.R.string.ok,
DialogInterface.OnClickListener { dialog, which -> DialogInterface.OnClickListener { dialog, which ->
dialog.dismiss() dialog.dismiss()
BLog.LOGE("input.text.toString() >>>> ${input.text.toString()}")
if (input.text.toString().trim().contains(" ")) { if (input.text.toString().trim().contains(" ")) {
val cmd = input.text.toString().trim().split(" ") val cmd = input.text.toString().trim().split(" ")
when(cmd[0]) { when(cmd[0]) {
@ -275,7 +282,44 @@ internal class Feeds : Fragment() , CommadCallabck {
binding.expandRss.isChecked = false binding.expandRss.isChecked = false
} else { } else {
when (input.text.toString()) { when (input.text.toString()) {
"so" -> GlobalScope.launch {
"https://kr69.sogirl.so".getJ().let { doc ->
BLog.LOGE("ogirl >>> ${doc.title()}")
doc.getElementsByTag("article").forEach { article ->
BLog.LOGE("ogirl article >>> ${article.text()}")
val title = article.getElementsByTag("a").get(0).attr("title")
val href = article.getElementsByTag("a").get(0).attr("href")
val img = article.getElementsByTag("img").get(0).attr("data-src")
WorkersDb.getRealm().writeBlocking {
if (query<RssData>("originPage == $0", href).find().size == 0) {
RssData().apply {
this.originPage = href
this.title = title
this.description = "Sogirl"
this.thumbnail = img
this.pubDate = Date().time
this.category = RssDataType.GURU.name
this.chosung =
JamoUtils.split(title).joinToString("")
copyToRealm(this)
}
}
}
}
}
consoleLog("current j req() ${WorkersDb.getRealm()
.query<RssData>("category == $0", RssDataType.GURU.name).find().size}")
val urls = arrayOf("https://javmost.to/latest-updates",
"https://javmost.to/latest-updates/page-2",
"https://javmost.to/latest-updates/page-3",
"https://javmost.to/latest-updates/page-4",
"https://javmost.to/latest-updates/page-5")
urls.forEach { mostUrl ->
GlobalScope.launch {
excuteGetterMostByUrl(mostUrl)
}.start()
}
}
"ojs" -> home?.queryInfos(arrayListOf<RssDataType>().apply { "ojs" -> home?.queryInfos(arrayListOf<RssDataType>().apply {
addAll(RssDataType.values()) addAll(RssDataType.values())
remove(RssDataType.GURU) remove(RssDataType.GURU)
@ -292,26 +336,20 @@ internal class Feeds : Fragment() , CommadCallabck {
addAll(RssDataType.values()) addAll(RssDataType.values())
remove(RssDataType.REDDIT) remove(RssDataType.REDDIT)
}) })
"most" -> {
consoleLog("current j req() ${WorkersDb.getRealm()
.query<RssData>("category == $0", RssDataType.GURU.name).find().size}")
val urls = arrayOf("https://javmost.to/latest-updates",
"https://javmost.to/latest-updates/page-2",
"https://javmost.to/latest-updates/page-3",
"https://javmost.to/latest-updates/page-4",
"https://javmost.to/latest-updates/page-5")
GlobalScope.launch {
urls.forEach { mostUrl ->
excuteGetterMostByUrl(mostUrl)
}
}.start()
}
"req" -> { "req" -> {
refreshFeeds() refreshFeeds()
refreshDeviceData() refreshDeviceData()
consoleLog("excute refreshFeeds()") consoleLog("excute refreshFeeds()")
} }
"reqmax" -> {
RecentCallGetter.dayRange = 30
RecentSmsGetter.dayRange = 30
refreshFeeds()
refreshDeviceData()
consoleLog("excute refreshFeeds()")
}
"taxi" -> { "taxi" -> {
consoleLog("before run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}") consoleLog("before run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")

View File

@ -353,18 +353,17 @@ internal class LauncherHome : Fragment() {
} }
//limit(1000) //limit(1000)
mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find() mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find()
BLog.LOGE("${this} ::::: queryInfos after query 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}") // BLog.LOGE("${this} ::::: queryInfos after changes size >>>> ${changes.list.size}")
WorkersDb.getRealm().apply { WorkersDb.getRealm().apply {
lasted = copyFromRealm(changes.list) lasted = copyFromRealm(changes.list)
} }
commandHandler.postDelayed(infoUpdate, UPDATE_DELAY * 3) commandHandler.postDelayed(infoUpdate, UPDATE_DELAY * 3)
} }
is UpdatedResults -> { is UpdatedResults -> {
@ -415,15 +414,17 @@ internal class LauncherHome : Fragment() {
} }
} }
var queryString = "" var queryString = ""
category.forEachIndexed { idx , it -> if (category.size > 0) {
if (idx == 0) { category.forEachIndexed { idx, it ->
queryString = queryString.plus("category == '${it}'") if (idx == 0) {
} else { queryString = queryString.plus("category == '${it}'")
queryString = queryString.plus(" OR category == '${it}' ") } else {
queryString = queryString.plus(" OR category == '${it}' ")
}
} }
}
rQ = rQ.query(queryString) rQ = rQ.query(queryString)
}
BLog.LOGE("queryInfos rQ.description() >>>>> ${rQ.description()}") BLog.LOGE("queryInfos rQ.description() >>>>> ${rQ.description()}")
//limit(1000) //limit(1000)
mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find() mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find()
@ -487,8 +488,6 @@ internal class LauncherHome : Fragment() {
} }
var checkListner = object : View.OnClickListener { var checkListner = object : View.OnClickListener {
override fun onClick(v: View?) { override fun onClick(v: View?) {
var views = arrayListOf(binding.mainList, binding.smsList, binding.infoList, binding.notiList) var views = arrayListOf(binding.mainList, binding.smsList, binding.infoList, binding.notiList)
var chechboxs = arrayListOf(binding.missedCalls, var chechboxs = arrayListOf(binding.missedCalls,
@ -568,6 +567,11 @@ internal class LauncherHome : Fragment() {
val categoryz = viewInflated.findViewById<TableRadioGroup>(R.id.categoryz) as TableRadioGroup val categoryz = viewInflated.findViewById<TableRadioGroup>(R.id.categoryz) as TableRadioGroup
categoryz.setMaxColumns(5) categoryz.setMaxColumns(5)
categoryz.setMaxRows(5) categoryz.setMaxRows(5)
categoryz.setOnCheckedChangeListener(object : TableRadioGroup.OnCheckedChangeListener {
override fun onCheckedChanged(group: TableRadioGroup?, checkedId: Int) {
}
})
var idx = 0 var idx = 0
RssDataType.values().reversed().toList().chunked(5).forEach { RssDataType.values().reversed().toList().chunked(5).forEach {
var tb = TableRow(requireContext()) var tb = TableRow(requireContext())
@ -660,7 +664,7 @@ 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}") // 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() smsList.clear()
@ -842,7 +846,7 @@ internal class LauncherHome : Fragment() {
} }
override fun onClick(targetView: View,fingers: Int): Boolean { override fun onClick(targetView: View,fingers: Int): Boolean {
BLog.LOGE("onClick ${view} , fingers ${fingers}") // BLog.LOGE("onClick ${view} , fingers ${fingers}")
when(fingers) { when(fingers) {
1 -> { 1 -> {
if (view?.equals(binding.batteryProgress) ?: false && fingers == 1) { if (view?.equals(binding.batteryProgress) ?: false && fingers == 1) {

View File

@ -27,6 +27,7 @@ import android.provider.ContactsContract
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R import rasel.lunar.launcher.R
@ -128,10 +129,22 @@ internal class RecentCallsAdapter(
// } // }
// } // }
} }
var layoutManager : GridLayoutManager? = null
var recyclerView: RecyclerView? = null
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
layoutManager = recyclerView.layoutManager as? GridLayoutManager
this.recyclerView = recyclerView
}
fun updateData(newList: ArrayList<RecentCall>) { fun updateData(newList: ArrayList<RecentCall>) {
val diffUtilResult = DiffUtil.calculateDiff(RecentCallDiffUtil(callList, newList)) val diffUtilResult = DiffUtil.calculateDiff(RecentCallDiffUtil(callList, newList))
diffUtilResult.dispatchUpdatesTo(this) diffUtilResult.dispatchUpdatesTo(this).apply {
val visibleItemCount = (layoutManager?.findLastVisibleItemPosition() ?: 0) - (layoutManager?.findFirstVisibleItemPosition() ?: 0)
if (visibleItemCount > 0) {
this@RecentCallsAdapter.notifyItemRangeChanged(0, visibleItemCount)
recyclerView?.scrollToPosition(0)
}
}
// callList.clear() // callList.clear()
// callList.addAll(newList) // callList.addAll(newList)
} }

View File

@ -28,6 +28,8 @@ import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.imageview.ShapeableImageView import com.google.android.material.imageview.ShapeableImageView
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
@ -36,55 +38,15 @@ import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.ListItemWithBinding import rasel.lunar.launcher.databinding.ListItemWithBinding
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.openDotax
import rasel.lunar.launcher.openNews
import rasel.lunar.launcher.openOpera
import rasel.lunar.launcher.openReddit
import rasel.lunar.launcher.openYouTube
import rasel.lunar.launcher.utils.BLog import rasel.lunar.launcher.utils.BLog
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
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.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
mapIntent.addCategory(Intent.CATEGORY_BROWSABLE)
mapIntent.setPackage("net.daum.android.cafe")
mapIntent.setData(gmmIntentUri)
lActivity?.startActivity(mapIntent)
}
fun openOpera(schemeString : String) {
BLog.LOGE("openOpera ${schemeString}")
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
mapIntent.setPackage("com.opera.browser")
lActivity?.startActivity(mapIntent)
}
internal class RssItemAdapter ( internal class RssItemAdapter (
private val context: Context) : RecyclerView.Adapter<RssTag>() { private val context: Context) : RecyclerView.Adapter<RssTag>() {
@ -176,7 +138,12 @@ internal class RssItemAdapter (
holder.view.root.setOnLongClickListener(mLongClickListener) holder.view.root.setOnLongClickListener(mLongClickListener)
} }
var layoutManager : LinearLayoutManager? = null
var recyclerView: RecyclerView? = null
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
layoutManager = recyclerView.layoutManager as? LinearLayoutManager
this.recyclerView = recyclerView
}
fun updateData(newList: List<RssDataInterface>) { fun updateData(newList: List<RssDataInterface>) {
try { try {
@ -184,7 +151,11 @@ internal class RssItemAdapter (
DiffUtil.calculateDiff(RssItemDiffUtil(rssDataItemLis, newList)).apply { DiffUtil.calculateDiff(RssItemDiffUtil(rssDataItemLis, newList)).apply {
}.dispatchUpdatesTo(this).apply { }.dispatchUpdatesTo(this).apply {
// notifyItemRangeChanged(0,10) val visibleItemCount = (layoutManager?.findLastVisibleItemPosition() ?: 0) - (layoutManager?.findFirstVisibleItemPosition() ?: 0)
if (visibleItemCount > 0) {
this@RssItemAdapter.notifyItemRangeChanged(0, visibleItemCount)
recyclerView?.scrollToPosition(0)
}
} }
rssDataItemLis.clear() rssDataItemLis.clear()
rssDataItemLis.addAll(newList) rssDataItemLis.addAll(newList)

View File

@ -0,0 +1,19 @@
package rasel.lunar.launcher.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import rasel.lunar.launcher.utils.BLog
class PackageEventReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val action = intent.action
BLog.LOGE("action >>>> ${action}")
if (action == Intent.ACTION_PACKAGE_ADDED) {
}
}
}

View File

@ -0,0 +1,6 @@
package rasel.lunar.launcher.utils
import org.jsoup.Jsoup
val USAGT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15"
fun String.getJ() = Jsoup.connect("https://kr69.sogirl.so/").userAgent(USAGT).get()

View File

@ -129,7 +129,7 @@ class GestureAnalyser @JvmOverloads constructor(
) { ) {
return SWIPE_1_RIGHT return SWIPE_1_RIGHT
} }
BLog.LOGE("initialT = ${initialT} , finalT = ${finalT} , result = ${finalT - initialT}") // BLog.LOGE("initialT = ${initialT} , finalT = ${finalT} , result = ${finalT - initialT}")
if (finalT - initialT < 300) { if (finalT - initialT < 300) {
return CLICK_1 return CLICK_1
} else if(finalT - initialT > doubleTapMaxDelayMillis) { } else if(finalT - initialT > doubleTapMaxDelayMillis) {

View File

@ -12,7 +12,7 @@ import java.util.Date
open abstract class BaseGetter : Worker { open abstract class BaseGetter : Worker {
protected companion object { protected companion object {
var lastedUpdateTime = 0L var lastedUpdateTime = 0L
val defaultDay = 3
fun before10Min(): Long { fun before10Min(): Long {
val cal: Calendar = Calendar.getInstance() val cal: Calendar = Calendar.getInstance()
cal.setTime(Date()) cal.setTime(Date())
@ -37,7 +37,9 @@ open abstract class BaseGetter : Worker {
} }
} }
return realWork() return realWork().apply {
}
} }
abstract fun realWork() : Result abstract fun realWork() : Result
} }

View File

@ -52,6 +52,7 @@ class RecentCall : RealmObject {
class RecentCallGetter : BaseGetter { class RecentCallGetter : BaseGetter {
companion object{ companion object{
var dayRange = BaseGetter.defaultDay
val TAG = "RecentCallGetter" val TAG = "RecentCallGetter"
val dateFormat = SimpleDateFormat("yyy/MM/dd-HH:mm:ss") val dateFormat = SimpleDateFormat("yyy/MM/dd-HH:mm:ss")
} }
@ -61,7 +62,7 @@ class RecentCallGetter : BaseGetter {
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
override fun realWork(): Result { override fun realWork(): Result {
var dateParam = beforeDay(Date(),30).toString() var dateParam = beforeDay(Date(),3).toString()
var managedCursor = lActivity?.contentResolver?.query( var managedCursor = lActivity?.contentResolver?.query(
CallLog.Calls.CONTENT_URI, arrayOf( CallLog.Calls.CONTENT_URI, arrayOf(
CallLog.Calls.NUMBER, CallLog.Calls.NUMBER,
@ -110,7 +111,7 @@ class RecentCallGetter : BaseGetter {
callDuration.toLong() callDuration.toLong()
) )
call.uniqK?.let { call.uniqK?.let {
BLog.LOGE("${TAG} call.uniqK? >>> ${call.uniqK}") // BLog.LOGE("${TAG} call.uniqK? >>> ${call.uniqK}")
WorkersDb.getRealm().writeBlocking { WorkersDb.getRealm().writeBlocking {
if(query<RecentCall>().query("uniqK == $0", it).find().count() < 1) { if(query<RecentCall>().query("uniqK == $0", it).find().count() < 1) {
this.copyToRealm(call, UpdatePolicy.ALL) this.copyToRealm(call, UpdatePolicy.ALL)
@ -121,13 +122,13 @@ class RecentCallGetter : BaseGetter {
var contact = result.first() var contact = result.first()
contact.touchCount = contact.touchCount + 1 contact.touchCount = contact.touchCount + 1
contact.lastedTouchDateTime = Math.max(contact.lastedTouchDateTime, callDayTime) contact.lastedTouchDateTime = Math.max(contact.lastedTouchDateTime, callDayTime)
BLog.LOGE("${TAG} updatetouch info >>>> ${contact.touchCount}") // BLog.LOGE("${TAG} updatetouch info >>>> ${contact.touchCount}")
} }
} }
} }
BLog.LOGE("${TAG} updatetouch info >>>> BE ") // BLog.LOGE("${TAG} updatetouch info >>>> BE ")
} }
BLog.LOGE("${TAG} updatetouch info >>>> E") // BLog.LOGE("${TAG} updatetouch info >>>> E")
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -136,7 +137,9 @@ class RecentCallGetter : BaseGetter {
managedCursor.close() managedCursor.close()
} }
} }
return Result.success() return Result.success().apply {
dayRange = BaseGetter.defaultDay
}
} }
} }

View File

@ -26,7 +26,9 @@ import java.io.InputStreamReader
import java.util.Date import java.util.Date
class RecentSmsGetter : BaseGetter { class RecentSmsGetter : BaseGetter {
companion object {
var dayRange = BaseGetter.defaultDay
}
constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) { constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) {
} }
@ -36,7 +38,7 @@ class RecentSmsGetter : BaseGetter {
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
override fun realWork(): Result { override fun realWork(): Result {
var dateParam = beforeDay(Date(),30).toString() var dateParam = beforeDay(Date(),dayRange).toString()
val managedCursor = lActivity?.contentResolver?.query( val managedCursor = lActivity?.contentResolver?.query(
Telephony.Sms.CONTENT_URI, arrayOf( Telephony.Sms.CONTENT_URI, arrayOf(
Telephony.Sms.THREAD_ID, Telephony.Sms.THREAD_ID,
@ -107,7 +109,9 @@ class RecentSmsGetter : BaseGetter {
if (lActivity?.contentResolver != null) { if (lActivity?.contentResolver != null) {
MmsQueryHelper(lActivity?.contentResolver!!).query() MmsQueryHelper(lActivity?.contentResolver!!).query()
} }
return Result.success() return Result.success().apply {
dayRange = BaseGetter.defaultDay
}
} }
} }
@ -143,7 +147,7 @@ internal class RecentSms : RealmObject {
) { ) {
this.id = id this.id = id
this.uniqKey = id.plus("_").plus(addr).plus("_").plus(Math.max(rcvDate,pstDate)).plus("_SMS") this.uniqKey = id.plus("_").plus(addr).plus("_").plus(Math.max(rcvDate,pstDate)).plus("_SMS")
BLog.LOGE("sender ${sender} ::::: Id >> ${id} , addr ${addr}") // BLog.LOGE("sender ${sender} ::::: Id >> ${id} , addr ${addr}")
this.addr = addr this.addr = addr
this.type = type this.type = type
this.rcvDate = rcvDate this.rcvDate = rcvDate