parent
2d2d7569e3
commit
55796c9a30
13 changed files with 21 additions and 45 deletions
|
@ -22,7 +22,7 @@ android {
|
|||
compileSdkVersion 31
|
||||
defaultConfig {
|
||||
applicationId APP_ID
|
||||
minSdkVersion 21
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 31
|
||||
versionCode 94
|
||||
versionName "19.0"
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" /> <!-- For notifications -->
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_COARSE_LOCATION"
|
||||
android:maxSdkVersion="22" /> <!-- for day/night mode -->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
<application
|
||||
|
|
|
@ -33,7 +33,6 @@ import android.view.View
|
|||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
|
@ -376,7 +375,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
|
|||
closeDrawerOnProfileListClick = true
|
||||
}
|
||||
|
||||
header.accountHeaderBackground.setColorFilter(ContextCompat.getColor(this, R.color.headerBackgroundFilter))
|
||||
header.accountHeaderBackground.setColorFilter(getColor(R.color.headerBackgroundFilter))
|
||||
header.accountHeaderBackground.setBackgroundColor(ThemeUtils.getColor(this, R.attr.colorBackgroundAccent))
|
||||
val animateAvatars = preferences.getBoolean("animateGifAvatars", false)
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
|
|||
Drawable getIconWithColor(Context context, @DrawableRes int drawable, @ColorRes int color) {
|
||||
Drawable icon = ContextCompat.getDrawable(context, drawable);
|
||||
if (icon != null) {
|
||||
icon.setColorFilter(ContextCompat.getColor(context, color), PorterDuff.Mode.SRC_ATOP);
|
||||
icon.setColorFilter(context.getColor(color), PorterDuff.Mode.SRC_ATOP);
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package com.keylesspalace.tusky.adapter
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.keylesspalace.tusky.R
|
||||
import com.keylesspalace.tusky.databinding.ItemPollBinding
|
||||
|
@ -97,7 +96,7 @@ class PollAdapter : RecyclerView.Adapter<BindingHolder<ItemPollBinding>>() {
|
|||
}
|
||||
|
||||
resultTextView.background.level = level
|
||||
resultTextView.background.setTint(ContextCompat.getColor(resultTextView.context, optionColor))
|
||||
resultTextView.background.setTint(resultTextView.context.getColor(optionColor))
|
||||
resultTextView.setOnClickListener(resultClickListener)
|
||||
}
|
||||
SINGLE -> {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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()))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue