mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-07 00:20:08 +02:00
Fix some color issues
This commit is contained in:
parent
99e3cdda1a
commit
b38eb3bb09
3 changed files with 33 additions and 5 deletions
|
@ -33,11 +33,13 @@ import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.client.entities.api.Account;
|
||||||
import app.fedilab.android.client.entities.api.Accounts;
|
import app.fedilab.android.client.entities.api.Accounts;
|
||||||
|
import app.fedilab.android.client.entities.api.RelationShip;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
import app.fedilab.android.client.entities.api.Status;
|
||||||
import app.fedilab.android.databinding.ActivityStatusInfoBinding;
|
import app.fedilab.android.databinding.ActivityStatusInfoBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.helper.ThemeHelper;
|
||||||
import app.fedilab.android.ui.drawer.AccountAdapter;
|
import app.fedilab.android.ui.drawer.AccountAdapter;
|
||||||
|
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
||||||
import app.fedilab.android.viewmodel.mastodon.StatusesVM;
|
import app.fedilab.android.viewmodel.mastodon.StatusesVM;
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +117,8 @@ public class StatusInfoActivity extends BaseActivity {
|
||||||
private void manageView(Accounts accounts) {
|
private void manageView(Accounts accounts) {
|
||||||
binding.loadingNextAccounts.setVisibility(View.GONE);
|
binding.loadingNextAccounts.setVisibility(View.GONE);
|
||||||
if (accountList != null && accounts != null && accounts.accounts != null) {
|
if (accountList != null && accounts != null && accounts.accounts != null) {
|
||||||
|
int position = this.accountList.size();
|
||||||
|
fetchRelationShip(accounts.accounts, position);
|
||||||
int startId = 0;
|
int startId = 0;
|
||||||
//There are some statuses present in the timeline
|
//There are some statuses present in the timeline
|
||||||
if (accountList.size() > 0) {
|
if (accountList.size() > 0) {
|
||||||
|
@ -127,6 +131,27 @@ public class StatusInfoActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fetchRelationShip(List<Account> accounts, int position) {
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
for (Account account : accounts) {
|
||||||
|
ids.add(account.id);
|
||||||
|
}
|
||||||
|
AccountsVM accountsVM = new ViewModelProvider(StatusInfoActivity.this).get(AccountsVM.class);
|
||||||
|
accountsVM.getRelationships(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, ids)
|
||||||
|
.observe(StatusInfoActivity.this, relationShips -> {
|
||||||
|
if (relationShips != null) {
|
||||||
|
for (RelationShip relationShip : relationShips) {
|
||||||
|
for (Account account : accounts) {
|
||||||
|
if (account.id.compareToIgnoreCase(relationShip.id) == 0) {
|
||||||
|
account.relationShip = relationShip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
accountAdapter.notifyItemRangeChanged(position, accounts.size());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
|
|
@ -79,7 +79,12 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
// start the new activity
|
// start the new activity
|
||||||
context.startActivity(intent, options.toBundle());
|
context.startActivity(intent, options.toBundle());
|
||||||
});
|
});
|
||||||
|
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.block);
|
||||||
|
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.mute);
|
||||||
|
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.muteNotification);
|
||||||
|
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.muteTimed);
|
||||||
|
accountViewHolder.binding.followAction.setIconResource(R.drawable.ic_baseline_person_add_24);
|
||||||
|
accountViewHolder.binding.followAction.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(context, R.color.cyanea_accent_dark_reference)));
|
||||||
if (account.relationShip != null) {
|
if (account.relationShip != null) {
|
||||||
|
|
||||||
ProfileActivity.action doAction = ProfileActivity.action.FOLLOW;
|
ProfileActivity.action doAction = ProfileActivity.action.FOLLOW;
|
||||||
|
@ -111,10 +116,6 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
accountViewHolder.binding.followAction.setIconResource(R.drawable.ic_baseline_person_add_24);
|
accountViewHolder.binding.followAction.setIconResource(R.drawable.ic_baseline_person_add_24);
|
||||||
accountViewHolder.binding.followAction.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(context, R.color.cyanea_accent_dark_reference)));
|
accountViewHolder.binding.followAction.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(context, R.color.cyanea_accent_dark_reference)));
|
||||||
}
|
}
|
||||||
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.block);
|
|
||||||
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.mute);
|
|
||||||
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.muteNotification);
|
|
||||||
ThemeHelper.changeColorOutlineButton(context, accountViewHolder.binding.muteTimed);
|
|
||||||
|
|
||||||
|
|
||||||
if (account.relationShip.blocking) {
|
if (account.relationShip.blocking) {
|
||||||
|
|
|
@ -208,6 +208,8 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
} else {
|
} else {
|
||||||
router(null);
|
router(null);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
router(null);
|
||||||
}
|
}
|
||||||
if (timelineStatuses != null && timelineStatuses.size() > 0) {
|
if (timelineStatuses != null && timelineStatuses.size() > 0) {
|
||||||
route(DIRECTION.FETCH_NEW, true);
|
route(DIRECTION.FETCH_NEW, true);
|
||||||
|
|
Loading…
Reference in a new issue