diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 63999ea35..3e92222c4 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -19,7 +19,6 @@ dependencies { compile 'com.journeyapps:zxing-android-embedded:3.4.0' compile 'com.google.zxing:core:3.3.0' compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1' - compile 'org.ocpsoft.prettytime:prettytime:4.0.1.Final' compile 'org.sufficientlysecure:donations:2.5' compile 'com.squareup.okhttp3:okhttp:3.9.1' compile 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1' @@ -129,7 +128,6 @@ dependencyVerification { 'com.android.support:support-annotations:af05330d997eb92a066534dbe0a3ea24347d26d7001221092113ae02a8f233da', 'com.google.zxing:core:bba7724e02a997cec38213af77133ee8e24b0d5cf5fa7ecbc16a4fa93f11ee0d', 'org.commonjava.googlecode.markdown4j:markdown4j:28eb991f702c6d85d6cafd68c24d1ce841d1f5c995c943f25aedb433c0c13f60', - 'org.ocpsoft.prettytime:prettytime:ef7098d973ae78b57d1a22dc37d3b8a771bf030301300e24055d676b6cdc5e75', 'com.squareup.okhttp3:okhttp-urlconnection:16a410e5c4457ab381759486df6f840fdc7cc426d67433d4da1b7d65ed2b3b33', 'com.squareup.okhttp3:okhttp:a0d01017a42bba26e507fc6d448bb36e536f4b6e612f7c42de30bbdac2b7785e', 'org.apache.james:apache-mime4j-dom:e18717fe6d36f32e5c5f7cbeea1a9bf04645fdabc84e7e8374d9da10fd52e78d', diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java index bad905a58..7606f4ba6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java @@ -17,7 +17,6 @@ package org.sufficientlysecure.keychain.ui.widget; -import java.util.Date; import android.content.Context; import android.database.Cursor; @@ -26,13 +25,13 @@ import android.os.Bundle; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; +import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.View; import android.widget.ListView; import android.widget.TextView; import android.widget.ViewAnimator; -import org.ocpsoft.prettytime.PrettyTime; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract.Certs; @@ -122,29 +121,28 @@ public class CertListWidget extends ViewAnimator } // TODO support external certificates - Date userCert = null; + Long certTime = null; while (!data.isAfterLast()) { int verified = data.getInt(INDEX_VERIFIED); - Date creation = new Date(data.getLong(INDEX_CREATION) * 1000); + long creation = data.getLong(INDEX_CREATION) * 1000; if (verified == Certs.VERIFIED_SECRET) { - if (userCert == null || userCert.after(creation)) { - userCert = creation; + if (certTime == null || certTime > creation) { + certTime = creation; } } data.moveToNext(); } - if (userCert != null) { - PrettyTime format = new PrettyTime(); + if (certTime != null) { + CharSequence relativeTimeStr = DateUtils + .getRelativeTimeSpanString(certTime, System.currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_ALL); if (mIsSecret) { - vCollapsed.setText("You created this identity " - + format.format(userCert) + "."); + vCollapsed.setText("You created this identity " + relativeTimeStr + "."); } else { - vCollapsed.setText("You verified and confirmed this identity " - + format.format(userCert) + "."); + vCollapsed.setText("You verified and confirmed this identity " + relativeTimeStr + "."); } } else { vCollapsed.setText("This identity is not yet verified or confirmed.");