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(
|
||||
messages: List<Message>,
|
||||
conversations: List<Conversation>,
|
||||
searchedText: String
|
||||
searchedText: String,
|
||||
) {
|
||||
val searchResults = ArrayList<SearchResult>()
|
||||
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 faqItems = arrayListOf(
|
||||
FAQItem(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(
|
||||
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(
|
||||
title = org.fossify.commons.R.string.faq_9_title_commons,
|
||||
text = org.fossify.commons.R.string.faq_9_text_commons
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
private fun deleteMessages(
|
||||
messagesToRemove: List<Message>,
|
||||
toRecycleBin: Boolean,
|
||||
fromRecycleBin: Boolean
|
||||
fromRecycleBin: Boolean,
|
||||
) {
|
||||
val deletePosition = threadItems.indexOf(messagesToRemove.first())
|
||||
messages.removeAll(messagesToRemove.toSet())
|
||||
|
|
@ -1069,7 +1069,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
@SuppressLint("MissingPermission")
|
||||
private fun getProperSimIndex(
|
||||
availableSIMs: MutableList<SubscriptionInfo>,
|
||||
numbers: List<String>
|
||||
numbers: List<String>,
|
||||
): Int {
|
||||
val userPreferredSimId = config.getUseSIMIdAtNumber(numbers.first())
|
||||
val userPreferredSimIdx =
|
||||
|
|
@ -1331,7 +1331,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
private fun launchActivityForResult(
|
||||
intent: Intent,
|
||||
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()
|
||||
try {
|
||||
|
|
@ -1708,7 +1708,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
private fun fixParticipantNumbers(
|
||||
participants: ArrayList<SimpleContact>,
|
||||
properNumbers: ArrayList<String>
|
||||
properNumbers: ArrayList<String>,
|
||||
): ArrayList<SimpleContact> {
|
||||
for (number in properNumbers) {
|
||||
for (participant in participants) {
|
||||
|
|
@ -2068,7 +2068,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
override fun onProgress(
|
||||
insets: WindowInsetsCompat,
|
||||
runningAnimations: MutableList<WindowInsetsAnimationCompat>
|
||||
runningAnimations: MutableList<WindowInsetsAnimationCompat>,
|
||||
) = insets
|
||||
}
|
||||
ViewCompat.setWindowInsetsAnimationCallback(window.decorView, callback)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,13 @@ import android.content.ActivityNotFoundException
|
|||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
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.IS_PRIVATE
|
||||
import org.fossify.commons.helpers.SimpleContactsHelper
|
||||
|
|
@ -56,21 +62,42 @@ fun Activity.launchViewIntent(uri: Uri, mimetype: String, filename: String) {
|
|||
fun Activity.startContactDetailsIntent(contact: SimpleContact) {
|
||||
val simpleContacts = "org.fossify.contacts"
|
||||
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))
|
||||
) {
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
putExtra(CONTACT_ID, contact.rawId)
|
||||
putExtra(IS_PRIVATE, true)
|
||||
setPackage(if (isPackageInstalled(simpleContacts)) simpleContacts else simpleContactsDebug)
|
||||
setDataAndType(ContactsContract.Contacts.CONTENT_LOOKUP_URI, "vnd.android.cursor.dir/person")
|
||||
setPackage(
|
||||
if (isPackageInstalled(simpleContacts)) {
|
||||
simpleContacts
|
||||
} else {
|
||||
simpleContactsDebug
|
||||
}
|
||||
)
|
||||
|
||||
setDataAndType(
|
||||
ContactsContract.Contacts.CONTENT_LOOKUP_URI,
|
||||
"vnd.android.cursor.dir/person"
|
||||
)
|
||||
|
||||
launchActivityIntent(this)
|
||||
}
|
||||
} else {
|
||||
ensureBackgroundThread {
|
||||
val lookupKey = SimpleContactsHelper(this).getContactLookupKey((contact).rawId.toString())
|
||||
val publicUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey)
|
||||
val lookupKey = SimpleContactsHelper(this)
|
||||
.getContactLookupKey(
|
||||
contactId = (contact).rawId.toString()
|
||||
)
|
||||
|
||||
val publicUri = Uri.withAppendedPath(
|
||||
ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey
|
||||
)
|
||||
|
||||
runOnUiThread {
|
||||
launchViewContactIntent(publicUri)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue