forked from Juby210/discord-jadx
141 lines
4.8 KiB
Java
141 lines
4.8 KiB
Java
package b.o.a.r;
|
|
|
|
import android.content.Context;
|
|
import android.hardware.display.DisplayManager;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.view.OrientationEventListener;
|
|
import android.view.WindowManager;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import b.o.a.j;
|
|
import com.google.android.material.snackbar.BaseTransientBottomBar;
|
|
import com.otaliastudios.cameraview.CameraView;
|
|
/* compiled from: OrientationHelper */
|
|
public class f {
|
|
public final Handler a = new Handler(Looper.getMainLooper());
|
|
|
|
/* renamed from: b reason: collision with root package name */
|
|
public final Context f1948b;
|
|
public final c c;
|
|
@VisibleForTesting
|
|
public final OrientationEventListener d;
|
|
public int e = -1;
|
|
@VisibleForTesting
|
|
public final DisplayManager.DisplayListener f;
|
|
public int g = -1;
|
|
public boolean h;
|
|
|
|
/* compiled from: OrientationHelper */
|
|
public class a extends OrientationEventListener {
|
|
public a(Context context, int i) {
|
|
super(context, i);
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:3:0x0008, code lost:
|
|
if (r6 != -1) goto L_0x002e;
|
|
*/
|
|
/* JADX WARNING: Removed duplicated region for block: B:22:0x0034 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:28:? A[RETURN, SYNTHETIC] */
|
|
@Override // android.view.OrientationEventListener
|
|
public void onOrientationChanged(int i) {
|
|
int i2;
|
|
f fVar;
|
|
if (i == -1) {
|
|
i2 = f.this.e;
|
|
} else if (i < 315 && i >= 45) {
|
|
if (i >= 45 && i < 135) {
|
|
i2 = 90;
|
|
fVar = f.this;
|
|
if (i2 == fVar.e) {
|
|
}
|
|
} else if (i >= 135 && i < 225) {
|
|
i2 = BaseTransientBottomBar.ANIMATION_FADE_DURATION;
|
|
fVar = f.this;
|
|
if (i2 == fVar.e) {
|
|
}
|
|
} else if (i >= 225 && i < 315) {
|
|
i2 = 270;
|
|
fVar = f.this;
|
|
if (i2 == fVar.e) {
|
|
fVar.e = i2;
|
|
CameraView.b bVar = (CameraView.b) fVar.c;
|
|
bVar.f3153b.a(1, "onDeviceOrientationChanged", Integer.valueOf(i2));
|
|
CameraView cameraView = CameraView.this;
|
|
int i3 = cameraView.f3151y.g;
|
|
if (!cameraView.m) {
|
|
int i4 = (360 - i3) % 360;
|
|
b.o.a.n.t.a e = cameraView.f3152z.e();
|
|
e.e(i4);
|
|
e.e = i4;
|
|
e.d();
|
|
} else {
|
|
b.o.a.n.t.a e2 = cameraView.f3152z.e();
|
|
e2.e(i2);
|
|
e2.e = i2;
|
|
e2.d();
|
|
}
|
|
CameraView.this.u.post(new j(bVar, (i2 + i3) % 360));
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
i2 = 0;
|
|
fVar = f.this;
|
|
if (i2 == fVar.e) {
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: OrientationHelper */
|
|
public class b implements DisplayManager.DisplayListener {
|
|
public b() {
|
|
}
|
|
|
|
@Override // android.hardware.display.DisplayManager.DisplayListener
|
|
public void onDisplayAdded(int i) {
|
|
}
|
|
|
|
@Override // android.hardware.display.DisplayManager.DisplayListener
|
|
public void onDisplayChanged(int i) {
|
|
f fVar = f.this;
|
|
int i2 = fVar.g;
|
|
int a = fVar.a();
|
|
if (a != i2) {
|
|
f fVar2 = f.this;
|
|
fVar2.g = a;
|
|
CameraView.b bVar = (CameraView.b) fVar2.c;
|
|
if (CameraView.this.d()) {
|
|
bVar.f3153b.a(2, "onDisplayOffsetChanged", "restarting the camera.");
|
|
CameraView.this.close();
|
|
CameraView.this.open();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.hardware.display.DisplayManager.DisplayListener
|
|
public void onDisplayRemoved(int i) {
|
|
}
|
|
}
|
|
|
|
/* compiled from: OrientationHelper */
|
|
public interface c {
|
|
}
|
|
|
|
public f(@NonNull Context context, @NonNull c cVar) {
|
|
this.f1948b = context;
|
|
this.c = cVar;
|
|
this.d = new a(context.getApplicationContext(), 3);
|
|
this.f = new b();
|
|
}
|
|
|
|
public final int a() {
|
|
int rotation = ((WindowManager) this.f1948b.getSystemService("window")).getDefaultDisplay().getRotation();
|
|
if (rotation != 1) {
|
|
return rotation != 2 ? rotation != 3 ? 0 : 270 : BaseTransientBottomBar.ANIMATION_FADE_DURATION;
|
|
}
|
|
return 90;
|
|
}
|
|
}
|