Show backoff state

pull/187/head
M66B 4 years ago
parent 952bcd87e6
commit cb8f4480d2

@ -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);

@ -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();

@ -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;
}

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M11,8v5l4.25,2.52l0.77,-1.28l-3.52,-2.09V8H11zM21,10V3l-2.64,2.64C16.74,4.01 14.49,3 12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9s9,-4.03 9,-9h-2c0,3.86 -3.14,7 -7,7s-7,-3.14 -7,-7s3.14,-7 7,-7c1.93,0 3.68,0.79 4.95,2.05L14,10H21z"/>
</vector>

@ -210,6 +210,39 @@
app:layout_constraintStart_toEndOf="@id/ivDisconnected"
app:layout_constraintTop_toTopOf="@id/ivDisconnected" />
<ImageView
android:id="@+id/ivBackoff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/title_legend_backoff"
android:padding="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivDisconnected"
app:srcCompat="@drawable/twotone_update_24" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBackoff"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center_vertical"
android:text="@string/title_legend_backoff"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toBottomOf="@id/ivBackoff"
app:layout_constraintEnd_toStartOf="@id/ibInfoBackoff"
app:layout_constraintStart_toEndOf="@id/ivBackoff"
app:layout_constraintTop_toTopOf="@id/ivBackoff" />
<ImageButton
android:id="@+id/ibInfoBackoff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/title_info"
android:tooltipText="@string/title_info"
app:layout_constraintBottom_toBottomOf="@id/ivBackoff"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/ivBackoff"
app:srcCompat="@drawable/twotone_info_24" />
<ImageView
android:id="@+id/ivConnecting"
android:layout_width="wrap_content"
@ -217,7 +250,7 @@
android:contentDescription="@string/title_legend_connecting"
android:padding="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivDisconnected"
app:layout_constraintTop_toBottomOf="@id/ivBackoff"
app:srcCompat="@drawable/twotone_cloud_queue_24" />
<eu.faircode.email.FixedTextView

@ -1206,6 +1206,7 @@
<string name="title_legend_synchronize_off">Synchronize off</string>
<string name="title_legend_synchronize_poll">Synchronize periodically</string>
<string name="title_legend_disconnected">Disconnected</string>
<string name="title_legend_backoff">Waiting</string>
<string name="title_legend_connecting">Connecting</string>
<string name="title_legend_connected">Connected</string>
<string name="title_legend_executing">Executing operations</string>

Loading…
Cancel
Save