forked from upstream-mirrors/quik
add delay send mms. add group send to individual recipients - sms and mms. add immediate show messages in convo, not wait for sent. new qktransaction that replaces android/smsmms transaction with mods for quik. lots of code cleanups and removing superfluous code. some bug fixes.
This commit is contained in:
@@ -135,9 +135,8 @@
|
||||
<action android:name="android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.DeleteMessagesReceiver" />
|
||||
<receiver
|
||||
android:name=".receiver.SmsReceiver"
|
||||
android:name=".receiver.SmsReceivedReceiver"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BROADCAST_SMS">
|
||||
<intent-filter>
|
||||
@@ -145,7 +144,7 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.MmsReceiver"
|
||||
android:name=".receiver.MmsWapPushReceiver"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BROADCAST_WAP_PUSH">
|
||||
<intent-filter>
|
||||
@@ -153,26 +152,21 @@
|
||||
<data android:mimeType="application/vnd.wap.mms-message" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.SmsSentReceiver" />
|
||||
<receiver android:name=".receiver.SmsDeliveredReceiver" />
|
||||
<receiver
|
||||
android:name=".receiver.MmsSentReceiver"
|
||||
android:taskAffinity="${applicationId}.MMS_SENT" />
|
||||
<receiver
|
||||
android:name=".receiver.MmsUpdatedReceiver"
|
||||
android:taskAffinity="${applicationId}.MMS_UPDATED" />
|
||||
<receiver
|
||||
android:name=".receiver.MmsReceivedReceiver"
|
||||
android:taskAffinity="com.klinker.android.messaging.MMS_RECEIVED" />
|
||||
<receiver android:name=".receiver.MarkArchivedReceiver" />
|
||||
<receiver android:name=".receiver.MessageSentReceiver" />
|
||||
<receiver android:name=".receiver.MessageDeliveredReceiver" />
|
||||
<receiver android:name=".receiver.SendScheduledMessageReceiver" />
|
||||
<receiver android:name=".receiver.SendDelayedMessageReceiver" />
|
||||
<receiver android:name=".receiver.DeleteMessagesReceiver" />
|
||||
<receiver android:name=".receiver.BlockThreadReceiver" />
|
||||
<receiver android:name=".receiver.MarkSeenReceiver" />
|
||||
<receiver android:name=".receiver.MarkReadReceiver" />
|
||||
<receiver android:name=".receiver.MessageMarkReceiver" />
|
||||
<receiver
|
||||
android:name=".receiver.SpeakThreadsReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.intent.action.ACTION_SPEAK_MESSAGES" />
|
||||
<action android:name=".action.ACTION_SPEAK_MESSAGES" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.RemoteMessagingReceiver" />
|
||||
@@ -184,17 +178,14 @@
|
||||
<action android:name="android.provider.action.EXTERNAL_PROVIDER_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receiver.SendScheduledMessageReceiver" />
|
||||
<receiver
|
||||
android:name=".feature.widget.WidgetSpeakUnseenProvider"
|
||||
android:label="@string/speak_unseen_messages"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="${applicationId}.intent.action.ACTION_NOTIFY_DATASET_CHANGED" />
|
||||
<action android:name="${applicationId}.action.ACTION_NOTIFY_DATASET_CHANGED" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_speak_unseen_info" />
|
||||
@@ -204,14 +195,13 @@
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="dev.octoshrimpy.quik.intent.action.ACTION_NOTIFY_DATASET_CHANGED" />
|
||||
<action android:name="${applicationId}.action.ACTION_NOTIFY_DATASET_CHANGED" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_info" />
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.SendSmsReceiver" />
|
||||
<receiver android:name=".receiver.StartActivityFromWidgetReceiver" />
|
||||
|
||||
<service android:name="com.android.mms.transaction.TransactionService" />
|
||||
|
||||
@@ -52,8 +52,8 @@ class MenuItemAdapter @Inject constructor(private val context: Context, private
|
||||
|
||||
field = value
|
||||
|
||||
old.let { notifyItemChanged(it) }
|
||||
new.let { notifyItemChanged(it) }
|
||||
notifyItemChanged(old)
|
||||
notifyItemChanged(new)
|
||||
}
|
||||
|
||||
fun setData(@ArrayRes titles: Int, @ArrayRes values: Int = -1) {
|
||||
|
||||
@@ -45,7 +45,6 @@ import dev.octoshrimpy.quik.manager.BillingManager
|
||||
import dev.octoshrimpy.quik.manager.NotificationManager
|
||||
import dev.octoshrimpy.quik.manager.PermissionManager
|
||||
import dev.octoshrimpy.quik.model.ScheduledMessage
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import androidx.emoji2.text.EmojiCompat
|
||||
import androidx.work.Configuration
|
||||
import androidx.work.WorkManager
|
||||
import androidx.work.WorkerFactory
|
||||
import com.moez.QKSMS.manager.SpeakManager
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.util.CrashlyticsTree
|
||||
import dev.octoshrimpy.quik.common.util.FileLoggingTree
|
||||
@@ -79,9 +78,6 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
// set application context for SpeakManager
|
||||
SpeakManager.setContext(this)
|
||||
|
||||
// set translated "no messages" string for speakThreads interactor
|
||||
SpeakThreads.setNoMessagesString(getString(R.string.speak_no_messages))
|
||||
|
||||
@@ -92,7 +88,7 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
|
||||
Realm.setDefaultConfiguration(RealmConfiguration.Builder()
|
||||
.compactOnLaunch()
|
||||
.migration(realmMigration)
|
||||
.schemaVersion(QkRealmMigration.SchemaVersion)
|
||||
.schemaVersion(QkRealmMigration.SCHEMA_VERSION)
|
||||
.build())
|
||||
|
||||
qkMigration.performMigration()
|
||||
|
||||
@@ -24,19 +24,16 @@ import android.animation.ObjectAnimator
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.annotation.Nullable
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.changehandler.AnimatorChangeHandler
|
||||
import dev.octoshrimpy.quik.common.util.extensions.dpToPx
|
||||
|
||||
class QkChangeHandler : AnimatorChangeHandler(250, true) {
|
||||
|
||||
@NonNull
|
||||
override fun getAnimator(
|
||||
@NonNull container: ViewGroup,
|
||||
@Nullable from: View?,
|
||||
@Nullable to: View?,
|
||||
container: ViewGroup,
|
||||
from: View?,
|
||||
to: View?,
|
||||
isPush: Boolean,
|
||||
toAddedToContainer: Boolean
|
||||
): Animator {
|
||||
@@ -66,12 +63,11 @@ class QkChangeHandler : AnimatorChangeHandler(250, true) {
|
||||
return animatorSet
|
||||
}
|
||||
|
||||
override fun resetFromView(@NonNull from: View) {
|
||||
override fun resetFromView(from: View) {
|
||||
from.translationX = 0f
|
||||
from.translationZ = 0f
|
||||
}
|
||||
|
||||
@NonNull
|
||||
override fun copy(): ControllerChangeHandler {
|
||||
return QkChangeHandler()
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import io.reactivex.disposables.Disposable
|
||||
*/
|
||||
abstract class FlowableAdapter<T> : QkAdapter<T, QkViewHolder>() {
|
||||
|
||||
var flowable: Flowable<List<T>>? = null
|
||||
private var flowable: Flowable<List<T>>? = null
|
||||
set(value) {
|
||||
if (field === value) return
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ abstract class QkAdapter<T, VHT : RecyclerView.ViewHolder> : RecyclerView.Adapte
|
||||
field?.isVisible = data.isEmpty()
|
||||
}
|
||||
|
||||
val selectionChanges: Subject<List<Long>> = BehaviorSubject.create()
|
||||
private val selectionChanges: Subject<List<Long>> = BehaviorSubject.create()
|
||||
|
||||
private val selection = mutableListOf<Long>()
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import io.reactivex.subjects.BehaviorSubject
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
|
||||
abstract class QkViewModel<in View : QkView<State>, State>(initialState: State) : ViewModel() {
|
||||
abstract class QkViewModel<in View : QkView<State>, State: Any>(initialState: State) : ViewModel() {
|
||||
|
||||
protected val disposables = CompositeDisposable()
|
||||
protected val state: Subject<State> = BehaviorSubject.createDefault(initialState)
|
||||
@@ -40,17 +40,17 @@ abstract class QkViewModel<in View : QkView<State>, State>(initialState: State)
|
||||
// If we accidentally push a realm object into the state on the wrong thread, switching
|
||||
// to mainThread right here should immediately alert us of the issue
|
||||
disposables += stateReducer
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.scan(initialState) { state, reducer -> reducer(state) }
|
||||
.subscribe(state::onNext)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.scan(initialState) { state, reducer -> reducer(state) }
|
||||
.subscribe(state::onNext)
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
open fun bindView(view: View) {
|
||||
state
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe(view::render)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe(view::render)
|
||||
}
|
||||
|
||||
protected fun newState(reducer: State.() -> State) = stateReducer.onNext(reducer)
|
||||
|
||||
@@ -24,17 +24,16 @@ import androidx.core.content.res.getColorOrThrow
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.util.extensions.getColorCompat
|
||||
import dev.octoshrimpy.quik.model.Recipient
|
||||
import dev.octoshrimpy.quik.util.PhoneNumberUtils
|
||||
import dev.octoshrimpy.quik.util.Preferences
|
||||
import io.reactivex.Observable
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.math.pow
|
||||
|
||||
@Singleton
|
||||
class Colors @Inject constructor(
|
||||
private val context: Context,
|
||||
private val phoneNumberUtils: PhoneNumberUtils,
|
||||
private val prefs: Preferences
|
||||
) {
|
||||
|
||||
@@ -129,7 +128,7 @@ class Colors @Inject constructor(
|
||||
*/
|
||||
private fun measureLuminance(color: Int): Double {
|
||||
val array = intArrayOf(Color.red(color), Color.green(color), Color.blue(color))
|
||||
.map { if (it < 0.03928) it / 12.92 else Math.pow((it + 0.055) / 1.055, 2.4) }
|
||||
.map { if (it < 0.03928) it / 12.92 else ((it + 0.055) / 1.055).pow(2.4) }
|
||||
|
||||
return 0.2126 * array[0] + 0.7152 * array[1] + 0.0722 * array[2] + 0.05
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ package dev.octoshrimpy.quik.common.util
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import dev.octoshrimpy.quik.util.Preferences
|
||||
import dev.octoshrimpy.quik.util.FileUtils
|
||||
import dev.octoshrimpy.quik.util.Preferences
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import timber.log.Timber
|
||||
import java.io.FileNotFoundException
|
||||
@@ -83,7 +83,7 @@ class FileLoggingTree @Inject constructor(
|
||||
}.log"
|
||||
|
||||
val (uri, e) = FileUtils.create(
|
||||
FileUtils.Companion.Location.Downloads,
|
||||
FileUtils.Location.Downloads,
|
||||
context,
|
||||
filename,
|
||||
"text/plain"
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.google.android.mms.pdu_alt.PduPersister
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.model.Message
|
||||
import dev.octoshrimpy.quik.util.tryOrNull
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
|
||||
class MessageDetailsFormatter @Inject constructor(
|
||||
@@ -36,68 +37,68 @@ class MessageDetailsFormatter @Inject constructor(
|
||||
val builder = StringBuilder()
|
||||
|
||||
message.type
|
||||
.takeIf { it.isNotBlank() }
|
||||
?.toUpperCase()
|
||||
?.let { context.getString(R.string.compose_details_type, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it.isNotBlank() }
|
||||
?.uppercase(Locale.getDefault())
|
||||
?.let { context.getString(R.string.compose_details_type, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
if (message.isSms()) {
|
||||
message.address
|
||||
.takeIf { it.isNotBlank() && !message.isMe() }
|
||||
?.let { context.getString(R.string.compose_details_from, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it.isNotBlank() && !message.isMe() }
|
||||
?.let { context.getString(R.string.compose_details_from, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
message.address
|
||||
.takeIf { it.isNotBlank() && message.isMe() }
|
||||
?.let { context.getString(R.string.compose_details_to, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it.isNotBlank() && message.isMe() }
|
||||
?.let { context.getString(R.string.compose_details_to, it) }
|
||||
?.let(builder::appendLine)
|
||||
} else {
|
||||
val pdu = tryOrNull {
|
||||
PduPersister.getPduPersister(context)
|
||||
.load(message.getUri())
|
||||
.load(message.getUri())
|
||||
as MultimediaMessagePdu
|
||||
}
|
||||
|
||||
pdu?.from?.string
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { context.getString(R.string.compose_details_from, it) }
|
||||
?.let(builder::appendln)
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { context.getString(R.string.compose_details_from, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
pdu?.to
|
||||
?.let(EncodedStringValue::concat)
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { context.getString(R.string.compose_details_to, it) }
|
||||
?.let(builder::appendln)
|
||||
?.let(EncodedStringValue::concat)
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { context.getString(R.string.compose_details_to, it) }
|
||||
?.let(builder::appendLine)
|
||||
}
|
||||
|
||||
message.date
|
||||
.takeIf { it > 0 && message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_sent, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it > 0 && message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_sent, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
message.dateSent
|
||||
.takeIf { it > 0 && !message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_sent, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it > 0 && !message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_sent, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
message.date
|
||||
.takeIf { it > 0 && !message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_received, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it > 0 && !message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_received, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
message.dateSent
|
||||
.takeIf { it > 0 && message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_delivered, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it > 0 && message.isMe() }
|
||||
?.let(dateFormatter::getDetailedTimestamp)
|
||||
?.let { context.getString(R.string.compose_details_delivered, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
message.errorCode
|
||||
.takeIf { it != 0 && message.isSms() }
|
||||
?.let { context.getString(R.string.compose_details_error_code, it) }
|
||||
?.let(builder::appendln)
|
||||
.takeIf { it != 0 && message.isSms() }
|
||||
?.let { context.getString(R.string.compose_details_error_code, it) }
|
||||
?.let(builder::appendLine)
|
||||
|
||||
return builder.toString().trim()
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@ import dev.octoshrimpy.quik.manager.ShortcutManager
|
||||
import dev.octoshrimpy.quik.mapper.CursorToPartImpl
|
||||
import dev.octoshrimpy.quik.receiver.BlockThreadReceiver
|
||||
import dev.octoshrimpy.quik.receiver.DeleteMessagesReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MarkArchivedReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MarkReadReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MarkSeenReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MessageMarkReceiver
|
||||
import dev.octoshrimpy.quik.receiver.RemoteMessagingReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SpeakThreadsReceiver
|
||||
import dev.octoshrimpy.quik.repository.ContactRepository
|
||||
@@ -63,6 +61,7 @@ import dev.octoshrimpy.quik.util.tryOrNull
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
import androidx.core.net.toUri
|
||||
|
||||
@Singleton
|
||||
class NotificationManagerImpl @Inject constructor(
|
||||
@@ -127,7 +126,9 @@ class NotificationManagerImpl @Inject constructor(
|
||||
.addNextIntent(contentIntent)
|
||||
val contentPI = taskStackBuilder.getPendingIntent(threadId.toInt(), PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
|
||||
val seenIntent = Intent(context, MarkSeenReceiver::class.java).putExtra("threadId", threadId)
|
||||
val seenIntent = Intent(context, MessageMarkReceiver::class.java)
|
||||
.putExtra("threadId", threadId)
|
||||
.putExtra("type", MessageMarkReceiver.MarkType.Seen.ordinal)
|
||||
val seenPI = PendingIntent.getBroadcast(context, threadId.toInt(), seenIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
|
||||
@@ -254,7 +255,9 @@ class NotificationManagerImpl @Inject constructor(
|
||||
.mapNotNull { action ->
|
||||
when (action) {
|
||||
Preferences.NOTIFICATION_ACTION_ARCHIVE -> {
|
||||
val intent = Intent(context, MarkArchivedReceiver::class.java).putExtra("threadId", threadId)
|
||||
val intent = Intent(context, MessageMarkReceiver::class.java)
|
||||
.putExtra("threadId", threadId)
|
||||
.putExtra("type", MessageMarkReceiver.MarkType.Archived.ordinal)
|
||||
val pi = PendingIntent.getBroadcast(context, threadId.toInt(), intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
NotificationCompat.Action.Builder(R.drawable.ic_archive_white_24dp, actionLabels[action], pi)
|
||||
@@ -281,7 +284,9 @@ class NotificationManagerImpl @Inject constructor(
|
||||
}
|
||||
|
||||
Preferences.NOTIFICATION_ACTION_READ -> {
|
||||
val intent = Intent(context, MarkReadReceiver::class.java).putExtra("threadId", threadId)
|
||||
val intent = Intent(context, MessageMarkReceiver::class.java)
|
||||
.putExtra("threadId", threadId)
|
||||
.putExtra("type", MessageMarkReceiver.MarkType.Read.ordinal)
|
||||
val pi = PendingIntent.getBroadcast(context, threadId.toInt(), intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
NotificationCompat.Action.Builder(R.drawable.ic_check_white_24dp, actionLabels[action], pi)
|
||||
@@ -304,7 +309,7 @@ class NotificationManagerImpl @Inject constructor(
|
||||
Preferences.NOTIFICATION_ACTION_CALL -> {
|
||||
val address = conversation.recipients[0]?.address
|
||||
val intentAction = if (permissions.hasCalling()) Intent.ACTION_CALL else Intent.ACTION_DIAL
|
||||
val intent = Intent(intentAction, Uri.parse("tel:$address"))
|
||||
val intent = Intent(intentAction, "tel:$address".toUri())
|
||||
val pi = PendingIntent.getActivity(context, threadId.toInt(), intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
NotificationCompat.Action.Builder(R.drawable.ic_call_white_24dp, actionLabels[action], pi)
|
||||
|
||||
@@ -21,10 +21,8 @@ package dev.octoshrimpy.quik.common.util
|
||||
import android.content.ComponentName
|
||||
import android.content.IntentFilter
|
||||
import android.graphics.drawable.Icon
|
||||
import android.os.Build
|
||||
import android.service.chooser.ChooserTarget
|
||||
import android.service.chooser.ChooserTargetService
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.os.bundleOf
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.feature.compose.ComposeActivity
|
||||
|
||||
@@ -61,13 +61,13 @@ class TextViewStyler @Inject constructor(
|
||||
var textSizeAttr = 0
|
||||
|
||||
when (this) {
|
||||
is QkTextView -> context.obtainStyledAttributes(attrs, R.styleable.QkTextView)?.run {
|
||||
is QkTextView -> context.obtainStyledAttributes(attrs, R.styleable.QkTextView).run {
|
||||
colorAttr = getInt(R.styleable.QkTextView_textColor, -1)
|
||||
textSizeAttr = getInt(R.styleable.QkTextView_textSize, -1)
|
||||
recycle()
|
||||
}
|
||||
|
||||
is QkEditText -> context.obtainStyledAttributes(attrs, R.styleable.QkEditText)?.run {
|
||||
is QkEditText -> context.obtainStyledAttributes(attrs, R.styleable.QkEditText).run {
|
||||
colorAttr = getInt(R.styleable.QkEditText_textColor, -1)
|
||||
textSizeAttr = getInt(R.styleable.QkEditText_textSize, -1)
|
||||
recycle()
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@ fun Int.forEach(action: (Int) -> Unit) {
|
||||
}
|
||||
|
||||
fun Float.within(min: Float, max: Float): Float {
|
||||
return Math.min(max, Math.max(min, this))
|
||||
return max.coerceAtMost(min.coerceAtLeast(this))
|
||||
}
|
||||
@@ -109,11 +109,6 @@ class CancelableSimpleOnGestureListener(view: View, parentView: View) : SimpleOn
|
||||
textInitiallySelectable = thisView.isTextSelectable
|
||||
}
|
||||
|
||||
fun cancelCurrentClick() {
|
||||
lastUpEvent?.recycle()
|
||||
lastUpEvent = null
|
||||
}
|
||||
|
||||
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||
if (lastUpEvent !== null) {
|
||||
parent.onTouchEvent(e)
|
||||
|
||||
@@ -59,7 +59,7 @@ class AvatarView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the [contact] information to display the avatar.
|
||||
* Use the contact information to display the avatar.
|
||||
*/
|
||||
fun setRecipient(recipient: Recipient?) {
|
||||
lookupKey = recipient?.contact?.lookupKey
|
||||
|
||||
@@ -23,11 +23,10 @@ import android.graphics.Canvas
|
||||
import android.graphics.Path
|
||||
import android.graphics.RectF
|
||||
import android.util.AttributeSet
|
||||
import android.widget.ImageView
|
||||
import dev.octoshrimpy.quik.common.util.extensions.dpToPx
|
||||
|
||||
class BubbleImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ImageView(context, attrs) {
|
||||
|
||||
class BubbleImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
|
||||
: androidx.appcompat.widget.AppCompatImageView(context, attrs) {
|
||||
enum class Style(val topLeft: Boolean, val topRight: Boolean, val bottomRight: Boolean, val bottomLeft: Boolean) {
|
||||
|
||||
ONLY(true, true, true, true),
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package dev.octoshrimpy.quik.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.AttributeSet
|
||||
import android.view.ContextMenu
|
||||
import android.view.View
|
||||
@@ -54,7 +53,7 @@ open class QkContextMenuRecyclerView<ADAPTER_VALUE_TYPE, VIEW_HOLDER_VALUE_TYPE>
|
||||
|
||||
private fun saveContextMenuInfo(originalView: View) {
|
||||
contextMenuInfo = ContextMenuInfo(
|
||||
(adapter as Adapter<ADAPTER_VALUE_TYPE, *, *>)?.contextMenuValue,
|
||||
(adapter as Adapter<ADAPTER_VALUE_TYPE, *, *>).contextMenuValue,
|
||||
getChildViewHolder(originalView)?.contextMenuValue,
|
||||
this,
|
||||
originalView,
|
||||
|
||||
@@ -87,7 +87,7 @@ class RadioPreferenceView @JvmOverloads constructor(
|
||||
radioButton.buttonTintList = ColorStateList(states, intArrayOf(themeColor, textSecondary))
|
||||
radioButton.forwardTouches(this)
|
||||
|
||||
context.obtainStyledAttributes(attrs, R.styleable.RadioPreferenceView)?.run {
|
||||
context.obtainStyledAttributes(attrs, R.styleable.RadioPreferenceView).run {
|
||||
title = getString(R.styleable.RadioPreferenceView_title)
|
||||
summary = getString(R.styleable.RadioPreferenceView_summary)
|
||||
|
||||
|
||||
@@ -20,10 +20,9 @@ package dev.octoshrimpy.quik.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.ImageView
|
||||
|
||||
class SquareImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ImageView(context, attrs) {
|
||||
|
||||
class SquareImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
|
||||
: androidx.appcompat.widget.AppCompatImageView(context, attrs) {
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
super.onMeasure(widthMeasureSpec, widthMeasureSpec)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package dev.octoshrimpy.quik.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import kotlin.math.ceil
|
||||
|
||||
class TightTextView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
@@ -35,11 +36,9 @@ class TightTextView @JvmOverloads constructor(
|
||||
return
|
||||
}
|
||||
|
||||
val maxLineWidth = (0 until layout.lineCount)
|
||||
.map(layout::getLineWidth)
|
||||
.max() ?: 0f
|
||||
val maxLineWidth = (0 until layout.lineCount).maxOfOrNull(layout::getLineWidth) ?: 0f
|
||||
|
||||
val width = Math.ceil(maxLineWidth.toDouble()).toInt() + compoundPaddingLeft + compoundPaddingRight
|
||||
val width = ceil(maxLineWidth.toDouble()).toInt() + compoundPaddingLeft + compoundPaddingRight
|
||||
if (width < measuredWidth) {
|
||||
val widthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.getMode(widthMeasureSpec))
|
||||
super.onMeasure(widthSpec, heightMeasureSpec)
|
||||
|
||||
@@ -159,7 +159,8 @@ class BackupController : QkController<BackupView, BackupState, BackupPresenter>(
|
||||
progressSummary.isVisible = progressSummary.text.isNotEmpty()
|
||||
progressCancel.isVisible = false
|
||||
val running = (state.backupProgress as? BackupRepository.Progress.Running)
|
||||
progressBar.isVisible = state.backupProgress.indeterminate || running?.max ?: 0 > 0
|
||||
progressBar.isVisible =
|
||||
state.backupProgress.indeterminate || (running?.max ?: 0) > 0
|
||||
progressBar.isIndeterminate = state.backupProgress.indeterminate
|
||||
progressBar.max = running?.max ?: 0
|
||||
progressBar.progress = running?.count ?: 0
|
||||
@@ -174,7 +175,8 @@ class BackupController : QkController<BackupView, BackupState, BackupPresenter>(
|
||||
progressSummary.isVisible = progressSummary.text.isNotEmpty()
|
||||
progressCancel.isVisible = true
|
||||
val running = (state.restoreProgress as? BackupRepository.Progress.Running)
|
||||
progressBar.isVisible = state.restoreProgress.indeterminate || running?.max ?: 0 > 0
|
||||
progressBar.isVisible =
|
||||
state.restoreProgress.indeterminate || (running?.max ?: 0) > 0
|
||||
progressBar.isIndeterminate = state.restoreProgress.indeterminate
|
||||
progressBar.max = running?.max ?: 0
|
||||
progressBar.progress = running?.count ?: 0
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package dev.octoshrimpy.quik.feature.backup
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.Navigator
|
||||
import dev.octoshrimpy.quik.common.base.QkPresenter
|
||||
@@ -34,7 +33,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.rxkotlin.withLatestFrom
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ class RestoreBackupService : Service() {
|
||||
companion object {
|
||||
private const val NOTIFICATION_ID = -1
|
||||
|
||||
private const val ACTION_START = "dev.octoshrimpy.quik.ACTION_START"
|
||||
private const val ACTION_STOP = "dev.octoshrimpy.quik.ACTION_STOP"
|
||||
private const val EXTRA_FILE_URI = "dev.octoshrimpy.quik.EXTRA_FILE_URI"
|
||||
private const val ACTION_START = "ACTION_START"
|
||||
private const val ACTION_STOP = "ACTION_STOP"
|
||||
private const val EXTRA_FILE_URI = "EXTRA_FILE_URI"
|
||||
|
||||
fun start(context: Context, backupFile: Uri) {
|
||||
val intent = Intent(context, RestoreBackupService::class.java)
|
||||
.setAction(ACTION_START)
|
||||
.putExtra(EXTRA_FILE_URI, backupFile.toString())
|
||||
.setAction("${context.packageName}.$ACTION_START")
|
||||
.putExtra("${context.packageName}.$EXTRA_FILE_URI", backupFile.toString())
|
||||
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
}
|
||||
@@ -67,11 +67,11 @@ class RestoreBackupService : Service() {
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
super.onStartCommand(intent, flags, startId)
|
||||
when (intent.action) {
|
||||
ACTION_START -> start(intent)
|
||||
ACTION_STOP -> stop()
|
||||
"${baseContext.packageName}.${ACTION_START}" -> start(intent)
|
||||
"${baseContext.packageName}.${ACTION_STOP}" -> stop()
|
||||
}
|
||||
|
||||
return Service.START_STICKY
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -81,30 +81,30 @@ class RestoreBackupService : Service() {
|
||||
startForeground(NOTIFICATION_ID, notification.build())
|
||||
|
||||
backupRepo.getRestoreProgress()
|
||||
.sample(200, TimeUnit.MILLISECONDS, true)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe { progress ->
|
||||
when (progress) {
|
||||
is BackupRepository.Progress.Idle -> stop()
|
||||
.sample(200, TimeUnit.MILLISECONDS, true)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe { progress ->
|
||||
when (progress) {
|
||||
is BackupRepository.Progress.Idle -> stop()
|
||||
|
||||
is BackupRepository.Progress.Running -> notification
|
||||
.setProgress(progress.max, progress.count, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
.let { notificationManager.notify(NOTIFICATION_ID, it.build()) }
|
||||
is BackupRepository.Progress.Running -> notification
|
||||
.setProgress(progress.max, progress.count, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
.let { notificationManager.notify(NOTIFICATION_ID, it.build()) }
|
||||
|
||||
else -> notification
|
||||
.setProgress(0, 0, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
.let { notificationManager.notify(NOTIFICATION_ID, it.build()) }
|
||||
}
|
||||
else -> notification
|
||||
.setProgress(0, 0, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
.let { notificationManager.notify(NOTIFICATION_ID, it.build()) }
|
||||
}
|
||||
}
|
||||
|
||||
// Start the restore
|
||||
Observable.just(intent)
|
||||
.map { Uri.parse(it.getStringExtra(EXTRA_FILE_URI)) }
|
||||
.map(backupRepo::performRestore)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe({}, Timber::w)
|
||||
.map { Uri.parse(it.getStringExtra("${baseContext.packageName}.$EXTRA_FILE_URI}")) }
|
||||
.map(backupRepo::performRestore)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe({}, Timber::w)
|
||||
}
|
||||
|
||||
private fun stop() {
|
||||
|
||||
-1
@@ -27,7 +27,6 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.util.extensions.animateLayoutChanges
|
||||
import dev.octoshrimpy.quik.common.util.extensions.resolveThemeAttribute
|
||||
import dev.octoshrimpy.quik.common.util.extensions.setVisible
|
||||
import kotlinx.android.synthetic.main.blocking_manager_preference_view.view.*
|
||||
|
||||
+2
-2
@@ -142,7 +142,7 @@ class BlockingManagerPresenter @Inject constructor(
|
||||
}
|
||||
|
||||
private fun getAddressesToBlock(client: BlockingClient) = conversationRepo.getBlockedConversations()
|
||||
.fold(listOf<String>(), { numbers, conversation -> numbers + conversation.recipients.map { it.address } })
|
||||
.filter { number -> client.isBlacklisted(number).blockingGet() !is BlockingClient.Action.Block }
|
||||
.fold(listOf<String>()) { numbers, conversation -> numbers + conversation.recipients.map { it.address } }
|
||||
.filter { number -> client.isBlacklisted(number).blockingGet() !is BlockingClient.Action.Block }
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class BlockedNumbersPresenter @Inject constructor(
|
||||
.observeOn(Schedulers.io())
|
||||
.doOnNext { id ->
|
||||
blockingRepo.getBlockedNumber(id)?.address
|
||||
?.let(conversationRepo::getConversation)
|
||||
?.let { address -> conversationRepo.getConversation(listOf(address)) }
|
||||
?.let { conversation -> markUnblocked.execute(listOf(conversation.id)) }
|
||||
}
|
||||
.doOnNext(blockingRepo::unblockNumber)
|
||||
|
||||
-1
@@ -19,7 +19,6 @@
|
||||
package dev.octoshrimpy.quik.feature.blocking.numbers
|
||||
|
||||
import dev.octoshrimpy.quik.model.BlockedNumber
|
||||
import io.realm.RealmList
|
||||
import io.realm.RealmResults
|
||||
|
||||
data class BlockedNumbersState(
|
||||
|
||||
@@ -21,6 +21,7 @@ package dev.octoshrimpy.quik.feature.compose
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.model.Message
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.abs
|
||||
|
||||
object BubbleUtils {
|
||||
|
||||
@@ -28,7 +29,7 @@ object BubbleUtils {
|
||||
|
||||
fun canGroup(message: Message, other: Message?): Boolean {
|
||||
if (other == null) return false
|
||||
val diff = TimeUnit.MILLISECONDS.toMinutes(Math.abs(message.date - other.date))
|
||||
val diff = TimeUnit.MILLISECONDS.toMinutes(abs(message.date - other.date))
|
||||
return message.compareSender(other) && diff < TIMESTAMP_THRESHOLD
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,7 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import android.widget.SeekBar
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
@@ -78,7 +76,6 @@ import dev.octoshrimpy.quik.common.util.extensions.setVisible
|
||||
import dev.octoshrimpy.quik.common.util.extensions.showKeyboard
|
||||
import dev.octoshrimpy.quik.common.widget.MicInputCloudView
|
||||
import dev.octoshrimpy.quik.common.widget.QkEditText
|
||||
import dev.octoshrimpy.quik.common.widget.TextInputDialog
|
||||
import dev.octoshrimpy.quik.extensions.mapNotNull
|
||||
import dev.octoshrimpy.quik.feature.compose.editing.ChipsAdapter
|
||||
import dev.octoshrimpy.quik.feature.contacts.ContactsActivity
|
||||
@@ -131,6 +128,7 @@ import kotlinx.android.synthetic.main.compose_activity.scheduledTime
|
||||
import kotlinx.android.synthetic.main.compose_activity.send
|
||||
import kotlinx.android.synthetic.main.compose_activity.sendAsGroup
|
||||
import kotlinx.android.synthetic.main.compose_activity.sendAsGroupBackground
|
||||
import kotlinx.android.synthetic.main.compose_activity.sendAsGroupSummary
|
||||
import kotlinx.android.synthetic.main.compose_activity.sendAsGroupSwitch
|
||||
import kotlinx.android.synthetic.main.compose_activity.sim
|
||||
import kotlinx.android.synthetic.main.compose_activity.simIndex
|
||||
@@ -160,7 +158,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
override val activityVisibleIntent: Subject<Boolean> = PublishSubject.create()
|
||||
override val chipsSelectedIntent: Subject<HashMap<String, String?>> = PublishSubject.create()
|
||||
override val chipDeletedIntent: Subject<Recipient> by lazy { chipsAdapter.chipDeleted }
|
||||
override val menuReadyIntent: Observable<Unit> = menu.map { Unit }
|
||||
override val menuReadyIntent: Observable<Unit> = menu.map { }
|
||||
override val optionsItemIntent: Subject<Int> = PublishSubject.create()
|
||||
override val contextItemIntent: Subject<MenuItem> = PublishSubject.create()
|
||||
override val scheduleAction: Subject<Boolean> = PublishSubject.create()
|
||||
@@ -168,17 +166,17 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
override val messagePartClickIntent: Subject<Long> by lazy { messageAdapter.partClicks }
|
||||
override val messagePartContextMenuRegistrar: Subject<View> by lazy { messageAdapter.partContextMenuRegistrar }
|
||||
override val messagesSelectedIntent by lazy { messageAdapter.selectionChanges }
|
||||
override val cancelSendingIntent: Subject<Long> by lazy { messageAdapter.cancelSendingClicks }
|
||||
override val sendNowIntent: Subject<Long> by lazy { messageAdapter.sendNowClicks }
|
||||
override val cancelDelayedIntent: Subject<Long> by lazy { messageAdapter.cancelSendingClicks }
|
||||
override val sendDelayedNowIntent: Subject<Long> by lazy { messageAdapter.sendNowClicks }
|
||||
override val resendIntent: Subject<Long> by lazy { messageAdapter.resendClicks }
|
||||
override val attachmentDeletedIntent: Subject<Attachment> by lazy { composeAttachmentAdapter.attachmentDeleted }
|
||||
override val textChangedIntent by lazy { message.textChanges() }
|
||||
override val attachIntent by lazy { Observable.merge(attach.clicks(), shadeBackground.clicks()) }
|
||||
override val cameraIntent by lazy { Observable.merge(camera.clicks(), cameraLabel.clicks()) }
|
||||
override val attachImageFileIntent by lazy { Observable.merge(gallery.clicks(), galleryLabel.clicks()) }
|
||||
override val attachAnyFileIntent by lazy { Observable.merge(attachAFileIcon.clicks(), attachAFileLabel.clicks()) }
|
||||
override val scheduleIntent by lazy { Observable.merge(schedule.clicks(), scheduleLabel.clicks()) }
|
||||
override val attachContactIntent by lazy { Observable.merge(contact.clicks(), contactLabel.clicks()) }
|
||||
override val attachIntent: Observable<Unit> by lazy { Observable.merge(attach.clicks(), shadeBackground.clicks()) }
|
||||
override val cameraIntent: Observable<Unit> by lazy { Observable.merge(camera.clicks(), cameraLabel.clicks()) }
|
||||
override val attachImageFileIntent: Observable<Unit> by lazy { Observable.merge(gallery.clicks(), galleryLabel.clicks()) }
|
||||
override val attachAnyFileIntent: Observable<Unit> by lazy { Observable.merge(attachAFileIcon.clicks(), attachAFileLabel.clicks()) }
|
||||
override val scheduleIntent: Observable<Unit> by lazy { Observable.merge(schedule.clicks(), scheduleLabel.clicks()) }
|
||||
override val attachContactIntent: Observable<Unit> by lazy { Observable.merge(contact.clicks(), contactLabel.clicks()) }
|
||||
override val attachAnyFileSelectedIntent: Subject<Uri> = PublishSubject.create()
|
||||
override val contactSelectedIntent: Subject<Uri> = PublishSubject.create()
|
||||
override val inputContentIntent by lazy { message.inputContentSelected }
|
||||
@@ -194,7 +192,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() }
|
||||
override val shadeIntent by lazy { shadeBackground.clicks() }
|
||||
override val recordAudioStartStopRecording: Subject<Boolean> = PublishSubject.create()
|
||||
override val recordAnAudioMessage by lazy {
|
||||
override val recordAnAudioMessage: Observable<Unit> by lazy {
|
||||
Observable.merge(recordAudioMsg.clicks(),
|
||||
attachAnAudioMessageIcon.clicks(),
|
||||
attachAnAudioMessageLabel.clicks())
|
||||
@@ -493,8 +491,12 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
|
||||
loading.setVisible(state.loading)
|
||||
|
||||
sendAsGroup.setVisible(state.editingMode && state.selectedChips.size >= 2)
|
||||
sendAsGroup.setVisible(state.recipientCount > 1)
|
||||
sendAsGroupSwitch.isChecked = state.sendAsGroup
|
||||
sendAsGroupSummary.setText(
|
||||
if (sendAsGroupSwitch.isChecked) R.string.compose_send_group_summary_on
|
||||
else R.string.compose_send_group_summary_off
|
||||
)
|
||||
|
||||
messageList.setVisible(!state.editingMode || state.sendAsGroup || state.selectedChips.size == 1)
|
||||
messageAdapter.data = state.messages
|
||||
@@ -635,8 +637,8 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
|
||||
override fun requestDatePicker() {
|
||||
val calendar = Calendar.getInstance()
|
||||
DatePickerDialog(this, DatePickerDialog.OnDateSetListener { _, year, month, day ->
|
||||
TimePickerDialog(this, TimePickerDialog.OnTimeSetListener { _, hour, minute ->
|
||||
DatePickerDialog(this, { _, year, month, day ->
|
||||
TimePickerDialog(this, { _, hour, minute ->
|
||||
calendar.set(Calendar.YEAR, year)
|
||||
calendar.set(Calendar.MONTH, month)
|
||||
calendar.set(Calendar.DAY_OF_MONTH, day)
|
||||
@@ -655,16 +657,16 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
val intent = Intent(Intent.ACTION_PICK)
|
||||
.setType(ContactsContract.Contacts.CONTENT_TYPE)
|
||||
|
||||
startActivityForResult(Intent.createChooser(intent, null), ComposeView.AttachContactRequestCode)
|
||||
startActivityForResult(Intent.createChooser(intent, null), ComposeView.ATTACH_CONTACT_REQUEST_CODE)
|
||||
}
|
||||
|
||||
override fun showContacts(sharing: Boolean, chips: List<Recipient>) {
|
||||
message.hideKeyboard()
|
||||
val serialized = HashMap(chips.associate { chip -> chip.address to chip.contact?.lookupKey })
|
||||
val intent = Intent(this, ContactsActivity::class.java)
|
||||
.putExtra(ContactsActivity.SharingKey, sharing)
|
||||
.putExtra(ContactsActivity.ChipsKey, serialized)
|
||||
startActivityForResult(intent, ComposeView.SelectContactRequestCode)
|
||||
.putExtra(ContactsActivity.SHARING_KEY, sharing)
|
||||
.putExtra(ContactsActivity.CHIPS_KEY, serialized)
|
||||
startActivityForResult(intent, ComposeView.SELECT_CONTACT_REQUEST_CODE)
|
||||
}
|
||||
|
||||
override fun startSpeechRecognition() {
|
||||
@@ -673,7 +675,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
|
||||
}
|
||||
try {
|
||||
startActivityForResult(intent, ComposeView.SpeechRecognitionRequestCode)
|
||||
startActivityForResult(intent, ComposeView.SPEECH_RECOGNITION_REQUEST_CODE)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(this, getString(R.string.error_stt_toast), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
@@ -697,7 +699,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
|
||||
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
||||
.putExtra(MediaStore.EXTRA_OUTPUT, cameraDestination)
|
||||
startActivityForResult(Intent.createChooser(intent, null), ComposeView.TakePhotoRequestCode)
|
||||
startActivityForResult(Intent.createChooser(intent, null), ComposeView.TAKE_PHOTOS_REQUEST_CODE)
|
||||
}
|
||||
|
||||
override fun requestGallery(mimeType: String, requestCode: Int) {
|
||||
@@ -745,7 +747,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
.setTitle(R.string.dialog_clear_compose_title)
|
||||
.setMessage(R.string.dialog_clear_compose)
|
||||
.setPositiveButton(R.string.button_clear) { _, _ ->
|
||||
clearCurrentMessageIntent.onNext(false)
|
||||
clearCurrentMessageIntent.onNext(true)
|
||||
}
|
||||
.setNegativeButton(R.string.button_cancel, null)
|
||||
.show()
|
||||
@@ -785,17 +787,17 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
return
|
||||
|
||||
when (requestCode) {
|
||||
ComposeView.SelectContactRequestCode -> {
|
||||
chipsSelectedIntent.onNext(data?.getSerializableExtra(ContactsActivity.ChipsKey)
|
||||
ComposeView.SELECT_CONTACT_REQUEST_CODE -> {
|
||||
chipsSelectedIntent.onNext(data?.getSerializableExtra(ContactsActivity.CHIPS_KEY)
|
||||
?.let { serializable -> serializable as? HashMap<String, String?> }
|
||||
?: hashMapOf())
|
||||
}
|
||||
|
||||
ComposeView.TakePhotoRequestCode -> {
|
||||
ComposeView.TAKE_PHOTOS_REQUEST_CODE -> {
|
||||
cameraDestination?.let(attachAnyFileSelectedIntent::onNext)
|
||||
}
|
||||
|
||||
ComposeView.AttachAFileRequestCode -> {
|
||||
ComposeView.ATTACH_FILE_REQUEST_CODE -> {
|
||||
data?.clipData?.itemCount
|
||||
?.let { count -> 0 until count }
|
||||
?.mapNotNull { i -> data.clipData?.getItemAt(i)?.uri }
|
||||
@@ -803,11 +805,11 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
?: data?.data?.let(attachAnyFileSelectedIntent::onNext)
|
||||
}
|
||||
|
||||
ComposeView.AttachContactRequestCode -> {
|
||||
ComposeView.ATTACH_CONTACT_REQUEST_CODE -> {
|
||||
data?.data?.let(contactSelectedIntent::onNext)
|
||||
}
|
||||
|
||||
ComposeView.SpeechRecognitionRequestCode -> {
|
||||
ComposeView.SPEECH_RECOGNITION_REQUEST_CODE -> {
|
||||
// check returned results are good
|
||||
val match = data?.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
|
||||
if ((match !== null) && (match.size > 0) && (!match[0].isNullOrEmpty())) {
|
||||
@@ -827,12 +829,12 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
outState.putParcelable(ComposeView.CameraDestinationKey, cameraDestination)
|
||||
outState.putParcelable(ComposeView.CAMERA_DESTINATION_KEY, cameraDestination)
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
|
||||
cameraDestination = savedInstanceState.getParcelable(ComposeView.CameraDestinationKey)
|
||||
cameraDestination = savedInstanceState.getParcelable(ComposeView.CAMERA_DESTINATION_KEY)
|
||||
super.onRestoreInstanceState(savedInstanceState)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import dev.octoshrimpy.quik.model.Attachment
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.multibindings.IntoMap
|
||||
import java.net.URLDecoder
|
||||
import javax.inject.Named
|
||||
|
||||
@Module
|
||||
@@ -56,7 +55,7 @@ class ComposeActivityModule {
|
||||
@Provides
|
||||
@Named("text")
|
||||
fun provideSharedText(activity: ComposeActivity): String {
|
||||
var retVal = StringBuilder()
|
||||
val retVal = StringBuilder()
|
||||
|
||||
// from subject, if passed in intent
|
||||
retVal.append(activity.intent?.getStringExtra(Intent.EXTRA_SUBJECT) ?: "")
|
||||
@@ -90,7 +89,7 @@ class ComposeActivityModule {
|
||||
activity.intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM)?.run(uris::add)
|
||||
activity.intent.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM)?.run(uris::addAll)
|
||||
|
||||
return uris.mapNotNull { Attachment(activity, it) }
|
||||
return uris.map { Attachment(activity, it) }
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -48,6 +48,7 @@ data class ComposeState(
|
||||
val subscription: SubscriptionInfoCompat? = null,
|
||||
val canSend: Boolean = false,
|
||||
val validRecipientNumbers: Int = 1,
|
||||
val recipientCount: Int = 1,
|
||||
val audioMsgRecording: Boolean = false,
|
||||
val saveDraft: Boolean = true,
|
||||
)
|
||||
@@ -34,13 +34,13 @@ import io.reactivex.subjects.Subject
|
||||
interface ComposeView : QkView<ComposeState> {
|
||||
|
||||
companion object {
|
||||
const val SelectContactRequestCode = 0
|
||||
const val TakePhotoRequestCode = 1
|
||||
const val AttachContactRequestCode = 3
|
||||
const val AttachAFileRequestCode = 4
|
||||
const val SpeechRecognitionRequestCode = 5
|
||||
const val SELECT_CONTACT_REQUEST_CODE = 0
|
||||
const val TAKE_PHOTOS_REQUEST_CODE = 1
|
||||
const val ATTACH_CONTACT_REQUEST_CODE = 3
|
||||
const val ATTACH_FILE_REQUEST_CODE = 4
|
||||
const val SPEECH_RECOGNITION_REQUEST_CODE = 5
|
||||
|
||||
const val CameraDestinationKey = "camera_destination"
|
||||
const val CAMERA_DESTINATION_KEY = "camera_destination"
|
||||
}
|
||||
|
||||
val activityVisibleIntent: Observable<Boolean>
|
||||
@@ -49,12 +49,12 @@ interface ComposeView : QkView<ComposeState> {
|
||||
val menuReadyIntent: Observable<Unit>
|
||||
val optionsItemIntent: Observable<Int>
|
||||
val contextItemIntent: Observable<MenuItem>
|
||||
val sendAsGroupIntent: Observable<*>
|
||||
val sendAsGroupIntent: Observable<Unit>
|
||||
val messagePartClickIntent: Subject<Long>
|
||||
val messagePartContextMenuRegistrar: Subject<View>
|
||||
val messagesSelectedIntent: Observable<List<Long>>
|
||||
val cancelSendingIntent: Subject<Long>
|
||||
val sendNowIntent: Subject<Long>
|
||||
val cancelDelayedIntent: Subject<Long>
|
||||
val sendDelayedNowIntent: Subject<Long>
|
||||
val resendIntent: Subject<Long>
|
||||
val attachmentDeletedIntent: Subject<Attachment>
|
||||
val textChangedIntent: Observable<CharSequence>
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.moez.QKSMS.manager.BluetoothMicManager
|
||||
import com.moez.QKSMS.manager.MediaRecorderManager
|
||||
import com.moez.QKSMS.manager.MediaRecorderManager.AUDIO_FILE_PREFIX
|
||||
import com.moez.QKSMS.manager.MediaRecorderManager.AUDIO_FILE_SUFFIX
|
||||
import com.moez.QKSMS.util.Constants.Companion.SAVED_MESSAGE_TEXT_FILE_PREFIX
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.autoDisposable
|
||||
import dev.octoshrimpy.quik.R
|
||||
@@ -48,19 +47,19 @@ import dev.octoshrimpy.quik.common.util.extensions.makeToast
|
||||
import dev.octoshrimpy.quik.common.widget.MicInputCloudView
|
||||
import dev.octoshrimpy.quik.common.widget.QkContextMenuRecyclerView
|
||||
import dev.octoshrimpy.quik.compat.SubscriptionManagerCompat
|
||||
import dev.octoshrimpy.quik.compat.TelephonyCompat
|
||||
import dev.octoshrimpy.quik.extensions.asObservable
|
||||
import dev.octoshrimpy.quik.extensions.isImage
|
||||
import dev.octoshrimpy.quik.extensions.isSmil
|
||||
import dev.octoshrimpy.quik.extensions.isText
|
||||
import dev.octoshrimpy.quik.extensions.isVideo
|
||||
import dev.octoshrimpy.quik.extensions.mapNotNull
|
||||
import dev.octoshrimpy.quik.interactor.ActionDelayedMessage
|
||||
import dev.octoshrimpy.quik.interactor.AddScheduledMessage
|
||||
import dev.octoshrimpy.quik.interactor.CancelDelayedMessage
|
||||
import dev.octoshrimpy.quik.interactor.DeleteMessages
|
||||
import dev.octoshrimpy.quik.interactor.MarkRead
|
||||
import dev.octoshrimpy.quik.interactor.RetrySending
|
||||
import dev.octoshrimpy.quik.interactor.SendExistingMessage
|
||||
import dev.octoshrimpy.quik.interactor.SaveImage
|
||||
import dev.octoshrimpy.quik.interactor.SendMessage
|
||||
import dev.octoshrimpy.quik.interactor.SendNewMessage
|
||||
import dev.octoshrimpy.quik.manager.ActiveConversationManager
|
||||
import dev.octoshrimpy.quik.manager.BillingManager
|
||||
import dev.octoshrimpy.quik.manager.PermissionManager
|
||||
@@ -76,6 +75,9 @@ import dev.octoshrimpy.quik.repository.MessageRepository
|
||||
import dev.octoshrimpy.quik.util.ActiveSubscriptionObservable
|
||||
import dev.octoshrimpy.quik.util.PhoneNumberUtils
|
||||
import dev.octoshrimpy.quik.util.Preferences
|
||||
import dev.octoshrimpy.quik.extensions.getResourceBytes
|
||||
import dev.octoshrimpy.quik.util.Constants.Companion.DELAY_CANCELLED_CACHED_ATTACHMENTS_FILE_PREFIX
|
||||
import dev.octoshrimpy.quik.util.Constants.Companion.SAVED_MESSAGE_TEXT_FILE_PREFIX
|
||||
import dev.octoshrimpy.quik.util.FileUtils
|
||||
import dev.octoshrimpy.quik.util.tryOrNull
|
||||
import io.reactivex.Observable
|
||||
@@ -108,7 +110,7 @@ class ComposeViewModel @Inject constructor(
|
||||
private val activeConversationManager: ActiveConversationManager,
|
||||
private val addScheduledMessage: AddScheduledMessage,
|
||||
private val billingManager: BillingManager,
|
||||
private val cancelMessage: CancelDelayedMessage,
|
||||
private val actionDelayedMessage: ActionDelayedMessage,
|
||||
private val conversationRepo: ConversationRepository,
|
||||
private val deleteMessages: DeleteMessages,
|
||||
private val markRead: MarkRead,
|
||||
@@ -118,8 +120,8 @@ class ComposeViewModel @Inject constructor(
|
||||
private val permissionManager: PermissionManager,
|
||||
private val phoneNumberUtils: PhoneNumberUtils,
|
||||
private val prefs: Preferences,
|
||||
private val retrySending: RetrySending,
|
||||
private val sendMessage: SendMessage,
|
||||
private val sendExistingMessage: SendExistingMessage,
|
||||
private val sendNewMessage: SendNewMessage,
|
||||
private val subscriptionManager: SubscriptionManagerCompat,
|
||||
private val saveImage: SaveImage,
|
||||
) : QkViewModel<ComposeView, ComposeState>(ComposeState(
|
||||
@@ -135,7 +137,6 @@ class ComposeViewModel @Inject constructor(
|
||||
private val searchSelection: Subject<Long> = BehaviorSubject.createDefault(-1)
|
||||
|
||||
private var shouldShowContacts = threadId == 0L && addresses.isEmpty()
|
||||
private var showScheduledToast = false
|
||||
|
||||
private var bluetoothMicManager: BluetoothMicManager? = null
|
||||
|
||||
@@ -185,7 +186,9 @@ class ComposeViewModel @Inject constructor(
|
||||
disposables += selectedConversation
|
||||
.mergeWith(initialConversation)
|
||||
.filter { it.isLoaded }
|
||||
.filter { it.isValid.also { if (!it) newState { copy(hasError = true) } } }
|
||||
.filter { conversation ->
|
||||
conversation.isValid.also { if (!it) newState { copy(hasError = true) } }
|
||||
}
|
||||
.subscribe(conversation::onNext)
|
||||
|
||||
if (addresses.isNotEmpty())
|
||||
@@ -198,6 +201,22 @@ class ComposeViewModel @Inject constructor(
|
||||
.takeUntil(state.filter { state -> !state.editingMode })
|
||||
.subscribe(selectedChips::onNext)
|
||||
|
||||
// update state sendAsGroup when conversation sendAsGroup value changes
|
||||
disposables += conversation
|
||||
.map { conversation -> conversation.sendAsGroup }
|
||||
.distinctUntilChanged()
|
||||
.doOnNext { sendAsGroup -> newState { copy(sendAsGroup = sendAsGroup) } }
|
||||
.subscribe()
|
||||
|
||||
// update recipient count whenever conversation changes
|
||||
disposables += conversation
|
||||
.observeOn(Schedulers.io())
|
||||
.distinctUntilChanged()
|
||||
.doOnNext { conversation ->
|
||||
newState { copy (recipientCount = conversation.recipients.size) }
|
||||
}
|
||||
.subscribe()
|
||||
|
||||
// When the conversation changes, mark read, and update the recipientId and the messages for the adapter
|
||||
disposables += conversation
|
||||
.distinctUntilChanged { conversation -> conversation.id }
|
||||
@@ -215,10 +234,6 @@ class ComposeViewModel @Inject constructor(
|
||||
.distinctUntilChanged()
|
||||
.subscribe { title -> newState { copy(conversationtitle = title) } }
|
||||
|
||||
disposables += prefs.sendAsGroup.asObservable()
|
||||
.distinctUntilChanged()
|
||||
.subscribe { enabled -> newState { copy(sendAsGroup = enabled) } }
|
||||
|
||||
disposables += conversation
|
||||
.map { conversation -> conversation.id }
|
||||
.distinctUntilChanged()
|
||||
@@ -394,7 +409,7 @@ class ComposeViewModel @Inject constructor(
|
||||
// save all messages text to a file in cache
|
||||
val (uri, e) = FileUtils.createAndWrite(
|
||||
context,
|
||||
FileUtils.Companion.Location.Cache,
|
||||
FileUtils.Location.Cache,
|
||||
filename,
|
||||
mimeType,
|
||||
messageIds
|
||||
@@ -411,7 +426,7 @@ class ComposeViewModel @Inject constructor(
|
||||
navigator.viewFile(
|
||||
FileProvider.getUriForFile(
|
||||
context,
|
||||
"dev.octoshrimpy.quik.messagesText",
|
||||
"${context.packageName}.messagesText",
|
||||
uri.toFile()
|
||||
),
|
||||
mimeType
|
||||
@@ -431,7 +446,7 @@ class ComposeViewModel @Inject constructor(
|
||||
Timber.e("Error writing to messages text cache file", e)
|
||||
}
|
||||
else
|
||||
Timber.d("Created and shared messages text file: $filename", e)
|
||||
Timber.d("Created and shared messages text file: $filename")
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.clearSelection() }
|
||||
@@ -537,10 +552,9 @@ class ComposeViewModel @Inject constructor(
|
||||
val menuInfo = it.menuInfo as QkContextMenuRecyclerView.ContextMenuInfo<Long, MmsPart>
|
||||
if (menuInfo.viewHolderValue != null)
|
||||
navigator.shareFile(
|
||||
MmsPartProvider.getUriForMmsPartId(
|
||||
menuInfo.viewHolderValue.id,
|
||||
menuInfo.viewHolderValue.getBestFilename()
|
||||
),
|
||||
MmsPartProvider().getUriForMmsPartId(
|
||||
context, menuInfo.viewHolderValue.id,
|
||||
menuInfo.viewHolderValue.getBestFilename()),
|
||||
menuInfo.viewHolderValue.type
|
||||
)
|
||||
}
|
||||
@@ -563,18 +577,21 @@ class ComposeViewModel @Inject constructor(
|
||||
val menuInfo = it.menuInfo as QkContextMenuRecyclerView.ContextMenuInfo<Long, MmsPart>
|
||||
if (menuInfo.viewHolderValue != null)
|
||||
navigator.viewFile(
|
||||
MmsPartProvider.getUriForMmsPartId(
|
||||
menuInfo.viewHolderValue.id,
|
||||
menuInfo.viewHolderValue.getBestFilename()
|
||||
),
|
||||
MmsPartProvider().getUriForMmsPartId(
|
||||
context, menuInfo.viewHolderValue.id,
|
||||
menuInfo.viewHolderValue.getBestFilename()),
|
||||
menuInfo.viewHolderValue.type
|
||||
)
|
||||
}
|
||||
|
||||
// Toggle the group sending mode
|
||||
// toggle the group sending mode and update the conversation saved value
|
||||
view.sendAsGroupIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { prefs.sendAsGroup.set(!prefs.sendAsGroup.get()) }
|
||||
.observeOn(Schedulers.io())
|
||||
.withLatestFrom(conversation, state) { _, conversation, state ->
|
||||
conversationRepo.updateSendAsGroup(conversation.id, !state.sendAsGroup)
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
|
||||
// Scroll to search position
|
||||
searchSelection
|
||||
@@ -604,17 +621,19 @@ class ComposeViewModel @Inject constructor(
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
navigator.viewFile(
|
||||
MmsPartProvider.getUriForMmsPartId(it.id, it.getBestFilename()),
|
||||
MmsPartProvider().getUriForMmsPartId(context, it.id, it.getBestFilename()),
|
||||
it.type
|
||||
)
|
||||
}
|
||||
|
||||
// Update the State when the message selected count changes
|
||||
view.messagesSelectedIntent
|
||||
.map {
|
||||
.map { selectedMessageIds ->
|
||||
Pair(
|
||||
it.size,
|
||||
it.any { messageRepo.getMessage(it)?.hasNonWhitespaceText() ?: false }
|
||||
selectedMessageIds.size,
|
||||
selectedMessageIds.any {
|
||||
messageRepo.getMessage(it)?.hasNonWhitespaceText() ?: false
|
||||
}
|
||||
)
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
@@ -628,32 +647,69 @@ class ComposeViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel sending a message
|
||||
view.cancelSendingIntent
|
||||
.mapNotNull(messageRepo::getMessage)
|
||||
.doOnNext { message -> view.setDraft(message.getText(false)) }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { message ->
|
||||
cancelMessage.execute(CancelDelayedMessage.Params(message.id, message.threadId))
|
||||
// cancel sending a delayed message
|
||||
view.cancelDelayedIntent
|
||||
// most important thing first - cancel the send timer
|
||||
.map {
|
||||
messageId -> messageRepo.cancelDelayedSmsAlarm(messageId)
|
||||
|
||||
messageRepo.getUnmanagedMessage(messageId).also {
|
||||
// copy text from copy of message being cancelled
|
||||
view.setDraft(it?.getText(false) ?: "")
|
||||
}
|
||||
}
|
||||
.observeOn(Schedulers.io())
|
||||
.map { unmanagedMessage ->
|
||||
// get attachments from copy of message and save locally to be attached to current
|
||||
// message. it's done this way because the original message is being deleted and
|
||||
// it's mms:// provider attachment uris will go away from
|
||||
// it's understood that images re-attached this way could be lower quality than the
|
||||
// originals because they may have been reduced to fit in the cancelled mms.
|
||||
// in, hopefully, rare cases they could become ridiculously low res if sent and
|
||||
// cancelled multiple times with other attachments that force them small.
|
||||
// but what can you do.
|
||||
unmanagedMessage.parts.filter { !(it.isSmil() || it.isText()) }
|
||||
.mapNotNull { unmanagedMessagePart ->
|
||||
try {
|
||||
// get best name of attachment uri
|
||||
val filename = unmanagedMessagePart.getBestFilename()
|
||||
|
||||
val (cacheFileUri, e) = FileUtils.createAndWrite(
|
||||
context,
|
||||
FileUtils.Location.Cache,
|
||||
"$DELAY_CANCELLED_CACHED_ATTACHMENTS_FILE_PREFIX-" +
|
||||
"${UUID.randomUUID()}/${filename}",
|
||||
unmanagedMessagePart.type,
|
||||
unmanagedMessagePart.getUri().getResourceBytes(context)
|
||||
)
|
||||
if (e is Exception)
|
||||
throw e
|
||||
|
||||
Attachment(context, cacheFileUri)
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
.let {
|
||||
listOfAttachments -> newState { copy(attachments = listOfAttachments) }
|
||||
}
|
||||
|
||||
unmanagedMessage.id
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { messageId ->
|
||||
// cancel/delete the message
|
||||
actionDelayedMessage.execute(
|
||||
ActionDelayedMessage.Params(messageId, ActionDelayedMessage.Action.Cancel)
|
||||
)
|
||||
}
|
||||
|
||||
// send a delayed message now
|
||||
view.sendNowIntent
|
||||
.mapNotNull(messageRepo::getMessage)
|
||||
view.sendDelayedNowIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { message ->
|
||||
cancelMessage.execute(CancelDelayedMessage.Params(message.id, message.threadId))
|
||||
val address = listOf(conversationRepo
|
||||
.getConversation(threadId)?.recipients?.firstOrNull()?.address ?: message.address)
|
||||
sendMessage.execute(
|
||||
SendMessage.Params(
|
||||
message.subId,
|
||||
message.threadId,
|
||||
address,
|
||||
message.body,
|
||||
listOf(), // sms with attachments (mms) can't be delayed so we can know attachments are empty for a 'send now' delayed sms
|
||||
0
|
||||
)
|
||||
.subscribe { messageId ->
|
||||
actionDelayedMessage.execute(
|
||||
ActionDelayedMessage.Params(messageId, ActionDelayedMessage.Action.Send)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -661,7 +717,7 @@ class ComposeViewModel @Inject constructor(
|
||||
view.resendIntent
|
||||
.mapNotNull(messageRepo::getMessage)
|
||||
.filter { message -> message.isFailedMessage() }
|
||||
.doOnNext { message -> retrySending.execute(message.id) }
|
||||
.doOnNext { message -> sendExistingMessage.execute(message.id) }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
|
||||
@@ -704,9 +760,6 @@ class ComposeViewModel @Inject constructor(
|
||||
else ""
|
||||
)
|
||||
|
||||
// remove attachments
|
||||
state.attachments.forEach { it.removeCacheFile() }
|
||||
|
||||
newState { copy(saveDraft = true) }
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
@@ -729,13 +782,13 @@ class ComposeViewModel @Inject constructor(
|
||||
view.attachImageFileIntent
|
||||
.doOnNext { newState { copy(attaching = false) } }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.requestGallery("image/*", ComposeView.AttachAFileRequestCode) }
|
||||
.subscribe { view.requestGallery("image/*", ComposeView.ATTACH_FILE_REQUEST_CODE) }
|
||||
|
||||
// pick any file from any provider apps
|
||||
view.attachAnyFileIntent
|
||||
.doOnNext { newState { copy(attaching = false) } }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.requestGallery("*/*", ComposeView.AttachAFileRequestCode) }
|
||||
.subscribe { view.requestGallery("*/*", ComposeView.ATTACH_FILE_REQUEST_CODE) }
|
||||
|
||||
// Choose a time to schedule the message
|
||||
view.scheduleIntent
|
||||
@@ -914,9 +967,9 @@ class ComposeViewModel @Inject constructor(
|
||||
// starting or stopping the recording of audio
|
||||
view.recordAudioStartStopRecording
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
.subscribe { start ->
|
||||
// if start recording
|
||||
if (it == true) {
|
||||
if (start == true) {
|
||||
view.recordAudioPlayerVisible.onNext(false) // hide audio player
|
||||
|
||||
// check have permissions to record audio
|
||||
@@ -1000,7 +1053,7 @@ class ComposeViewModel @Inject constructor(
|
||||
// create new filename for recorded file because leaving the recording ui
|
||||
// will delete the original filename as a catch-all to not leave orphaned files
|
||||
val (newUri, e) = FileUtils.create(
|
||||
FileUtils.Companion.Location.Cache,
|
||||
FileUtils.Location.Cache,
|
||||
context,
|
||||
"$AUDIO_FILE_PREFIX-${UUID.randomUUID()}$AUDIO_FILE_SUFFIX",
|
||||
""
|
||||
@@ -1077,12 +1130,12 @@ class ComposeViewModel @Inject constructor(
|
||||
) { _, body, state, conversation, chips ->
|
||||
if (!permissionManager.isDefaultSms()) {
|
||||
view.requestDefaultSms()
|
||||
return@withLatestFrom
|
||||
return@withLatestFrom false
|
||||
}
|
||||
|
||||
if (!permissionManager.hasSendSms()) {
|
||||
view.requestSmsPermission()
|
||||
return@withLatestFrom
|
||||
return@withLatestFrom false
|
||||
}
|
||||
|
||||
val delay = when (prefs.sendDelay.get()) {
|
||||
@@ -1094,7 +1147,7 @@ class ComposeViewModel @Inject constructor(
|
||||
|
||||
if ((delay != 0 || state.scheduled != 0L) && !permissionManager.hasExactAlarms()) {
|
||||
navigator.showExactAlarmsSettings()
|
||||
return@withLatestFrom
|
||||
return@withLatestFrom false
|
||||
}
|
||||
|
||||
val subId = state.subscription?.subscriptionId ?: -1
|
||||
@@ -1102,68 +1155,47 @@ class ComposeViewModel @Inject constructor(
|
||||
true -> conversation.recipients.map { it.address }
|
||||
false -> chips.map { chip -> chip.address }
|
||||
}
|
||||
val sendAsGroup = ((addresses.size > 1) && // if more than one address to send to
|
||||
(!state.editingMode || // and is not a new convo (group msg or not is already set)
|
||||
state.sendAsGroup)) // or (is a new convo and) send as group is selected
|
||||
val sendAsGroup = ((addresses.size > 1) && state.sendAsGroup)
|
||||
|
||||
var scheduled = false
|
||||
|
||||
when {
|
||||
// Scheduling a message
|
||||
state.scheduled != 0L -> addScheduledMessage.execute(
|
||||
AddScheduledMessage.Params(
|
||||
state.scheduled,
|
||||
subId,
|
||||
addresses,
|
||||
sendAsGroup,
|
||||
body.toString(),
|
||||
state.attachments.map { it.uri.toString() }
|
||||
)
|
||||
).also {
|
||||
newState { copy(scheduled = 0) }
|
||||
showScheduledToast = true
|
||||
}
|
||||
|
||||
// sending a group message
|
||||
sendAsGroup -> sendMessage.execute(
|
||||
SendMessage.Params(
|
||||
subId,
|
||||
0,
|
||||
addresses,
|
||||
body.toString(),
|
||||
state.attachments,
|
||||
delay
|
||||
)
|
||||
)
|
||||
|
||||
// sending message to individual address(es)
|
||||
else -> addresses.forEach {
|
||||
sendMessage.execute(
|
||||
SendMessage.Params(
|
||||
state.scheduled != 0L -> {
|
||||
addScheduledMessage.execute(
|
||||
AddScheduledMessage.Params(
|
||||
state.scheduled,
|
||||
subId,
|
||||
0,
|
||||
listOf(it),
|
||||
addresses,
|
||||
sendAsGroup,
|
||||
body.toString(),
|
||||
state.attachments,
|
||||
delay
|
||||
state.attachments.map { it.uri }
|
||||
)
|
||||
)
|
||||
|
||||
scheduled = true
|
||||
}
|
||||
|
||||
// send message
|
||||
else -> {
|
||||
sendNewMessage.execute(
|
||||
SendNewMessage.Params(subId, 0, addresses, body.toString(),
|
||||
sendAsGroup, state.attachments.toList(), delay)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// clear the current message ready for new message composition (or finish()
|
||||
// compose activity)
|
||||
view.clearCurrentMessageIntent.onNext(
|
||||
((addresses.size > 1) && // if more than one address to send to
|
||||
state.editingMode && // and is a new convo
|
||||
!state.sendAsGroup) // and is *not* sent as a group
|
||||
)
|
||||
// clear the current message ready for new message composition
|
||||
view.clearCurrentMessageIntent.onNext(false)
|
||||
|
||||
scheduled
|
||||
}
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext {
|
||||
.doOnNext { scheduled ->
|
||||
view.focusMessage()
|
||||
if (showScheduledToast) {
|
||||
|
||||
if (scheduled)
|
||||
context.makeToast(R.string.compose_scheduled_toast)
|
||||
showScheduledToast = false
|
||||
}
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
@@ -1176,7 +1208,7 @@ class ComposeViewModel @Inject constructor(
|
||||
// Navigate back
|
||||
view.optionsItemIntent
|
||||
.filter { it == android.R.id.home }
|
||||
.map { Unit }
|
||||
.map { }
|
||||
.mergeWith(view.backPressedIntent)
|
||||
.withLatestFrom(state) { _, state ->
|
||||
when {
|
||||
@@ -1198,23 +1230,22 @@ class ComposeViewModel @Inject constructor(
|
||||
// clear the current message schedule, text and attachments
|
||||
view.clearCurrentMessageIntent
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.withLatestFrom(state) { hasError, state ->
|
||||
// remove attachments
|
||||
state.attachments.forEach { it.removeCacheFile() }
|
||||
hasError
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
.withLatestFrom(state) { removeCacheFiles, state ->
|
||||
// remove attachments cache files if they exist and flagged to do so
|
||||
if (removeCacheFiles)
|
||||
state.attachments.forEach { it.removeCacheFile() }
|
||||
|
||||
view.setDraft("")
|
||||
newState {
|
||||
copy(
|
||||
editingMode = false,
|
||||
hasError = it, // hasError being kinda misused to finish() compose activity
|
||||
attachments = listOf(),
|
||||
scheduled = 0,
|
||||
)
|
||||
}
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package dev.octoshrimpy.quik.feature.compose
|
||||
|
||||
import android.app.Activity
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.view.ActionMode
|
||||
import android.view.KeyEvent
|
||||
import android.view.Menu
|
||||
@@ -31,7 +30,6 @@ import android.view.View
|
||||
import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import android.view.accessibility.AccessibilityEvent
|
||||
import androidx.annotation.RequiresApi
|
||||
import dev.octoshrimpy.quik.feature.compose.editing.DetailedChipView
|
||||
|
||||
class ComposeWindowCallback(
|
||||
@@ -49,8 +47,7 @@ class ComposeWindowCallback(
|
||||
|
||||
override fun dispatchTouchEvent(motionEvent: MotionEvent): Boolean {
|
||||
if (motionEvent.action == MotionEvent.ACTION_DOWN) {
|
||||
val v = activity.currentFocus
|
||||
when (v) {
|
||||
when (val v = activity.currentFocus) {
|
||||
is DetailedChipView -> {
|
||||
val rect = Rect().apply { v.getGlobalVisibleRect(this) }
|
||||
if (!rect.contains(motionEvent.rawX.toInt(), motionEvent.rawY.toInt())) {
|
||||
|
||||
@@ -41,7 +41,6 @@ import androidx.core.net.toUri
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.common.QkMediaPlayer
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.Navigator
|
||||
import dev.octoshrimpy.quik.common.base.QkRealmAdapter
|
||||
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
||||
import dev.octoshrimpy.quik.common.util.Colors
|
||||
@@ -96,7 +95,6 @@ class MessagesAdapter @Inject constructor(
|
||||
private val phoneNumberUtils: PhoneNumberUtils,
|
||||
private val prefs: Preferences,
|
||||
private val textViewStyler: TextViewStyler,
|
||||
private val navigator: Navigator,
|
||||
) : QkRealmAdapter<Message>() {
|
||||
class AudioState(
|
||||
var partId: Long = -1,
|
||||
@@ -198,40 +196,43 @@ class MessagesAdapter @Inject constructor(
|
||||
// Update the selected state
|
||||
holder.containerView.isActivated = isSelected(message.id) || highlight == message.id
|
||||
|
||||
// Bind the cancelFrame (cancel button) view
|
||||
holder.cancelFrame?.let {
|
||||
val isCancellable = message.isSending() && message.date > System.currentTimeMillis()
|
||||
it.visibility = if (isCancellable) View.VISIBLE else View.GONE
|
||||
it.let {
|
||||
it.clicks().subscribe { cancelSendingClicks.onNext(message.id) }
|
||||
}
|
||||
it.cancel.progress = 2
|
||||
// bind the cancelFrame (cancel button) and send now button
|
||||
holder.cancelFrame?.let { cancelFrame ->
|
||||
holder.sendNowIcon?.let { sendNowIcon ->
|
||||
val isCancellable = message.isSending() && message.date > System.currentTimeMillis()
|
||||
|
||||
if (isCancellable) {
|
||||
val delay = when (prefs.sendDelay.get()) {
|
||||
Preferences.SEND_DELAY_SHORT -> 3000
|
||||
Preferences.SEND_DELAY_MEDIUM -> 5000
|
||||
Preferences.SEND_DELAY_LONG -> 10000
|
||||
else -> 0
|
||||
if (isCancellable) {
|
||||
cancelFrame.visibility = View.VISIBLE
|
||||
sendNowIcon.visibility = View.VISIBLE
|
||||
|
||||
cancelFrame.setOnClickListener { cancelSendingClicks.onNext(message.id) }
|
||||
sendNowIcon.setOnClickListener { sendNowClicks.onNext(message.id) }
|
||||
|
||||
cancelFrame.cancel.progress = 2
|
||||
|
||||
val delay = when (prefs.sendDelay.get()) {
|
||||
Preferences.SEND_DELAY_SHORT -> 3000
|
||||
Preferences.SEND_DELAY_MEDIUM -> 5000
|
||||
Preferences.SEND_DELAY_LONG -> 10000
|
||||
else -> 0
|
||||
}
|
||||
val progress =
|
||||
(1 - (message.date - System.currentTimeMillis()) / delay.toFloat()) * 100
|
||||
|
||||
ObjectAnimator.ofInt(cancelFrame.cancel, "progress", progress.toInt(), 100)
|
||||
.setDuration(message.date - System.currentTimeMillis())
|
||||
.start()
|
||||
}
|
||||
val progress =
|
||||
(1 - (message.date - System.currentTimeMillis()) / delay.toFloat()) * 100
|
||||
else {
|
||||
cancelFrame.visibility = View.GONE
|
||||
sendNowIcon.visibility = View.GONE
|
||||
|
||||
ObjectAnimator.ofInt(it.cancel, "progress", progress.toInt(), 100)
|
||||
.setDuration(message.date - System.currentTimeMillis())
|
||||
.start()
|
||||
cancelFrame.setOnClickListener(null)
|
||||
sendNowIcon.setOnClickListener(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bind the send now icon view
|
||||
holder.sendNowIcon?.let {
|
||||
if (message.isSending() && message.date > System.currentTimeMillis()) {
|
||||
it.visibility = View.VISIBLE
|
||||
it.clicks().subscribe { sendNowClicks.onNext(message.id) }
|
||||
} else
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
|
||||
// bind the resend icon view
|
||||
holder.resendIcon?.let { resendIcon ->
|
||||
if (message.isFailedMessage()) {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package dev.octoshrimpy.quik.feature.compose.editing
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.RelativeLayout
|
||||
@@ -28,8 +27,6 @@ import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.base.QkAdapter
|
||||
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
||||
import dev.octoshrimpy.quik.common.util.extensions.dpToPx
|
||||
import dev.octoshrimpy.quik.common.util.extensions.resolveThemeColor
|
||||
import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint
|
||||
import dev.octoshrimpy.quik.model.Recipient
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import kotlinx.android.synthetic.main.contact_chip.*
|
||||
@@ -38,7 +35,7 @@ import javax.inject.Inject
|
||||
class ChipsAdapter @Inject constructor() : QkAdapter<Recipient, QkViewHolder>() {
|
||||
|
||||
var view: RecyclerView? = null
|
||||
val chipDeleted: PublishSubject<Recipient> = PublishSubject.create<Recipient>()
|
||||
val chipDeleted: PublishSubject<Recipient> = PublishSubject.create()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
|
||||
+1
-3
@@ -84,9 +84,7 @@ class ComposeItemAdapter @Inject constructor(
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val prevItem = if (position > 0) getItem(position - 1) else null
|
||||
val item = getItem(position)
|
||||
|
||||
when (item) {
|
||||
when (val item = getItem(position)) {
|
||||
is ComposeItem.New -> bindNew(holder, item.value)
|
||||
is ComposeItem.Recent -> bindRecent(holder, item.value, prevItem)
|
||||
is ComposeItem.Starred -> bindStarred(holder, item.value, prevItem)
|
||||
|
||||
@@ -22,10 +22,10 @@ import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.media.AudioAttributes
|
||||
import android.media.MediaMetadataRetriever
|
||||
import android.media.MediaMetadataRetriever.METADATA_KEY_TITLE
|
||||
import android.view.View
|
||||
import android.widget.SeekBar
|
||||
import com.moez.QKSMS.common.QkMediaPlayer
|
||||
import com.moez.QKSMS.contentproviders.MmsPartProvider
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.Navigator
|
||||
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
||||
@@ -53,10 +53,6 @@ import javax.inject.Inject
|
||||
class AudioBinder @Inject constructor(colors: Colors, private val context: Context) :
|
||||
PartBinder() {
|
||||
|
||||
companion object {
|
||||
const val DEFAULT_SHARE_FILENAME = "quik-audio-attachment.mp3"
|
||||
}
|
||||
|
||||
@Inject lateinit var navigator: Navigator
|
||||
|
||||
override val partLayout = R.layout.mms_audio_preview_list_item
|
||||
@@ -238,54 +234,60 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte
|
||||
}
|
||||
|
||||
MediaMetadataRetriever().apply {
|
||||
if (part.getUri().resourceExists(context))
|
||||
setDataSource(context, part.getUri())
|
||||
try {
|
||||
if (part.getUri().resourceExists(context))
|
||||
setDataSource(context, part.getUri())
|
||||
|
||||
// metadata title
|
||||
holder.metadataTitle.apply {
|
||||
text = extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE)
|
||||
// metadata title
|
||||
holder.metadataTitle.apply {
|
||||
text = extractMetadata(METADATA_KEY_TITLE)
|
||||
|
||||
if (text.isEmpty())
|
||||
visibility = View.GONE
|
||||
else {
|
||||
visibility = View.VISIBLE
|
||||
setTextColor(primaryColor)
|
||||
setBackgroundTint(secondaryColor.withAlpha(0xcc)) // hex value is alpha
|
||||
if (text.isEmpty())
|
||||
visibility = View.GONE
|
||||
else {
|
||||
visibility = View.VISIBLE
|
||||
setTextColor(primaryColor)
|
||||
setBackgroundTint(secondaryColor.withAlpha(0xcc)) // hex value is alpha
|
||||
}
|
||||
}
|
||||
|
||||
// bubble / embedded image
|
||||
holder.thumbnail.apply {
|
||||
bubbleStyle = when {
|
||||
!canGroupWithPrevious && canGroupWithNext ->
|
||||
if (message.isMe()) BubbleImageView.Style.OUT_FIRST else BubbleImageView.Style.IN_FIRST
|
||||
|
||||
canGroupWithPrevious && canGroupWithNext ->
|
||||
if (message.isMe()) BubbleImageView.Style.OUT_MIDDLE else BubbleImageView.Style.IN_MIDDLE
|
||||
|
||||
canGroupWithPrevious && !canGroupWithNext ->
|
||||
if (message.isMe()) BubbleImageView.Style.OUT_LAST else BubbleImageView.Style.IN_LAST
|
||||
|
||||
else -> BubbleImageView.Style.ONLY
|
||||
}
|
||||
|
||||
val embeddedPicture = embeddedPicture
|
||||
if (embeddedPicture == null) {
|
||||
holder.frame.layoutParams.height = (holder.frame.layoutParams.width / 2)
|
||||
setTint(secondaryColor)
|
||||
setImageResource(R.drawable.rectangle)
|
||||
} else {
|
||||
holder.frame.layoutParams.height = holder.frame.layoutParams.width
|
||||
setTint(null)
|
||||
GlideApp.with(context)
|
||||
.asBitmap()
|
||||
.load(embeddedPicture)
|
||||
.override(
|
||||
holder.frame.layoutParams.width,
|
||||
holder.frame.layoutParams.height
|
||||
)
|
||||
.into(this)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) { /* nothing */ }
|
||||
finally {
|
||||
release()
|
||||
}
|
||||
|
||||
// bubble / embedded image
|
||||
holder.thumbnail.apply {
|
||||
bubbleStyle = when {
|
||||
!canGroupWithPrevious && canGroupWithNext ->
|
||||
if (message.isMe()) BubbleImageView.Style.OUT_FIRST else BubbleImageView.Style.IN_FIRST
|
||||
canGroupWithPrevious && canGroupWithNext ->
|
||||
if (message.isMe()) BubbleImageView.Style.OUT_MIDDLE else BubbleImageView.Style.IN_MIDDLE
|
||||
canGroupWithPrevious && !canGroupWithNext ->
|
||||
if (message.isMe()) BubbleImageView.Style.OUT_LAST else BubbleImageView.Style.IN_LAST
|
||||
else -> BubbleImageView.Style.ONLY
|
||||
}
|
||||
|
||||
val embeddedPicture = embeddedPicture
|
||||
if (embeddedPicture == null) {
|
||||
holder.frame.layoutParams.height = (holder.frame.layoutParams.width / 2)
|
||||
setTint(secondaryColor)
|
||||
setImageResource(R.drawable.rectangle)
|
||||
} else {
|
||||
holder.frame.layoutParams.height = holder.frame.layoutParams.width
|
||||
setTint(null)
|
||||
GlideApp.with(context)
|
||||
.asBitmap()
|
||||
.load(embeddedPicture)
|
||||
.override(
|
||||
holder.frame.layoutParams.width,
|
||||
holder.frame.layoutParams.height
|
||||
)
|
||||
.into(this)
|
||||
}
|
||||
}
|
||||
|
||||
release()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,6 @@ package dev.octoshrimpy.quik.feature.compose.part
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.widget.FrameLayout
|
||||
import com.moez.QKSMS.contentproviders.MmsPartProvider
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.Navigator
|
||||
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
||||
@@ -30,9 +27,11 @@ import dev.octoshrimpy.quik.common.util.Colors
|
||||
import dev.octoshrimpy.quik.common.util.extensions.resolveThemeColor
|
||||
import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint
|
||||
import dev.octoshrimpy.quik.common.util.extensions.setTint
|
||||
import dev.octoshrimpy.quik.extensions.mapNotNull
|
||||
import dev.octoshrimpy.quik.feature.compose.BubbleUtils
|
||||
import dev.octoshrimpy.quik.model.Message
|
||||
import dev.octoshrimpy.quik.model.MmsPart
|
||||
import dev.octoshrimpy.quik.util.tryOrNull
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@@ -60,9 +59,13 @@ class FileBinder @Inject constructor(colors: Colors, private val context: Contex
|
||||
BubbleUtils.getBubble(false, canGroupWithPrevious, canGroupWithNext, message.isMe())
|
||||
.let(holder.fileBackground::setBackgroundResource)
|
||||
|
||||
Observable.just(part.getUri())
|
||||
.map(context.contentResolver::openInputStream)
|
||||
.map { inputStream -> inputStream.use { it.available() } }
|
||||
tryOrNull(true) {
|
||||
Observable.just(part.getUri())
|
||||
.mapNotNull { uri ->
|
||||
tryOrNull(true) {
|
||||
context.contentResolver.openInputStream(uri)?.use { it.available() }
|
||||
}
|
||||
}
|
||||
.map { bytes ->
|
||||
when (bytes) {
|
||||
in 0..999 -> "$bytes B"
|
||||
@@ -75,7 +78,8 @@ class FileBinder @Inject constructor(colors: Colors, private val context: Contex
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { size -> holder.size.text = size }
|
||||
|
||||
holder.filename.text = part.name
|
||||
holder.filename.text = part.getBestFilename()
|
||||
}
|
||||
|
||||
if (!message.isMe()) {
|
||||
holder.fileBackground.setBackgroundTint(theme.theme)
|
||||
|
||||
@@ -29,6 +29,7 @@ import dev.octoshrimpy.quik.extensions.isVideo
|
||||
import dev.octoshrimpy.quik.model.Message
|
||||
import dev.octoshrimpy.quik.model.MmsPart
|
||||
import dev.octoshrimpy.quik.util.GlideApp
|
||||
import dev.octoshrimpy.quik.util.tryOrNull
|
||||
import kotlinx.android.synthetic.main.mms_image_preview_list_item.*
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -56,7 +57,9 @@ class ImageBinder @Inject constructor(colors: Colors, private val context: Conte
|
||||
else -> BubbleImageView.Style.ONLY
|
||||
}
|
||||
|
||||
GlideApp.with(context).load(part.getUri()).fitCenter().into(holder.thumbnail)
|
||||
tryOrNull(true) {
|
||||
GlideApp.with(context).load(part.getUri()).fitCenter().into(holder.thumbnail)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package dev.octoshrimpy.quik.feature.compose.part
|
||||
|
||||
import android.net.Uri
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package dev.octoshrimpy.quik.feature.compose.part
|
||||
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.isVisible
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
||||
@@ -34,6 +32,7 @@ import dev.octoshrimpy.quik.extensions.mapNotNull
|
||||
import dev.octoshrimpy.quik.feature.compose.BubbleUtils
|
||||
import dev.octoshrimpy.quik.model.Message
|
||||
import dev.octoshrimpy.quik.model.MmsPart
|
||||
import dev.octoshrimpy.quik.util.tryOrNull
|
||||
import ezvcard.Ezvcard
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -60,7 +59,8 @@ class VCardBinder @Inject constructor(colors: Colors, private val context: Conte
|
||||
|
||||
holder.containerView.setOnClickListener { clicks.onNext(part.id) }
|
||||
|
||||
Observable.just(part.getUri())
|
||||
tryOrNull(true) {
|
||||
Observable.just(part.getUri())
|
||||
.map(context.contentResolver::openInputStream)
|
||||
.mapNotNull { inputStream -> inputStream.use { Ezvcard.parse(it).first() } }
|
||||
.map { vcard -> vcard.getDisplayName() ?: "" }
|
||||
@@ -70,6 +70,7 @@ class VCardBinder @Inject constructor(colors: Colors, private val context: Conte
|
||||
holder.name?.text = displayName
|
||||
holder.name.isVisible = displayName.isNotEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
if (!message.isMe()) {
|
||||
holder.vCardBackground.setBackgroundTint(theme.theme)
|
||||
|
||||
@@ -20,7 +20,6 @@ package dev.octoshrimpy.quik.feature.contacts
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
@@ -31,8 +30,6 @@ import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.ViewModelFactory
|
||||
import dev.octoshrimpy.quik.common.base.QkThemedActivity
|
||||
import dev.octoshrimpy.quik.common.util.extensions.hideKeyboard
|
||||
import dev.octoshrimpy.quik.common.util.extensions.resolveThemeColor
|
||||
import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint
|
||||
import dev.octoshrimpy.quik.common.util.extensions.showKeyboard
|
||||
import dev.octoshrimpy.quik.common.widget.QkDialog
|
||||
import dev.octoshrimpy.quik.extensions.Optional
|
||||
@@ -50,8 +47,8 @@ import javax.inject.Inject
|
||||
class ContactsActivity : QkThemedActivity(), ContactsContract {
|
||||
|
||||
companion object {
|
||||
const val SharingKey = "sharing"
|
||||
const val ChipsKey = "chips"
|
||||
const val SHARING_KEY = "sharing"
|
||||
const val CHIPS_KEY = "chips"
|
||||
}
|
||||
|
||||
@Inject lateinit var contactsAdapter: ComposeItemAdapter
|
||||
@@ -116,7 +113,7 @@ class ContactsActivity : QkThemedActivity(), ContactsContract {
|
||||
|
||||
override fun finish(result: HashMap<String, String?>) {
|
||||
search.hideKeyboard()
|
||||
val intent = Intent().putExtra(ChipsKey, result)
|
||||
val intent = Intent().putExtra(CHIPS_KEY, result)
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
+2
-2
@@ -29,12 +29,12 @@ class ContactsActivityModule {
|
||||
|
||||
@Provides
|
||||
fun provideIsSharing(activity: ContactsActivity): Boolean {
|
||||
return activity.intent.extras?.getBoolean(ContactsActivity.SharingKey, false) ?: false
|
||||
return activity.intent.extras?.getBoolean(ContactsActivity.SHARING_KEY, false) ?: false
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun provideChips(activity: ContactsActivity): HashMap<String, String?> {
|
||||
return activity.intent.extras?.getSerializable(ContactsActivity.ChipsKey)
|
||||
return activity.intent.extras?.getSerializable(ContactsActivity.CHIPS_KEY)
|
||||
?.let { serializable -> serializable as? HashMap<String, String?> }
|
||||
?: hashMapOf()
|
||||
}
|
||||
|
||||
-2
@@ -22,10 +22,8 @@ import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.text.bold
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.core.text.color
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.common.Navigator
|
||||
|
||||
@@ -31,8 +31,6 @@ import dev.octoshrimpy.quik.repository.ConversationRepository
|
||||
import dev.octoshrimpy.quik.repository.MessageRepository
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.autoDisposable
|
||||
import dev.octoshrimpy.quik.common.widget.QkContextMenuRecyclerView
|
||||
import dev.octoshrimpy.quik.model.MmsPart
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.rxkotlin.withLatestFrom
|
||||
@@ -48,10 +46,6 @@ class GalleryViewModel @Inject constructor(
|
||||
private val saveImage: SaveImage,
|
||||
private val permissions: PermissionManager
|
||||
) : QkViewModel<GalleryView, GalleryState>(GalleryState()) {
|
||||
companion object {
|
||||
const val DEFAULT_SHARE_FILENAME = "quik-media-attachment.jpg"
|
||||
}
|
||||
|
||||
init {
|
||||
disposables += Flowable.just(partId)
|
||||
.mapNotNull(messageRepo::getMessageForPart)
|
||||
@@ -90,7 +84,7 @@ class GalleryViewModel @Inject constructor(
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
navigator.shareFile(
|
||||
MmsPartProvider.getUriForMmsPartId(it.id, it.getBestFilename()),
|
||||
MmsPartProvider().getUriForMmsPartId(context, it.id, it.getBestFilename()),
|
||||
it.type
|
||||
)
|
||||
}
|
||||
@@ -109,7 +103,7 @@ class GalleryViewModel @Inject constructor(
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
navigator.viewFile(
|
||||
MmsPartProvider.getUriForMmsPartId(it.id, it.getBestFilename()),
|
||||
MmsPartProvider().getUriForMmsPartId(context, it.id, it.getBestFilename()),
|
||||
it.type
|
||||
)
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import dev.octoshrimpy.quik.common.util.extensions.setVisible
|
||||
import dev.octoshrimpy.quik.extensions.removeAccents
|
||||
import dev.octoshrimpy.quik.model.SearchResult
|
||||
import kotlinx.android.synthetic.main.search_list_item.*
|
||||
import kotlinx.android.synthetic.main.search_list_item.view.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class SearchAdapter @Inject constructor(
|
||||
|
||||
+5
-3
@@ -106,8 +106,8 @@ class NotificationPrefsViewModel @Inject constructor(
|
||||
|
||||
view.preferenceClickIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
when (it.id) {
|
||||
.subscribe { preferenceView ->
|
||||
when (preferenceView.id) {
|
||||
R.id.notificationsO -> navigator.showNotificationChannel(threadId)
|
||||
|
||||
R.id.notifications -> notifications.set(!notifications.get())
|
||||
@@ -120,7 +120,9 @@ class NotificationPrefsViewModel @Inject constructor(
|
||||
|
||||
R.id.vibration -> vibration.set(!vibration.get())
|
||||
|
||||
R.id.ringtone -> view.showRingtonePicker(ringtone.get().takeIf { it.isNotEmpty() }?.let(Uri::parse))
|
||||
R.id.ringtone -> view.showRingtonePicker(
|
||||
ringtone.get().takeIf { it.isNotEmpty() }?.let(Uri::parse)
|
||||
)
|
||||
|
||||
R.id.action1 -> view.showActionDialog(prefs.notifAction1.get())
|
||||
|
||||
|
||||
-1
@@ -19,7 +19,6 @@
|
||||
package dev.octoshrimpy.quik.feature.plus.experiment
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.StringRes
|
||||
import dev.octoshrimpy.quik.R
|
||||
import dev.octoshrimpy.quik.experiment.Experiment
|
||||
import dev.octoshrimpy.quik.experiment.Variant
|
||||
|
||||
@@ -27,7 +27,7 @@ import dev.octoshrimpy.quik.extensions.asObservable
|
||||
import dev.octoshrimpy.quik.extensions.mapNotNull
|
||||
import dev.octoshrimpy.quik.interactor.DeleteMessages
|
||||
import dev.octoshrimpy.quik.interactor.MarkRead
|
||||
import dev.octoshrimpy.quik.interactor.SendMessage
|
||||
import dev.octoshrimpy.quik.interactor.SendNewMessage
|
||||
import dev.octoshrimpy.quik.model.Message
|
||||
import dev.octoshrimpy.quik.repository.ConversationRepository
|
||||
import dev.octoshrimpy.quik.repository.MessageRepository
|
||||
@@ -52,7 +52,7 @@ class QkReplyViewModel @Inject constructor(
|
||||
private val markRead: MarkRead,
|
||||
private val messageRepo: MessageRepository,
|
||||
private val navigator: Navigator,
|
||||
private val sendMessage: SendMessage,
|
||||
private val sendNewMessage: SendNewMessage,
|
||||
private val subscriptionManager: SubscriptionManagerCompat
|
||||
) : QkViewModel<QkReplyView, QkReplyState>(QkReplyState(threadId = threadId)) {
|
||||
|
||||
@@ -69,7 +69,7 @@ class QkReplyViewModel @Inject constructor(
|
||||
|
||||
init {
|
||||
disposables += markRead
|
||||
disposables += sendMessage
|
||||
disposables += sendNewMessage
|
||||
|
||||
// When the set of messages changes, update the state
|
||||
// If we're ever showing an empty set of messages, then it's time to shut down to activity
|
||||
@@ -215,9 +215,10 @@ class QkReplyViewModel @Inject constructor(
|
||||
.withLatestFrom(view.textChangedIntent) { _, body -> body }
|
||||
.map { body -> body.toString() }
|
||||
.withLatestFrom(state, conversation) { body, state, conversation ->
|
||||
val subId = state.subscription?.subscriptionId ?: -1
|
||||
val addresses = conversation.recipients.map { it.address }
|
||||
sendMessage.execute(SendMessage.Params(subId, threadId, addresses, body))
|
||||
sendNewMessage.execute(SendNewMessage.Params(
|
||||
state.subscription?.subscriptionId ?: -1, 0,
|
||||
conversation.recipients.map { it.address }, body, conversation.sendAsGroup
|
||||
))
|
||||
view.setDraft("")
|
||||
}
|
||||
.doOnNext {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package dev.octoshrimpy.quik.feature.scheduled
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
|
||||
@@ -51,83 +51,91 @@ class ScheduledViewModel @Inject constructor(
|
||||
// show the delete message dialog if one or more messages selected
|
||||
view.optionsItemIntent
|
||||
.filter { it == R.id.delete }
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages }
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages ->
|
||||
view.showDeleteDialog(selectedMessages)
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.showDeleteDialog(it) }
|
||||
.subscribe()
|
||||
|
||||
// copy the selected message text to the clipboard
|
||||
view.optionsItemIntent
|
||||
.filter { it == R.id.copy }
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
val messages = it
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessageIds ->
|
||||
selectedMessageIds // same order as messages on screen
|
||||
.mapNotNull(scheduledMessageRepo::getScheduledMessage)
|
||||
.sortedBy { it.date } // same order as messages on screen
|
||||
val text = when (messages.size) {
|
||||
1 -> messages.first().body
|
||||
else -> messages.fold(StringBuilder()) { acc, message ->
|
||||
if (acc.isNotEmpty() && message.body.isNotEmpty())
|
||||
acc.append("\n\n")
|
||||
acc.append(message.body)
|
||||
.sortedBy { it.date }
|
||||
.let { scheduledMessages ->
|
||||
ClipboardUtils.copy(
|
||||
context,
|
||||
when (scheduledMessages.size) {
|
||||
1 -> scheduledMessages.first().body
|
||||
else -> scheduledMessages.fold(StringBuilder()) { acc, message ->
|
||||
if (acc.isNotEmpty() && message.body.isNotEmpty())
|
||||
acc.append("\n\n")
|
||||
acc.append(message.body)
|
||||
}
|
||||
}.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
ClipboardUtils.copy(context, text.toString())
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
|
||||
// send the messages now menu item selected
|
||||
view.optionsItemIntent
|
||||
.filter { it == R.id.send_now }
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages }
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages ->
|
||||
view.showSendNowDialog(selectedMessages)
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.showSendNowDialog(it) }
|
||||
.subscribe()
|
||||
|
||||
// edit message menu item selected
|
||||
view.optionsItemIntent
|
||||
.filter { it == R.id.edit_message }
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessage -> selectedMessage.first() }
|
||||
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessage ->
|
||||
view.showEditMessageDialog(selectedMessage.first())
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.showEditMessageDialog(it) }
|
||||
.subscribe()
|
||||
|
||||
// delete message(s) (fired after the confirmation dialog has been shown)
|
||||
view.deleteScheduledMessages
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
deleteScheduledMessagesInteractor.execute(it)
|
||||
.subscribe { selectedMessagesIds ->
|
||||
deleteScheduledMessagesInteractor.execute(selectedMessagesIds.toList())
|
||||
view.clearSelection()
|
||||
}
|
||||
|
||||
// send message(s) now (fired after the confirmation dialog has been shown)
|
||||
view.sendScheduledMessages
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
it.forEach { sendScheduledMessageInteractor.execute(it) }
|
||||
.subscribe { selectedMessagesIds ->
|
||||
selectedMessagesIds.forEach { selectedMessagesId ->
|
||||
sendScheduledMessageInteractor.execute(selectedMessagesId)
|
||||
}
|
||||
view.clearSelection()
|
||||
}
|
||||
|
||||
|
||||
// edit message (fired after the confirmation dialog has been shown)
|
||||
view.editScheduledMessage
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
scheduledMessageRepo.getScheduledMessage(it)?.let {
|
||||
navigator.showCompose(it)
|
||||
scheduledMessageRepo.deleteScheduledMessage(it.id)
|
||||
}
|
||||
view.clearSelection()
|
||||
.observeOn(Schedulers.io())
|
||||
.doOnNext { selectedMessageId ->
|
||||
scheduledMessageRepo.getScheduledMessage(selectedMessageId)
|
||||
?.let { scheduledMessage ->
|
||||
navigator.showCompose(scheduledMessage)
|
||||
scheduledMessageRepo.deleteScheduledMessage(scheduledMessage.id)
|
||||
}
|
||||
}
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.clearSelection() }
|
||||
|
||||
// navigate back or unselect
|
||||
view.optionsItemIntent
|
||||
.filter { it == android.R.id.home }
|
||||
.map { Unit }
|
||||
.map { }
|
||||
.mergeWith(view.backPressedIntent)
|
||||
.withLatestFrom(state) { _, state -> state }
|
||||
.autoDisposable(view.scope())
|
||||
|
||||
@@ -251,7 +251,7 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
|
||||
override fun showAutoDeleteDialog(days: Int) = autoDeleteDialog.setExpiry(days).show()
|
||||
|
||||
override suspend fun showAutoDeleteWarningDialog(messages: Int): Boolean = withContext(Dispatchers.Main) {
|
||||
suspendCancellableCoroutine<Boolean> { cont ->
|
||||
suspendCancellableCoroutine { cont ->
|
||||
AlertDialog.Builder(activity!!)
|
||||
.setTitle(R.string.settings_auto_delete_warning)
|
||||
.setMessage(context.resources.getString(R.string.settings_auto_delete_warning_message, messages))
|
||||
|
||||
@@ -34,7 +34,7 @@ class ThemePagerAdapter @Inject constructor(private val context: Context) : Page
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPageTitle(position: Int): CharSequence? {
|
||||
override fun getPageTitle(position: Int): CharSequence {
|
||||
return when (position) {
|
||||
1 -> context.getString(R.string.theme_plus)
|
||||
else -> context.getString(R.string.theme_material)
|
||||
|
||||
@@ -95,7 +95,7 @@ class WidgetAdapter(intent: Intent) : RemoteViewsService.RemoteViewsFactory {
|
||||
* we'll return the max count + 1, where the last row just shows "View more conversations"
|
||||
*/
|
||||
override fun getCount(): Int {
|
||||
val count = Math.min(conversations.size, MAX_CONVERSATIONS_COUNT)
|
||||
val count = conversations.size.coerceAtMost(MAX_CONVERSATIONS_COUNT)
|
||||
val shouldShowViewMore = count < conversations.size
|
||||
return count + if (shouldShowViewMore) 1 else 0
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
AndroidInjection.inject(this, context)
|
||||
|
||||
when (intent.action) {
|
||||
WidgetManager.ACTION_NOTIFY_DATASET_CHANGED -> updateData(context)
|
||||
"${context.packageName}.${WidgetManager.ACTION_NOTIFY_DATASET_CHANGED}" -> updateData(context)
|
||||
else -> super.onReceive(context, intent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import android.widget.RemoteViewsService
|
||||
|
||||
class WidgetService : RemoteViewsService() {
|
||||
|
||||
override fun onGetViewFactory(intent: Intent): RemoteViewsService.RemoteViewsFactory {
|
||||
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
|
||||
return WidgetAdapter(intent)
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -52,10 +52,13 @@ class WidgetSpeakUnseenProvider : AppWidgetProvider() {
|
||||
remoteViews.setImageViewResource(R.id.speakUnseenImage, R.drawable.ic_speak_unseen_widget)
|
||||
|
||||
// speak unseen intent
|
||||
val speakUnseenIntent = Intent(context, SpeakThreadsReceiver::class.java)
|
||||
.putExtra("threadId", -1L)
|
||||
val speakUnseenPendingIntent = PendingIntent.getBroadcast(context,0,
|
||||
speakUnseenIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
val speakUnseenPendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
0,
|
||||
Intent(context, SpeakThreadsReceiver::class.java)
|
||||
.putExtra("threadId", -1L),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
remoteViews.setOnClickPendingIntent(R.id.speakUnseenImage, speakUnseenPendingIntent)
|
||||
|
||||
AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteViews)
|
||||
|
||||
+33
-48
@@ -24,22 +24,19 @@ import dev.octoshrimpy.quik.receiver.BlockThreadReceiver
|
||||
import dev.octoshrimpy.quik.receiver.BootReceiver
|
||||
import dev.octoshrimpy.quik.receiver.DefaultSmsChangedReceiver
|
||||
import dev.octoshrimpy.quik.receiver.DeleteMessagesReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MarkArchivedReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MarkReadReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MarkSeenReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MmsReceivedReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MmsReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MmsSentReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MmsUpdatedReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MmsWapPushReceiver
|
||||
import dev.octoshrimpy.quik.receiver.NightModeReceiver
|
||||
import dev.octoshrimpy.quik.receiver.RemoteMessagingReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SendScheduledMessageReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SmsDeliveredReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MessageDeliveredReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SmsProviderChangedReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SmsReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SmsSentReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SmsReceivedReceiver
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import dev.octoshrimpy.quik.receiver.MessageMarkReceiver
|
||||
import dev.octoshrimpy.quik.receiver.MessageSentReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SendDelayedMessageReceiver
|
||||
import dev.octoshrimpy.quik.receiver.SpeakThreadsReceiver
|
||||
import dev.octoshrimpy.quik.receiver.StartActivityFromWidgetReceiver
|
||||
|
||||
@@ -47,87 +44,75 @@ import dev.octoshrimpy.quik.receiver.StartActivityFromWidgetReceiver
|
||||
abstract class BroadcastReceiverBuilderModule {
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindBlockThreadReceiver(): BlockThreadReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindBootReceiver(): BootReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindDefaultSmsChangedReceiver(): DefaultSmsChangedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindDeleteMessagesReceiver(): DeleteMessagesReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMarkArchivedReceiver(): MarkArchivedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMarkReadReceiver(): MarkReadReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSpeakThreadsReceiver(): SpeakThreadsReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindStartActivityFromWidgetReceiver(): StartActivityFromWidgetReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMarkSeenReceiver(): MarkSeenReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMmsReceivedReceiver(): MmsReceivedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMmsReceiver(): MmsReceiver
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMmsWapPushReceiver(): MmsWapPushReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMmsSentReceiver(): MmsSentReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMmsUpdatedReceiver(): MmsUpdatedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindNightModeReceiver(): NightModeReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindRemoteMessagingReceiver(): RemoteMessagingReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindSendScheduledMessageReceiver(): SendScheduledMessageReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSmsDeliveredReceiver(): SmsDeliveredReceiver
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindSendDelayedMessageReceiver(): SendDelayedMessageReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMessageDeliveredReceiver(): MessageDeliveredReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindSmsProviderChangedReceiver(): SmsProviderChangedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSmsReceiver(): SmsReceiver
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindSmsReceivedReceiver(): SmsReceivedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSmsSentReceiver(): SmsSentReceiver
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMessageSentReceiver(): MessageSentReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMessageMarkReceiver(): MessageMarkReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindWidgetProvider(): WidgetProvider
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ package dev.octoshrimpy.quik.injection.android
|
||||
import dev.octoshrimpy.quik.feature.backup.RestoreBackupService
|
||||
import dev.octoshrimpy.quik.injection.scope.ActivityScope
|
||||
import dev.octoshrimpy.quik.service.HeadlessSmsSendService
|
||||
import dev.octoshrimpy.quik.receiver.SendSmsReceiver
|
||||
import dev.octoshrimpy.quik.service.AutoDeleteService
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
@@ -30,19 +29,15 @@ import dagger.android.ContributesAndroidInjector
|
||||
abstract class ServiceBuilderModule {
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindAutoDeleteService(): AutoDeleteService
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindHeadlessSmsSendService(): HeadlessSmsSendService
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindRestoreBackupService(): RestoreBackupService
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSendSmsReceiver(): SendSmsReceiver
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
~
|
||||
~ This file is part of QKSMS.
|
||||
~
|
||||
~ QKSMS is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ QKSMS is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,8V4l8,8 -8,8v-4H4V8z"/>
|
||||
</vector>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vector xmlns:aapt="http://schemas.android.com/aapt"
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="56dp"
|
||||
android:width="56dp"
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<!--
|
||||
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
~
|
||||
~ This file is part of QKSMS.
|
||||
~
|
||||
~ QKSMS is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ QKSMS is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M6,6h12v12H6z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
~
|
||||
~ This file is part of QKSMS.
|
||||
~
|
||||
~ QKSMS is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ QKSMS is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12.87,15.07l-2.54,-2.51 0.03,-0.03c1.74,-1.94 2.98,-4.17 3.71,-6.53L17,6L17,4h-7L10,2L8,2v2L1,4v1.99h11.17C11.5,7.92 10.44,9.75 9,11.35 8.07,10.32 7.3,9.19 6.69,8h-2c0.73,1.63 1.73,3.17 2.98,4.56l-5.09,5.02L4,19l5,-5 3.11,3.11 0.76,-2.04zM18.5,10h-2L12,22h2l1.12,-3h4.75L21,22h2l-4.5,-12zM15.88,17l1.62,-4.33L19.12,17h-3.24z"/>
|
||||
</vector>
|
||||
@@ -21,4 +21,4 @@
|
||||
app:fontProviderAuthority="com.google.android.gms.fonts"
|
||||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"
|
||||
app:fontProviderPackage="com.google.android.gms"
|
||||
app:fontProviderQuery="Lato"></font-family>
|
||||
app:fontProviderQuery="Lato" />
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:src="@drawable/ic_person_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -88,6 +88,6 @@
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?attr/bubbleColor"
|
||||
android:src="@drawable/ic_cancel_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary" />
|
||||
app:tint="?android:attr/textColorSecondary" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -41,7 +41,7 @@
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_person_black_24dp"
|
||||
android:tint="@color/white" />
|
||||
app:tint="@color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/photo"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/progressSummary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/progressTitle"
|
||||
@@ -88,7 +88,7 @@
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_close_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/progressSummary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/progressTitle" />
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
android:elevation="8dp"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_add_black_24dp"
|
||||
android:tint="@color/white"
|
||||
app:tint="@color/white"
|
||||
tools:backgroundTint="@color/tools_theme" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -139,7 +139,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/compose_send_group_summary"
|
||||
android:text="@string/compose_send_group_summary_on"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
app:layout_constraintEnd_toEndOf="@id/sendAsGroupTitle"
|
||||
app:layout_constraintStart_toStartOf="@id/sendAsGroupTitle"
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
android:layout_marginTop="2dp"
|
||||
android:paddingStart="4dp"
|
||||
android:src="@drawable/ic_baseline_push_pin_24"
|
||||
android:tint="?android:attr/textColorTertiary"
|
||||
app:tint="?android:attr/textColorTertiary"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/unread"
|
||||
app:layout_constraintTop_toTopOf="@id/snippet"
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
android:layout_marginEnd="16dp"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_person_add_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/theme"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -81,7 +81,7 @@
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_palette_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<ImageView
|
||||
style="@style/DrawerIcon"
|
||||
android:src="@drawable/ic_import_export_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary" />
|
||||
app:tint="?android:attr/textColorSecondary" />
|
||||
|
||||
<dev.octoshrimpy.quik.common.widget.QkTextView
|
||||
style="@style/DrawerText"
|
||||
@@ -104,7 +104,7 @@
|
||||
<ImageView
|
||||
style="@style/DrawerIcon"
|
||||
android:src="@drawable/ic_event_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary" />
|
||||
app:tint="?android:attr/textColorSecondary" />
|
||||
|
||||
<dev.octoshrimpy.quik.common.widget.QkTextView
|
||||
style="@style/DrawerText"
|
||||
@@ -131,7 +131,7 @@
|
||||
<ImageView
|
||||
style="@style/DrawerIcon"
|
||||
android:src="@drawable/ic_block_white_24dp"
|
||||
android:tint="?android:attr/textColorSecondary" />
|
||||
app:tint="?android:attr/textColorSecondary" />
|
||||
|
||||
<dev.octoshrimpy.quik.common.widget.QkTextView
|
||||
style="@style/DrawerText"
|
||||
@@ -153,7 +153,7 @@
|
||||
<ImageView
|
||||
style="@style/DrawerIcon"
|
||||
android:src="@drawable/ic_settings_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary" />
|
||||
app:tint="?android:attr/textColorSecondary" />
|
||||
|
||||
<dev.octoshrimpy.quik.common.widget.QkTextView
|
||||
style="@style/DrawerText"
|
||||
@@ -198,7 +198,7 @@
|
||||
<ImageView
|
||||
style="@style/DrawerIcon"
|
||||
android:src="@drawable/ic_people_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary" />
|
||||
app:tint="?android:attr/textColorSecondary" />
|
||||
|
||||
<dev.octoshrimpy.quik.common.widget.QkTextView
|
||||
style="@style/DrawerText"
|
||||
@@ -259,7 +259,7 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_chevron_right_black_24dp"
|
||||
android:tint="?android:attr/textColorTertiary"
|
||||
app:tint="?android:attr/textColorTertiary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
android:contentDescription="@string/compose_sim_cd"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_sim_card_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message"
|
||||
app:layout_constraintEnd_toEndOf="@id/messageBackground" />
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
android:contentDescription="@string/compose_send_cd"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_send_black_24dp"
|
||||
android:tint="?android:textColorSecondary"
|
||||
app:tint="?android:textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:backgroundTint="@color/tools_theme" />
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
android:backgroundTint="?android:attr/divider"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_person_black_24dp"
|
||||
android:tint="?android:attr/textColorTertiary"
|
||||
app:tint="?android:attr/textColorTertiary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rightBackground"
|
||||
app:layout_constraintStart_toEndOf="@id/rightIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/rightBackground" />
|
||||
@@ -237,7 +237,7 @@
|
||||
android:backgroundTint="?android:attr/divider"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_person_black_24dp"
|
||||
android:tint="?android:attr/textColorTertiary"
|
||||
app:tint="?android:attr/textColorTertiary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/leftBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/leftBackground"
|
||||
app:layout_constraintTop_toTopOf="@id/leftBackground" />
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
-->
|
||||
<dev.octoshrimpy.quik.common.widget.QkEditText xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_cancel_black_24dp"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@@ -132,7 +132,8 @@
|
||||
<string name="compose_title_selected">%d selected</string>
|
||||
<string name="compose_subtitle_results">%1$d of %2$d results</string>
|
||||
<string name="compose_send_group_title">Send as group message</string>
|
||||
<string name="compose_send_group_summary">Recipients and replies will be visible to everyone</string>
|
||||
<string name="compose_send_group_summary_on">Recipients and replies will be visible to everyone</string>
|
||||
<string name="compose_send_group_summary_off">Messages will be sent separately to all recipients</string>
|
||||
<string name="compose_messages_empty">This is the start of your conversation. Say something nice!</string>
|
||||
<string name="compose_vcard_label">Contact card</string>
|
||||
<string name="compose_scheduled_for">Scheduled for</string>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package dev.octoshrimpy.quik.common.util
|
||||
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class CrashlyticsTree : Timber.Tree() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user