Show backoff state

This commit is contained in:
M66B
2020-10-31 09:06:06 +01:00
parent 952bcd87e6
commit cb8f4480d2
6 changed files with 72 additions and 8 deletions

View File

@@ -186,8 +186,13 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
ivState.setImageResource(R.drawable.twotone_cancel_24);
ivState.setContentDescription(context.getString(R.string.title_legend_closing));
} else {
ivState.setImageResource(R.drawable.twotone_cloud_off_24);
ivState.setContentDescription(context.getString(R.string.title_legend_disconnected));
if (account.backoff_until == null) {
ivState.setImageResource(R.drawable.twotone_cloud_off_24);
ivState.setContentDescription(context.getString(R.string.title_legend_disconnected));
} else {
ivState.setImageResource(R.drawable.twotone_update_24);
ivState.setContentDescription(context.getString(R.string.title_legend_backoff));
}
}
ivState.setVisibility(account.synchronize || account.state != null ? View.VISIBLE : View.INVISIBLE);
@@ -456,7 +461,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.SHORT);
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.MEDIUM);
setHasStableIds(true);

View File

@@ -89,9 +89,14 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
}
private void bindTo(TupleAccountEx account) {
ivItem.setImageResource("connected".equals(account.state)
? account.primary ? R.drawable.twotone_folder_special_24 : R.drawable.twotone_folder_done_24
: R.drawable.twotone_folder_24);
if ("connected".equals(account.state))
ivItem.setImageResource(account.primary
? R.drawable.twotone_folder_special_24
: R.drawable.twotone_folder_done_24);
else
ivItem.setImageResource(account.backoff_until == null
? R.drawable.twotone_folder_24
: R.drawable.twotone_update_24);
if (account.color == null)
ivItem.clearColorFilter();

View File

@@ -58,9 +58,19 @@ public class FragmentLegend extends FragmentBase {
pager = view.findViewById(R.id.pager);
adapter = new PagerAdapter(getChildFragmentManager());
pager.setAdapter(adapter);
} else
} else {
view = inflater.inflate(layout, container, false);
if (layout == R.layout.fragment_legend_synchronization) {
view.findViewById(R.id.ibInfoBackoff).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.viewFAQ(getContext(), 123);
}
});
}
}
return view;
}