mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Show expires in entry view.
This commit is contained in:
@@ -21,7 +21,6 @@ package com.keepassdroid;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.UUID;
|
||||
@@ -125,9 +124,19 @@ public class EntryActivity extends LockingActivity {
|
||||
populateText(R.id.entry_modified, df.format(mEntry.tLastMod));
|
||||
populateText(R.id.entry_accessed, df.format(mEntry.tLastAccess));
|
||||
|
||||
if ( PwEntry.IsNever(mEntry.tExpire) ) {
|
||||
populateText(R.id.entry_expires, R.string.never);
|
||||
} else {
|
||||
populateText(R.id.entry_expires, df.format(mEntry.tExpire));
|
||||
}
|
||||
populateText(R.id.entry_comment, mEntry.additional);
|
||||
}
|
||||
|
||||
private void populateText(int viewId, int resId) {
|
||||
TextView tv = (TextView) findViewById(viewId);
|
||||
tv.setText(resId);
|
||||
}
|
||||
|
||||
private void populateText(int viewId, String text) {
|
||||
TextView tv = (TextView) findViewById(viewId);
|
||||
tv.setText(text);
|
||||
|
||||
@@ -71,6 +71,24 @@ public class PwEntry {
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
public static boolean IsNever(Date date) {
|
||||
Calendar never = Calendar.getInstance();
|
||||
never.setTime(NEVER_EXPIRE);
|
||||
never.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
return (never.get(Calendar.YEAR) == cal.get(Calendar.YEAR)) &&
|
||||
(never.get(Calendar.MONTH) == cal.get(Calendar.MONTH)) &&
|
||||
(never.get(Calendar.DAY_OF_MONTH) == cal.get(Calendar.DAY_OF_MONTH)) &&
|
||||
(never.get(Calendar.HOUR) == cal.get(Calendar.HOUR)) &&
|
||||
(never.get(Calendar.MINUTE) == cal.get(Calendar.MINUTE)) &&
|
||||
(never.get(Calendar.SECOND) == cal.get(Calendar.SECOND));
|
||||
|
||||
}
|
||||
|
||||
// for tree traversing
|
||||
public PwGroup parent = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user