...
This commit is contained in:
parent
5929aee345
commit
87263747f3
@ -97,6 +97,7 @@ 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.RssList.jGuruMain
|
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
|
||||||
@ -122,7 +123,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
companion object {
|
companion object {
|
||||||
var home : LauncherHome? = null
|
var home : LauncherHome? = null
|
||||||
var lastedFinishedPageUrl : String = ""
|
var lastedFinishedPageUrl : String = ""
|
||||||
var recentCalls = hashMapOf<String, 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>()
|
||||||
@ -180,7 +181,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
mRssAdapter = RssItemAdapter(requireContext())
|
mRssAdapter = RssItemAdapter(requireContext())
|
||||||
|
|
||||||
val decoration = DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL)
|
val decoration = DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL)
|
||||||
binding.mainList.addItemDecoration(decoration)
|
|
||||||
binding.notiList.addItemDecoration(decoration)
|
binding.notiList.addItemDecoration(decoration)
|
||||||
binding.infoList.addItemDecoration(decoration)
|
binding.infoList.addItemDecoration(decoration)
|
||||||
binding.missedCalls.isSelected = true
|
binding.missedCalls.isSelected = true
|
||||||
@ -188,7 +189,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.infoList.visibility = View.GONE
|
binding.infoList.visibility = View.GONE
|
||||||
|
|
||||||
binding.notiList.layoutManager = LinearLayoutManager(requireContext())
|
binding.notiList.layoutManager = LinearLayoutManager(requireContext())
|
||||||
binding.mainList.layoutManager = LinearLayoutManager(requireContext())
|
binding.mainList.layoutManager = GridLayoutManager(requireContext(),2)
|
||||||
binding.smsList.layoutManager = GridLayoutManager(requireContext(),2)
|
binding.smsList.layoutManager = GridLayoutManager(requireContext(),2)
|
||||||
binding.infoList.layoutManager = LinearLayoutManager(requireContext())
|
binding.infoList.layoutManager = LinearLayoutManager(requireContext())
|
||||||
|
|
||||||
@ -351,8 +352,13 @@ internal class LauncherHome : Fragment() {
|
|||||||
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)
|
||||||
keyword.split("").forEach {
|
keyword.split("").forEach {
|
||||||
|
if (Character.codePointAt(it, 0) in 0xAC00..0xD79D) {
|
||||||
|
rQ = rQ.query("title CONTAINS $0 OR chosung CONTAINS $1 ", it, JamoUtils.splitOne(it))
|
||||||
|
} else {
|
||||||
rQ = rQ.query("title CONTAINS $0 OR title CONTAINS $1", it.toUpperCase(), it.toLowerCase())
|
rQ = rQ.query("title CONTAINS $0 OR title CONTAINS $1", it.toUpperCase(), it.toLowerCase())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
category?.let {
|
category?.let {
|
||||||
rQ = rQ.query("category == $0", it)
|
rQ = rQ.query("category == $0", it)
|
||||||
}
|
}
|
||||||
@ -571,9 +577,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
if (recentCalls.size > 0) {
|
if (recentCalls.size > 0) {
|
||||||
try {
|
try {
|
||||||
callList.clear()
|
callList.clear()
|
||||||
recentCalls.forEach { t, u ->
|
callList.addAll(recentCalls)
|
||||||
callList.add(u)
|
|
||||||
}.apply {
|
|
||||||
callList.sortByDescending { it.date }
|
callList.sortByDescending { it.date }
|
||||||
// Handler(Looper.getMainLooper()).post {
|
// Handler(Looper.getMainLooper()).post {
|
||||||
binding.mainList.visibility = View.VISIBLE
|
binding.mainList.visibility = View.VISIBLE
|
||||||
@ -581,8 +585,6 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.recentSms.isSelected = false
|
binding.recentSms.isSelected = false
|
||||||
binding.otherCheck.isSelected = false
|
binding.otherCheck.isSelected = false
|
||||||
binding.notice.isSelected = false
|
binding.notice.isSelected = false
|
||||||
// }
|
|
||||||
}
|
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import io.realm.kotlin.types.annotations.Ignore
|
|||||||
import io.realm.kotlin.types.annotations.PrimaryKey
|
import io.realm.kotlin.types.annotations.PrimaryKey
|
||||||
import org.jsoup.select.Elements
|
import org.jsoup.select.Elements
|
||||||
import rasel.lunar.launcher.utils.BLog
|
import rasel.lunar.launcher.utils.BLog
|
||||||
|
import rasel.lunar.launcher.utils.JamoUtils
|
||||||
import rasel.lunar.launcher.utils.afterDay
|
import rasel.lunar.launcher.utils.afterDay
|
||||||
import rasel.lunar.launcher.utils.beforeDay
|
import rasel.lunar.launcher.utils.beforeDay
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
@ -192,6 +193,9 @@ class RssData : RealmObject, RssDataInterface {
|
|||||||
var thumbnail : String? = null
|
var thumbnail : String? = null
|
||||||
var pubDate : Long = 0L
|
var pubDate : Long = 0L
|
||||||
var category : String? = null
|
var category : String? = null
|
||||||
|
|
||||||
|
var chosung : String? = null
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
var mRssDataType : RssDataType? = null
|
var mRssDataType : RssDataType? = null
|
||||||
override fun title(): String {
|
override fun title(): String {
|
||||||
@ -200,6 +204,8 @@ class RssData : RealmObject, RssDataInterface {
|
|||||||
if(title?.length ?: 0 > 30) title?.substring(0,30).plus("...") else title ?: ""
|
if(title?.length ?: 0 > 30) title?.substring(0,30).plus("...") else title ?: ""
|
||||||
}
|
}
|
||||||
else -> title ?: ""
|
else -> title ?: ""
|
||||||
|
}.apply {
|
||||||
|
chosung = JamoUtils.split(this).joinToString { "" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.provider.CallLog
|
||||||
import android.provider.ContactsContract
|
import android.provider.ContactsContract
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -32,6 +33,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
||||||
import rasel.lunar.launcher.R
|
import rasel.lunar.launcher.R
|
||||||
|
import rasel.lunar.launcher.databinding.CalllogItemBinding
|
||||||
import rasel.lunar.launcher.databinding.ListItemBinding
|
import rasel.lunar.launcher.databinding.ListItemBinding
|
||||||
import rasel.lunar.launcher.databinding.TodoDialogBinding
|
import rasel.lunar.launcher.databinding.TodoDialogBinding
|
||||||
import rasel.lunar.launcher.helpers.UniUtils.Companion.copyToClipboard
|
import rasel.lunar.launcher.helpers.UniUtils.Companion.copyToClipboard
|
||||||
@ -49,7 +51,7 @@ internal class MissedCallsAdapter(
|
|||||||
private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer)
|
private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer)
|
||||||
|
|
||||||
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): MissedCallsHolder {
|
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): MissedCallsHolder {
|
||||||
val binding = ListItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)
|
val binding = CalllogItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)
|
||||||
return MissedCallsHolder(binding)
|
return MissedCallsHolder(binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,14 +63,26 @@ internal class MissedCallsAdapter(
|
|||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onBindViewHolder(holder: MissedCallsHolder, position: Int) {
|
override fun onBindViewHolder(holder: MissedCallsHolder, position: Int) {
|
||||||
val todo = callList[position]
|
val todo = callList[position]
|
||||||
holder.view.itemText.text = "\u25CF ${if(todo.name.equals("unknown")) todo.number else { todo.name}} , ${todo.typeString} : ${todo.count} : ${todo.date}"
|
holder.view.name.text = if(todo.name.equals("unknown")) todo.number else { todo.name}
|
||||||
|
|
||||||
|
when (todo.type) {
|
||||||
|
// CallLog.Calls.INCOMING_TYPE -> { dir = "INCOMING_TYPE" }
|
||||||
|
// CallLog.Calls.OUTGOING_TYPE -> { dir = "OUTGOING_TYPE" }
|
||||||
|
CallLog.Calls.MISSED_TYPE -> { holder.view.root.isSelected = true }
|
||||||
|
// CallLog.Calls.VOICEMAIL_TYPE -> { dir = "VOICEMAIL_TYPE" }
|
||||||
|
// CallLog.Calls.REJECTED_TYPE -> { dir = "REJECTED_TYPE" }
|
||||||
|
// CallLog.Calls.BLOCKED_TYPE -> { dir = "BLOCKED_TYPE" }
|
||||||
|
// CallLog.Calls.ANSWERED_EXTERNALLY_TYPE -> { dir = "ANSWERED_EXTERNALLY_TYPE" }
|
||||||
|
else -> { holder.view.root.isSelected = false }
|
||||||
|
}
|
||||||
|
// "\u25CF ${} , ${todo.typeString} : ${todo.count} : ${todo.date}"
|
||||||
|
holder.view.type.text = todo.typeString
|
||||||
/* multiline texts are enabled for TodoManager */
|
/* multiline texts are enabled for TodoManager */
|
||||||
holder.view.itemText.isSingleLine = false
|
holder.view.date.text = todo.date
|
||||||
/* launch edit or update dialog on item click */
|
/* launch edit or update dialog on item click */
|
||||||
holder.view.itemText.setOnClickListener { updateDialog(position) }
|
holder.view.root.setOnClickListener { updateDialog(position) }
|
||||||
/* copy texts on long click */
|
/* copy texts on long click */
|
||||||
holder.view.itemText.setOnLongClickListener {
|
holder.view.root.setOnLongClickListener {
|
||||||
|
|
||||||
// copyToClipboard(context, todo.name)
|
// copyToClipboard(context, todo.name)
|
||||||
var cId = getContactId(lActivity!!.contentResolver, todo.number)
|
var cId = getContactId(lActivity!!.contentResolver, todo.number)
|
||||||
@ -85,7 +99,7 @@ internal class MissedCallsAdapter(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class MissedCallsHolder(var view: ListItemBinding) : RecyclerView.ViewHolder(view.root)
|
inner class MissedCallsHolder(var view: CalllogItemBinding) : RecyclerView.ViewHolder(view.root)
|
||||||
|
|
||||||
/* update dialog */
|
/* update dialog */
|
||||||
private fun updateDialog(position: Int) {
|
private fun updateDialog(position: Int) {
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import rasel.lunar.launcher.R
|
|||||||
import rasel.lunar.launcher.databinding.ListItemBinding
|
import rasel.lunar.launcher.databinding.ListItemBinding
|
||||||
import rasel.lunar.launcher.databinding.SmsItemBinding
|
import rasel.lunar.launcher.databinding.SmsItemBinding
|
||||||
import rasel.lunar.launcher.utils.BLog
|
import rasel.lunar.launcher.utils.BLog
|
||||||
|
import rasel.lunar.launcher.utils.getContactName
|
||||||
import rasel.lunar.launcher.workers.RecentSms
|
import rasel.lunar.launcher.workers.RecentSms
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
@ -55,10 +56,14 @@ internal class SmsLogsAdapter(
|
|||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onBindViewHolder(holder: SmsLogHolder, position: Int) {
|
override fun onBindViewHolder(holder: SmsLogHolder, position: Int) {
|
||||||
val todo = smsList[position]
|
val todo = smsList[position]
|
||||||
|
var name = getContactName(lActivity!!.contentResolver,todo.person)
|
||||||
|
if (name == null) {
|
||||||
|
getContactName(lActivity!!.contentResolver,todo.addr)
|
||||||
|
}
|
||||||
if(todo.isMms) {
|
if(todo.isMms) {
|
||||||
var body = todo.mmsContents.get("text")?.joinToString("\n")?.replace("\n"," ")
|
var body = todo.mmsContents.get("text")?.joinToString("\n")?.replace("\n"," ")
|
||||||
body = if (body?.length ?: 0 > 60) body?.substring(0,60).plus("...") else body
|
body = if (body?.length ?: 0 > 60) body?.substring(0,60).plus("...") else body
|
||||||
holder.view.itemText.text = "\u25CF ${todo.person} ${todo.addr} : ${
|
holder.view.itemText.text = "\u25CF ${if(name != null && name.length > 0) name else if(todo.person != null && todo.person.length > 0){todo.person} else todo.addr} : ${
|
||||||
SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(
|
SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(
|
||||||
Date(
|
Date(
|
||||||
Math.max(
|
Math.max(
|
||||||
@ -70,7 +75,7 @@ internal class SmsLogsAdapter(
|
|||||||
} : ${todo.type}"
|
} : ${todo.type}"
|
||||||
holder.view.contents.text = "${body}"
|
holder.view.contents.text = "${body}"
|
||||||
} else {
|
} else {
|
||||||
holder.view.itemText.text = "\u25CF ${todo.person} ${todo.addr} : ${
|
holder.view.itemText.text = "\u25CF ${if(name != null && name.length > 0) name else if(todo.person != null && todo.person.length > 0){todo.person} else todo.addr} : ${
|
||||||
SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(
|
SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(
|
||||||
Date(
|
Date(
|
||||||
Math.max(
|
Math.max(
|
||||||
@ -80,9 +85,15 @@ internal class SmsLogsAdapter(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
} : ${todo.type}"
|
} : ${todo.type}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
holder.view.contents.text = "${todo.body}"
|
holder.view.contents.text = "${todo.body}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* multiline texts are enabled for TodoManager */
|
/* multiline texts are enabled for TodoManager */
|
||||||
// holder.view.itemText.isSingleLine = false
|
// holder.view.itemText.isSingleLine = false
|
||||||
/* launch edit or update dialog on item click */
|
/* launch edit or update dialog on item click */
|
||||||
@ -95,6 +106,7 @@ internal class SmsLogsAdapter(
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.view.root.isActivated = if(holder.view.itemText.text.contains("#CMAS#")) true else false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package rasel.lunar.launcher.utils
|
|||||||
|
|
||||||
import android.content.ContentResolver
|
import android.content.ContentResolver
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.provider.ContactsContract
|
||||||
import android.provider.ContactsContract.PhoneLookup
|
import android.provider.ContactsContract.PhoneLookup
|
||||||
|
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
@ -38,20 +39,21 @@ fun afterDay(date: Date?, day: Int): Long {
|
|||||||
|
|
||||||
|
|
||||||
fun getContactName(contentResolver: ContentResolver, phoneNumber: String?): String? {
|
fun getContactName(contentResolver: ContentResolver, phoneNumber: String?): String? {
|
||||||
val cr = contentResolver
|
|
||||||
val uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber))
|
|
||||||
val cursor =
|
|
||||||
cr.query(uri, arrayOf(PhoneLookup.DISPLAY_NAME), null, null, null)
|
|
||||||
?: return null
|
|
||||||
var contactName: String? = null
|
var contactName: String? = null
|
||||||
|
if (phoneNumber != null && phoneNumber.length > 0) {
|
||||||
|
val cr = contentResolver
|
||||||
|
val uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber))
|
||||||
|
val cursor =
|
||||||
|
cr.query(uri, arrayOf(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME), null, null, null)
|
||||||
|
?: return null
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
contactName = cursor.getString(cursor.getColumnIndexOrThrow(PhoneLookup.DISPLAY_NAME))
|
contactName = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor != null && !cursor.isClosed) {
|
if (cursor != null && !cursor.isClosed) {
|
||||||
cursor.close()
|
cursor.close()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return contactName
|
return contactName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
40
app/src/main/kotlin/rasel/lunar/launcher/utils/JamoUtils.kt
Normal file
40
app/src/main/kotlin/rasel/lunar/launcher/utils/JamoUtils.kt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package rasel.lunar.launcher.utils
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
|
||||||
|
object JamoUtils {
|
||||||
|
val CHOSUNG = listOf(
|
||||||
|
"ㄱ", "ㄲ", "ㄴ", "ㄷ", "ㄸ", "ㄹ", "ㅁ", "ㅂ", "ㅃ",
|
||||||
|
"ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅉ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ",
|
||||||
|
)
|
||||||
|
val JUNGSUNG = listOf(
|
||||||
|
"ㅏ", "ㅐ", "ㅑ", "ㅒ", "ㅓ", "ㅔ", "ㅕ", "ㅖ", "ㅗ", "ㅘ",
|
||||||
|
"ㅙ", "ㅚ", "ㅛ", "ㅜ", "ㅝ", "ㅞ", "ㅟ", "ㅠ", "ㅡ", "ㅢ", "ㅣ",
|
||||||
|
)
|
||||||
|
val JONGSUNG = listOf(
|
||||||
|
"", "ㄱ", "ㄲ", "ᆪ", "ᆫ", "ᆬ", "ᆭ", "ㄷ",
|
||||||
|
"ㄹ", "ᆰ", "ᆱ", "ᆲ", "ᆳ", "ᆴ", "ᆵ", "ᆶ", "ㅁ", "ㅂ", "ᆹ", "ᆺ", "ᆻ", "ᆼ",
|
||||||
|
"ᆽ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ",
|
||||||
|
)
|
||||||
|
|
||||||
|
fun split(target: String): List<String> {
|
||||||
|
return target.split("")
|
||||||
|
.filter(String::isNotEmpty)
|
||||||
|
.map(JamoUtils::splitOne)
|
||||||
|
.toList()
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SuspiciousIndentation")
|
||||||
|
fun splitOne(target: String): String {
|
||||||
|
val codePoint = Character.codePointAt(target, 0)
|
||||||
|
return if (codePoint in 0xAC00..0xD79D) {
|
||||||
|
val startValue = codePoint - 0xAC00
|
||||||
|
val jong = startValue % 28
|
||||||
|
val jung = (startValue - jong) / 28 % 21
|
||||||
|
val cho = ((startValue - jong) / 28 - jung) / 21
|
||||||
|
CHOSUNG[cho]
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -44,7 +44,7 @@ class RecentCallGetter : BaseGetter {
|
|||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
override fun realWork(): Result {
|
override fun realWork(): Result {
|
||||||
|
|
||||||
var dateParam = beforeDay(Date(),3).toString()
|
var dateParam = beforeDay(Date(),7).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,
|
||||||
@ -82,22 +82,14 @@ class RecentCallGetter : BaseGetter {
|
|||||||
CallLog.Calls.BLOCKED_TYPE -> { dir = "BLOCKED_TYPE" }
|
CallLog.Calls.BLOCKED_TYPE -> { dir = "BLOCKED_TYPE" }
|
||||||
CallLog.Calls.ANSWERED_EXTERNALLY_TYPE -> { dir = "ANSWERED_EXTERNALLY_TYPE" }
|
CallLog.Calls.ANSWERED_EXTERNALLY_TYPE -> { dir = "ANSWERED_EXTERNALLY_TYPE" }
|
||||||
}
|
}
|
||||||
var missed: RecentCall = if (recentCalls.containsKey(phNumber)) {
|
recentCalls.add(RecentCall(
|
||||||
recentCalls.get(phNumber)!!.apply {
|
|
||||||
count = count + 1
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
RecentCall(
|
|
||||||
1,
|
1,
|
||||||
callerName,
|
callerName,
|
||||||
phNumber,
|
phNumber,
|
||||||
dircode,
|
dircode,
|
||||||
dir,
|
dir,
|
||||||
SimpleDateFormat("yyy/MM/dd-HH:mm:ss").format(callDayTime)
|
SimpleDateFormat("yyy/MM/dd-HH:mm:ss").format(callDayTime)
|
||||||
)
|
))
|
||||||
}
|
|
||||||
// BLog.LOGE("missed put >>> ${missed.toJson()}")
|
|
||||||
recentCalls.put(phNumber, missed)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class RecentSmsGetter : BaseGetter {
|
|||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
override fun realWork(): Result {
|
override fun realWork(): Result {
|
||||||
var dateParam = beforeDay(Date(),3).toString()
|
var dateParam = beforeDay(Date(),7).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,
|
||||||
@ -301,7 +301,7 @@ internal class MmsQueryHelper(
|
|||||||
|
|
||||||
fun convertData(cursor: Cursor?) {
|
fun convertData(cursor: Cursor?) {
|
||||||
cursor ?: return
|
cursor ?: return
|
||||||
val dateTime = beforeDay(Date(),3)
|
val dateTime = beforeDay(Date(),7)
|
||||||
cursor.use {
|
cursor.use {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|||||||
6
app/src/main/res/color/sms_board.xml
Normal file
6
app/src/main/res/color/sms_board.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="#CCBB5555" android:state_selected="true"/>
|
||||||
|
<item android:color="#CCBBBB55" android:state_activated="true"/>
|
||||||
|
<item android:color="#44000000" />
|
||||||
|
</selector>
|
||||||
@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
|
|
||||||
<corners android:radius="15dp"/>
|
<corners android:radius="15dp"/>
|
||||||
<solid android:color="#44000000"/>
|
<solid android:color="#22CCCCCC"/>
|
||||||
|
<stroke android:color="@color/sms_board" android:width="2dp"/>
|
||||||
</shape>
|
</shape>
|
||||||
37
app/src/main/res/layout/calllog_item.xml
Normal file
37
app/src/main/res/layout/calllog_item.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/sms_bg"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="@dimen/zero"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/twelve"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/date"
|
||||||
|
android:layout_width="@dimen/zero"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/twelve"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/name"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/type"
|
||||||
|
android:layout_width="@dimen/zero"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/twelve"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/date"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
x
Reference in New Issue
Block a user