Some fixes

This commit is contained in:
Thomas 2023-02-02 14:18:52 +01:00
parent 0ca53b75d2
commit 4c89a855c6
2 changed files with 14 additions and 5 deletions

View file

@ -304,7 +304,7 @@ public class PinnedTimelineHelper {
//Small hack to hide first tabs (they represent the item of the bottom menu)
toRemove = itemToRemoveInBottomMenu(activity);
for (int i = 0; i < (FedilabPageAdapter.BOTTOM_TIMELINE_COUNT - toRemove); i++) {
activityMainBinding.tabLayout.addTab(activityMainBinding.tabLayout.newTab());
activityMainBinding.tabLayout.addTab(activityMainBinding.tabLayout.newTab(), false);
((ViewGroup) activityMainBinding.tabLayout.getChildAt(0)).getChildAt(i).setVisibility(View.GONE);
}
}
@ -413,7 +413,7 @@ public class PinnedTimelineHelper {
//We be used to fetch position of tabs
String slug = pinnedTimeline.type.getValue() + (ident != null ? "|" + ident : "");
tab.setTag(slug);
activityMainBinding.tabLayout.addTab(tab);
activityMainBinding.tabLayout.addTab(tab, false);
pinnedTimelineVisibleList.add(pinnedTimeline);
}
}

View file

@ -28,6 +28,7 @@ import app.fedilab.android.databinding.DrawerCacheBinding;
import app.fedilab.android.mastodon.client.entities.app.CacheAccount;
import app.fedilab.android.mastodon.helper.CacheHelper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.peertube.helper.Helper;
public class CacheAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@ -61,9 +62,17 @@ public class CacheAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
CacheAccount cacheAccount = accountList.get(position);
AccountCacheViewHolder holder = (AccountCacheViewHolder) viewHolder;
MastodonHelper.loadPPMastodon(holder.binding.pp, cacheAccount.account.mastodon_account);
holder.binding.acct.setText(String.format("@%s@%s", cacheAccount.account.mastodon_account.username, cacheAccount.account.instance));
holder.binding.displayName.setText(cacheAccount.account.mastodon_account.display_name);
if (cacheAccount.account.mastodon_account != null) {
MastodonHelper.loadPPMastodon(holder.binding.pp, cacheAccount.account.mastodon_account);
holder.binding.acct.setText(String.format("@%s@%s", cacheAccount.account.mastodon_account.username, cacheAccount.account.instance));
holder.binding.displayName.setText(cacheAccount.account.mastodon_account.display_name);
} else if (cacheAccount.account.peertube_account != null) {
Helper.loadAvatar(context, cacheAccount.account.peertube_account, holder.binding.pp);
holder.binding.acct.setText(String.format("@%s@%s", cacheAccount.account.peertube_account.getUsername(), cacheAccount.account.instance));
holder.binding.displayName.setText(cacheAccount.account.peertube_account.getDisplayName());
}
CacheHelper.getTimelineValues(context, cacheAccount.account, countStatuses -> {
if (countStatuses != null && countStatuses.size() == 3) {
holder.binding.homeCount.setText(String.valueOf(countStatuses.get(0)));