1190 lines
28 KiB
Smali
1190 lines
28 KiB
Smali
.class public final Lcom/discord/utilities/time/TimeUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "TimeUtils.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/utilities/time/TimeUtils$UTCFormat;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final DATE_FORMAT_DISCORD_API:Ljava/lang/String; = "yyyy-MM-dd\'T\'HH:mm:ss"
|
|
|
|
.field public static final INSTANCE:Lcom/discord/utilities/time/TimeUtils;
|
|
|
|
.field public static final localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Lcom/discord/utilities/time/TimeUtils;
|
|
|
|
invoke-direct {v0}, Lcom/discord/utilities/time/TimeUtils;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/time/TimeUtils;->INSTANCE:Lcom/discord/utilities/time/TimeUtils;
|
|
|
|
new-instance v0, Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
invoke-direct {v0}, Lcom/discord/utilities/locale/LocaleManager;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/time/TimeUtils;->localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final currentTimeUTCDateString(Lcom/discord/utilities/time/Clock;)Ljava/lang/String;
|
|
.locals 3
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
invoke-interface {p0}, Lcom/discord/utilities/time/Clock;->currentTimeMillis()J
|
|
|
|
move-result-wide v1
|
|
|
|
invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v1, 0x2
|
|
|
|
invoke-static {p0, v0, v1, v0}, Lcom/discord/utilities/time/TimeUtils;->toUTCDateTime$default(Ljava/lang/Long;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
const-string p0, "clock"
|
|
|
|
invoke-static {p0}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static final getMonthsBetweenDates(Ljava/util/Date;Ljava/util/Date;)I
|
|
.locals 3
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_3
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, p1}, Ljava/util/Date;->before(Ljava/util/Date;)Z
|
|
|
|
move-result v1
|
|
|
|
const-string v2, "calendar"
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-static {v0, v2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0, p0}, Ljava/util/Calendar;->setTime(Ljava/util/Date;)V
|
|
|
|
move-object p0, p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
invoke-static {v0, v2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0, p1}, Ljava/util/Calendar;->setTime(Ljava/util/Date;)V
|
|
|
|
:goto_0
|
|
const/4 p1, 0x0
|
|
|
|
:goto_1
|
|
invoke-virtual {v0}, Ljava/util/Calendar;->getTime()Ljava/util/Date;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, p0}, Ljava/util/Date;->before(Ljava/util/Date;)Z
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
const/4 v1, 0x2
|
|
|
|
invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->add(II)V
|
|
|
|
add-int/lit8 p1, p1, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
sub-int/2addr p1, v2
|
|
|
|
return p1
|
|
|
|
:cond_2
|
|
const-string p0, "secondDate"
|
|
|
|
invoke-static {p0}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_3
|
|
const-string p0, "firstDate"
|
|
|
|
invoke-static {p0}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static final getReadableTimeString(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 2
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
invoke-static {p1}, Lcom/discord/utilities/time/TimeUtils;->parseUTCDate(Ljava/lang/String;)J
|
|
|
|
move-result-wide v0
|
|
|
|
invoke-static {p0, v0, v1}, Lcom/discord/utilities/time/TimeUtils;->toReadableTimeString(Landroid/content/Context;J)Ljava/lang/CharSequence;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
const-string p0, "context"
|
|
|
|
invoke-static {p0}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p0, 0x0
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static final parseSnowflake(Ljava/lang/Long;)J
|
|
.locals 4
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p0
|
|
|
|
:cond_0
|
|
invoke-virtual {p0}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v0
|
|
|
|
const/16 p0, 0x16
|
|
|
|
shr-long/2addr v0, p0
|
|
|
|
const-wide v2, 0x14aa2cab000L
|
|
|
|
add-long/2addr v0, v2
|
|
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method public static final parseUTCDate(Ljava/lang/String;)J
|
|
.locals 5
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
return-wide v0
|
|
|
|
:cond_0
|
|
:try_start_0
|
|
new-instance v2, Ljava/text/SimpleDateFormat;
|
|
|
|
const-string v3, "yyyy-MM-dd\'T\'HH:mm:ss"
|
|
|
|
sget-object v4, Ljava/util/Locale;->ROOT:Ljava/util/Locale;
|
|
|
|
invoke-direct {v2, v3, v4}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
const-string v3, "UTC"
|
|
|
|
invoke-static {v3}, Ljava/util/TimeZone;->getTimeZone(Ljava/lang/String;)Ljava/util/TimeZone;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v2, v3}, Ljava/text/SimpleDateFormat;->setTimeZone(Ljava/util/TimeZone;)V
|
|
|
|
invoke-virtual {v2, p0}, Ljava/text/SimpleDateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
invoke-virtual {p0}, Ljava/util/Date;->getTime()J
|
|
|
|
move-result-wide v0
|
|
:try_end_0
|
|
.catch Ljava/text/ParseException; {:try_start_0 .. :try_end_0} :catch_0
|
|
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_0 .. :try_end_0} :catch_0
|
|
.catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
:catch_0
|
|
:cond_1
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method private final renderUtcDate(Ljava/lang/String;Ljava/util/Locale;Ljava/lang/String;Ljava/text/DateFormat;I)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
new-instance v0, Ljava/text/SimpleDateFormat;
|
|
|
|
invoke-direct {v0, p3, p2}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
const-string p3, "UTC"
|
|
|
|
invoke-static {p3}, Ljava/util/TimeZone;->getTimeZone(Ljava/lang/String;)Ljava/util/TimeZone;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-virtual {v0, p3}, Ljava/text/SimpleDateFormat;->setTimeZone(Ljava/util/TimeZone;)V
|
|
|
|
invoke-virtual {v0, p1}, Ljava/text/SimpleDateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p2}, Ljava/util/Calendar;->getInstance(Ljava/util/Locale;)Ljava/util/Calendar;
|
|
|
|
move-result-object p2
|
|
|
|
const-string p3, "calendar"
|
|
|
|
invoke-static {p2, p3}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
new-instance p1, Ljava/util/Date;
|
|
|
|
invoke-direct {p1}, Ljava/util/Date;-><init>()V
|
|
|
|
:goto_0
|
|
invoke-virtual {p2, p1}, Ljava/util/Calendar;->setTime(Ljava/util/Date;)V
|
|
|
|
const/4 p1, 0x5
|
|
|
|
invoke-virtual {p2, p1, p5}, Ljava/util/Calendar;->add(II)V
|
|
|
|
invoke-virtual {p2}, Ljava/util/Calendar;->getTime()Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p4, p1}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "outputFormat.format(offsetDate)"
|
|
|
|
invoke-static {p1, p2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public static synthetic renderUtcDate$default(Lcom/discord/utilities/time/TimeUtils;JLandroid/content/Context;IILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 0
|
|
|
|
and-int/lit8 p5, p5, 0x4
|
|
|
|
if-eqz p5, :cond_0
|
|
|
|
const/4 p4, 0x2
|
|
|
|
:cond_0
|
|
invoke-virtual {p0, p1, p2, p3, p4}, Lcom/discord/utilities/time/TimeUtils;->renderUtcDate(JLandroid/content/Context;I)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic renderUtcDate$default(Lcom/discord/utilities/time/TimeUtils;Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;Ljava/text/DateFormat;IILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 6
|
|
|
|
and-int/lit8 p7, p6, 0x4
|
|
|
|
if-eqz p7, :cond_0
|
|
|
|
const-string p3, "yyyy-MM-dd\'T\'HH:mm:ss"
|
|
|
|
:cond_0
|
|
move-object v3, p3
|
|
|
|
and-int/lit8 p3, p6, 0x8
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
invoke-static {p2}, Landroid/text/format/DateFormat;->getMediumDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;
|
|
|
|
move-result-object p4
|
|
|
|
const-string p3, "DateFormat.getMediumDateFormat(context)"
|
|
|
|
invoke-static {p4, p3}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:cond_1
|
|
move-object v4, p4
|
|
|
|
and-int/lit8 p3, p6, 0x10
|
|
|
|
if-eqz p3, :cond_2
|
|
|
|
const/4 p5, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
move v5, p5
|
|
|
|
:goto_0
|
|
move-object v0, p0
|
|
|
|
move-object v1, p1
|
|
|
|
move-object v2, p2
|
|
|
|
invoke-virtual/range {v0 .. v5}, Lcom/discord/utilities/time/TimeUtils;->renderUtcDate(Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;Ljava/text/DateFormat;I)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic renderUtcDate$default(Lcom/discord/utilities/time/TimeUtils;Ljava/lang/String;Ljava/util/Locale;Ljava/lang/String;Ljava/text/DateFormat;IILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 6
|
|
|
|
and-int/lit8 p7, p6, 0x4
|
|
|
|
if-eqz p7, :cond_0
|
|
|
|
const-string p3, "yyyy-MM-dd\'T\'HH:mm:ss"
|
|
|
|
:cond_0
|
|
move-object v3, p3
|
|
|
|
and-int/lit8 p3, p6, 0x10
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
const/4 p5, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
move v5, p5
|
|
|
|
:goto_0
|
|
move-object v0, p0
|
|
|
|
move-object v1, p1
|
|
|
|
move-object v2, p2
|
|
|
|
move-object v4, p4
|
|
|
|
invoke-direct/range {v0 .. v5}, Lcom/discord/utilities/time/TimeUtils;->renderUtcDate(Ljava/lang/String;Ljava/util/Locale;Ljava/lang/String;Ljava/text/DateFormat;I)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic renderUtcDateTime$default(Lcom/discord/utilities/time/TimeUtils;Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;IIILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 6
|
|
|
|
and-int/lit8 p6, p6, 0x4
|
|
|
|
if-eqz p6, :cond_0
|
|
|
|
const-string p3, "yyyy-MM-dd\'T\'HH:mm:ss"
|
|
|
|
:cond_0
|
|
move-object v3, p3
|
|
|
|
move-object v0, p0
|
|
|
|
move-object v1, p1
|
|
|
|
move-object v2, p2
|
|
|
|
move v4, p4
|
|
|
|
move v5, p5
|
|
|
|
invoke-virtual/range {v0 .. v5}, Lcom/discord/utilities/time/TimeUtils;->renderUtcDateTime(Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;II)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final toCalendar(J)Ljava/util/Calendar;
|
|
.locals 2
|
|
|
|
sget-object v0, Ljava/util/Locale;->ROOT:Ljava/util/Locale;
|
|
|
|
invoke-static {v0}, Ljava/util/Calendar;->getInstance(Ljava/util/Locale;)Ljava/util/Calendar;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "calendar"
|
|
|
|
invoke-static {v0, v1}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0, p0, p1}, Ljava/util/Calendar;->setTimeInMillis(J)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static synthetic toFriendlyString$default(Lcom/discord/utilities/time/TimeUtils;JJLjava/lang/String;ILjava/lang/Object;)Ljava/lang/CharSequence;
|
|
.locals 6
|
|
|
|
and-int/lit8 p7, p6, 0x2
|
|
|
|
if-eqz p7, :cond_0
|
|
|
|
invoke-static {}, Lcom/discord/utilities/time/ClockFactory;->get()Lcom/discord/utilities/time/Clock;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-interface {p3}, Lcom/discord/utilities/time/Clock;->currentTimeMillis()J
|
|
|
|
move-result-wide p3
|
|
|
|
:cond_0
|
|
move-wide v3, p3
|
|
|
|
and-int/lit8 p3, p6, 0x4
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
const/4 p5, 0x0
|
|
|
|
:cond_1
|
|
move-object v5, p5
|
|
|
|
move-object v0, p0
|
|
|
|
move-wide v1, p1
|
|
|
|
invoke-virtual/range {v0 .. v5}, Lcom/discord/utilities/time/TimeUtils;->toFriendlyString(JJLjava/lang/String;)Ljava/lang/CharSequence;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic toFriendlyStringSimple$default(Lcom/discord/utilities/time/TimeUtils;JLjava/lang/String;ILjava/lang/Object;)Ljava/lang/CharSequence;
|
|
.locals 0
|
|
|
|
and-int/lit8 p4, p4, 0x2
|
|
|
|
if-eqz p4, :cond_0
|
|
|
|
const/4 p3, 0x0
|
|
|
|
:cond_0
|
|
invoke-virtual {p0, p1, p2, p3}, Lcom/discord/utilities/time/TimeUtils;->toFriendlyStringSimple(JLjava/lang/String;)Ljava/lang/CharSequence;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final toReadableTimeString(Landroid/content/Context;J)Ljava/lang/CharSequence;
|
|
.locals 8
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
sget-object v0, Lcom/discord/utilities/time/TimeUtils;->localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
invoke-virtual {v0, p0}, Lcom/discord/utilities/locale/LocaleManager;->getPrimaryLocale(Landroid/content/Context;)Ljava/util/Locale;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "en"
|
|
|
|
invoke-static {v0, v1}, Lj0/n/c/h;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
sget-object v0, Lcom/discord/utilities/time/TimeUtils;->INSTANCE:Lcom/discord/utilities/time/TimeUtils;
|
|
|
|
sget-object v1, Lcom/discord/utilities/time/TimeUtils;->localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
invoke-virtual {v1, p0}, Lcom/discord/utilities/locale/LocaleManager;->getPrimaryLocale(Landroid/content/Context;)Ljava/util/Locale;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v0, p0, p1, p2}, Lcom/discord/utilities/time/TimeUtils;->toReadableTimeStringEN(Ljava/util/Locale;J)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const-wide/32 v3, 0x5265c00
|
|
|
|
const-wide/32 v5, 0x240c8400
|
|
|
|
const/high16 v7, 0x20000
|
|
|
|
move-object v0, p0
|
|
|
|
move-wide v1, p1
|
|
|
|
invoke-static/range {v0 .. v7}, Landroid/text/format/DateUtils;->getRelativeDateTimeString(Landroid/content/Context;JJJI)Ljava/lang/CharSequence;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "DateUtils.getRelativeDat\u2026RMAT_NUMERIC_DATE\n )"
|
|
|
|
invoke-static {p0, p1}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:goto_0
|
|
return-object p0
|
|
|
|
:cond_1
|
|
const-string p0, "context"
|
|
|
|
invoke-static {p0}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p0, 0x0
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static final toUTCDateTime(Ljava/lang/Long;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 4
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
new-instance v1, Ljava/text/SimpleDateFormat;
|
|
|
|
sget-object v2, Ljava/util/Locale;->ROOT:Ljava/util/Locale;
|
|
|
|
invoke-direct {v1, p1, v2}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
const-string p1, "UTC"
|
|
|
|
invoke-static {p1}, Ljava/util/TimeZone;->getTimeZone(Ljava/lang/String;)Ljava/util/TimeZone;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {v1, p1}, Ljava/text/SimpleDateFormat;->setTimeZone(Ljava/util/TimeZone;)V
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
new-instance p1, Ljava/util/Date;
|
|
|
|
invoke-virtual {p0}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-direct {p1, v2, v3}, Ljava/util/Date;-><init>(J)V
|
|
|
|
invoke-virtual {v1, p1}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_0
|
|
return-object v0
|
|
|
|
:cond_1
|
|
const-string p0, "format"
|
|
|
|
invoke-static {p0}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static synthetic toUTCDateTime$default(Ljava/lang/Long;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 0
|
|
|
|
and-int/lit8 p2, p2, 0x2
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
const-string p1, "yyyy-MM-dd\'T\'HH:mm:ss"
|
|
|
|
:cond_0
|
|
invoke-static {p0, p1}, Lcom/discord/utilities/time/TimeUtils;->toUTCDateTime(Ljava/lang/Long;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final getHoursFromMillis(J)I
|
|
.locals 3
|
|
|
|
const v0, 0x36ee80
|
|
|
|
int-to-long v0, v0
|
|
|
|
cmp-long v2, p1, v0
|
|
|
|
if-gez v2, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
div-long/2addr p1, v0
|
|
|
|
long-to-int p1, p1
|
|
|
|
:goto_0
|
|
return p1
|
|
.end method
|
|
|
|
.method public final getLocalizedMonthName(ILandroid/content/Context;)Ljava/lang/String;
|
|
.locals 2
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
new-instance v0, Ljava/text/DateFormatSymbols;
|
|
|
|
sget-object v1, Lcom/discord/utilities/time/TimeUtils;->localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
invoke-virtual {v1, p2}, Lcom/discord/utilities/locale/LocaleManager;->getPrimaryLocale(Landroid/content/Context;)Ljava/util/Locale;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {v0, p2}, Ljava/text/DateFormatSymbols;-><init>(Ljava/util/Locale;)V
|
|
|
|
invoke-virtual {v0}, Ljava/text/DateFormatSymbols;->getMonths()[Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
add-int/lit8 p1, p1, -0x1
|
|
|
|
aget-object p1, p2, p1
|
|
|
|
const-string p2, "DateFormatSymbols(locale\u2026xt)).months[monthInt - 1]"
|
|
|
|
invoke-static {p1, p2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public final getMinutesFromMillis(J)I
|
|
.locals 3
|
|
|
|
const v0, 0xea60
|
|
|
|
int-to-long v0, v0
|
|
|
|
cmp-long v2, p1, v0
|
|
|
|
if-gez v2, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
div-long/2addr p1, v0
|
|
|
|
long-to-int p1, p1
|
|
|
|
:goto_0
|
|
return p1
|
|
.end method
|
|
|
|
.method public final renderUtcDate(JLandroid/content/Context;I)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
if-eqz p3, :cond_0
|
|
|
|
sget-object v0, Lcom/discord/utilities/time/TimeUtils;->localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
invoke-virtual {v0, p3}, Lcom/discord/utilities/locale/LocaleManager;->getPrimaryLocale(Landroid/content/Context;)Ljava/util/Locale;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-static {p4, p3}, Ljava/text/DateFormat;->getDateInstance(ILjava/util/Locale;)Ljava/text/DateFormat;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p3, p1}, Ljava/text/DateFormat;->format(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "formatter.format(unixTimeMillis)"
|
|
|
|
invoke-static {p1, p2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public final renderUtcDate(Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;Ljava/text/DateFormat;I)Ljava/lang/String;
|
|
.locals 7
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
if-eqz p4, :cond_0
|
|
|
|
sget-object v0, Lcom/discord/utilities/time/TimeUtils;->localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
invoke-virtual {v0, p2}, Lcom/discord/utilities/locale/LocaleManager;->getPrimaryLocale(Landroid/content/Context;)Ljava/util/Locale;
|
|
|
|
move-result-object v3
|
|
|
|
move-object v1, p0
|
|
|
|
move-object v2, p1
|
|
|
|
move-object v4, p3
|
|
|
|
move-object v5, p4
|
|
|
|
move v6, p5
|
|
|
|
invoke-direct/range {v1 .. v6}, Lcom/discord/utilities/time/TimeUtils;->renderUtcDate(Ljava/lang/String;Ljava/util/Locale;Ljava/lang/String;Ljava/text/DateFormat;I)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
const-string p1, "outputFormat"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_1
|
|
const-string p1, "inputFormat"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_2
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_3
|
|
const-string p1, "utcDate"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public final renderUtcDateTime(Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;II)Ljava/lang/String;
|
|
.locals 2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
new-instance v0, Ljava/text/SimpleDateFormat;
|
|
|
|
sget-object v1, Lcom/discord/utilities/time/TimeUtils;->localeManager:Lcom/discord/utilities/locale/LocaleManager;
|
|
|
|
invoke-virtual {v1, p2}, Lcom/discord/utilities/locale/LocaleManager;->getPrimaryLocale(Landroid/content/Context;)Ljava/util/Locale;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {v0, p3, p2}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
const-string p2, "UTC"
|
|
|
|
invoke-static {p2}, Ljava/util/TimeZone;->getTimeZone(Ljava/lang/String;)Ljava/util/TimeZone;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {v0, p2}, Ljava/text/SimpleDateFormat;->setTimeZone(Ljava/util/TimeZone;)V
|
|
|
|
invoke-virtual {v0, p1}, Ljava/text/SimpleDateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
new-instance p1, Ljava/util/Date;
|
|
|
|
invoke-direct {p1}, Ljava/util/Date;-><init>()V
|
|
|
|
:goto_0
|
|
invoke-static {p4, p5}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p2, p1}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "outputDateFormatInstance.format(date)"
|
|
|
|
invoke-static {p1, p2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
const-string p1, "inputFormat"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_2
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_3
|
|
const-string p1, "utcDateTime"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public final toFriendlyString(JJLjava/lang/String;)Ljava/lang/CharSequence;
|
|
.locals 7
|
|
|
|
sub-long v0, p3, p1
|
|
|
|
sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-virtual {v2, v0, v1}, Ljava/util/concurrent/TimeUnit;->toDays(J)J
|
|
|
|
move-result-wide v2
|
|
|
|
const-wide/16 v4, 0x0
|
|
|
|
cmp-long v6, v2, v4
|
|
|
|
if-nez v6, :cond_0
|
|
|
|
invoke-virtual {p0, v0, v1, p5}, Lcom/discord/utilities/time/TimeUtils;->toFriendlyStringSimple(JLjava/lang/String;)Ljava/lang/CharSequence;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const-wide/32 v4, 0x5265c00
|
|
|
|
const/high16 v6, 0x20000
|
|
|
|
move-wide v0, p1
|
|
|
|
move-wide v2, p3
|
|
|
|
invoke-static/range {v0 .. v6}, Landroid/text/format/DateUtils;->getRelativeTimeSpanString(JJJI)Ljava/lang/CharSequence;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "DateUtils.getRelativeTim\u2026AT_NUMERIC_DATE\n )"
|
|
|
|
invoke-static {p1, p2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:goto_0
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public final toFriendlyStringSimple(JLjava/lang/String;)Ljava/lang/CharSequence;
|
|
.locals 3
|
|
|
|
sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
const-wide/16 v1, 0x0
|
|
|
|
invoke-static {v1, v2, p1, p2}, Ljava/lang/Math;->max(JJ)J
|
|
|
|
move-result-wide p1
|
|
|
|
invoke-virtual {v0, p1, p2}, Ljava/util/concurrent/TimeUnit;->toSeconds(J)J
|
|
|
|
move-result-wide p1
|
|
|
|
invoke-static {p1, p2}, Landroid/text/format/DateUtils;->formatElapsedTime(J)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p3, :cond_0
|
|
|
|
const/4 p2, 0x1
|
|
|
|
new-array v0, p2, [Ljava/lang/Object;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
aput-object p1, v0, v1
|
|
|
|
invoke-static {v0, p2}, Ljava/util/Arrays;->copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p3, p1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "java.lang.String.format(this, *args)"
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const-string p2, "elapsedTime"
|
|
|
|
:goto_0
|
|
invoke-static {p1, p2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public final toReadableTimeStringEN(Ljava/util/Locale;J)Ljava/lang/String;
|
|
.locals 5
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
invoke-virtual {p1}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "en"
|
|
|
|
invoke-static {v0, v1}, Lj0/n/c/h;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
xor-int/lit8 v0, v0, 0x1
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const-string p1, ""
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
const/4 v0, 0x3
|
|
|
|
invoke-static {v0, p1}, Ljava/text/DateFormat;->getTimeInstance(ILjava/util/Locale;)Ljava/text/DateFormat;
|
|
|
|
move-result-object v1
|
|
|
|
const/4 v2, 0x2
|
|
|
|
invoke-static {v2, v0, p1}, Ljava/text/DateFormat;->getDateTimeInstance(IILjava/util/Locale;)Ljava/text/DateFormat;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {}, Lcom/discord/utilities/time/ClockFactory;->get()Lcom/discord/utilities/time/Clock;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v0}, Lcom/discord/utilities/time/Clock;->currentTimeMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v2, v3}, Lcom/discord/utilities/time/TimeUtils;->toCalendar(J)Ljava/util/Calendar;
|
|
|
|
move-result-object v0
|
|
|
|
const/16 v2, 0xb
|
|
|
|
const/4 v3, 0x0
|
|
|
|
invoke-virtual {v0, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
const/16 v2, 0xc
|
|
|
|
invoke-virtual {v0, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
const/16 v2, 0xd
|
|
|
|
invoke-virtual {v0, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
const/16 v2, 0xe
|
|
|
|
invoke-virtual {v0, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
invoke-virtual {v0}, Ljava/util/Calendar;->getTimeInMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
cmp-long v4, p2, v2
|
|
|
|
if-lez v4, :cond_1
|
|
|
|
const-string p1, "Today at "
|
|
|
|
invoke-static {p1}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p2, p3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {v1, p2}, Ljava/text/DateFormat;->format(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
const/4 v2, 0x5
|
|
|
|
const/4 v3, -0x1
|
|
|
|
invoke-virtual {v0, v2, v3}, Ljava/util/Calendar;->add(II)V
|
|
|
|
invoke-virtual {v0}, Ljava/util/Calendar;->getTimeInMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
cmp-long v0, p2, v2
|
|
|
|
if-lez v0, :cond_2
|
|
|
|
const-string p1, "Yesterday at "
|
|
|
|
invoke-static {p1}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p2, p3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {v1, p2}, Ljava/text/DateFormat;->format(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
invoke-static {p2, p3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, Ljava/text/DateFormat;->format(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "formatterDateTime.format(unixTimeMillis)"
|
|
|
|
invoke-static {p1, p2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:goto_0
|
|
return-object p1
|
|
|
|
:cond_3
|
|
const-string p1, "locale"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|