diff --git a/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt b/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt index 54d76ca6ac..0323c29201 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt @@ -84,7 +84,6 @@ class ListsActivity : BaseActivity() { ) binding.swipeRefreshLayout.setOnRefreshListener { viewModel.retryLoading() } - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) lifecycleScope.launch { viewModel.state.collect(this@ListsActivity::update) diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index 765d4f7fe1..c572b9faef 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -58,6 +58,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.request.target.CustomTarget import com.bumptech.glide.request.target.FixedSizeDrawable import com.bumptech.glide.request.transition.Transition +import com.google.android.material.R as materialR import com.google.android.material.color.MaterialColors import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout.OnTabSelectedListener @@ -698,8 +699,8 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { startActivityWithSlideInAnimation(AnnouncementsActivity.newIntent(context)) } badgeStyle = BadgeStyle().apply { - textColor = ColorHolder.fromColor(MaterialColors.getColor(binding.mainDrawer, com.google.android.material.R.attr.colorOnPrimary)) - color = ColorHolder.fromColor(MaterialColors.getColor(binding.mainDrawer, com.google.android.material.R.attr.colorPrimary)) + textColor = ColorHolder.fromColor(MaterialColors.getColor(binding.mainDrawer, materialR.attr.colorOnPrimary)) + color = ColorHolder.fromColor(MaterialColors.getColor(binding.mainDrawer, materialR.attr.colorPrimary)) } }, DividerDrawerItem(), @@ -856,7 +857,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { if (tabs[position].id == DIRECT) { val badge = tab.orCreateBadge badge.isVisible = accountManager.activeAccount?.hasDirectMessageBadge ?: false - badge.backgroundColor = MaterialColors.getColor(binding.mainDrawer, com.google.android.material.R.attr.colorPrimary) + badge.backgroundColor = MaterialColors.getColor(binding.mainDrawer, materialR.attr.colorPrimary) directMessageTab = tab } }.also { it.attach() } 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 f3e8e070ab..5ea9dc7abe 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 @@ -49,6 +49,7 @@ import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager import androidx.viewpager2.widget.MarginPageTransformer import com.bumptech.glide.Glide +import com.google.android.material.R as materialR import com.google.android.material.appbar.AppBarLayout import com.google.android.material.chip.Chip import com.google.android.material.color.MaterialColors @@ -189,9 +190,9 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide * Load colors and dimensions from resources */ private fun loadResources() { - toolbarColor = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurface, Color.BLACK) + toolbarColor = MaterialColors.getColor(this, materialR.attr.colorSurface, Color.BLACK) statusBarColorTransparent = getColor(R.color.transparent_statusbar_background) - statusBarColorOpaque = MaterialColors.getColor(this, androidx.appcompat.R.attr.colorPrimaryDark, Color.BLACK) + statusBarColorOpaque = MaterialColors.getColor(this, materialR.attr.colorPrimaryDark, Color.BLACK) avatarSize = resources.getDimension(R.dimen.account_activity_avatar_size) titleVisibleHeight = resources.getDimensionPixelSize(R.dimen.account_activity_scroll_title_visible_height) } @@ -458,7 +459,6 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide binding.swipeToRefreshLayout.isRefreshing = isRefreshing == true } } - binding.swipeToRefreshLayout.setColorSchemeResources(R.color.tusky_blue) } private fun onAccountChanged(account: Account?) { diff --git a/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaFragment.kt index 0eb61018ce..fb87827b7b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaFragment.kt @@ -104,7 +104,6 @@ class AccountMediaFragment : binding.swipeRefreshLayout.isEnabled = false binding.swipeRefreshLayout.setOnRefreshListener { refreshContent() } - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) binding.statusView.visibility = View.GONE diff --git a/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaGridAdapter.kt b/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaGridAdapter.kt index 72358c7c22..613546491d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaGridAdapter.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/account/media/AccountMediaGridAdapter.kt @@ -11,6 +11,7 @@ import androidx.core.view.setPadding import androidx.paging.PagingDataAdapter import androidx.recyclerview.widget.DiffUtil import com.bumptech.glide.Glide +import com.google.android.material.R as materialR import com.google.android.material.color.MaterialColors import com.keylesspalace.tusky.R import com.keylesspalace.tusky.databinding.ItemAccountMediaBinding @@ -47,7 +48,7 @@ class AccountMediaGridAdapter( private val baseItemBackgroundColor = MaterialColors.getColor( context, - com.google.android.material.R.attr.colorSurface, + materialR.attr.colorSurface, Color.BLACK ) private val videoIndicator = AppCompatResources.getDrawable( diff --git a/app/src/main/java/com/keylesspalace/tusky/components/accountlist/AccountListFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/accountlist/AccountListFragment.kt index 559b9b11bc..a463ef76d6 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/accountlist/AccountListFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/accountlist/AccountListFragment.kt @@ -138,7 +138,6 @@ class AccountListFragment : binding.recyclerView.addOnScrollListener(scrollListener) binding.swipeRefreshLayout.setOnRefreshListener { fetchAccounts(adapter) } - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) fetchAccounts(adapter) } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/announcements/AnnouncementsActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/announcements/AnnouncementsActivity.kt index 69abe8174e..f777dbaf64 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/announcements/AnnouncementsActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/announcements/AnnouncementsActivity.kt @@ -91,7 +91,6 @@ class AnnouncementsActivity : } binding.swipeRefreshLayout.setOnRefreshListener(this::refreshAnnouncements) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) binding.announcementsList.setHasFixedSize(true) binding.announcementsList.layoutManager = LinearLayoutManager(this) 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 89dafca329..d391bfcb63 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 @@ -43,6 +43,7 @@ import android.widget.Toast import androidx.activity.OnBackPressedCallback import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels +import androidx.annotation.AttrRes import androidx.annotation.ColorInt import androidx.annotation.StringRes import androidx.annotation.VisibleForTesting @@ -61,6 +62,7 @@ import androidx.transition.TransitionManager import com.canhub.cropper.CropImage import com.canhub.cropper.CropImageContract import com.canhub.cropper.options +import com.google.android.material.R as materialR import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior.BottomSheetCallback import com.google.android.material.color.MaterialColors @@ -821,24 +823,26 @@ class ComposeActivity : binding.descriptionMissingWarningButton.hide() } else { binding.composeHideMediaButton.show() - @ColorInt val color = if (contentWarningShown) { + @AttrRes val color = if (contentWarningShown) { binding.composeHideMediaButton.setImageResource(R.drawable.ic_hide_media_24dp) binding.composeHideMediaButton.isClickable = false - getColor(R.color.transparent_tusky_blue) + materialR.attr.colorPrimary } else { binding.composeHideMediaButton.isClickable = true if (markMediaSensitive) { binding.composeHideMediaButton.setImageResource(R.drawable.ic_hide_media_24dp) - getColor(R.color.tusky_blue) + materialR.attr.colorPrimary } else { binding.composeHideMediaButton.setImageResource(R.drawable.ic_eye_24dp) - MaterialColors.getColor( - binding.composeHideMediaButton, - android.R.attr.textColorTertiary - ) + android.R.attr.textColorTertiary } } - binding.composeHideMediaButton.drawable.setTint(color) + binding.composeHideMediaButton.drawable.setTint( + MaterialColors.getColor( + binding.composeHideMediaButton, + color + ) + ) var oneMediaWithoutDescription = false for (media in viewModel.media.value) { @@ -856,14 +860,15 @@ class ComposeActivity : // Can't reschedule a published status enableButton(binding.composeScheduleButton, clickable = false, colorActive = false) } else { - @ColorInt val color = if (binding.composeScheduleView.time == null) { + @ColorInt val color = MaterialColors.getColor( binding.composeScheduleButton, - android.R.attr.textColorTertiary + if (binding.composeScheduleView.time == null) { + android.R.attr.textColorTertiary + } else { + materialR.attr.colorPrimary + } ) - } else { - getColor(R.color.tusky_blue) - } binding.composeScheduleButton.drawable.setTint(color) } } @@ -1242,22 +1247,24 @@ class ComposeActivity : TransitionManager.beginDelayedTransition( binding.composeContentWarningBar.parent as ViewGroup ) - @ColorInt val color = if (show) { + @AttrRes val color = if (show) { binding.composeContentWarningBar.show() binding.composeContentWarningField.setSelection( binding.composeContentWarningField.text.length ) binding.composeContentWarningField.requestFocus() - getColor(R.color.tusky_blue) + materialR.attr.colorPrimary } else { binding.composeContentWarningBar.hide() binding.composeEditField.requestFocus() + android.R.attr.textColorTertiary + } + binding.composeContentWarningButton.drawable.setTint( MaterialColors.getColor( - binding.composeContentWarningButton, - android.R.attr.textColorTertiary + binding.composeHideMediaButton, + color ) - } - binding.composeContentWarningButton.drawable.setTint(color) + ) } override fun onOptionsItemSelected(item: MenuItem): Boolean { diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.kt index 6678356eaf..8bdaa465d9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.kt @@ -24,6 +24,8 @@ import android.graphics.RectF import android.util.AttributeSet import androidx.appcompat.content.res.AppCompatResources import at.connyduck.sparkbutton.helpers.Utils +import com.google.android.material.R as materialR +import com.google.android.material.color.MaterialColors import com.keylesspalace.tusky.R import com.keylesspalace.tusky.view.MediaPreviewImageView @@ -37,7 +39,7 @@ class ProgressImageView private val progressRect = RectF() private val biggerRect = RectF() private val circlePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = context.getColor(R.color.tusky_blue) + color = MaterialColors.getColor(this@ProgressImageView, materialR.attr.colorPrimary) strokeWidth = Utils.dpToPx(context, 4).toFloat() style = Paint.Style.STROKE } @@ -46,13 +48,15 @@ class ProgressImageView } private val markBgPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.FILL - color = context.getColor(R.color.tusky_grey_10) + color = MaterialColors.getColor(this@ProgressImageView, android.R.attr.colorBackground) } private val captionDrawable = AppCompatResources.getDrawable( context, R.drawable.spellcheck )!!.apply { - setTint(Color.WHITE) + setTint( + MaterialColors.getColor(this@ProgressImageView, android.R.attr.textColorTertiary) + ) } private val circleRadius = Utils.dpToPx(context, 14) private val circleMargin = Utils.dpToPx(context, 14) @@ -68,8 +72,10 @@ class ProgressImageView } fun setChecked(checked: Boolean) { - markBgPaint.color = - context.getColor(if (checked) R.color.tusky_blue else R.color.tusky_grey_10) + val backgroundColor = if (checked) materialR.attr.colorPrimary else android.R.attr.colorBackground + val foregroundColor = if (checked) materialR.attr.colorOnPrimary else android.R.attr.textColorTertiary + markBgPaint.color = MaterialColors.getColor(this, backgroundColor) + captionDrawable.setTint(MaterialColors.getColor(this, foregroundColor)) invalidate() } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt index b32c4bb174..c97cacccda 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt @@ -109,7 +109,7 @@ class ConversationsFragment : setupRecyclerView(adapter) - initSwipeToRefresh() + binding.swipeRefreshLayout.setOnRefreshListener { refreshContent() } adapter.addLoadStateListener { loadState -> if (loadState.refresh != LoadState.Loading && loadState.source.refresh != LoadState.Loading) { @@ -245,11 +245,6 @@ class ConversationsFragment : adapter?.refresh() } - private fun initSwipeToRefresh() { - binding.swipeRefreshLayout.setOnRefreshListener { refreshContent() } - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) - } - override fun onReblog(reblog: Boolean, position: Int) { // its impossible to reblog private messages } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/filters/FiltersActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/filters/FiltersActivity.kt index 8d8e91ebb5..edfa81abc0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/filters/FiltersActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/filters/FiltersActivity.kt @@ -48,7 +48,6 @@ class FiltersActivity : BaseActivity(), FiltersListener { } binding.swipeRefreshLayout.setOnRefreshListener { reloadFilters() } - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) setTitle(R.string.pref_title_timeline_filters) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsFragment.kt index 8398f953c3..195e15d440 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsFragment.kt @@ -137,7 +137,6 @@ class NotificationsFragment : // Setup the SwipeRefreshLayout. binding.swipeRefreshLayout.setOnRefreshListener(this) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) // Setup the RecyclerView. binding.recyclerView.setHasFixedSize(true) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt index f52cef46fa..66a1c29f18 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt @@ -102,6 +102,7 @@ class ReportStatusesFragment : startActivity(intent) } } + Attachment.Type.UNKNOWN -> { } } @@ -111,7 +112,7 @@ class ReportStatusesFragment : requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED) handleClicks() initStatusesView() - setupSwipeRefreshLayout() + binding.swipeRefreshLayout.setOnRefreshListener(this) } override fun onDestroyView() { @@ -138,6 +139,7 @@ class ReportStatusesFragment : onRefresh() true } + else -> false } } @@ -148,12 +150,6 @@ class ReportStatusesFragment : adapter?.refresh() } - private fun setupSwipeRefreshLayout() { - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) - - binding.swipeRefreshLayout.setOnRefreshListener(this) - } - private fun initStatusesView() { val statusDisplayOptions = StatusDisplayOptions( animateAvatars = false, diff --git a/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledStatusActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledStatusActivity.kt index e8d9955189..d2289d4119 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledStatusActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledStatusActivity.kt @@ -77,7 +77,6 @@ class ScheduledStatusActivity : } binding.swipeRefreshLayout.setOnRefreshListener(this::refreshStatuses) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) binding.scheduledTootList.setHasFixedSize(true) binding.scheduledTootList.layoutManager = LinearLayoutManager(this) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt index 31e673c3a4..6dfe2c02b9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt @@ -62,7 +62,7 @@ abstract class SearchFragment : override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val adapter = initAdapter() - setupSwipeRefreshLayout() + binding.swipeRefreshLayout.setOnRefreshListener(this) requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED) subscribeObservables(adapter) } @@ -74,11 +74,6 @@ abstract class SearchFragment : super.onDestroyView() } - private fun setupSwipeRefreshLayout() { - binding.swipeRefreshLayout.setOnRefreshListener(this) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) - } - private fun subscribeObservables(adapter: PagingDataAdapter) { viewLifecycleOwner.lifecycleScope.launch { data.collectLatest { pagingData -> @@ -131,6 +126,7 @@ abstract class SearchFragment : onRefresh() true } + else -> false } } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt index 796ee7b2ea..fb09d033e2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt @@ -373,7 +373,6 @@ class TimelineFragment : private fun setupSwipeRefreshLayout() { binding.swipeRefreshLayout.isEnabled = isSwipeToRefreshEnabled binding.swipeRefreshLayout.setOnRefreshListener(this) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) } private fun setupRecyclerView(adapter: TimelinePagingAdapter) { diff --git a/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagsFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagsFragment.kt index a6c98aa05e..b6c1956798 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagsFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagsFragment.kt @@ -72,7 +72,7 @@ class TrendingTagsFragment : override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val adapter = TrendingTagsAdapter(::onViewTag) this.adapter = adapter - setupSwipeRefreshLayout() + binding.swipeRefreshLayout.setOnRefreshListener(this) setupRecyclerView(adapter) adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() { @@ -106,11 +106,6 @@ class TrendingTagsFragment : super.onDestroyView() } - private fun setupSwipeRefreshLayout() { - binding.swipeRefreshLayout.setOnRefreshListener(this) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) - } - private fun setupLayoutManager(adapter: TrendingTagsAdapter, columnCount: Int) { binding.recyclerView.layoutManager = GridLayoutManager(context, columnCount).apply { spanSizeLookup = object : SpanSizeLookup() { diff --git a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt index abe1068ce1..e19be4bcec 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt @@ -126,7 +126,6 @@ class ViewThreadFragment : this.adapter = adapter binding.swipeRefreshLayout.setOnRefreshListener(this) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) binding.recyclerView.setHasFixedSize(true) binding.recyclerView.layoutManager = LinearLayoutManager(context) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsFragment.kt index 422399161e..10301ca156 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsFragment.kt @@ -75,7 +75,6 @@ class ViewEditsFragment : requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED) binding.swipeRefreshLayout.setOnRefreshListener(this) - binding.swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue) binding.recyclerView.setHasFixedSize(true) binding.recyclerView.layoutManager = LinearLayoutManager(context) diff --git a/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.kt b/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.kt index 68de28b8a2..239b19630a 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.kt +++ b/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.kt @@ -43,6 +43,7 @@ import androidx.browser.customtabs.CustomTabsIntent import androidx.core.net.toUri import androidx.preference.PreferenceManager import at.connyduck.sparkbutton.helpers.Utils +import com.google.android.material.R as materialR import com.google.android.material.color.MaterialColors import com.keylesspalace.tusky.R import com.keylesspalace.tusky.entity.HashTag @@ -329,7 +330,7 @@ private fun openLinkInBrowser(uri: Uri?, context: Context) { fun openLinkInCustomTab(uri: Uri, context: Context) { val toolbarColor = MaterialColors.getColor( context, - com.google.android.material.R.attr.colorSurface, + materialR.attr.colorSurface, Color.BLACK ) val navigationbarColor = MaterialColors.getColor( diff --git a/app/src/main/java/com/keylesspalace/tusky/view/GraphView.kt b/app/src/main/java/com/keylesspalace/tusky/view/GraphView.kt index e6a54a2bce..0d70f011a9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/view/GraphView.kt +++ b/app/src/main/java/com/keylesspalace/tusky/view/GraphView.kt @@ -26,6 +26,8 @@ import android.view.View import androidx.annotation.ColorInt import androidx.annotation.Dimension import androidx.core.content.res.use +import com.google.android.material.R as materialR +import com.google.android.material.color.MaterialColors import com.keylesspalace.tusky.R import kotlin.math.max @@ -127,37 +129,29 @@ class GraphView @JvmOverloads constructor( private fun initFromXML(attr: AttributeSet?) { context.obtainStyledAttributes(attr, R.styleable.GraphView).use { a -> - primaryLineColor = context.getColor( - a.getResourceId( - R.styleable.GraphView_primaryLineColor, - R.color.tusky_blue - ) + primaryLineColor = a.getColor( + R.styleable.GraphView_primaryLineColor, + MaterialColors.getColor(this, materialR.attr.colorPrimary) ) - secondaryLineColor = context.getColor( - a.getResourceId( - R.styleable.GraphView_secondaryLineColor, - R.color.tusky_red - ) + secondaryLineColor = a.getColor( + R.styleable.GraphView_secondaryLineColor, + context.getColor(R.color.warning_color) ) - lineWidth = a.getDimensionPixelSize( + lineWidth = a.getDimension( R.styleable.GraphView_lineWidth, - R.dimen.graph_line_thickness - ).toFloat() + context.resources.getDimension(R.dimen.graph_line_thickness) + ) - graphColor = context.getColor( - a.getResourceId( - R.styleable.GraphView_graphColor, - R.color.colorBackground - ) + graphColor = a.getColor( + R.styleable.GraphView_graphColor, + context.getColor(R.color.colorBackground) ) - metaColor = context.getColor( - a.getResourceId( - R.styleable.GraphView_metaColor, - R.color.dividerColor - ) + metaColor = a.getColor( + R.styleable.GraphView_metaColor, + context.getColor(R.color.dividerColor) ) proportionalTrending = a.getBoolean( diff --git a/app/src/main/java/com/keylesspalace/tusky/view/LicenseCard.kt b/app/src/main/java/com/keylesspalace/tusky/view/LicenseCard.kt index 1b232eae11..04d689e1ec 100644 --- a/app/src/main/java/com/keylesspalace/tusky/view/LicenseCard.kt +++ b/app/src/main/java/com/keylesspalace/tusky/view/LicenseCard.kt @@ -20,6 +20,7 @@ import android.graphics.Color import android.util.AttributeSet import android.view.LayoutInflater import androidx.core.content.res.use +import com.google.android.material.R as materialR import com.google.android.material.card.MaterialCardView import com.google.android.material.color.MaterialColors import com.keylesspalace.tusky.R @@ -40,7 +41,7 @@ class LicenseCard setCardBackgroundColor( MaterialColors.getColor( context, - com.google.android.material.R.attr.colorSurface, + materialR.attr.colorSurface, Color.BLACK ) ) diff --git a/app/src/main/java/com/keylesspalace/tusky/view/TuskySwipeRefreshLayout.kt b/app/src/main/java/com/keylesspalace/tusky/view/TuskySwipeRefreshLayout.kt new file mode 100644 index 0000000000..801f39c00f --- /dev/null +++ b/app/src/main/java/com/keylesspalace/tusky/view/TuskySwipeRefreshLayout.kt @@ -0,0 +1,37 @@ +/* Copyright 2024 Tusky contributors + * + * This file is a part of Tusky. + * + * This program 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. + * + * Tusky 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 Tusky; if not, + * see . */ +package com.keylesspalace.tusky.view + +import android.content.Context +import android.util.AttributeSet +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import com.google.android.material.R as materialR +import com.google.android.material.color.MaterialColors + +/** + * SwipeRefreshLayout does not allow theming of the color scheme, + * so we use this class to still have a single point to change its colors. + */ +class TuskySwipeRefreshLayout @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null +) : SwipeRefreshLayout(context, attrs) { + + init { + setColorSchemeColors( + MaterialColors.getColor(this, materialR.attr.colorPrimary) + ) + } +} diff --git a/app/src/main/res/color/compound_button_color.xml b/app/src/main/res/color/compound_button_color.xml index 8b151c7024..f8dbe906d2 100644 --- a/app/src/main/res/color/compound_button_color.xml +++ b/app/src/main/res/color/compound_button_color.xml @@ -1,6 +1,5 @@ - - - - \ No newline at end of file + + + diff --git a/app/src/main/res/color/text_input_layout_box_stroke_color.xml b/app/src/main/res/color/text_input_layout_box_stroke_color.xml index 5b21f78fee..3f808bd224 100644 --- a/app/src/main/res/color/text_input_layout_box_stroke_color.xml +++ b/app/src/main/res/color/text_input_layout_box_stroke_color.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + + diff --git a/app/src/main/res/drawable/ic_check_circle.xml b/app/src/main/res/drawable/ic_check_circle.xml index 7ff119e728..6024550782 100644 --- a/app/src/main/res/drawable/ic_check_circle.xml +++ b/app/src/main/res/drawable/ic_check_circle.xml @@ -4,5 +4,5 @@ android:width="18dp" android:viewportWidth="24" android:viewportHeight="24"> - - \ No newline at end of file + + diff --git a/app/src/main/res/drawable/ic_flag_24dp.xml b/app/src/main/res/drawable/ic_flag_24dp.xml index 14529c0a9a..03df9261dc 100644 --- a/app/src/main/res/drawable/ic_flag_24dp.xml +++ b/app/src/main/res/drawable/ic_flag_24dp.xml @@ -3,7 +3,7 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" - android:tint="@color/tusky_blue"> + android:tint="?attr/colorPrimary"> diff --git a/app/src/main/res/drawable/ic_link.xml b/app/src/main/res/drawable/ic_link.xml index 5bb6b6862a..94455ebeda 100644 --- a/app/src/main/res/drawable/ic_link.xml +++ b/app/src/main/res/drawable/ic_link.xml @@ -4,6 +4,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/drawable/ic_person_add_24dp.xml b/app/src/main/res/drawable/ic_person_add_24dp.xml index dc849f045c..b42eb2f44b 100644 --- a/app/src/main/res/drawable/ic_person_add_24dp.xml +++ b/app/src/main/res/drawable/ic_person_add_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_play_indicator.xml b/app/src/main/res/drawable/ic_play_indicator.xml index 4cdae508c3..451e51ec1b 100644 --- a/app/src/main/res/drawable/ic_play_indicator.xml +++ b/app/src/main/res/drawable/ic_play_indicator.xml @@ -4,5 +4,5 @@ android:pathData="M21.282,12A9.282,9.282 0,0 1,12 21.282,9.282 9.282,0 0,1 2.718,12 9.282,9.282 0,0 1,12 2.718,9.282 9.282,0 0,1 21.282,12Z" android:strokeAlpha="1" android:strokeColor="#00000000" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="8"/> - + diff --git a/app/src/main/res/drawable/ic_poll_24dp.xml b/app/src/main/res/drawable/ic_poll_24dp.xml index 5e55dc5ab9..dd0c4abe93 100644 --- a/app/src/main/res/drawable/ic_poll_24dp.xml +++ b/app/src/main/res/drawable/ic_poll_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/drawable/ic_reblog_active_24dp.xml b/app/src/main/res/drawable/ic_reblog_active_24dp.xml index 8d28a4005c..48d987fe93 100644 --- a/app/src/main/res/drawable/ic_reblog_active_24dp.xml +++ b/app/src/main/res/drawable/ic_reblog_active_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/drawable/ic_reblog_private_active_24dp.xml b/app/src/main/res/drawable/ic_reblog_private_active_24dp.xml index 43169d1417..48b7351c8a 100644 --- a/app/src/main/res/drawable/ic_reblog_private_active_24dp.xml +++ b/app/src/main/res/drawable/ic_reblog_private_active_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/report_success_background.xml b/app/src/main/res/drawable/report_success_background.xml index 147e048574..f1685bcc30 100644 --- a/app/src/main/res/drawable/report_success_background.xml +++ b/app/src/main/res/drawable/report_success_background.xml @@ -1,4 +1,4 @@ - - \ No newline at end of file + + diff --git a/app/src/main/res/layout-land/item_trending_cell.xml b/app/src/main/res/layout-land/item_trending_cell.xml index 7d71ee5f1a..4d5b0302ec 100644 --- a/app/src/main/res/layout-land/item_trending_cell.xml +++ b/app/src/main/res/layout-land/item_trending_cell.xml @@ -25,10 +25,10 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:lineWidth="2sp" - app:metaColor="@color/tusky_blue_light" - app:primaryLineColor="@color/tusky_blue" + app:metaColor="?android:attr/textColorTertiary" + app:primaryLineColor="?attr/colorPrimary" app:proportionalTrending="true" - app:secondaryLineColor="@color/tusky_red" /> + app:secondaryLineColor="@color/warning_color" /> - @@ -50,7 +50,7 @@ tools:src="@drawable/errorphant_error" tools:visibility="visible" /> - + - - + - - + - @@ -461,7 +461,8 @@ android:layout_gravity="bottom|end" android:layout_margin="16dp" android:contentDescription="@string/action_mention" - app:srcCompat="@drawable/ic_create_24dp" /> + app:srcCompat="@drawable/ic_create_24dp" + app:tint="?attr/colorOnPrimary" /> @@ -479,4 +480,4 @@ - + diff --git a/app/src/main/res/layout/activity_announcements.xml b/app/src/main/res/layout/activity_announcements.xml index 35248a702b..6a18bf1315 100644 --- a/app/src/main/res/layout/activity_announcements.xml +++ b/app/src/main/res/layout/activity_announcements.xml @@ -15,7 +15,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" /> - - + diff --git a/app/src/main/res/layout/activity_edit_filter.xml b/app/src/main/res/layout/activity_edit_filter.xml index 755aab5ac7..2a56297b1c 100644 --- a/app/src/main/res/layout/activity_edit_filter.xml +++ b/app/src/main/res/layout/activity_edit_filter.xml @@ -28,85 +28,89 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:hint="@string/label_filter_title"> + + android:inputType="textNoSuggestions" /> - - + android:id="@+id/keywordChips" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + + + android:text="@string/filter_description_warn" /> + + android:text="@string/filter_description_hide" /> + android:minHeight="48dp" /> + android:paddingStart="?android:attr/listPreferredItemPaddingStart" + android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">