content: package com.google.android.material.timepicker;
  
  import android.content.Context;
  import android.text.TextUtils;
  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.constraintlayout.widget.ConstraintSet;
  import androidx.core.view.AccessibilityDelegateCompat;
  import androidx.core.view.ViewCompat;
  import com.google.android.material.R;
  import com.google.android.material.button.MaterialButtonToggleGroup;
  import com.google.android.material.chip.Chip;
  import com.google.android.material.timepicker.ClockHandView;
  import java.util.Locale;
  import mt.Log1F380D;
  
  /* compiled from: 010A */
  class TimePickerView extends ConstraintLayout implements TimePickerControls {
      static final String GENERIC_VIEW_ACCESSIBILITY_CLASS_NAME = "android.view.View";
      private final ClockFaceView clockFace;
      private final ClockHandView clockHandView;
      private final Chip hourView;
      private final Chip minuteView;
      /* access modifiers changed from: private */
      public OnDoubleTapListener onDoubleTapListener;
      /* access modifiers changed from: private */
      public OnPeriodChangeListener onPeriodChangeListener;
      /* access modifiers changed from: private */
      public OnSelectionChange onSelectionChangeListener;
      private final View.OnClickListener selectionListener;
      private final MaterialButtonToggleGroup toggle;
  
      interface OnDoubleTapListener {
          void onDoubleTap();
      }
  
      interface OnPeriodChangeListener {
          void onPeriodChange(int i);
      }
  
      interface OnSelectionChange {
          void onSelectionChanged(int i);
      }
  
      public TimePickerView(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public TimePickerView(Context context, AttributeSet attrs) {
          this(context, attrs, 0);
      }
  
      public TimePickerView(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          this.selectionListener = new View.OnClickListener() {
              public void onClick(View v) {
                  if (TimePickerView.this.onSelectionChangeListener != null) {
                      TimePickerView.this.onSelectionChangeListener.onSelectionChanged(((Integer) v.getTag(R.id.selection_type)).intValue());
                  }
              }
          };
          LayoutInflater.from(context).inflate(R.layout.material_timepicker, this);
          this.clockFace = (ClockFaceView) findViewById(R.id.material_clock_face);
          MaterialButtonToggleGroup materialButtonToggleGroup = (MaterialButtonToggleGroup) findViewById(R.id.material_clock_period_toggle);
          this.toggle = materialButtonToggleGroup;
          materialButtonToggleGroup.addOnButtonCheckedListener(new MaterialButtonToggleGroup.OnButtonCheckedListener() {
              public void onButtonChecked(MaterialButtonToggleGroup group, int checkedId, boolean isChecked) {
                  int i = checkedId == R.id.material_clock_period_pm_button ? 1 : 0;
                  if (TimePickerView.this.onPeriodChangeListener != null && isChecked) {
                      TimePickerView.this.onPeriodChangeListener.onPeriodChange(i);
                  }
              }
          });
          this.minuteView = (Chip) findViewById(R.id.material_minute_tv);
          this.hourView = (Chip) findViewById(R.id.material_hour_tv);
          this.clockHandView = (ClockHandView) findViewById(R.id.material_clock_hand);
          setupDoubleTap();
          setUpDisplay();
      }
  
      private void setUpDisplay() {
          this.minuteView.setTag(R.id.selection_type, 12);
          this.hourView.setTag(R.id.selection_type, 10);
          this.minuteView.setOnClickListener(this.selectionListener);
          this.hourView.setOnClickListener(this.selectionListener);
          this.minuteView.setAccessibilityClassName(GENERIC_VIEW_ACCESSIBILITY_CLASS_NAME);
          this.hourView.setAccessibilityClassName(GENERIC_VIEW_ACCESSIBILITY_CLASS_NAME);
      }
  
      private void setupDoubleTap() {
          final GestureDetector gestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
              public boolean onDoubleTap(MotionEvent e) {
                  OnDoubleTapListener access$200 = TimePickerView.this.onDoubleTapListener;
                  if (access$200 == null) {
                      return false;
                  }
                  access$200.onDoubleTap();
                  return true;
              }
          });
          AnonymousClass4 r1 = new View.OnTouchListener() {
              public boolean onTouch(View v, MotionEvent event) {
                  if (((Checkable) v).isChecked()) {
                      return gestureDetector.onTouchEvent(event);
                  }
                  return false;
              }
          };
          this.minuteView.setOnTouchListener(r1);
          this.hourView.setOnTouchListener(r1);
      }
  
      private void updateSelection(Chip chip, boolean isSelected) {
          chip.setChecked(isSelected);
          ViewCompat.setAccessibilityLiveRegion(chip, isSelected ? 2 : 0);
      }
  
      private void updateToggleConstraints() {
          if (this.toggle.getVisibility() == 0) {
              ConstraintSet constraintSet = new ConstraintSet();
              constraintSet.clone((ConstraintLayout) this);
              int i = 1;
              if (ViewCompat.getLayoutDirection(this) == 0) {
                  i = 2;
              }
              constraintSet.clear(R.id.material_clock_display, i);
              constraintSet.applyTo(this);
          }
      }
  
      public void addOnRotateListener(ClockHandView.OnRotateListener onRotateListener) {
          this.clockHandView.addOnRotateListener(onRotateListener);
      }
  
      /* access modifiers changed from: protected */
      public void onAttachedToWindow() {
          super.onAttachedToWindow();
          updateToggleConstraints();
      }
  
      /* access modifiers changed from: protected */
      public void onVisibilityChanged(View changedView, int visibility) {
          super.onVisibilityChanged(changedView, visibility);
          if (changedView == this && visibility == 0) {
              updateToggleConstraints();
          }
      }
  
      public void setActiveSelection(int selection) {
          boolean z = true;
          updateSelection(this.minuteView, selection == 12);
          Chip chip = this.hourView;
          if (selection != 10) {
              z = false;
          }
          updateSelection(chip, z);
      }
  
      public void setAnimateOnTouchUp(boolean animating) {
          this.clockHandView.setAnimateOnTouchUp(animating);
      }
  
      public void setHandRotation(float rotation) {
          this.clockHandView.setHandRotation(rotation);
      }
  
      public void setHandRotation(float rotation, boolean animate) {
          this.clockHandView.setHandRotation(rotation, animate);
      }
  
      public void setHourClickDelegate(AccessibilityDelegateCompat clickActionDelegate) {
          ViewCompat.setAccessibilityDelegate(this.minuteView, clickActionDelegate);
      }
  
      public void setMinuteHourDelegate(AccessibilityDelegateCompat clickActionDelegate) {
          ViewCompat.setAccessibilityDelegate(this.hourView, clickActionDelegate);
      }
  
      public void setOnActionUpListener(ClockHandView.OnActionUpListener onActionUpListener) {
          this.clockHandView.setOnActionUpListener(onActionUpListener);
      }
  
      /* access modifiers changed from: package-private */
      public void setOnDoubleTapListener(OnDoubleTapListener listener) {
          this.onDoubleTapListener = listener;
      }
  
      /* access modifiers changed from: package-private */
      public void setOnPeriodChangeListener(OnPeriodChangeListener onPeriodChangeListener2) {
          this.onPeriodChangeListener = onPeriodChangeListener2;
      }
  
      /* access modifiers changed from: package-private */
      public void setOnSelectionChangeListener(OnSelectionChange onSelectionChangeListener2) {
          this.onSelectionChangeListener = onSelectionChangeListener2;
      }
  
      public void setValues(String[] values, int contentDescription) {
          this.clockFace.setValues(values, contentDescription);
      }
  
      public void showToggle() {
          this.toggle.setVisibility(0);
      }
  
      public void updateTime(int period, int hourOfDay, int minute) {
          this.toggle.check(period == 1 ? R.id.material_clock_period_pm_button : R.id.material_clock_period_am_button);
          Locale locale = getResources().getConfiguration().locale;
          String format = String.format(locale, TimeModel.ZERO_LEADING_NUMBER_FORMAT, new Object[]{Integer.valueOf(minute)});
          Log1F380D.a((Object) format);
          String format2 = String.format(locale, TimeModel.ZERO_LEADING_NUMBER_FORMAT, new Object[]{Integer.valueOf(hourOfDay)});
          Log1F380D.a((Object) format2);
          if (!TextUtils.equals(this.minuteView.getText(), format)) {
              this.minuteView.setText(format);
          }
          if (!TextUtils.equals(this.hourView.getText(), format2)) {
              this.hourView.setText(format2);
          }
      }
  }
  