167 lines
6.1 KiB
Java
167 lines
6.1 KiB
Java
package c.i.a.g.k;
|
|
|
|
import android.view.accessibility.AccessibilityManager;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.exifinterface.media.ExifInterface;
|
|
import com.google.android.material.R;
|
|
import com.google.android.material.chip.Chip;
|
|
import com.google.android.material.timepicker.ClockHandView;
|
|
import com.google.android.material.timepicker.TimeModel;
|
|
import com.google.android.material.timepicker.TimePickerView;
|
|
import java.util.Locale;
|
|
import java.util.Objects;
|
|
/* compiled from: TimePickerClockPresenter */
|
|
public class f implements ClockHandView.OnRotateListener, TimePickerView.d, TimePickerView.c, ClockHandView.OnActionUpListener, g {
|
|
public static final String[] i = {"12", "1", ExifInterface.GPS_MEASUREMENT_2D, ExifInterface.GPS_MEASUREMENT_3D, "4", "5", "6", "7", "8", "9", "10", "11"};
|
|
public static final String[] j = {"00", ExifInterface.GPS_MEASUREMENT_2D, "4", "6", "8", "10", "12", "14", "16", "18", "20", "22"};
|
|
public static final String[] k = {"00", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55"};
|
|
public TimePickerView l;
|
|
public TimeModel m;
|
|
public float n;
|
|
public float o;
|
|
public boolean p = false;
|
|
|
|
public f(TimePickerView timePickerView, TimeModel timeModel) {
|
|
this.l = timePickerView;
|
|
this.m = timeModel;
|
|
if (timeModel.k == 0) {
|
|
timePickerView.m.setVisibility(0);
|
|
}
|
|
this.l.k.p.add(this);
|
|
TimePickerView timePickerView2 = this.l;
|
|
timePickerView2.p = this;
|
|
timePickerView2.o = this;
|
|
timePickerView2.k.f2431x = this;
|
|
g(i, "%d");
|
|
g(j, "%d");
|
|
g(k, "%02d");
|
|
a();
|
|
}
|
|
|
|
@Override // c.i.a.g.k.g
|
|
public void a() {
|
|
this.o = (float) (d() * this.m.b());
|
|
TimeModel timeModel = this.m;
|
|
this.n = (float) (timeModel.m * 6);
|
|
e(timeModel.n, false);
|
|
f();
|
|
}
|
|
|
|
@Override // com.google.android.material.timepicker.TimePickerView.d
|
|
public void b(int i2) {
|
|
e(i2, true);
|
|
}
|
|
|
|
@Override // c.i.a.g.k.g
|
|
public void c() {
|
|
this.l.setVisibility(8);
|
|
}
|
|
|
|
public final int d() {
|
|
return this.m.k == 1 ? 15 : 30;
|
|
}
|
|
|
|
public void e(int i2, boolean z2) {
|
|
boolean z3 = false;
|
|
boolean z4 = i2 == 12;
|
|
TimePickerView timePickerView = this.l;
|
|
timePickerView.k.k = z4;
|
|
TimeModel timeModel = this.m;
|
|
timeModel.n = i2;
|
|
timePickerView.l.c(z4 ? k : timeModel.k == 1 ? j : i, z4 ? R.string.material_minute_suffix : R.string.material_hour_suffix);
|
|
this.l.k.b(z4 ? this.n : this.o, z2);
|
|
TimePickerView timePickerView2 = this.l;
|
|
timePickerView2.i.setChecked(i2 == 12);
|
|
Chip chip = timePickerView2.j;
|
|
if (i2 == 10) {
|
|
z3 = true;
|
|
}
|
|
chip.setChecked(z3);
|
|
ViewCompat.setAccessibilityDelegate(this.l.j, new a(this.l.getContext(), R.string.material_hour_selection));
|
|
ViewCompat.setAccessibilityDelegate(this.l.i, new a(this.l.getContext(), R.string.material_minute_selection));
|
|
}
|
|
|
|
public final void f() {
|
|
TimePickerView timePickerView = this.l;
|
|
TimeModel timeModel = this.m;
|
|
int i2 = timeModel.o;
|
|
int b = timeModel.b();
|
|
int i3 = this.m.m;
|
|
timePickerView.m.check(i2 == 1 ? R.id.material_clock_period_pm_button : R.id.material_clock_period_am_button);
|
|
Locale locale = timePickerView.getResources().getConfiguration().locale;
|
|
String format = String.format(locale, "%02d", Integer.valueOf(i3));
|
|
String format2 = String.format(locale, "%02d", Integer.valueOf(b));
|
|
timePickerView.i.setText(format);
|
|
timePickerView.j.setText(format2);
|
|
}
|
|
|
|
public final void g(String[] strArr, String str) {
|
|
for (int i2 = 0; i2 < strArr.length; i2++) {
|
|
strArr[i2] = TimeModel.a(this.l.getResources(), strArr[i2], str);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.material.timepicker.ClockHandView.OnActionUpListener
|
|
public void onActionUp(float f, boolean z2) {
|
|
this.p = true;
|
|
TimeModel timeModel = this.m;
|
|
int i2 = timeModel.m;
|
|
int i3 = timeModel.l;
|
|
if (timeModel.n == 10) {
|
|
TimePickerView timePickerView = this.l;
|
|
timePickerView.k.b(this.o, false);
|
|
if (!((AccessibilityManager) ContextCompat.getSystemService(this.l.getContext(), AccessibilityManager.class)).isTouchExplorationEnabled()) {
|
|
e(12, true);
|
|
}
|
|
} else {
|
|
int round = Math.round(f);
|
|
if (!z2) {
|
|
TimeModel timeModel2 = this.m;
|
|
Objects.requireNonNull(timeModel2);
|
|
timeModel2.m = (((round + 15) / 30) * 5) % 60;
|
|
this.n = (float) (this.m.m * 6);
|
|
}
|
|
TimePickerView timePickerView2 = this.l;
|
|
timePickerView2.k.b(this.n, z2);
|
|
}
|
|
this.p = false;
|
|
f();
|
|
TimeModel timeModel3 = this.m;
|
|
if (timeModel3.m != i2 || timeModel3.l != i3) {
|
|
this.l.performHapticFeedback(4);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.material.timepicker.ClockHandView.OnRotateListener
|
|
public void onRotate(float f, boolean z2) {
|
|
if (!this.p) {
|
|
TimeModel timeModel = this.m;
|
|
int i2 = timeModel.l;
|
|
int i3 = timeModel.m;
|
|
int round = Math.round(f);
|
|
TimeModel timeModel2 = this.m;
|
|
if (timeModel2.n == 12) {
|
|
int i4 = ((round + 3) / 6) % 60;
|
|
timeModel2.m = i4;
|
|
this.n = (float) Math.floor((double) (i4 * 6));
|
|
} else {
|
|
this.m.c((round + (d() / 2)) / d());
|
|
this.o = (float) (d() * this.m.b());
|
|
}
|
|
if (!z2) {
|
|
f();
|
|
TimeModel timeModel3 = this.m;
|
|
if (timeModel3.m != i3 || timeModel3.l != i2) {
|
|
this.l.performHapticFeedback(4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.g.k.g
|
|
public void show() {
|
|
this.l.setVisibility(0);
|
|
}
|
|
}
|