what-the-bank/sources/com/google/android/material/timepicker/TimePickerView.java

187 lines
6.3 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.material.timepicker;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Checkable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.ViewCompat;
import com.google.android.material.button.MaterialButtonToggleGroup;
import com.google.android.material.chip.Chip;
import com.google.android.material.timepicker.ClockHandView;
import com.google.android.material.timepicker.TimePickerView;
import o.C17052tZT;
import o.yZt;
/* loaded from: classes2.dex */
public class TimePickerView extends ConstraintLayout {
public final ClockFaceView a;
public final Chip b;
public final Chip c;
public final ClockHandView d;
Sts e;
public RVV f;
public final MaterialButtonToggleGroup g;
private final View.OnClickListener h;
public HBt j;
/* loaded from: classes2.dex */
public interface HBt {
void c(int i);
}
/* loaded from: classes2.dex */
public interface RVV {
void b(int i);
}
/* loaded from: classes2.dex */
interface Sts {
void a();
}
public TimePickerView(Context context) {
this(context, null);
}
public TimePickerView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public TimePickerView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
View.OnClickListener onClickListener = new View.OnClickListener(this) { // from class: com.google.android.material.timepicker.TimePickerView.4
private TimePickerView a;
{
this.a = this;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
if (this.a.j != null) {
this.a.j.c(((Integer) view.getTag(C17052tZT.ZqN.selection_type)).intValue());
}
}
};
this.h = onClickListener;
LayoutInflater.from(context).inflate(C17052tZT.tOB.material_timepicker, this);
this.a = (ClockFaceView) findViewById(C17052tZT.ZqN.material_clock_face);
MaterialButtonToggleGroup materialButtonToggleGroup = (MaterialButtonToggleGroup) findViewById(C17052tZT.ZqN.material_clock_period_toggle);
this.g = materialButtonToggleGroup;
materialButtonToggleGroup.b.add(new MaterialButtonToggleGroup.RVV(this) { // from class: o.ODs
private TimePickerView e;
@Override // com.google.android.material.button.MaterialButtonToggleGroup.RVV
public final void a(int i2, boolean z) {
TimePickerView timePickerView = this.e;
if (!z || timePickerView.f == null) {
return;
}
timePickerView.f.b(i2 == C17052tZT.ZqN.material_clock_period_pm_button ? 1 : 0);
}
{
this.e = this;
}
});
Chip chip = (Chip) findViewById(C17052tZT.ZqN.material_minute_tv);
this.c = chip;
Chip chip2 = (Chip) findViewById(C17052tZT.ZqN.material_hour_tv);
this.b = chip2;
this.d = (ClockHandView) findViewById(C17052tZT.ZqN.material_clock_hand);
View.OnTouchListener onTouchListener = new View.OnTouchListener(this, new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener(this) { // from class: com.google.android.material.timepicker.TimePickerView.1
private TimePickerView b;
{
this.b = this;
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnDoubleTapListener
public final boolean onDoubleTap(MotionEvent motionEvent) {
Sts sts = this.b.e;
if (sts == null) {
return false;
}
sts.a();
return true;
}
})) { // from class: com.google.android.material.timepicker.TimePickerView.5
private TimePickerView c;
private GestureDetector d;
{
this.c = this;
this.d = r2;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // android.view.View.OnTouchListener
public final boolean onTouch(View view, MotionEvent motionEvent) {
if (((Checkable) view).isChecked()) {
return this.d.onTouchEvent(motionEvent);
}
return false;
}
};
chip.setOnTouchListener(onTouchListener);
chip2.setOnTouchListener(onTouchListener);
chip.setTag(C17052tZT.ZqN.selection_type, 12);
chip2.setTag(C17052tZT.ZqN.selection_type, 10);
chip.setOnClickListener(onClickListener);
chip2.setOnClickListener(onClickListener);
chip.setAccessibilityClassName("android.view.View");
chip2.setAccessibilityClassName("android.view.View");
}
public void setMinuteHourDelegate(yZt yzt) {
ViewCompat.e(this.b, yzt);
}
public void setHourClickDelegate(yZt yzt) {
ViewCompat.e(this.c, yzt);
}
public void setValues(String[] strArr, int i) {
this.a.setValues(strArr, i);
}
public void setHandRotation(float f) {
this.d.setHandRotation(f);
}
public void setHandRotation(float f, boolean z) {
this.d.setHandRotation(f, z);
}
public void setAnimateOnTouchUp(boolean z) {
this.d.setAnimateOnTouchUp(z);
}
public void setOnActionUpListener(ClockHandView.RVV rvv) {
this.d.setOnActionUpListener(rvv);
}
@Override // android.view.View
protected void onVisibilityChanged(View view, int i) {
super.onVisibilityChanged(view, i);
if (view == this && i == 0) {
this.b.sendAccessibilityEvent(8);
}
}
public void setActiveSelection(int i) {
Chip chip = this.c;
boolean z = i == 12;
chip.setChecked(z);
ViewCompat.c(chip, z ? 2 : 0);
Chip chip2 = this.b;
boolean z2 = i == 10;
chip2.setChecked(z2);
ViewCompat.c(chip2, z2 ? 2 : 0);
}
}