mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-03 11:10:22 +01:00
59 lines
2.6 KiB
Java
59 lines
2.6 KiB
Java
package androidx.appcompat.app;
|
|
|
|
import androidx.biometric.ErrorUtils$$ExternalSyntheticOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes.dex */
|
|
class TwilightCalculator {
|
|
private static final float ALTIDUTE_CORRECTION_CIVIL_TWILIGHT = -0.10471976f;
|
|
private static final float C1 = 0.0334196f;
|
|
private static final float C2 = 3.49066E-4f;
|
|
private static final float C3 = 5.236E-6f;
|
|
public static final int DAY = 0;
|
|
private static final float DEGREES_TO_RADIANS = 0.017453292f;
|
|
private static final float J0 = 9.0E-4f;
|
|
public static final int NIGHT = 1;
|
|
private static final float OBLIQUITY = 0.4092797f;
|
|
private static final long UTC_2000 = 946728000000L;
|
|
private static TwilightCalculator sInstance;
|
|
public int state;
|
|
public long sunrise;
|
|
public long sunset;
|
|
|
|
public static TwilightCalculator getInstance() {
|
|
if (sInstance == null) {
|
|
sInstance = new TwilightCalculator();
|
|
}
|
|
return sInstance;
|
|
}
|
|
|
|
public void calculateTwilight(long j, double d, double d2) {
|
|
double d3 = (0.01720197f * ((j - UTC_2000) / 8.64E7f)) + 6.24006f;
|
|
double sin = (Math.sin(r4 * 3.0f) * 5.236000106378924E-6d) + ErrorUtils$$ExternalSyntheticOutline0.m(2.0f * r4, 3.4906598739326E-4d, ErrorUtils$$ExternalSyntheticOutline0.m(d3, 0.03341960161924362d, d3)) + 1.796593063d + 3.141592653589793d;
|
|
double sin2 = (Math.sin(2.0d * sin) * (-0.0069d)) + ErrorUtils$$ExternalSyntheticOutline0.m(d3, 0.0053d, Math.round((r3 - J0) - r7) + J0 + ((-d2) / 360.0d));
|
|
double asin = Math.asin(Math.sin(0.4092797040939331d) * Math.sin(sin));
|
|
double d4 = 0.01745329238474369d * d;
|
|
double sin3 = (Math.sin(-0.10471975803375244d) - (Math.sin(asin) * Math.sin(d4))) / (Math.cos(asin) * Math.cos(d4));
|
|
if (sin3 >= 1.0d) {
|
|
this.state = 1;
|
|
this.sunset = -1L;
|
|
this.sunrise = -1L;
|
|
} else {
|
|
if (sin3 <= -1.0d) {
|
|
this.state = 0;
|
|
this.sunset = -1L;
|
|
this.sunrise = -1L;
|
|
return;
|
|
}
|
|
double acos = (float) (Math.acos(sin3) / 6.283185307179586d);
|
|
this.sunset = Math.round((sin2 + acos) * 8.64E7d) + UTC_2000;
|
|
long round = Math.round((sin2 - acos) * 8.64E7d) + UTC_2000;
|
|
this.sunrise = round;
|
|
if (round >= j || this.sunset <= j) {
|
|
this.state = 1;
|
|
} else {
|
|
this.state = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|