mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 11:28:41 +01:00
Showing last account connected time
This commit is contained in:
@@ -21,9 +21,7 @@ package eu.faircode.email;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -31,10 +29,11 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -47,11 +46,12 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHolder> {
|
||||
private Context context;
|
||||
private LayoutInflater inflater;
|
||||
private boolean debug;
|
||||
|
||||
private List<EntityAccount> all = new ArrayList<>();
|
||||
private List<EntityAccount> filtered = new ArrayList<>();
|
||||
|
||||
private static final DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
View itemView;
|
||||
View vwColor;
|
||||
@@ -106,8 +106,8 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
||||
ivState.setImageResource(R.drawable.baseline_cloud_off_24);
|
||||
ivState.setVisibility(account.synchronize ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
tvLast.setText(account.last_connected == null ? null : new Date(account.last_connected).toString());
|
||||
tvLast.setVisibility(debug ? View.VISIBLE : View.GONE);
|
||||
tvLast.setText(context.getString(R.string.title_last_connected,
|
||||
account.last_connected == null ? "" : df.format(account.last_connected)));
|
||||
|
||||
tvError.setText(account.error);
|
||||
tvError.setVisibility(account.error == null ? View.GONE : View.VISIBLE);
|
||||
@@ -134,9 +134,6 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
||||
this.context = context;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.debug = prefs.getBoolean("debug", false);
|
||||
|
||||
setHasStableIds(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,25 +170,29 @@ public class EntityAccount {
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof EntityAccount) {
|
||||
EntityAccount other = (EntityAccount) obj;
|
||||
return ((this.name == null ? other.name == null : this.name.equals(other.name)) &&
|
||||
(this.prefix == null ? other.prefix == null : this.prefix.equals(other.prefix)) &&
|
||||
return (this.auth_type.equals(other.auth_type) &&
|
||||
this.host.equals(other.host) &&
|
||||
this.starttls == other.starttls &&
|
||||
this.insecure == other.insecure &&
|
||||
this.port.equals(other.port) &&
|
||||
this.user.equals(other.user) &&
|
||||
this.password.equals(other.password) &&
|
||||
this.auth_type.equals(other.auth_type) &&
|
||||
(this.realm == null ? other.realm == null : this.realm.equals(other.realm)) &&
|
||||
(this.name == null ? other.name == null : this.name.equals(other.name)) &&
|
||||
(this.color == null ? other.color == null : this.color.equals(other.color)) &&
|
||||
this.synchronize.equals(other.synchronize) &&
|
||||
this.primary.equals(other.primary) &&
|
||||
this.browse.equals(other.browse) &&
|
||||
(this.color == null ? other.color == null : this.color.equals(other.color)) &&
|
||||
this.notify.equals(other.notify) &&
|
||||
this.browse.equals(other.browse) &&
|
||||
(this.swipe_left == null ? other.swipe_left == null : this.swipe_left.equals(other.swipe_left)) &&
|
||||
(this.swipe_right == null ? other.swipe_right == null : this.swipe_right.equals(other.swipe_right)) &&
|
||||
this.poll_interval.equals(other.poll_interval) &&
|
||||
(this.prefix == null ? other.prefix == null : this.prefix.equals(other.prefix)) &&
|
||||
(this.created == null ? other.created == null : this.created.equals(other.created)) &&
|
||||
(this.tbd == null ? other.tbd == null : this.tbd.equals(other.tbd)) &&
|
||||
(this.state == null ? other.state == null : this.state.equals(other.state)) &&
|
||||
(this.error == null ? other.error == null : this.error.equals(other.error)));
|
||||
(this.error == null ? other.error == null : this.error.equals(other.error)) ||
|
||||
(this.last_connected == null ? other.last_connected == null : this.last_connected.equals(other.last_connected)));
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class EntityIdentity {
|
||||
@NonNull
|
||||
public Boolean read_receipt = false;
|
||||
@NonNull
|
||||
public Boolean store_sent = false; // obsolete
|
||||
public Boolean store_sent = false;
|
||||
public Long sent_folder; // obsolete
|
||||
public Boolean tbd;
|
||||
public String state;
|
||||
@@ -167,17 +167,21 @@ public class EntityIdentity {
|
||||
(this.display == null ? other.display == null : this.display.equals(other.display)) &&
|
||||
(this.color == null ? other.color == null : this.color.equals(other.color)) &&
|
||||
(this.signature == null ? other.signature == null : this.signature.equals(other.signature)) &&
|
||||
this.auth_type.equals(other.auth_type) &&
|
||||
this.host.equals(other.host) &&
|
||||
this.starttls.equals(other.starttls) &&
|
||||
this.insecure.equals(other.insecure) &&
|
||||
this.port.equals(other.port) &&
|
||||
this.user.equals(other.user) &&
|
||||
this.password.equals(other.password) &&
|
||||
(this.realm == null ? other.realm == null : this.realm.equals(other.realm)) &&
|
||||
this.synchronize.equals(other.synchronize) &&
|
||||
this.primary.equals(other.primary) &&
|
||||
(this.replyto == null ? other.replyto == null : this.replyto.equals(other.replyto)) &&
|
||||
(this.bcc == null ? other.bcc == null : this.bcc.equals(other.bcc)) &&
|
||||
this.delivery_receipt.equals(other.delivery_receipt) &&
|
||||
this.read_receipt.equals(other.read_receipt) &&
|
||||
this.store_sent.equals(other.store_sent) &&
|
||||
(this.tbd == null ? other.tbd == null : this.tbd.equals(other.tbd)) &&
|
||||
(this.state == null ? other.state == null : this.state.equals(other.state)) &&
|
||||
(this.error == null ? other.error == null : this.error.equals(other.error)));
|
||||
|
||||
Reference in New Issue
Block a user