Fix key creation string and display

This commit is contained in:
Dominik Schürmann 2015-04-30 18:57:51 +02:00
parent 7c275fed9d
commit c88d2e42b7
4 changed files with 12 additions and 26 deletions

View File

@ -173,11 +173,10 @@ public class KeyAdapter extends CursorAdapter {
String dateTime = DateUtils.formatDateTime(context,
cursor.getLong(INDEX_CREATION) * 1000,
DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_SHOW_TIME
| DateUtils.FORMAT_SHOW_YEAR
| DateUtils.FORMAT_ABBREV_MONTH);
mCreationDate.setText(context.getString(R.string.label_creation,
mCreationDate.setText(context.getString(R.string.label_key_created,
dateTime));
mCreationDate.setVisibility(View.VISIBLE);
} else {
@ -281,20 +280,6 @@ public class KeyAdapter extends CursorAdapter {
}
}
public boolean hasDuplicate() {
return mHasDuplicate;
}
public String getCreationDate(Context context) {
Calendar creationCal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
creationCal.setTime(mCreation);
// convert from UTC to time zone of device
creationCal.setTimeZone(TimeZone.getDefault());
return context.getString(R.string.label_creation) + ": "
+ DateFormat.getDateFormat(context).format(creationCal.getTime());
}
}
}

View File

@ -141,7 +141,7 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter {
| DateUtils.FORMAT_SHOW_YEAR
| DateUtils.FORMAT_ABBREV_MONTH);
h.creation.setText(context.getString(R.string.label_creation, dateTime));
h.creation.setText(context.getString(R.string.label_key_created, dateTime));
h.creation.setVisibility(View.VISIBLE);
} else {
h.creation.setVisibility(View.GONE);

View File

@ -26,6 +26,7 @@ import android.support.v4.content.Loader;
import android.support.v4.widget.CursorAdapter;
import android.support.v7.widget.AppCompatSpinner;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
@ -167,14 +168,13 @@ public abstract class KeySpinner extends AppCompatSpinner implements LoaderManag
boolean duplicate = cursor.getLong(mIndexDuplicate) > 0;
if (duplicate) {
Date creationDate = new Date(cursor.getLong(mIndexCreationDate) * 1000);
Calendar creationCal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
creationCal.setTime(creationDate);
// convert from UTC to time zone of device
creationCal.setTimeZone(TimeZone.getDefault());
String dateTime = DateUtils.formatDateTime(context,
cursor.getLong(mIndexCreationDate) * 1000,
DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_SHOW_YEAR
| DateUtils.FORMAT_ABBREV_MONTH);
vDuplicate.setText(context.getString(R.string.label_creation) + ": "
+ DateFormat.getDateFormat(context).format(creationCal.getTime()));
vDuplicate.setText(context.getString(R.string.label_key_created, dateTime));
vDuplicate.setVisibility(View.VISIBLE);
} else {
vDuplicate.setVisibility(View.GONE);

View File

@ -137,7 +137,8 @@
<string name="label_file_compression">"File compression"</string>
<string name="label_keyservers">"Keyservers"</string>
<string name="label_key_id">"Key ID"</string>
<string name="label_creation">"Key created %s"</string>
<string name="label_key_created">"Key created %s"</string>
<string name="label_creation">"Creation"</string>
<string name="label_expiry">"Expiry"</string>
<string name="label_usage">"Usage"</string>
<string name="label_key_size">"Key Size"</string>
@ -503,7 +504,7 @@
<string name="api_settings_delete_account">"Delete account"</string>
<string name="api_settings_package_name">"Package Name"</string>
<string name="api_settings_package_signature">"SHA-256 of Package Signature"</string>
<string name="api_settings_accounts">"Accounts (deprecated API)"</string>
<string name="api_settings_accounts">"Accounts (old API)"</string>
<string name="api_settings_advanced">"Extended Information"</string>
<string name="api_settings_allowed_keys">"Allowed Keys"</string>
<string name="api_settings_settings">"Settings"</string>