mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 06:37:30 +00:00
more #1309
This commit is contained in:
parent
2395b3b892
commit
7e00dcc1b7
@ -6,20 +6,20 @@ import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Date;
|
||||
//import java.util.Date;
|
||||
|
||||
import awais.instagrabber.models.enums.FavoriteType;
|
||||
|
||||
public class Converters {
|
||||
@TypeConverter
|
||||
public static Date fromTimestamp(Long value) {
|
||||
return value == null ? null : new Date(value);
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public static Long dateToTimestamp(Date date) {
|
||||
return date == null ? null : date.getTime();
|
||||
}
|
||||
// @TypeConverter
|
||||
// public static Date fromTimestamp(Long value) {
|
||||
// return value == null ? null : new Date(value);
|
||||
// }
|
||||
//
|
||||
// @TypeConverter
|
||||
// public static Long dateToTimestamp(Date date) {
|
||||
// return date == null ? null : date.getTime();
|
||||
// }
|
||||
|
||||
@TypeConverter
|
||||
public static FavoriteType fromFavoriteTypeString(String value) {
|
||||
|
@ -19,8 +19,8 @@ import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Locale;
|
||||
|
||||
import awais.instagrabber.databinding.DialogCreateBackupBinding;
|
||||
@ -34,7 +34,7 @@ import static awais.instagrabber.utils.DownloadUtils.PERMS;
|
||||
|
||||
public class CreateBackupDialogFragment extends DialogFragment {
|
||||
private static final int STORAGE_PERM_REQUEST_CODE = 8020;
|
||||
private static final SimpleDateFormat BACKUP_FILE_DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US);
|
||||
private static final DateTimeFormatter BACKUP_FILE_DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyyMMddHHmmss", Locale.US);
|
||||
|
||||
private final OnResultListener onResultListener;
|
||||
private DialogCreateBackupBinding binding;
|
||||
@ -142,8 +142,7 @@ public class CreateBackupDialogFragment extends DialogFragment {
|
||||
final DirectoryChooser directoryChooser = new DirectoryChooser()
|
||||
.setInitialDirectory(folderPath)
|
||||
.setInteractionListener(path -> {
|
||||
final Date now = new Date();
|
||||
final File file = new File(path, String.format("barinsta_%s.backup", BACKUP_FILE_DATE_TIME_FORMAT.format(now)));
|
||||
final File file = new File(path, String.format("barinsta_%s.backup", LocalDateTime.now().format(BACKUP_FILE_DATE_TIME_FORMAT)));
|
||||
int flags = 0;
|
||||
if (binding.cbExportFavorites.isChecked()) {
|
||||
flags |= ExportImportUtils.FLAG_FAVORITES;
|
||||
|
@ -2,7 +2,6 @@ package awais.instagrabber.repositories.responses.notification;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -6,6 +6,7 @@ import awais.instagrabber.models.UploadPhotoOptions
|
||||
import awais.instagrabber.models.UploadVideoOptions
|
||||
import awais.instagrabber.models.enums.MediaItemType
|
||||
import org.json.JSONObject
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
import kotlin.random.Random
|
||||
|
||||
@ -106,7 +107,7 @@ fun createUploadDmVoiceOptions(
|
||||
}
|
||||
|
||||
fun generateUploadId(): String {
|
||||
return (Date().time / 1000).toString()
|
||||
return Instant.now().epochSecond.toString()
|
||||
}
|
||||
|
||||
fun generateName(uploadId: String): String {
|
||||
|
@ -94,9 +94,6 @@ object TextUtils {
|
||||
|
||||
@JvmStatic
|
||||
fun nowToString(): String {
|
||||
return LocalDateTime.ofInstant(
|
||||
Instant.now(),
|
||||
ZoneId.systemDefault()
|
||||
).format(datetimeParser)
|
||||
return LocalDateTime.now().format(datetimeParser)
|
||||
}
|
||||
}
|
@ -9,9 +9,9 @@ import android.webkit.MimeTypeMap;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@ -24,7 +24,7 @@ public class VoiceRecorder {
|
||||
private static final int AUDIO_BIT_DEPTH = 16;
|
||||
private static final int AUDIO_BIT_RATE = AUDIO_SAMPLE_RATE * AUDIO_BIT_DEPTH;
|
||||
private static final String FILE_FORMAT = "yyyy-MM-dd-HH-mm-ss-SSS";
|
||||
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat(FILE_FORMAT, Locale.US);
|
||||
private static final DateTimeFormatter SIMPLE_DATE_FORMAT = DateTimeFormatter.ofPattern(FILE_FORMAT, Locale.US);
|
||||
|
||||
private final List<Float> waveform = new ArrayList<>();
|
||||
private final File recordingsDir;
|
||||
@ -141,7 +141,7 @@ public class VoiceRecorder {
|
||||
|
||||
@NonNull
|
||||
private File getAudioRecordFile() {
|
||||
final String name = String.format("%s-%s.%s", FILE_PREFIX, SIMPLE_DATE_FORMAT.format(new Date()), EXTENSION);
|
||||
final String name = String.format("%s-%s.%s", FILE_PREFIX, LocalDateTime.now().format(SIMPLE_DATE_FORMAT), EXTENSION);
|
||||
return new File(recordingsDir, name);
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,9 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -34,7 +34,7 @@ public class ImageEditViewModel extends AndroidViewModel {
|
||||
private static final String CROP = "crop";
|
||||
private static final String RESULT = "result";
|
||||
private static final String FILE_FORMAT = "yyyyMMddHHmmssSSS";
|
||||
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat(FILE_FORMAT, Locale.US);
|
||||
private static final DateTimeFormatter SIMPLE_DATE_FORMAT = DateTimeFormatter.ofPattern(FILE_FORMAT, Locale.US);
|
||||
|
||||
private Uri originalUri;
|
||||
private SavedImageEditState savedImageEditState;
|
||||
@ -55,7 +55,7 @@ public class ImageEditViewModel extends AndroidViewModel {
|
||||
|
||||
public ImageEditViewModel(final Application application) {
|
||||
super(application);
|
||||
sessionId = SIMPLE_DATE_FORMAT.format(new Date());
|
||||
sessionId = LocalDateTime.now().format(SIMPLE_DATE_FORMAT);
|
||||
outputDir = DirectoryUtils.getOutputMediaDirectory(application, "Edit", sessionId);
|
||||
destinationFile = new File(outputDir, RESULT + ".jpg");
|
||||
destinationUri = Uri.fromFile(destinationFile);
|
||||
|
@ -16,7 +16,7 @@ import java.io.FileReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import awais.instagrabber.BuildConfig;
|
||||
import awais.instagrabber.R;
|
||||
@ -28,9 +28,10 @@ public final class CrashReporterHelper {
|
||||
public static void startErrorReporterActivity(@NonNull final Application application,
|
||||
@NonNull final Throwable exception) {
|
||||
final StringBuilder reportBuilder = new StringBuilder();
|
||||
reportBuilder.append("IMPORTANT: If sending by email, your email address and the entire content will be made public on GitHub issues.")
|
||||
reportBuilder.append("IMPORTANT: If sending by email, your email address and the entire content will be made public at")
|
||||
.append("\r\nIMPORTANT: https://github.com/austinhuang0131/barinsta/issues")
|
||||
.append("\r\nIMPORTANT: When possible, please describe the steps leading to this crash. Thank you for your cooperation.")
|
||||
.append("\r\n\r\nError report collected on: ").append(new Date().toString())
|
||||
.append("\r\n\r\nError report collected on: ").append(LocalDateTime.now().toString())
|
||||
.append("\r\n\r\nInformation:\r\n==============")
|
||||
.append("\r\nVERSION : ").append(BuildConfig.VERSION_NAME)
|
||||
.append("\r\nVERSION_CODE : ").append(BuildConfig.VERSION_CODE)
|
||||
|
Loading…
Reference in New Issue
Block a user