diff --git a/app/build.gradle b/app/build.gradle
index 981ef3ef..730d428a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -22,7 +22,7 @@ android {
compileSdkVersion 31
defaultConfig {
applicationId APP_ID
- minSdkVersion 21
+ minSdkVersion 23
targetSdkVersion 31
versionCode 94
versionName "19.0"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 48a5e622..2273316d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,9 +7,6 @@
-
>() {
}
resultTextView.background.level = level
- resultTextView.background.setTint(ContextCompat.getColor(resultTextView.context, optionColor))
+ resultTextView.background.setTint(resultTextView.context.getColor(optionColor))
resultTextView.setOnClickListener(resultClickListener)
}
SINGLE -> {
diff --git a/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt
index 7b5b8d7d..6c8f997b 100644
--- a/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt
@@ -31,7 +31,6 @@ import androidx.annotation.ColorInt
import androidx.annotation.Px
import androidx.appcompat.app.AlertDialog
import androidx.core.app.ActivityOptionsCompat
-import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
@@ -171,7 +170,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
*/
private fun loadResources() {
toolbarColor = ThemeUtils.getColor(this, R.attr.colorSurface)
- statusBarColorTransparent = ContextCompat.getColor(this, R.color.transparent_statusbar_background)
+ statusBarColorTransparent = getColor(R.color.transparent_statusbar_background)
statusBarColorOpaque = ThemeUtils.getColor(this, R.attr.colorPrimaryDark)
avatarSize = resources.getDimension(R.dimen.account_activity_avatar_size)
titleVisibleHeight = resources.getDimensionPixelSize(R.dimen.account_activity_scroll_title_visible_height)
diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt
index 7924c8e5..0ffe8f60 100644
--- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt
@@ -595,12 +595,12 @@ class ComposeActivity :
@ColorInt val color = if (contentWarningShown) {
binding.composeHideMediaButton.setImageResource(R.drawable.ic_hide_media_24dp)
binding.composeHideMediaButton.isClickable = false
- ContextCompat.getColor(this, R.color.transparent_tusky_blue)
+ getColor(R.color.transparent_tusky_blue)
} else {
binding.composeHideMediaButton.isClickable = true
if (markMediaSensitive) {
binding.composeHideMediaButton.setImageResource(R.drawable.ic_hide_media_24dp)
- ContextCompat.getColor(this, R.color.tusky_blue)
+ getColor(R.color.tusky_blue)
} else {
binding.composeHideMediaButton.setImageResource(R.drawable.ic_eye_24dp)
ThemeUtils.getColor(this, android.R.attr.textColorTertiary)
@@ -614,7 +614,7 @@ class ComposeActivity :
@ColorInt val color = if (binding.composeScheduleView.time == null) {
ThemeUtils.getColor(this, android.R.attr.textColorTertiary)
} else {
- ContextCompat.getColor(this, R.color.tusky_blue)
+ getColor(R.color.tusky_blue)
}
binding.composeScheduleButton.drawable.colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)
}
@@ -797,7 +797,7 @@ class ComposeActivity :
binding.composeCharactersLeftView.text = String.format(Locale.getDefault(), "%d", remainingLength)
val textColor = if (remainingLength < 0) {
- ContextCompat.getColor(this, R.color.tusky_red)
+ getColor(R.color.tusky_red)
} else {
ThemeUtils.getColor(this, android.R.attr.textColorTertiary)
}
@@ -969,7 +969,7 @@ class ComposeActivity :
binding.composeContentWarningBar.show()
binding.composeContentWarningField.setSelection(binding.composeContentWarningField.text.length)
binding.composeContentWarningField.requestFocus()
- ContextCompat.getColor(this, R.color.tusky_blue)
+ getColor(R.color.tusky_blue)
} else {
binding.composeContentWarningBar.hide()
binding.composeEditField.requestFocus()
diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.java b/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.java
index fde993d1..33519610 100644
--- a/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.java
+++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.java
@@ -58,15 +58,14 @@ public final class ProgressImageView extends AppCompatImageView {
}
private void init() {
- circlePaint.setColor(ContextCompat.getColor(getContext(), R.color.tusky_blue));
+ circlePaint.setColor(getContext().getColor(R.color.tusky_blue));
circlePaint.setStrokeWidth(Utils.dpToPx(getContext(), 4));
circlePaint.setStyle(Paint.Style.STROKE);
clearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
markBgPaint.setStyle(Paint.Style.FILL);
- markBgPaint.setColor(ContextCompat.getColor(getContext(),
- R.color.tusky_grey_10));
+ markBgPaint.setColor(getContext().getColor(R.color.tusky_grey_10));
captionDrawable = AppCompatResources.getDrawable(getContext(), R.drawable.spellcheck);
}
@@ -81,8 +80,7 @@ public final class ProgressImageView extends AppCompatImageView {
}
public void setChecked(boolean checked) {
- this.markBgPaint.setColor(ContextCompat.getColor(getContext(),
- checked ? R.color.tusky_blue : R.color.tusky_grey_10));
+ this.markBgPaint.setColor(getContext().getColor(checked ? R.color.tusky_blue : R.color.tusky_grey_10));
invalidate();
}
diff --git a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java
index 45ecd0f6..bb1599fb 100644
--- a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java
+++ b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java
@@ -296,7 +296,7 @@ public class NotificationHelper {
.setSmallIcon(R.drawable.ic_notify)
.setContentIntent(summary ? summaryResultPendingIntent : eventResultPendingIntent)
.setDeleteIntent(deletePendingIntent)
- .setColor(ContextCompat.getColor(context, R.color.notification_color))
+ .setColor(context.getColor(R.color.notification_color))
.setGroup(account.getAccountId())
.setAutoCancel(true)
.setShortcutId(Long.toString(account.getId()))
diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java
index 01a08c20..fe94dbf8 100644
--- a/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java
+++ b/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java
@@ -354,7 +354,7 @@ public abstract class SFragment extends Fragment implements Injectable {
urlIndex);
if (view != null) {
String url = active.getAttachment().getUrl();
- ViewCompat.setTransitionName(view, url);
+ view.setTransitionName(url);
ActivityOptionsCompat options =
ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
view, url);
diff --git a/app/src/main/java/com/keylesspalace/tusky/receiver/SendStatusBroadcastReceiver.kt b/app/src/main/java/com/keylesspalace/tusky/receiver/SendStatusBroadcastReceiver.kt
index a0eac833..53cccf09 100644
--- a/app/src/main/java/com/keylesspalace/tusky/receiver/SendStatusBroadcastReceiver.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/receiver/SendStatusBroadcastReceiver.kt
@@ -18,13 +18,10 @@ package com.keylesspalace.tusky.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
-import android.graphics.Color
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.app.RemoteInput
-import androidx.core.content.ContextCompat
-import com.keylesspalace.tusky.BuildConfig
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.components.notifications.NotificationHelper
import com.keylesspalace.tusky.db.AccountManager
@@ -66,7 +63,7 @@ class SendStatusBroadcastReceiver : BroadcastReceiver() {
val builder = NotificationCompat.Builder(context, NotificationHelper.CHANNEL_MENTION + senderIdentifier)
.setSmallIcon(R.drawable.ic_notify)
- .setColor(ContextCompat.getColor(context, R.color.tusky_blue))
+ .setColor(context.getColor(R.color.tusky_blue))
.setGroup(senderFullName)
.setDefaults(0) // So it doesn't ring twice, notify only in Target callback
@@ -107,15 +104,9 @@ class SendStatusBroadcastReceiver : BroadcastReceiver() {
context.startService(sendIntent)
- val color = if (BuildConfig.FLAVOR == "green") {
- Color.parseColor("#19A341")
- } else {
- ContextCompat.getColor(context, R.color.tusky_blue)
- }
-
val builder = NotificationCompat.Builder(context, NotificationHelper.CHANNEL_MENTION + senderIdentifier)
.setSmallIcon(R.drawable.ic_notify)
- .setColor(color)
+ .setColor(context.getColor(R.color.notification_color))
.setGroup(senderFullName)
.setDefaults(0) // So it doesn't ring twice, notify only in Target callback
diff --git a/app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt b/app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt
index a6de4b3f..13af53ec 100644
--- a/app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt
@@ -14,7 +14,6 @@ import android.os.Parcelable
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.app.ServiceCompat
-import androidx.core.content.ContextCompat
import at.connyduck.calladapter.networkresult.fold
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.appstore.EventHub
@@ -88,7 +87,7 @@ class SendStatusService : Service(), Injectable {
.setContentText(notificationText)
.setProgress(1, 0, true)
.setOngoing(true)
- .setColor(ContextCompat.getColor(this, R.color.notification_color))
+ .setColor(getColor(R.color.notification_color))
.addAction(0, getString(android.R.string.cancel), cancelSendingIntent(sendingNotificationId))
if (statusesToSend.size == 0 || Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -189,12 +188,7 @@ class SendStatusService : Service(), Injectable {
.setSmallIcon(R.drawable.ic_notify)
.setContentTitle(getString(R.string.send_post_notification_error_title))
.setContentText(getString(R.string.send_post_notification_saved_content))
- .setColor(
- ContextCompat.getColor(
- this@SendStatusService,
- R.color.notification_color
- )
- )
+ .setColor(getColor(R.color.notification_color))
notificationManager.cancel(statusId)
notificationManager.notify(errorNotificationId--, builder.build())
@@ -237,7 +231,7 @@ class SendStatusService : Service(), Injectable {
.setSmallIcon(R.drawable.ic_notify)
.setContentTitle(getString(R.string.send_post_notification_cancel_title))
.setContentText(getString(R.string.send_post_notification_saved_content))
- .setColor(ContextCompat.getColor(this@SendStatusService, R.color.notification_color))
+ .setColor(getColor(R.color.notification_color))
notificationManager.notify(statusId, builder.build())
diff --git a/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt b/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt
index 0752c4e5..44d9fee3 100644
--- a/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt
@@ -23,7 +23,6 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.DrawableRes
-import androidx.core.content.ContextCompat
import com.bumptech.glide.Glide
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.entity.Attachment
@@ -319,7 +318,7 @@ class StatusViewHelper(private val itemView: View) {
}
pollResults[i].background.level = level
- pollResults[i].background.setTint(ContextCompat.getColor(pollResults[i].context, optionColor))
+ pollResults[i].background.setTint(pollResults[i].context.getColor(optionColor))
} else {
pollResults[i].visibility = View.GONE
}