mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 06:11:19 +00:00
* Device overview: Show status "Syncing" in case of data throughput (fixes #240) If (incoming_bits_per_second + outgoing_bits_per_second) top the threshold, we'll assume syncing state for the device reporting that data throughput. * Imported de translation
This commit is contained in:
parent
e479bf6f77
commit
80d24c8843
3 changed files with 22 additions and 2 deletions
|
@ -26,6 +26,12 @@ public class DevicesAdapter extends ArrayAdapter<Device> {
|
|||
|
||||
private static final String TAG = "DevicesAdapter";
|
||||
|
||||
/**
|
||||
* If (incoming_bits_per_second + outgoing_bits_per_second) top the threshold,
|
||||
* we'll assume syncing state for the device reporting that data throughput.
|
||||
*/
|
||||
private static final long ACTIVE_SYNC_BITS_PER_SECOND_THRESHOLD = 50 * 1024 * 8;
|
||||
|
||||
private Connections mConnections;
|
||||
|
||||
public DevicesAdapter(Context context) {
|
||||
|
@ -80,8 +86,20 @@ public class DevicesAdapter extends ArrayAdapter<Device> {
|
|||
rateInOutView.setVisibility(VISIBLE);
|
||||
status.setVisibility(VISIBLE);
|
||||
if (conn.completion == 100) {
|
||||
/**
|
||||
* UI polish - We distinguish the following cases:
|
||||
* a) conn.completion == 100 because of the model init assignment, data transmission ongoing.
|
||||
* b) conn.completion == 100 because of a finished sync, no data transmission.
|
||||
*/
|
||||
if ((conn.inBits + conn.outBits) >= ACTIVE_SYNC_BITS_PER_SECOND_THRESHOLD) {
|
||||
// case a) device_syncing
|
||||
status.setText(r.getString(R.string.state_syncing_general));
|
||||
status.setTextColor(ContextCompat.getColor(getContext(), R.color.text_blue));
|
||||
} else {
|
||||
// case b) device_up_to_date
|
||||
status.setText(r.getString(R.string.device_up_to_date));
|
||||
status.setTextColor(ContextCompat.getColor(getContext(), R.color.text_green));
|
||||
}
|
||||
} else {
|
||||
status.setText(r.getString(R.string.device_syncing, conn.completion));
|
||||
status.setTextColor(ContextCompat.getColor(getContext(), R.color.text_blue));
|
||||
|
|
|
@ -778,6 +778,7 @@ Bitte melden Sie auftretende Probleme via GitHub.</string>
|
|||
<!-- Possible folder states -->
|
||||
<string name="state_idle">Untätig</string>
|
||||
<string name="state_scanning">Scannen</string>
|
||||
<string name="state_syncing_general">Synchronisiere</string>
|
||||
<string name="state_syncing">Synchronisiere (%1$d%%)</string>
|
||||
<string name="state_error">Fehler</string>
|
||||
<string name="state_unknown">Unbekannt</string>
|
||||
|
|
|
@ -794,6 +794,7 @@ Please report any problems you encounter via Github.</string>
|
|||
<!-- Possible folder states -->
|
||||
<string name="state_idle">Idle</string>
|
||||
<string name="state_scanning">Scanning</string>
|
||||
<string name="state_syncing_general">Syncing</string>
|
||||
<string name="state_syncing">Syncing (%1$d%%)</string>
|
||||
<string name="state_error">Error</string>
|
||||
<string name="state_unknown">Unknown</string>
|
||||
|
|
Loading…
Reference in a new issue