Add constants for dated filename

This commit is contained in:
RichyHBM 2018-02-01 13:06:39 +00:00
parent 9d4cde2946
commit 8869799ffb
2 changed files with 14 additions and 0 deletions

View file

@ -107,6 +107,10 @@ public class Constants {
public final static String BACKUP_FILENAME_CRYPT = "otp_accounts.json.aes";
public final static String BACKUP_FILENAME_PGP = "otp_accounts.json.gpg";
public final static String BACKUP_FILENAME_PLAIN_FORMAT = "otp_accounts_%s.json";
public final static String BACKUP_FILENAME_CRYPT_FORMAT = "otp_accounts_%s.json.aes";
public final static String BACKUP_FILENAME_PGP_FORMAT = "otp_accounts_%s.json.gpg";
public final static String BACKUP_MIMETYPE_PLAIN = "application/json";
public final static String BACKUP_MIMETYPE_CRYPT = "binary/aes";
public final static String BACKUP_MIMETYPE_PGP = "application/pgp-encrypted";

View file

@ -33,6 +33,10 @@ import android.os.Build;
import android.os.Environment;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class Tools {
@ -94,4 +98,10 @@ public class Tools {
}
return ret.toString().trim();
}
public static String getDateTimeString() {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.ENGLISH);
Date now = Calendar.getInstance().getTime();
return df.format(now);
}
}