159 lines
5.1 KiB
Java
159 lines
5.1 KiB
Java
|
package com.google.android.material.timepicker;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.res.ColorStateList;
|
||
|
import android.content.res.TypedArray;
|
||
|
import android.os.Handler;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.view.LayoutInflater;
|
||
|
import android.view.View;
|
||
|
import android.view.ViewGroup;
|
||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||
|
import androidx.core.view.ViewCompat;
|
||
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||
|
import com.google.android.material.timepicker.RadialViewGroup;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import o.C17052tZT;
|
||
|
import o.C4363bXv;
|
||
|
import o.DRp;
|
||
|
import o.FLD;
|
||
|
import o.yqQ;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class RadialViewGroup extends ConstraintLayout {
|
||
|
private C4363bXv a;
|
||
|
private int c;
|
||
|
private final Runnable e;
|
||
|
|
||
|
public RadialViewGroup(Context context) {
|
||
|
this(context, null);
|
||
|
}
|
||
|
|
||
|
public RadialViewGroup(Context context, AttributeSet attributeSet) {
|
||
|
this(context, attributeSet, 0);
|
||
|
}
|
||
|
|
||
|
public RadialViewGroup(Context context, AttributeSet attributeSet, int i) {
|
||
|
super(context, attributeSet, i);
|
||
|
LayoutInflater.from(context).inflate(C17052tZT.tOB.material_radial_view_group, this);
|
||
|
C4363bXv c4363bXv = new C4363bXv();
|
||
|
this.a = c4363bXv;
|
||
|
DRp dRp = new DRp(0.5f);
|
||
|
FLD.RVV rvv = new FLD.RVV(c4363bXv.B.l);
|
||
|
rvv.f = dRp;
|
||
|
rvv.k = dRp;
|
||
|
rvv.d = dRp;
|
||
|
rvv.e = dRp;
|
||
|
c4363bXv.setShapeAppearanceModel(new FLD(rvv, (byte) 0));
|
||
|
C4363bXv c4363bXv2 = this.a;
|
||
|
ColorStateList valueOf = ColorStateList.valueOf(-1);
|
||
|
if (c4363bXv2.B.d != valueOf) {
|
||
|
c4363bXv2.B.d = valueOf;
|
||
|
c4363bXv2.onStateChange(c4363bXv2.getState());
|
||
|
}
|
||
|
ViewCompat.sn_(this, this.a);
|
||
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C17052tZT.jNh.RadialViewGroup, i, 0);
|
||
|
this.c = obtainStyledAttributes.getDimensionPixelSize(C17052tZT.jNh.RadialViewGroup_materialCircleRadius, 0);
|
||
|
this.e = new Runnable(this) { // from class: o.Yos
|
||
|
private RadialViewGroup d;
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
this.d.e();
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.d = this;
|
||
|
}
|
||
|
};
|
||
|
obtainStyledAttributes.recycle();
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void setBackgroundColor(int i) {
|
||
|
C4363bXv c4363bXv = this.a;
|
||
|
ColorStateList valueOf = ColorStateList.valueOf(i);
|
||
|
if (c4363bXv.B.d != valueOf) {
|
||
|
c4363bXv.B.d = valueOf;
|
||
|
c4363bXv.onStateChange(c4363bXv.getState());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.ViewGroup
|
||
|
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
|
||
|
super.addView(view, i, layoutParams);
|
||
|
if (view.getId() == -1) {
|
||
|
view.setId(ViewCompat.a());
|
||
|
}
|
||
|
Handler handler = getHandler();
|
||
|
if (handler != null) {
|
||
|
handler.removeCallbacks(this.e);
|
||
|
handler.post(this.e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // androidx.constraintlayout.widget.ConstraintLayout, android.view.ViewGroup
|
||
|
public void onViewRemoved(View view) {
|
||
|
super.onViewRemoved(view);
|
||
|
Handler handler = getHandler();
|
||
|
if (handler != null) {
|
||
|
handler.removeCallbacks(this.e);
|
||
|
handler.post(this.e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onFinishInflate() {
|
||
|
super.onFinishInflate();
|
||
|
e();
|
||
|
}
|
||
|
|
||
|
public void e() {
|
||
|
yqQ yqq = new yqQ();
|
||
|
yqq.e(this);
|
||
|
HashMap hashMap = new HashMap();
|
||
|
for (int i = 0; i < getChildCount(); i++) {
|
||
|
View childAt = getChildAt(i);
|
||
|
if (childAt.getId() != C17052tZT.ZqN.circle_center && !"skip".equals(childAt.getTag())) {
|
||
|
int i2 = (Integer) childAt.getTag(C17052tZT.ZqN.material_clock_level);
|
||
|
if (i2 == null) {
|
||
|
i2 = 1;
|
||
|
}
|
||
|
if (!hashMap.containsKey(i2)) {
|
||
|
hashMap.put(i2, new ArrayList());
|
||
|
}
|
||
|
((List) hashMap.get(i2)).add(childAt);
|
||
|
}
|
||
|
}
|
||
|
for (Map.Entry entry : hashMap.entrySet()) {
|
||
|
List list = (List) entry.getValue();
|
||
|
int round = ((Integer) entry.getKey()).intValue() == 2 ? Math.round(this.c * 0.66f) : this.c;
|
||
|
Iterator it = list.iterator();
|
||
|
float f = BitmapDescriptorFactory.HUE_RED;
|
||
|
while (it.hasNext()) {
|
||
|
int id = ((View) it.next()).getId();
|
||
|
int i3 = C17052tZT.ZqN.circle_center;
|
||
|
yqQ.Sts b = yqq.b(id);
|
||
|
b.a.j = i3;
|
||
|
b.a.f = round;
|
||
|
b.a.i = f;
|
||
|
f += 360.0f / list.size();
|
||
|
}
|
||
|
}
|
||
|
yqq.d(this);
|
||
|
}
|
||
|
|
||
|
public void setRadius(int i) {
|
||
|
this.c = i;
|
||
|
e();
|
||
|
}
|
||
|
|
||
|
public final int b() {
|
||
|
return this.c;
|
||
|
}
|
||
|
}
|