Refactoring

pull/169/head
M66B 5 years ago
parent dc1e6ae733
commit 4bd83818d3

@ -56,7 +56,7 @@ public class AdapterCertificate extends RecyclerView.Adapter<AdapterCertificate.
private TextView tvSubject;
private TextView tvAfter;
private TextView tvBefore;
private TextView tvOutdated;
private TextView tvExpired;
private TwoStateOwner powner = new TwoStateOwner(owner, "CertificatePopup");
@ -68,7 +68,7 @@ public class AdapterCertificate extends RecyclerView.Adapter<AdapterCertificate.
tvSubject = itemView.findViewById(R.id.tvSubject);
tvAfter = itemView.findViewById(R.id.tvAfter);
tvBefore = itemView.findViewById(R.id.tvBefore);
tvOutdated = itemView.findViewById(R.id.tvOutdated);
tvExpired = itemView.findViewById(R.id.tvExpired);
}
@Override
@ -139,7 +139,7 @@ public class AdapterCertificate extends RecyclerView.Adapter<AdapterCertificate.
tvSubject.setText(certificate.subject);
tvAfter.setText(certificate.after == null ? null : TF.format(certificate.after));
tvBefore.setText(certificate.before == null ? null : TF.format(certificate.before));
tvOutdated.setVisibility(certificate.isOutdated() ? View.VISIBLE : View.GONE);
tvExpired.setVisibility(certificate.isExpired() ? View.VISIBLE : View.GONE);
}
}

@ -92,7 +92,7 @@ public class EntityCertificate {
.generateCertificate(new ByteArrayInputStream(encoded));
}
boolean isOutdated() {
boolean isExpired() {
long now = new Date().getTime();
return ((this.after != null && now <= this.after) || (this.before != null && now > this.before));
}

@ -4571,7 +4571,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
break;
}
if (known && !record.isOutdated() && match)
if (known && !record.isExpired() && match)
Snackbar.make(view, R.string.title_signature_valid, Snackbar.LENGTH_LONG).show();
else {
LayoutInflater inflator = LayoutInflater.from(getContext());
@ -4582,7 +4582,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
TextView tvSubject = dview.findViewById(R.id.tvSubject);
TextView tvAfter = dview.findViewById(R.id.tvAfter);
TextView tvBefore = dview.findViewById(R.id.tvBefore);
TextView tvOutdated = dview.findViewById(R.id.tvOutdated);
TextView tvExpired = dview.findViewById(R.id.tvExpired);
tvSender.setText(sender);
tvEmail.setText(TextUtils.join(",", emails));
@ -4592,7 +4592,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
DateFormat TF = Helper.getDateTimeInstance(getContext(), SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
tvAfter.setText(record.after == null ? null : TF.format(record.after));
tvBefore.setText(record.before == null ? null : TF.format(record.before));
tvOutdated.setVisibility(record.isOutdated() ? View.VISIBLE : View.GONE);
tvExpired.setVisibility(record.isExpired() ? View.VISIBLE : View.GONE);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
.setView(dview)

@ -118,7 +118,7 @@
app:layout_constraintTop_toBottomOf="@+id/tvValidityTitle" />
<TextView
android:id="@+id/tvOutdated"
android:id="@+id/tvExpired"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"

@ -54,7 +54,7 @@
app:layout_constraintTop_toBottomOf="@+id/tvSubject" />
<TextView
android:id="@+id/tvOutdated"
android:id="@+id/tvExpired"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_signature_outdated"

Loading…
Cancel
Save