discord-jadx/app/src/main/java/c/k/a/a/e.java
2021-07-13 22:23:20 +02:00

866 lines
32 KiB
Java

package c.k.a.a;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.FontRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.graphics.ColorUtils;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import c.k.a.a.b;
import com.jaredrummler.android.colorpicker.ColorPanelView;
import com.jaredrummler.android.colorpicker.ColorPickerView;
import com.jaredrummler.android.colorpicker.R;
import java.util.Arrays;
import java.util.Locale;
/* compiled from: ColorPickerDialog */
public class e extends DialogFragment implements ColorPickerView.c, TextWatcher {
public static final int[] i = {-769226, -1499549, -54125, -6543440, -10011977, -12627531, -14575885, -16537100, -16728876, -16738680, -11751600, -7617718, -3285959, -5317, -16121, -26624, -8825528, -10453621, -6381922};
public View A;
public TextView B;
public Button C;
public Button D;
public TextView E;
public boolean F;
public int G;
public boolean H;
public int I;
public final View.OnTouchListener J = new b();
public g j;
public View k;
public FrameLayout l;
public int[] m;
@ColorInt
public int n;
public int o;
public int p;
public boolean q;
public int r;
/* renamed from: s reason: collision with root package name */
public b f1453s;
public LinearLayout t;
public SeekBar u;
public TextView v;
public ColorPickerView w;
/* renamed from: x reason: collision with root package name */
public ColorPanelView f1454x;
/* renamed from: y reason: collision with root package name */
public EditText f1455y;
/* renamed from: z reason: collision with root package name */
public EditText f1456z;
/* compiled from: ColorPickerDialog */
public class a implements View.OnLongClickListener {
public final /* synthetic */ ColorPanelView i;
public a(e eVar, ColorPanelView colorPanelView) {
this.i = colorPanelView;
}
@Override // android.view.View.OnLongClickListener
public boolean onLongClick(View view) {
this.i.a();
return true;
}
}
/* compiled from: ColorPickerDialog */
public class b implements View.OnTouchListener {
public b() {
}
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
EditText editText = e.this.f1456z;
if (view == editText || !editText.hasFocus()) {
return false;
}
e.this.f1456z.clearFocus();
((InputMethodManager) e.this.getActivity().getSystemService("input_method")).hideSoftInputFromWindow(e.this.f1456z.getWindowToken(), 0);
e.this.f1456z.clearFocus();
return true;
}
}
/* compiled from: ColorPickerDialog */
public class c implements View.OnClickListener {
public c() {
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
e eVar = e.this;
e.g(eVar, eVar.n);
e.this.dismiss();
}
}
/* compiled from: ColorPickerDialog */
public class d implements View.OnClickListener {
public d() {
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
e eVar = e.this;
if (eVar.j != null) {
Log.w("ColorPickerDialog", "Using deprecated listener which may be remove in future releases");
eVar.j.onColorReset(eVar.p);
} else {
FragmentActivity activity = eVar.getActivity();
if (activity instanceof g) {
((g) activity).onColorReset(eVar.p);
} else {
throw new IllegalStateException("The activity must implement ColorPickerDialogListener");
}
}
e.this.dismiss();
}
}
/* compiled from: ColorPickerDialog */
/* renamed from: c.k.a.a.e$e reason: collision with other inner class name */
public class View$OnClickListenerC0152e implements View.OnClickListener {
public View$OnClickListenerC0152e() {
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
e.this.l.removeAllViews();
e eVar = e.this;
int i = eVar.o;
if (i == 0) {
eVar.o = 1;
Button button = (Button) view;
int i2 = eVar.I;
if (i2 == 0) {
i2 = R.e.cpv_custom;
}
button.setText(i2);
e eVar2 = e.this;
eVar2.l.addView(eVar2.j());
} else if (i == 1) {
eVar.o = 0;
Button button2 = (Button) view;
int i3 = eVar.G;
if (i3 == 0) {
i3 = R.e.cpv_presets;
}
button2.setText(i3);
e eVar3 = e.this;
eVar3.l.addView(eVar3.i());
}
}
}
/* compiled from: ColorPickerDialog */
public class f implements View.OnClickListener {
public f() {
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
int color = e.this.f1454x.getColor();
e eVar = e.this;
int i = eVar.n;
if (color == i) {
e.g(eVar, i);
e.this.dismiss();
}
}
}
/* compiled from: ColorPickerDialog */
public class g implements View.OnFocusChangeListener {
public g() {
}
@Override // android.view.View.OnFocusChangeListener
public void onFocusChange(View view, boolean z2) {
if (z2) {
((InputMethodManager) e.this.getActivity().getSystemService("input_method")).showSoftInput(e.this.f1456z, 1);
}
}
}
/* compiled from: ColorPickerDialog */
public class h implements b.a {
public h() {
}
}
/* compiled from: ColorPickerDialog */
public class i implements Runnable {
public final /* synthetic */ ColorPanelView i;
public final /* synthetic */ int j;
public i(e eVar, ColorPanelView colorPanelView, int i) {
this.i = colorPanelView;
this.j = i;
}
@Override // java.lang.Runnable
public void run() {
this.i.setColor(this.j);
}
}
/* compiled from: ColorPickerDialog */
public class j implements View.OnClickListener {
public final /* synthetic */ ColorPanelView i;
public j(ColorPanelView colorPanelView) {
this.i = colorPanelView;
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (!(view.getTag() instanceof Boolean) || !((Boolean) view.getTag()).booleanValue()) {
e.this.n = this.i.getColor();
b bVar = e.this.f1453s;
bVar.k = -1;
bVar.notifyDataSetChanged();
for (int i = 0; i < e.this.t.getChildCount(); i++) {
FrameLayout frameLayout = (FrameLayout) e.this.t.getChildAt(i);
ColorPanelView colorPanelView = (ColorPanelView) frameLayout.findViewById(R.c.cpv_color_panel_view);
ImageView imageView = (ImageView) frameLayout.findViewById(R.c.cpv_color_image_view);
imageView.setImageResource(colorPanelView == view ? R.b.cpv_preset_checked : 0);
if ((colorPanelView != view || ColorUtils.calculateLuminance(colorPanelView.getColor()) < 0.65d) && Color.alpha(colorPanelView.getColor()) > 165) {
imageView.setColorFilter((ColorFilter) null);
} else {
imageView.setColorFilter(-16777216, PorterDuff.Mode.SRC_IN);
}
colorPanelView.setTag(Boolean.valueOf(colorPanelView == view));
}
return;
}
e eVar = e.this;
e.g(eVar, eVar.n);
e.this.dismiss();
}
}
/* compiled from: ColorPickerDialog */
public static final class k {
@StringRes
public int a = R.e.cpv_default_title;
@StringRes
public int b = R.e.cpv_presets;
@StringRes
/* renamed from: c reason: collision with root package name */
public int f1457c = R.e.cpv_custom;
@StringRes
public int d = R.e.cpv_select;
@StringRes
public int e = 0;
public int f = 1;
public int[] g = e.i;
@ColorInt
public int h = -16777216;
public boolean i = false;
public boolean j = true;
public boolean k = true;
public boolean l = true;
public boolean m = true;
public int n = 1;
@ColorInt
public int o = 0;
@ColorInt
public int p = 0;
@ColorInt
public int q = 0;
@ColorInt
public int r = 0;
@ColorInt
/* renamed from: s reason: collision with root package name */
public int f1458s = 0;
@ColorInt
public int t = 0;
@DrawableRes
public int u = 0;
@ColorInt
public int v = 0;
@ColorInt
public int w = 0;
@FontRes
/* renamed from: x reason: collision with root package name */
public int f1459x = 0;
@FontRes
/* renamed from: y reason: collision with root package name */
public int f1460y = 0;
@FontRes
/* renamed from: z reason: collision with root package name */
public int f1461z = 0;
public e a() {
e eVar = new e();
Bundle bundle = new Bundle();
bundle.putInt("id", 0);
bundle.putInt("dialogType", this.f);
bundle.putInt("color", this.h);
bundle.putIntArray("presets", this.g);
bundle.putBoolean("alpha", this.i);
bundle.putBoolean("allowCustom", this.k);
bundle.putBoolean("allowPresets", this.j);
bundle.putBoolean("allowReset", this.l);
bundle.putInt("dialogTitle", this.a);
bundle.putBoolean("showColorShades", this.m);
bundle.putInt("colorShape", this.n);
bundle.putInt("presetsButtonText", this.b);
bundle.putInt("customButtonText", this.f1457c);
bundle.putInt("customButtonColor", this.o);
bundle.putInt("customButtonTextColor", this.v);
bundle.putInt("selectedButtonText", this.d);
bundle.putInt("selectedButtonColor", this.p);
bundle.putInt("selectedButtonTextColor", this.w);
bundle.putInt("resetButtonText", this.e);
bundle.putInt("buttonFont", this.f1460y);
bundle.putInt("titleTextColor", this.r);
bundle.putInt("titleFont", this.f1459x);
bundle.putInt("dividerColor", this.q);
bundle.putInt("backgroundColor", this.f1458s);
bundle.putInt("inputTextColor", this.t);
bundle.putInt("inputBackground", this.u);
bundle.putInt("inputFont", this.f1461z);
eVar.setArguments(bundle);
return eVar;
}
}
public static void g(e eVar, int i2) {
if (eVar.j != null) {
Log.w("ColorPickerDialog", "Using deprecated listener which may be remove in future releases");
eVar.j.onColorSelected(eVar.p, i2);
return;
}
FragmentActivity activity = eVar.getActivity();
if (activity instanceof g) {
((g) activity).onColorSelected(eVar.p, i2);
return;
}
throw new IllegalStateException("The activity must implement ColorPickerDialogListener");
}
/* JADX WARNING: Removed duplicated region for block: B:37:0x011b */
/* JADX WARNING: Removed duplicated region for block: B:40:? A[RETURN, SYNTHETIC] */
@Override // android.text.TextWatcher
public void afterTextChanged(Editable editable) {
int i2;
int i3;
int argb;
int i4;
int i5;
int i6;
int parseInt;
int parseInt2;
int parseInt3;
if (this.f1456z.isFocused()) {
String obj = editable.toString();
if (obj.startsWith("#")) {
obj = obj.substring(1);
}
int i7 = 0;
int i8 = -1;
if (obj.length() == 0) {
i6 = 0;
} else if (obj.length() <= 2) {
i6 = Integer.parseInt(obj, 16);
} else {
if (obj.length() == 3) {
parseInt = Integer.parseInt(obj.substring(0, 1), 16);
parseInt2 = Integer.parseInt(obj.substring(1, 2), 16);
parseInt3 = Integer.parseInt(obj.substring(2, 3), 16);
} else if (obj.length() == 4) {
int parseInt4 = Integer.parseInt(obj.substring(0, 2), 16);
i5 = Integer.parseInt(obj.substring(2, 4), 16);
i7 = parseInt4;
i4 = 0;
i3 = i4;
i2 = i5;
i8 = 255;
argb = Color.argb(i8, i3, i7, i2);
if (argb == this.w.getColor()) {
this.H = true;
this.w.b(argb, true);
return;
}
return;
} else if (obj.length() == 5) {
parseInt = Integer.parseInt(obj.substring(0, 1), 16);
parseInt2 = Integer.parseInt(obj.substring(1, 3), 16);
parseInt3 = Integer.parseInt(obj.substring(3, 5), 16);
} else if (obj.length() == 6) {
parseInt = Integer.parseInt(obj.substring(0, 2), 16);
parseInt2 = Integer.parseInt(obj.substring(2, 4), 16);
parseInt3 = Integer.parseInt(obj.substring(4, 6), 16);
} else {
if (obj.length() == 7) {
i8 = Integer.parseInt(obj.substring(0, 1), 16);
i3 = Integer.parseInt(obj.substring(1, 3), 16);
i7 = Integer.parseInt(obj.substring(3, 5), 16);
i2 = Integer.parseInt(obj.substring(5, 7), 16);
} else if (obj.length() == 8) {
i8 = Integer.parseInt(obj.substring(0, 2), 16);
i3 = Integer.parseInt(obj.substring(2, 4), 16);
i7 = Integer.parseInt(obj.substring(4, 6), 16);
i2 = Integer.parseInt(obj.substring(6, 8), 16);
} else {
i2 = -1;
i3 = -1;
i7 = -1;
}
argb = Color.argb(i8, i3, i7, i2);
if (argb == this.w.getColor()) {
}
}
i5 = parseInt3;
i4 = parseInt;
i7 = parseInt2;
i3 = i4;
i2 = i5;
i8 = 255;
argb = Color.argb(i8, i3, i7, i2);
if (argb == this.w.getColor()) {
}
}
i5 = i6;
i4 = 0;
i3 = i4;
i2 = i5;
i8 = 255;
argb = Color.argb(i8, i3, i7, i2);
if (argb == this.w.getColor()) {
}
}
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
public void h(@ColorInt int i2) {
int i3 = 0;
int[] iArr = {m(i2, 0.9d), m(i2, 0.7d), m(i2, 0.5d), m(i2, 0.333d), m(i2, 0.166d), m(i2, -0.125d), m(i2, -0.25d), m(i2, -0.375d), m(i2, -0.5d), m(i2, -0.675d), m(i2, -0.7d), m(i2, -0.775d)};
if (this.t.getChildCount() != 0) {
while (i3 < this.t.getChildCount()) {
FrameLayout frameLayout = (FrameLayout) this.t.getChildAt(i3);
ColorPanelView colorPanelView = (ColorPanelView) frameLayout.findViewById(R.c.cpv_color_panel_view);
colorPanelView.setColor(iArr[i3]);
colorPanelView.setTag(Boolean.FALSE);
((ImageView) frameLayout.findViewById(R.c.cpv_color_image_view)).setImageDrawable(null);
i3++;
}
return;
}
int dimensionPixelSize = getResources().getDimensionPixelSize(R.a.cpv_item_horizontal_padding);
while (i3 < 12) {
int i4 = iArr[i3];
View inflate = View.inflate(getActivity(), this.r == 0 ? R.d.cpv_color_item_square : R.d.cpv_color_item_circle, null);
ColorPanelView colorPanelView2 = (ColorPanelView) inflate.findViewById(R.c.cpv_color_panel_view);
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) colorPanelView2.getLayoutParams();
marginLayoutParams.rightMargin = dimensionPixelSize;
marginLayoutParams.leftMargin = dimensionPixelSize;
colorPanelView2.setLayoutParams(marginLayoutParams);
colorPanelView2.setColor(i4);
this.t.addView(inflate);
colorPanelView2.post(new i(this, colorPanelView2, i4));
colorPanelView2.setOnClickListener(new j(colorPanelView2));
colorPanelView2.setOnLongClickListener(new a(this, colorPanelView2));
i3++;
}
}
public View i() {
View inflate = View.inflate(getActivity(), R.d.cpv_dialog_color_picker, null);
this.w = (ColorPickerView) inflate.findViewById(R.c.cpv_color_picker_view);
this.f1454x = (ColorPanelView) inflate.findViewById(R.c.cpv_color_panel_new);
this.f1456z = (EditText) inflate.findViewById(R.c.cpv_hex);
this.f1455y = (EditText) inflate.findViewById(R.c.cpv_hex_prefix);
this.A = inflate.findViewById(R.c.cpv_hex_container);
this.w.setAlphaSliderVisible(this.F);
this.w.b(this.n, true);
this.f1454x.setColor(this.n);
l(this.n);
if (!this.F) {
this.f1456z.setFilters(new InputFilter[]{new InputFilter.LengthFilter(6)});
}
this.f1454x.setOnClickListener(new f());
inflate.setOnTouchListener(this.J);
this.w.setOnColorChangedListener(this);
this.f1456z.addTextChangedListener(this);
this.f1456z.setOnFocusChangeListener(new g());
int i2 = getArguments().getInt("inputTextColor", 0);
if (i2 != 0) {
this.f1456z.setTextColor(i2);
this.f1455y.setTextColor(i2);
}
int i3 = getArguments().getInt("inputBackground", 0);
if (i3 != 0) {
this.A.setBackgroundResource(i3);
}
int i4 = getArguments().getInt("inputFont", 0);
if (i4 != 0) {
this.f1456z.setTypeface(ResourcesCompat.getFont(requireContext(), i4));
this.f1455y.setTypeface(ResourcesCompat.getFont(requireContext(), i4));
}
return inflate;
}
public View j() {
boolean z2;
View inflate = View.inflate(getActivity(), R.d.cpv_dialog_presets, null);
this.t = (LinearLayout) inflate.findViewById(R.c.shades_layout);
this.u = (SeekBar) inflate.findViewById(R.c.transparency_seekbar);
this.v = (TextView) inflate.findViewById(R.c.transparency_text);
GridView gridView = (GridView) inflate.findViewById(R.c.gridView);
View findViewById = inflate.findViewById(R.c.shades_divider);
int alpha = Color.alpha(this.n);
int[] intArray = getArguments().getIntArray("presets");
this.m = intArray;
if (intArray == null) {
this.m = i;
}
int[] iArr = this.m;
boolean z3 = iArr == i;
this.m = Arrays.copyOf(iArr, iArr.length);
if (alpha != 255) {
int i2 = 0;
while (true) {
int[] iArr2 = this.m;
if (i2 >= iArr2.length) {
break;
}
int i3 = iArr2[i2];
this.m[i2] = Color.argb(alpha, Color.red(i3), Color.green(i3), Color.blue(i3));
i2++;
}
}
this.m = n(this.m, this.n);
int i4 = getArguments().getInt("color");
if (i4 != this.n) {
this.m = n(this.m, i4);
}
if (z3) {
int[] iArr3 = this.m;
if (iArr3.length == 19) {
int argb = Color.argb(alpha, 0, 0, 0);
int length = iArr3.length;
int i5 = 0;
while (true) {
if (i5 >= length) {
z2 = false;
break;
} else if (iArr3[i5] == argb) {
z2 = true;
break;
} else {
i5++;
}
}
if (!z2) {
int length2 = iArr3.length + 1;
int[] iArr4 = new int[length2];
int i6 = length2 - 1;
iArr4[i6] = argb;
System.arraycopy(iArr3, 0, iArr4, 0, i6);
iArr3 = iArr4;
}
this.m = iArr3;
}
}
if (this.q) {
h(this.n);
findViewById.setVisibility(0);
int i7 = getArguments().getInt("dividerColor", 0);
if (i7 != 0) {
findViewById.setBackgroundTintList(ColorStateList.valueOf(i7));
}
} else {
this.t.setVisibility(8);
findViewById.setVisibility(8);
}
h hVar = new h();
int[] iArr5 = this.m;
int i8 = 0;
while (true) {
int[] iArr6 = this.m;
if (i8 >= iArr6.length) {
i8 = -1;
break;
} else if (iArr6[i8] == this.n) {
break;
} else {
i8++;
}
}
b bVar = new b(hVar, iArr5, i8, this.r);
this.f1453s = bVar;
gridView.setAdapter((ListAdapter) bVar);
if (this.F) {
int alpha2 = 255 - Color.alpha(this.n);
this.u.setMax(255);
this.u.setProgress(alpha2);
this.v.setText(String.format(Locale.ENGLISH, "%d%%", Integer.valueOf((int) ((((double) alpha2) * 100.0d) / 255.0d))));
this.u.setOnSeekBarChangeListener(new f(this));
} else {
inflate.findViewById(R.c.transparency_layout).setVisibility(8);
inflate.findViewById(R.c.transparency_title).setVisibility(8);
}
return inflate;
}
public void k(int i2) {
this.n = i2;
ColorPanelView colorPanelView = this.f1454x;
if (colorPanelView != null) {
colorPanelView.setColor(i2);
}
if (!this.H && this.f1456z != null) {
l(i2);
if (this.f1456z.hasFocus()) {
((InputMethodManager) getActivity().getSystemService("input_method")).hideSoftInputFromWindow(this.f1456z.getWindowToken(), 0);
this.f1456z.clearFocus();
}
}
this.H = false;
}
public final void l(int i2) {
if (this.F) {
this.f1456z.setText(String.format("%08X", Integer.valueOf(i2)));
} else {
this.f1456z.setText(String.format("%06X", Integer.valueOf(i2 & 16777215)));
}
}
public final int m(@ColorInt int i2, double d2) {
long parseLong = Long.parseLong(String.format("#%06X", Integer.valueOf(16777215 & i2)).substring(1), 16);
double d3 = 0.0d;
int i3 = (d2 > 0.0d ? 1 : (d2 == 0.0d ? 0 : -1));
if (i3 >= 0) {
d3 = 255.0d;
}
if (i3 < 0) {
d2 *= -1.0d;
}
long j2 = parseLong >> 16;
long j3 = (parseLong >> 8) & 255;
long j4 = parseLong & 255;
return Color.argb(Color.alpha(i2), (int) (Math.round((d3 - ((double) j2)) * d2) + j2), (int) (Math.round((d3 - ((double) j3)) * d2) + j3), (int) (Math.round((d3 - ((double) j4)) * d2) + j4));
}
public final int[] n(int[] iArr, int i2) {
boolean z2;
int length = iArr.length;
int i3 = 0;
while (true) {
if (i3 >= length) {
z2 = false;
break;
} else if (iArr[i3] == i2) {
z2 = true;
break;
} else {
i3++;
}
}
if (z2) {
return iArr;
}
int length2 = iArr.length + 1;
int[] iArr2 = new int[length2];
iArr2[0] = i2;
System.arraycopy(iArr, 0, iArr2, 1, length2 - 1);
return iArr2;
}
@Override // androidx.fragment.app.DialogFragment
public Dialog onCreateDialog(Bundle bundle) {
this.p = getArguments().getInt("id");
this.F = getArguments().getBoolean("alpha");
this.q = getArguments().getBoolean("showColorShades");
this.r = getArguments().getInt("colorShape");
if (bundle == null) {
this.n = getArguments().getInt("color");
this.o = getArguments().getInt("dialogType");
} else {
this.n = bundle.getInt("color");
this.o = bundle.getInt("dialogType");
}
View inflate = LayoutInflater.from(requireContext()).inflate(R.d.cpv_dialog, (ViewGroup) null);
this.k = inflate;
FrameLayout frameLayout = (FrameLayout) inflate.findViewById(R.c.cpv_color_picker_content);
this.l = frameLayout;
int i2 = this.o;
if (i2 == 0) {
frameLayout.addView(i());
} else if (i2 == 1) {
frameLayout.addView(j());
}
return new AlertDialog.Builder(requireActivity()).setView(this.k).create();
}
@Override // androidx.fragment.app.Fragment
@Nullable
public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
return this.k;
}
@Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnDismissListener
public void onDismiss(DialogInterface dialogInterface) {
super.onDismiss(dialogInterface);
if (this.j != null) {
Log.w("ColorPickerDialog", "Using deprecated listener which may be remove in future releases");
this.j.onDialogDismissed(this.p);
return;
}
FragmentActivity activity = getActivity();
if (activity instanceof g) {
((g) activity).onDialogDismissed(this.p);
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onSaveInstanceState(Bundle bundle) {
bundle.putInt("color", this.n);
bundle.putInt("dialogType", this.o);
super.onSaveInstanceState(bundle);
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onStart() {
super.onStart();
AlertDialog alertDialog = (AlertDialog) getDialog();
alertDialog.getWindow().clearFlags(131080);
alertDialog.getWindow().setSoftInputMode(4);
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
@Override // androidx.fragment.app.Fragment
public void onViewCreated(@NonNull View view, @Nullable Bundle bundle) {
int i2;
super.onViewCreated(view, bundle);
this.B = (TextView) view.findViewById(R.c.cpv_color_picker_title);
this.C = (Button) view.findViewById(R.c.cpv_color_picker_custom_button);
this.D = (Button) view.findViewById(R.c.cpv_color_picker_select_button);
this.E = (TextView) view.findViewById(R.c.cpv_color_picker_custom_reset);
int i3 = getArguments().getInt("backgroundColor", 0);
if (i3 != 0) {
view.setBackgroundColor(i3);
}
int i4 = getArguments().getInt("dialogTitle");
if (i4 != 0) {
this.B.setText(i4);
}
int i5 = getArguments().getInt("titleTextColor", 0);
if (i5 != 0) {
this.B.setTextColor(i5);
}
int i6 = getArguments().getInt("selectedButtonText");
if (i6 == 0) {
i6 = R.e.cpv_select;
}
this.D.setText(i6);
this.D.setOnClickListener(new c());
int i7 = getArguments().getInt("resetButtonText");
if (i7 != 0) {
this.E.setText(i7);
}
this.E.setOnClickListener(new d());
this.G = getArguments().getInt("presetsButtonText");
this.I = getArguments().getInt("customButtonText");
if (this.o == 0 && getArguments().getBoolean("allowPresets")) {
i2 = this.G;
if (i2 == 0) {
i2 = R.e.cpv_presets;
}
} else if (this.o != 1 || !getArguments().getBoolean("allowCustom")) {
i2 = 0;
} else {
i2 = this.I;
if (i2 == 0) {
i2 = R.e.cpv_custom;
}
}
if (i2 != 0) {
this.C.setText(i2);
this.C.setVisibility(0);
} else {
this.C.setVisibility(8);
}
if (getArguments().getBoolean("allowReset")) {
this.E.setVisibility(0);
} else {
this.E.setVisibility(8);
}
int i8 = getArguments().getInt("customButtonColor", 0);
if (i8 != 0) {
this.C.setBackgroundTintList(ColorStateList.valueOf(i8));
}
int i9 = getArguments().getInt("selectedButtonColor", 0);
if (i9 != 0) {
this.D.setBackgroundTintList(ColorStateList.valueOf(i9));
this.E.setTextColor(i9);
}
int i10 = getArguments().getInt("customButtonTextColor", 0);
if (i10 != 0) {
this.C.setTextColor(i10);
}
int i11 = getArguments().getInt("selectedButtonTextColor", 0);
if (i11 != 0) {
this.D.setTextColor(i11);
}
int i12 = getArguments().getInt("titleFont", 0);
if (i12 != 0) {
this.B.setTypeface(ResourcesCompat.getFont(requireContext(), i12));
}
int i13 = getArguments().getInt("buttonFont", 0);
if (i13 != 0) {
this.D.setTypeface(ResourcesCompat.getFont(requireContext(), i13));
this.C.setTypeface(ResourcesCompat.getFont(requireContext(), i13));
this.E.setTypeface(ResourcesCompat.getFont(requireContext(), i13));
}
this.C.setOnClickListener(new View$OnClickListenerC0152e());
}
}