discord-jadx/app/src/main/java/com/discord/utilities/duration/DurationUtilsKt.java

56 lines
3.0 KiB
Java

package com.discord.utilities.duration;
import android.content.Context;
import c.a.k.b;
import com.discord.utilities.resources.StringResourceUtilsKt;
import d0.a0.a;
import d0.z.d.m;
/* compiled from: DurationUtils.kt */
public final class DurationUtilsKt {
private static final int FEW_SECONDS_BOUNDARY = 30;
public static final CharSequence humanizeDuration(Context context, long j) {
m.checkNotNullParameter(context, "context");
if (j <= 30000) {
String string = context.getString(2131890331);
m.checkNotNullExpressionValue(string, "context.getString(\n …ation_a_few_seconds\n )");
return string;
} else if (j <= 60000) {
int i = (int) (j / 1000);
return b.g(context, 2131890335, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755193, i, Integer.valueOf(i))}, null, 4);
} else if (j <= 3600000) {
int i2 = (int) (j / 60000);
return b.g(context, 2131890334, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755192, i2, Integer.valueOf(i2))}, null, 4);
} else if (j <= 86400000) {
int i3 = (int) (j / 3600000);
return b.g(context, 2131890333, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755191, i3, Integer.valueOf(i3))}, null, 4);
} else {
int i4 = (int) (j / 86400000);
return b.g(context, 2131890332, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755190, i4, Integer.valueOf(i4))}, null, 4);
}
}
public static final CharSequence humanizeDurationRounded(Context context, long j) {
m.checkNotNullParameter(context, "context");
if (j <= 30000) {
String string = context.getString(2131890331);
m.checkNotNullExpressionValue(string, "context.getString(\n …ation_a_few_seconds\n )");
return string;
}
double d = (double) j;
if (d <= 54000.0d) {
float f = ((float) j) / ((float) 1000);
return b.g(context, 2131890335, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755193, a.roundToInt(f), Integer.valueOf(a.roundToInt(f)))}, null, 4);
} else if (d <= 3240000.0d) {
float f2 = ((float) j) / ((float) 60000);
return b.g(context, 2131890334, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755192, a.roundToInt(f2), Integer.valueOf(a.roundToInt(f2)))}, null, 4);
} else if (d <= 7.776E7d) {
float f3 = ((float) j) / ((float) 3600000);
return b.g(context, 2131890333, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755191, a.roundToInt(f3), Integer.valueOf(a.roundToInt(f3)))}, null, 4);
} else {
float f4 = ((float) j) / ((float) 86400000);
return b.g(context, 2131890332, new Object[]{StringResourceUtilsKt.getI18nPluralString(context, 2131755190, a.roundToInt(f4), Integer.valueOf(a.roundToInt(f4)))}, null, 4);
}
}
}