More minor tweaks

This commit is contained in:
Grishka 2023-03-23 00:58:38 +03:00
parent 3c0ab6822f
commit 6b5e5b0f25
8 changed files with 41 additions and 15 deletions

View File

@ -29,7 +29,7 @@ public class FeaturedHashtagsListFragment extends BaseStatusListFragment<Hashtag
accountID=getArguments().getString("account"); accountID=getArguments().getString("account");
account=Parcels.unwrap(getArguments().getParcelable("profileAccount")); account=Parcels.unwrap(getArguments().getParcelable("profileAccount"));
onDataLoaded(getArguments().getParcelableArrayList("hashtags").stream().map(p->(Hashtag)Parcels.unwrap(p)).collect(Collectors.toList()), false); onDataLoaded(getArguments().getParcelableArrayList("hashtags").stream().map(p->(Hashtag)Parcels.unwrap(p)).collect(Collectors.toList()), false);
setTitle(R.string.featured_hashtags); setTitle(R.string.hashtags);
} }
@Override @Override

View File

@ -4,6 +4,8 @@ import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.Toolbar; import android.widget.Toolbar;
import org.joinmastodon.android.R;
import org.joinmastodon.android.ui.utils.UiUtils;
import org.joinmastodon.android.utils.ElevationOnScrollListener; import org.joinmastodon.android.utils.ElevationOnScrollListener;
import java.util.Collections; import java.util.Collections;
@ -35,6 +37,12 @@ public abstract class MastodonRecyclerFragment<T> extends BaseRecyclerFragment<T
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
if(wantsElevationOnScrollEffect()) if(wantsElevationOnScrollEffect())
list.addOnScrollListener(elevationOnScrollListener=new ElevationOnScrollListener((FragmentRootLinearLayout) view, getViewsForElevationEffect())); list.addOnScrollListener(elevationOnScrollListener=new ElevationOnScrollListener((FragmentRootLinearLayout) view, getViewsForElevationEffect()));
if(refreshLayout!=null){
int colorBackground=UiUtils.getThemeColor(getActivity(), R.attr.colorM3Background);
int colorPrimary=UiUtils.getThemeColor(getActivity(), R.attr.colorM3Primary);
refreshLayout.setProgressBackgroundColorSchemeColor(UiUtils.alphaBlendColors(colorBackground, colorPrimary, 0.11f));
refreshLayout.setColorSchemeColors(colorPrimary);
}
} }
@Override @Override

View File

@ -19,7 +19,7 @@ public class PinnedPostsListFragment extends StatusListFragment{
public void onCreate(Bundle savedInstanceState){ public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
account=Parcels.unwrap(getArguments().getParcelable("profileAccount")); account=Parcels.unwrap(getArguments().getParcelable("profileAccount"));
setTitle(R.string.pinned_posts); setTitle(R.string.posts);
loadData(); loadData();
} }

View File

@ -14,6 +14,7 @@ import org.joinmastodon.android.model.Hashtag;
import org.joinmastodon.android.model.SearchResult; import org.joinmastodon.android.model.SearchResult;
import org.joinmastodon.android.model.Status; import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.ui.displayitems.AccountStatusDisplayItem; import org.joinmastodon.android.ui.displayitems.AccountStatusDisplayItem;
import org.joinmastodon.android.ui.displayitems.FooterStatusDisplayItem;
import org.joinmastodon.android.ui.displayitems.HashtagStatusDisplayItem; import org.joinmastodon.android.ui.displayitems.HashtagStatusDisplayItem;
import org.joinmastodon.android.ui.displayitems.SectionHeaderStatusDisplayItem; import org.joinmastodon.android.ui.displayitems.SectionHeaderStatusDisplayItem;
import org.joinmastodon.android.ui.displayitems.StatusDisplayItem; import org.joinmastodon.android.ui.displayitems.StatusDisplayItem;
@ -108,7 +109,7 @@ public class ProfileFeaturedFragment extends BaseStatusListFragment<SearchResult
@Override @Override
protected void doLoadData(int offset, int count){ protected void doLoadData(int offset, int count){
if(!statusesLoaded){ if(!statusesLoaded){
new GetAccountStatuses(profileAccount.id, null, null, 1, GetAccountStatuses.Filter.PINNED) new GetAccountStatuses(profileAccount.id, null, null, 2, GetAccountStatuses.Filter.PINNED)
.setCallback(new SimpleCallback<>(this){ .setCallback(new SimpleCallback<>(this){
@Override @Override
public void onSuccess(List<Status> result){ public void onSuccess(List<Status> result){
@ -150,12 +151,12 @@ public class ProfileFeaturedFragment extends BaseStatusListFragment<SearchResult
private void onOneApiRequestCompleted(){ private void onOneApiRequestCompleted(){
if(tagsLoaded && statusesLoaded){ if(tagsLoaded && statusesLoaded){
ArrayList<SearchResult> results=new ArrayList<>(); ArrayList<SearchResult> results=new ArrayList<>();
if(!pinnedStatuses.isEmpty()){ for(int i=0;i<Math.min(2, pinnedStatuses.size());i++){
SearchResult res=new SearchResult(pinnedStatuses.get(0)); SearchResult res=new SearchResult(pinnedStatuses.get(i));
res.firstInSection=true; res.firstInSection=(i==0);
results.add(res); results.add(res);
} }
for(int i=0;i<Math.min(3, featuredTags.size());i++){ for(int i=0;i<Math.min(5, featuredTags.size());i++){
SearchResult res=new SearchResult(featuredTags.get(i)); SearchResult res=new SearchResult(featuredTags.get(i));
res.firstInSection=(i==0); res.firstInSection=(i==0);
results.add(res); results.add(res);
@ -175,7 +176,9 @@ public class ProfileFeaturedFragment extends BaseStatusListFragment<SearchResult
@Override @Override
protected void drawDivider(View child, View bottomSibling, RecyclerView.ViewHolder holder, RecyclerView.ViewHolder siblingHolder, RecyclerView parent, Canvas c, Paint paint){ protected void drawDivider(View child, View bottomSibling, RecyclerView.ViewHolder holder, RecyclerView.ViewHolder siblingHolder, RecyclerView parent, Canvas c, Paint paint){
// no-op if(holder instanceof FooterStatusDisplayItem.Holder && siblingHolder instanceof StatusDisplayItem.Holder<?> sdi && sdi.getItemID().startsWith("post_")){
super.drawDivider(child, bottomSibling, holder, siblingHolder, parent, c, paint);
}
} }
private void showAllPinnedPosts(){ private void showAllPinnedPosts(){

View File

@ -299,6 +299,11 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
return pos+1; return pos+1;
}); });
int colorBackground=UiUtils.getThemeColor(getActivity(), R.attr.colorM3Background);
int colorPrimary=UiUtils.getThemeColor(getActivity(), R.attr.colorM3Primary);
refreshLayout.setProgressBackgroundColorSchemeColor(UiUtils.alphaBlendColors(colorBackground, colorPrimary, 0.11f));
refreshLayout.setColorSchemeColors(colorPrimary);
return sizeWrapper; return sizeWrapper;
} }

View File

@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?colorBackgroundLightest"/> <item>
<corners android:radius="10dp"/> <shape>
<solid android:color="?colorM3Surface"/>
<corners android:radius="4dp"/>
</shape>
</item>
<item>
<shape android:tint="?colorM3Primary">
<solid android:color="#14000000"/>
<corners android:radius="4dp"/>
<padding android:top="8dp" android:bottom="8dp"/> <padding android:top="8dp" android:bottom="8dp"/>
</shape> </shape>
</item>
</layer-list>

View File

@ -447,7 +447,5 @@
<string name="profile_timeline">Timeline</string> <string name="profile_timeline">Timeline</string>
<string name="view_all">View all</string> <string name="view_all">View all</string>
<string name="profile_endorsed_accounts">Accounts</string> <string name="profile_endorsed_accounts">Accounts</string>
<string name="pinned_posts">Pinned posts</string>
<string name="featured_hashtags">Featured hashtags</string>
<string name="verified_link">Verified link</string> <string name="verified_link">Verified link</string>
</resources> </resources>

View File

@ -71,6 +71,7 @@
<item name="android:statusBarColor">?colorM3Background</item> <item name="android:statusBarColor">?colorM3Background</item>
<item name="android:navigationBarColor">@color/navigation_bar_bg_light</item> <item name="android:navigationBarColor">@color/navigation_bar_bg_light</item>
<item name="android:colorAccent">?colorM3Primary</item> <item name="android:colorAccent">?colorM3Primary</item>
<item name="android:colorControlHighlight">@color/m3_primary_overlay</item>
</style> </style>
<style name="Theme.Mastodon.Dark" parent="Theme.AppKit"> <style name="Theme.Mastodon.Dark" parent="Theme.AppKit">
@ -146,6 +147,7 @@
<item name="android:statusBarColor">?colorM3Background</item> <item name="android:statusBarColor">?colorM3Background</item>
<item name="android:navigationBarColor">?colorM3Background</item> <item name="android:navigationBarColor">?colorM3Background</item>
<item name="android:colorAccent">?colorM3Primary</item> <item name="android:colorAccent">?colorM3Primary</item>
<item name="android:colorControlHighlight">@color/m3_primary_overlay</item>
</style> </style>
<style name="Theme.Mastodon.Dark.TrueBlack"> <style name="Theme.Mastodon.Dark.TrueBlack">