From 23843e9002e94b4e71d18e239220b69b4e505f24 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Fri, 29 Sep 2023 16:22:56 -0300 Subject: [PATCH] fix: use built-in appkit empty view styles entry and remove hack to apply colors to the empty view texts --- .../android/fragments/MastodonRecyclerFragment.java | 13 ++----------- mastodon/src/main/res/values/styles.xml | 6 ++++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/MastodonRecyclerFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/MastodonRecyclerFragment.java index 1710d2c22c..24521f759d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/MastodonRecyclerFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/MastodonRecyclerFragment.java @@ -40,19 +40,10 @@ protected List getViewsForElevationEffect(){ @CallSuper public void onViewCreated(View view, Bundle savedInstanceState){ super.onViewCreated(view, savedInstanceState); - if (getParentFragment() instanceof HasElevationOnScrollListener elevator) - list.addOnScrollListener(elevator.getElevationOnScrollListener()); - else if(wantsElevationOnScrollEffect()) + if(wantsElevationOnScrollEffect()) list.addOnScrollListener(elevationOnScrollListener=new ElevationOnScrollListener((FragmentRootLinearLayout) view, getViewsForElevationEffect())); - if(refreshLayout!=null) + if(refreshLayout!=null){ setRefreshLayoutColors(refreshLayout); - - // This is to set the color of the 'This list is empty' - for (int i = 0; i < ((LinearLayout) emptyView).getChildCount(); i++) { - View v = ((LinearLayout) emptyView).getChildAt(i); - if(v instanceof TextView) { - ((TextView) v).setTextColor(UiUtils.getThemeColor(getContext(), android.R.attr.textColorSecondary)); - } } } diff --git a/mastodon/src/main/res/values/styles.xml b/mastodon/src/main/res/values/styles.xml index 4703d1d3fd..ba7384ced3 100644 --- a/mastodon/src/main/res/values/styles.xml +++ b/mastodon/src/main/res/values/styles.xml @@ -44,6 +44,7 @@ ?colorM3OnSurface ?colorM3OnSurface ?colorM3OnSurfaceVariant + @style/empty_text + + \ No newline at end of file