Fixed some more time formatting

This commit is contained in:
M66B
2019-07-15 21:28:25 +02:00
parent ea14fa769a
commit 075d3dc6e9
13 changed files with 58 additions and 39 deletions

View File

@@ -52,7 +52,6 @@ import androidx.recyclerview.widget.RecyclerView;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@@ -70,7 +69,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private List<TupleAccountEx> items = new ArrayList<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
private DateFormat DTF;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private View view;
@@ -159,7 +158,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
tvHost.setText(String.format("%s:%d", account.host, account.port));
tvLast.setText(context.getString(R.string.title_last_connected,
account.last_connected == null ? "-" : df.format(account.last_connected)));
account.last_connected == null ? "-" : DTF.format(account.last_connected)));
tvAuthorize.setVisibility(account.auth_type == ConnectionHelper.AUTH_TYPE_PASSWORD ? View.GONE : View.VISIBLE);
tvIdentity.setVisibility(account.identities > 0 || !settings ? View.GONE : View.VISIBLE);
@@ -289,6 +288,8 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
this.colorUnread = Helper.resolveColor(context, R.attr.colorUnread);
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.SHORT);
setHasStableIds(true);
owner.getLifecycle().addObserver(new LifecycleObserver() {