797 lines
20 KiB
Smali
797 lines
20 KiB
Smali
.class public final Lcom/discord/utilities/time/TimeUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "TimeUtils.kt"
|
|
|
|
|
|
# static fields
|
|
.field private 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;
|
|
|
|
|
|
# direct methods
|
|
.method 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;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final getMonthsBetweenDates(Ljava/util/Date;Ljava/util/Date;)I
|
|
.locals 3
|
|
|
|
const-string v0, "firstDate"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "secondDate"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
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}, Lkotlin/jvm/internal/k;->g(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}, Lkotlin/jvm/internal/k;->g(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
|
|
.end method
|
|
|
|
.method public static final getReadableTimeString(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 2
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
sget-object v0, Lcom/discord/utilities/time/TimeUtils;->INSTANCE:Lcom/discord/utilities/time/TimeUtils;
|
|
|
|
invoke-static {p0}, Lcom/discord/utilities/locale/LocaleUtilsKt;->getPrimaryLocale(Landroid/content/Context;)Ljava/util/Locale;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1, p1}, Lcom/discord/utilities/time/TimeUtils;->parseUTCDate(Ljava/util/Locale;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
|
|
.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}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
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}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
.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}, Lkotlin/jvm/internal/k;->g(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 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 private final toCalendar(Ljava/util/Locale;J)Ljava/util/Calendar;
|
|
.locals 1
|
|
|
|
invoke-static {p1}, Ljava/util/Calendar;->getInstance(Ljava/util/Locale;)Ljava/util/Calendar;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "calendar"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1, p2, p3}, Ljava/util/Calendar;->setTimeInMillis(J)V
|
|
|
|
return-object p1
|
|
.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 {}, Ljava/lang/System;->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
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static {p0}, Lcom/discord/utilities/locale/LocaleUtilsKt;->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}, Lkotlin/jvm/internal/k;->n(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;
|
|
|
|
invoke-static {p0}, Lcom/discord/utilities/locale/LocaleUtilsKt;->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
|
|
|
|
check-cast p0, Ljava/lang/CharSequence;
|
|
|
|
return-object p0
|
|
|
|
: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\u2026tils.FORMAT_NUMERIC_DATE)"
|
|
|
|
invoke-static {p0, p1}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final getHoursFromMillis(J)I
|
|
.locals 3
|
|
|
|
const-wide/32 v0, 0x36ee80
|
|
|
|
cmp-long v2, p1, v0
|
|
|
|
if-gez v2, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
div-long/2addr p1, v0
|
|
|
|
long-to-int p2, p1
|
|
|
|
return p2
|
|
.end method
|
|
|
|
.method public final getLocalizedMonthName(ILandroid/content/Context;)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p2, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v0, Ljava/text/DateFormatSymbols;
|
|
|
|
invoke-static {p2}, Lcom/discord/utilities/locale/LocaleUtilsKt;->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(contex\u2026e()).months[monthInt - 1]"
|
|
|
|
invoke-static {p1, p2}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public final getMinutesFromMillis(J)I
|
|
.locals 3
|
|
|
|
const-wide/32 v0, 0xea60
|
|
|
|
cmp-long v2, p1, v0
|
|
|
|
if-gez v2, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
div-long/2addr p1, v0
|
|
|
|
long-to-int p2, p1
|
|
|
|
return p2
|
|
.end method
|
|
|
|
.method public final parseUTCDate(Ljava/util/Locale;Ljava/lang/String;)J
|
|
.locals 4
|
|
|
|
const-string v0, "locale"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
if-nez p2, :cond_0
|
|
|
|
return-wide v0
|
|
|
|
:cond_0
|
|
new-instance v2, Ljava/text/SimpleDateFormat;
|
|
|
|
const-string v3, "yyyy-MM-dd\'T\'HH:mm:ss"
|
|
|
|
invoke-direct {v2, v3, p1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
:try_start_0
|
|
invoke-virtual {v2, p2}, Ljava/text/SimpleDateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "formatter.parse(dateTime)"
|
|
|
|
invoke-static {p1, p2}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1}, 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
|
|
return-wide v0
|
|
.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-string v0, "utcDate"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p2, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "inputFormat"
|
|
|
|
invoke-static {p3, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "outputFormat"
|
|
|
|
invoke-static {p4, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static {p2}, Lcom/discord/utilities/locale/LocaleUtilsKt;->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
|
|
.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
|
|
|
|
return-object p1
|
|
|
|
: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\u2026tils.FORMAT_NUMERIC_DATE)"
|
|
|
|
invoke-static {p1, p2}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
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 p2
|
|
|
|
invoke-static {p3, p2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
const-string p3, "java.lang.String.format(this, *args)"
|
|
|
|
invoke-static {p2, p3}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
check-cast p2, Ljava/lang/CharSequence;
|
|
|
|
return-object p2
|
|
|
|
:cond_0
|
|
const-string p2, "elapsedTime"
|
|
|
|
invoke-static {p1, p2}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
check-cast p1, Ljava/lang/CharSequence;
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public final toReadableTimeStringEN(Ljava/util/Locale;J)Ljava/lang/String;
|
|
.locals 5
|
|
|
|
const-string v0, "locale"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "en"
|
|
|
|
invoke-static {v0, v1}, Lkotlin/jvm/internal/k;->n(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 v0
|
|
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-direct {p0, p1, v2, v3}, Lcom/discord/utilities/time/TimeUtils;->toCalendar(Ljava/util/Locale;J)Ljava/util/Calendar;
|
|
|
|
move-result-object p1
|
|
|
|
const/16 v2, 0xb
|
|
|
|
const/4 v3, 0x0
|
|
|
|
invoke-virtual {p1, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
const/16 v2, 0xc
|
|
|
|
invoke-virtual {p1, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
const/16 v2, 0xd
|
|
|
|
invoke-virtual {p1, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
const/16 v2, 0xe
|
|
|
|
invoke-virtual {p1, v2, v3}, Ljava/util/Calendar;->set(II)V
|
|
|
|
invoke-virtual {p1}, Ljava/util/Calendar;->getTimeInMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
cmp-long v4, p2, v2
|
|
|
|
if-lez v4, :cond_1
|
|
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, "Today at "
|
|
|
|
invoke-direct {p1, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
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 {p1, v2, v3}, Ljava/util/Calendar;->add(II)V
|
|
|
|
invoke-virtual {p1}, Ljava/util/Calendar;->getTimeInMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
cmp-long p1, p2, v2
|
|
|
|
if-lez p1, :cond_2
|
|
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, "Yesterday at "
|
|
|
|
invoke-direct {p1, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
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_2
|
|
invoke-static {p2, p3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {v0, p1}, Ljava/text/DateFormat;->format(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "formatterDateTime.format(unixTimeMillis)"
|
|
|
|
invoke-static {p1, p2}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
.end method
|