Refactoring

pull/159/head
M66B 6 years ago
parent 704b5c30b0
commit 049f3c342d

@ -68,7 +68,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private List<TupleAccountEx> items = new ArrayList<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private NumberFormat NF = NumberFormat.getNumberInstance();
private DateFormat DTF;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
@ -136,7 +136,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
tvName.setText(account.name);
else {
if (account.unseen > 0)
tvName.setText(context.getString(R.string.title_name_count, account.name, nf.format(account.unseen)));
tvName.setText(context.getString(R.string.title_name_count, account.name, NF.format(account.unseen)));
else
tvName.setText(account.name);

@ -60,7 +60,7 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
private List<TupleContactEx> all = new ArrayList<>();
private List<TupleContactEx> selected = new ArrayList<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private NumberFormat NF = NumberFormat.getNumberInstance();
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private View view;
@ -140,7 +140,7 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
tvName.setText(contact.name == null ? contact.email : contact.name);
tvEmail.setText(contact.accountName + "/" + contact.email);
tvTimes.setText(nf.format(contact.times_contacted));
tvTimes.setText(NF.format(contact.times_contacted));
tvLast.setText(contact.last_contacted == null ? null
: Helper.getRelativeTimeSpanString(context, contact.last_contacted));

@ -86,7 +86,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private List<TupleFolderEx> all = new ArrayList<>();
private List<TupleFolderEx> items = new ArrayList<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private NumberFormat NF = NumberFormat.getNumberInstance();
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private View view;
@ -220,7 +220,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
if (folder.unseen > 0)
tvName.setText(context.getString(R.string.title_name_count,
folder.getDisplayName(context, folder.parent_ref == null ? null : folder.parent_ref),
nf.format(folder.unseen)));
NF.format(folder.unseen)));
else
tvName.setText(folder.getDisplayName(context, folder.parent_ref == null ? null : folder.parent_ref));
@ -230,11 +230,11 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
if (listener == null && folder.selectable) {
StringBuilder sb = new StringBuilder();
if (folder.account == null)
sb.append(nf.format(folder.messages));
sb.append(NF.format(folder.messages));
else {
sb.append(nf.format(folder.content));
sb.append(NF.format(folder.content));
sb.append('/');
sb.append(nf.format(folder.messages));
sb.append(NF.format(folder.messages));
}
tvMessages.setText(sb.toString());
@ -251,19 +251,19 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
else
tvType.setText(Helper.localizeFolderType(context, folder.type));
tvTotal.setText(folder.total == null ? "" : nf.format(folder.total));
tvTotal.setText(folder.total == null ? "" : NF.format(folder.total));
if (folder.account == null) {
tvAfter.setText(null);
ivSync.setImageResource(R.drawable.baseline_sync_24);
} else {
StringBuilder a = new StringBuilder();
a.append(nf.format(folder.sync_days));
a.append(NF.format(folder.sync_days));
a.append('/');
if (folder.keep_days == Integer.MAX_VALUE)
a.append('∞');
else
a.append(nf.format(folder.keep_days));
a.append(NF.format(folder.keep_days));
tvAfter.setText(a.toString());
ivSync.setImageResource(folder.synchronize ? R.drawable.baseline_sync_24 : R.drawable.baseline_sync_disabled_24);
}

@ -49,7 +49,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
private List<TupleAccountEx> items = new ArrayList<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private NumberFormat NF = NumberFormat.getNumberInstance();
private DateFormat DTF;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@ -91,7 +91,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
tvItem.setText(account.name);
else
tvItem.setText(context.getString(R.string.title_name_count,
account.name, nf.format(account.unseen)));
account.name, NF.format(account.unseen)));
tvItem.setTextColor(Helper.resolveColor(context,
account.unseen == 0 ? android.R.attr.textColorSecondary : R.attr.colorUnread));

@ -47,7 +47,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
private List<TupleFolderNav> items = new ArrayList<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private NumberFormat NF = NumberFormat.getNumberInstance();
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View view;
@ -106,7 +106,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
tvItem.setText(folder.getDisplayName(context));
else
tvItem.setText(context.getString(R.string.title_name_count,
folder.getDisplayName(context), nf.format(count)));
folder.getDisplayName(context), NF.format(count)));
tvItem.setTextColor(Helper.resolveColor(context,
count == 0 ? android.R.attr.textColorSecondary : R.attr.colorUnread));

@ -44,7 +44,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
private List<NavMenuItem> items = new ArrayList<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private NumberFormat NF = NumberFormat.getNumberInstance();
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private View view;
@ -80,7 +80,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
tvItem.setText(menu.getTitle());
else
tvItem.setText(context.getString(R.string.title_name_count,
context.getString(menu.getTitle()), nf.format(menu.getCount())));
context.getString(menu.getTitle()), NF.format(menu.getCount())));
tvItem.setTextColor(Helper.resolveColor(context,
menu.getCount() == null ? android.R.attr.textColorSecondary : R.attr.colorUnread));

@ -232,7 +232,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private LongSparseArray<List<EntityAttachment>> attachments = new LongSparseArray<>();
private LongSparseArray<TupleAccountSwipes> accountSwipes = new LongSparseArray<>();
private NumberFormat nf = NumberFormat.getNumberInstance();
private NumberFormat NF = NumberFormat.getNumberInstance();
private static final int UNDO_TIMEOUT = 5000; // milliseconds
private static final int SWIPE_DISABLE_SELECT_DURATION = 1500; // milliseconds
@ -2635,7 +2635,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (unseen == 0)
setSubtitle(name);
else
setSubtitle(getString(R.string.title_name_count, name, nf.format(unseen)));
setSubtitle(getString(R.string.title_name_count, name, NF.format(unseen)));
if (errors)
fabError.show();

Loading…
Cancel
Save