Skip to content

Commit

Permalink
fix: use built-in appkit empty view styles entry and remove hack to a…
Browse files Browse the repository at this point in the history
…pply colors to the empty view texts
  • Loading branch information
LucasGGamerM committed Sep 29, 2023
1 parent 232d2e7 commit 23843e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,10 @@ protected List<View> 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));
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions mastodon/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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>

0 comments on commit 23843e9

Please sign in to comment.