discord-jadx/app/src/main/java/c/a/a/j.java

172 lines
6.6 KiB
Java

package c.a.a;
import android.os.Bundle;
import android.view.View;
import android.widget.DatePicker;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.discord.app.AppDialog;
import com.discord.utilities.birthday.BirthdayHelper;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
import com.google.android.material.button.MaterialButton;
import d0.z.d.k;
import d0.z.d.m;
import java.util.Calendar;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
/* compiled from: DatePickerDialog.kt */
public final class j extends AppDialog {
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.V(j.class, "binding", "getBinding()Lcom/discord/databinding/DialogDatePickerBinding;", 0)};
public static final a j = new a(null);
public Function1<? super Long, Unit> k;
public long l;
public boolean m;
public final FragmentViewBindingDelegate n = FragmentViewBindingDelegateKt.viewBinding$default(this, b.i, null, 2, null);
/* compiled from: DatePickerDialog.kt */
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
public final j a(FragmentManager fragmentManager, CharSequence charSequence, long j, long j2) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
m.checkNotNullParameter(charSequence, "label");
j jVar = new j();
Bundle bundle = new Bundle();
bundle.putCharSequence("label", charSequence);
bundle.putLong("initial_date", j);
bundle.putLong("max_date", j2);
jVar.setArguments(bundle);
jVar.show(fragmentManager, j.class.getName());
return jVar;
}
}
/* compiled from: DatePickerDialog.kt */
public static final /* synthetic */ class b extends k implements Function1<View, c.a.i.k> {
public static final b i = new b();
public b() {
super(1, c.a.i.k.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/DialogDatePickerBinding;", 0);
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public c.a.i.k invoke(View view) {
View view2 = view;
m.checkNotNullParameter(view2, "p1");
int i2 = 2131362919;
MaterialButton materialButton = (MaterialButton) view2.findViewById(2131362919);
if (materialButton != null) {
i2 = 2131362920;
DatePicker datePicker = (DatePicker) view2.findViewById(2131362920);
if (datePicker != null) {
i2 = 2131362921;
TextView textView = (TextView) view2.findViewById(2131362921);
if (textView != null) {
return new c.a.i.k((LinearLayout) view2, materialButton, datePicker, textView);
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i2)));
}
}
/* compiled from: DatePickerDialog.kt */
public static final class c implements DatePicker.OnDateChangedListener {
public final /* synthetic */ j i;
public c(j jVar) {
this.i = jVar;
}
@Override // android.widget.DatePicker.OnDateChangedListener
public final void onDateChanged(DatePicker datePicker, int i, int i2, int i3) {
Calendar instance = Calendar.getInstance();
instance.set(i, i2, i3);
j jVar = this.i;
m.checkNotNullExpressionValue(instance, "cal");
jVar.l = instance.getTimeInMillis();
j jVar2 = this.i;
jVar2.m = true;
Function1<? super Long, Unit> function1 = jVar2.k;
if (function1 != null) {
function1.invoke(Long.valueOf(jVar2.l));
}
}
}
/* compiled from: DatePickerDialog.kt */
public static final class d implements View.OnClickListener {
public final /* synthetic */ j i;
public d(j jVar) {
this.i = jVar;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
Function1<? super Long, Unit> function1;
j jVar = this.i;
if (jVar.m && (function1 = jVar.k) != null) {
function1.invoke(Long.valueOf(jVar.l));
}
this.i.dismiss();
}
}
public j() {
super(2131558478);
}
public final c.a.i.k g() {
return (c.a.i.k) this.n.getValue((Fragment) this, i[0]);
}
@Override // com.discord.app.AppDialog, androidx.fragment.app.Fragment
public void onPause() {
super.onPause();
g().f113c.clearFocus();
}
@Override // com.discord.app.AppDialog
public void onViewBoundOrOnResume() {
CharSequence charSequence;
super.onViewBoundOrOnResume();
TextView textView = g().d;
m.checkNotNullExpressionValue(textView, "binding.dialogDatePickerTitle");
Bundle arguments = getArguments();
if (arguments == null || (charSequence = arguments.getCharSequence("label")) == null) {
charSequence = "";
}
textView.setText(charSequence);
DatePicker datePicker = g().f113c;
m.checkNotNullExpressionValue(datePicker, "binding.dialogDatePickerInput");
Bundle arguments2 = getArguments();
long j2 = 0;
datePicker.setMaxDate(arguments2 != null ? arguments2.getLong("max_date") : 0);
DatePicker datePicker2 = g().f113c;
m.checkNotNullExpressionValue(datePicker2, "binding.dialogDatePickerInput");
datePicker2.setMinDate(BirthdayHelper.INSTANCE.subtractYearsFromToday(150));
Bundle arguments3 = getArguments();
if (arguments3 != null) {
j2 = arguments3.getLong("initial_date");
}
this.l = j2;
if (this.k == null) {
dismiss();
}
Calendar instance = Calendar.getInstance();
m.checkNotNullExpressionValue(instance, "calendar");
instance.setTimeInMillis(this.l);
g().f113c.init(instance.get(1), instance.get(2), instance.get(5), new c(this));
g().b.setOnClickListener(new d(this));
}
}