fix: use built-in appkit empty view styles entry and remove hack to apply colors to the empty view texts

This commit is contained in:
LucasGGamerM 2023-09-29 16:22:56 -03:00
parent 232d2e7e6d
commit 23843e9002
2 changed files with 8 additions and 11 deletions

View File

@ -40,19 +40,10 @@ public abstract class MastodonRecyclerFragment<T> extends BaseRecyclerFragment<T
@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));
}
}
}

View File

@ -44,6 +44,7 @@
<item name="android:textColor">?colorM3OnSurface</item>
<item name="android:textColorPrimary">?colorM3OnSurface</item>
<item name="android:textColorSecondary">?colorM3OnSurfaceVariant</item>
<item name="appkitEmptyTextAppearance">@style/empty_text</item>
</style>
<style name="Theme.Mastodon.Dark" parent="Theme.AppKit">
@ -86,6 +87,7 @@
<item name="android:textColor">?colorM3OnSurface</item>
<item name="android:textColorPrimary">?colorM3OnSurface</item>
<item name="android:textColorSecondary">?colorM3OnSurfaceVariant</item>
<item name="appkitEmptyTextAppearance">@style/empty_text</item>
</style>
<style name="Theme.Mastodon.Dark.SplashFragment">
@ -383,4 +385,8 @@
<style name="window_fade_out">
<item name="android:windowExitAnimation">@anim/fade_out_fast</item>
</style>
<style name="empty_text" parent="m3_body_large">
<item name="android:textColor">?colorM3OnSurfaceVariant</item>
</style>
</resources>