Format some code
This commit is contained in:
parent
0a8273f676
commit
8fcd792a15
3 changed files with 47 additions and 14 deletions
|
|
@ -550,7 +550,7 @@ class MainActivity : SimpleActivity() {
|
||||||
private fun showSearchResults(
|
private fun showSearchResults(
|
||||||
messages: List<Message>,
|
messages: List<Message>,
|
||||||
conversations: List<Conversation>,
|
conversations: List<Conversation>,
|
||||||
searchedText: String
|
searchedText: String,
|
||||||
) {
|
) {
|
||||||
val searchResults = ArrayList<SearchResult>()
|
val searchResults = ArrayList<SearchResult>()
|
||||||
conversations.forEach { conversation ->
|
conversations.forEach { conversation ->
|
||||||
|
|
@ -637,8 +637,14 @@ class MainActivity : SimpleActivity() {
|
||||||
val licenses = LICENSE_EVENT_BUS or LICENSE_SMS_MMS or LICENSE_INDICATOR_FAST_SCROLL
|
val licenses = LICENSE_EVENT_BUS or LICENSE_SMS_MMS or LICENSE_INDICATOR_FAST_SCROLL
|
||||||
|
|
||||||
val faqItems = arrayListOf(
|
val faqItems = arrayListOf(
|
||||||
FAQItem(title = R.string.faq_2_title, text = R.string.faq_2_text),
|
FAQItem(
|
||||||
FAQItem(title = R.string.faq_3_title, text = R.string.faq_3_text),
|
title = R.string.faq_2_title,
|
||||||
|
text = R.string.faq_2_text
|
||||||
|
),
|
||||||
|
FAQItem(
|
||||||
|
title = R.string.faq_3_title,
|
||||||
|
text = R.string.faq_3_text
|
||||||
|
),
|
||||||
FAQItem(
|
FAQItem(
|
||||||
title = org.fossify.commons.R.string.faq_9_title_commons,
|
title = org.fossify.commons.R.string.faq_9_title_commons,
|
||||||
text = org.fossify.commons.R.string.faq_9_text_commons
|
text = org.fossify.commons.R.string.faq_9_text_commons
|
||||||
|
|
|
||||||
|
|
@ -667,7 +667,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
private fun deleteMessages(
|
private fun deleteMessages(
|
||||||
messagesToRemove: List<Message>,
|
messagesToRemove: List<Message>,
|
||||||
toRecycleBin: Boolean,
|
toRecycleBin: Boolean,
|
||||||
fromRecycleBin: Boolean
|
fromRecycleBin: Boolean,
|
||||||
) {
|
) {
|
||||||
val deletePosition = threadItems.indexOf(messagesToRemove.first())
|
val deletePosition = threadItems.indexOf(messagesToRemove.first())
|
||||||
messages.removeAll(messagesToRemove.toSet())
|
messages.removeAll(messagesToRemove.toSet())
|
||||||
|
|
@ -1069,7 +1069,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
private fun getProperSimIndex(
|
private fun getProperSimIndex(
|
||||||
availableSIMs: MutableList<SubscriptionInfo>,
|
availableSIMs: MutableList<SubscriptionInfo>,
|
||||||
numbers: List<String>
|
numbers: List<String>,
|
||||||
): Int {
|
): Int {
|
||||||
val userPreferredSimId = config.getUseSIMIdAtNumber(numbers.first())
|
val userPreferredSimId = config.getUseSIMIdAtNumber(numbers.first())
|
||||||
val userPreferredSimIdx =
|
val userPreferredSimIdx =
|
||||||
|
|
@ -1331,7 +1331,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
private fun launchActivityForResult(
|
private fun launchActivityForResult(
|
||||||
intent: Intent,
|
intent: Intent,
|
||||||
requestCode: Int,
|
requestCode: Int,
|
||||||
@StringRes error: Int = org.fossify.commons.R.string.no_app_found
|
@StringRes error: Int = org.fossify.commons.R.string.no_app_found,
|
||||||
) {
|
) {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
try {
|
try {
|
||||||
|
|
@ -1708,7 +1708,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun fixParticipantNumbers(
|
private fun fixParticipantNumbers(
|
||||||
participants: ArrayList<SimpleContact>,
|
participants: ArrayList<SimpleContact>,
|
||||||
properNumbers: ArrayList<String>
|
properNumbers: ArrayList<String>,
|
||||||
): ArrayList<SimpleContact> {
|
): ArrayList<SimpleContact> {
|
||||||
for (number in properNumbers) {
|
for (number in properNumbers) {
|
||||||
for (participant in participants) {
|
for (participant in participants) {
|
||||||
|
|
@ -2068,7 +2068,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
|
|
||||||
override fun onProgress(
|
override fun onProgress(
|
||||||
insets: WindowInsetsCompat,
|
insets: WindowInsetsCompat,
|
||||||
runningAnimations: MutableList<WindowInsetsAnimationCompat>
|
runningAnimations: MutableList<WindowInsetsAnimationCompat>,
|
||||||
) = insets
|
) = insets
|
||||||
}
|
}
|
||||||
ViewCompat.setWindowInsetsAnimationCallback(window.decorView, callback)
|
ViewCompat.setWindowInsetsAnimationCallback(window.decorView, callback)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,13 @@ import android.content.ActivityNotFoundException
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.ContactsContract
|
import android.provider.ContactsContract
|
||||||
import org.fossify.commons.extensions.*
|
import org.fossify.commons.extensions.getMimeType
|
||||||
|
import org.fossify.commons.extensions.hideKeyboard
|
||||||
|
import org.fossify.commons.extensions.isPackageInstalled
|
||||||
|
import org.fossify.commons.extensions.launchActivityIntent
|
||||||
|
import org.fossify.commons.extensions.launchViewContactIntent
|
||||||
|
import org.fossify.commons.extensions.showErrorToast
|
||||||
|
import org.fossify.commons.extensions.toast
|
||||||
import org.fossify.commons.helpers.CONTACT_ID
|
import org.fossify.commons.helpers.CONTACT_ID
|
||||||
import org.fossify.commons.helpers.IS_PRIVATE
|
import org.fossify.commons.helpers.IS_PRIVATE
|
||||||
import org.fossify.commons.helpers.SimpleContactsHelper
|
import org.fossify.commons.helpers.SimpleContactsHelper
|
||||||
|
|
@ -56,21 +62,42 @@ fun Activity.launchViewIntent(uri: Uri, mimetype: String, filename: String) {
|
||||||
fun Activity.startContactDetailsIntent(contact: SimpleContact) {
|
fun Activity.startContactDetailsIntent(contact: SimpleContact) {
|
||||||
val simpleContacts = "org.fossify.contacts"
|
val simpleContacts = "org.fossify.contacts"
|
||||||
val simpleContactsDebug = "org.fossify.contacts.debug"
|
val simpleContactsDebug = "org.fossify.contacts.debug"
|
||||||
if (contact.rawId > 1000000 && contact.contactId > 1000000 && contact.rawId == contact.contactId &&
|
if (
|
||||||
|
contact.rawId > 1000000 &&
|
||||||
|
contact.contactId > 1000000 &&
|
||||||
|
contact.rawId == contact.contactId &&
|
||||||
(isPackageInstalled(simpleContacts) || isPackageInstalled(simpleContactsDebug))
|
(isPackageInstalled(simpleContacts) || isPackageInstalled(simpleContactsDebug))
|
||||||
) {
|
) {
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
putExtra(CONTACT_ID, contact.rawId)
|
putExtra(CONTACT_ID, contact.rawId)
|
||||||
putExtra(IS_PRIVATE, true)
|
putExtra(IS_PRIVATE, true)
|
||||||
setPackage(if (isPackageInstalled(simpleContacts)) simpleContacts else simpleContactsDebug)
|
setPackage(
|
||||||
setDataAndType(ContactsContract.Contacts.CONTENT_LOOKUP_URI, "vnd.android.cursor.dir/person")
|
if (isPackageInstalled(simpleContacts)) {
|
||||||
|
simpleContacts
|
||||||
|
} else {
|
||||||
|
simpleContactsDebug
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
setDataAndType(
|
||||||
|
ContactsContract.Contacts.CONTENT_LOOKUP_URI,
|
||||||
|
"vnd.android.cursor.dir/person"
|
||||||
|
)
|
||||||
|
|
||||||
launchActivityIntent(this)
|
launchActivityIntent(this)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val lookupKey = SimpleContactsHelper(this).getContactLookupKey((contact).rawId.toString())
|
val lookupKey = SimpleContactsHelper(this)
|
||||||
val publicUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey)
|
.getContactLookupKey(
|
||||||
|
contactId = (contact).rawId.toString()
|
||||||
|
)
|
||||||
|
|
||||||
|
val publicUri = Uri.withAppendedPath(
|
||||||
|
ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey
|
||||||
|
)
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
launchViewContactIntent(publicUri)
|
launchViewContactIntent(publicUri)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue