正在查看: BodyTech v7.6.4 应用的 k0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BodyTech v7.6.4 应用的 k0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.fitnessmobileapps.fma.views.fragments.dialogs;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.DialogFragment;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.fitnessmobileapps.bodytech39559.R;
import com.fitnessmobileapps.fma.core.domain.RatingEntity;
import com.fitnessmobileapps.fma.core.domain.ReviewTypeEntity;
import com.fitnessmobileapps.fma.core.domain.StaffEntity;
import com.fitnessmobileapps.fma.core.domain.VisitEntity;
import com.fitnessmobileapps.fma.core.domain.h1;
import com.fitnessmobileapps.fma.core.domain.w0;
import com.mindbodyonline.contracts.interfaces.TaskCallback;
import com.mindbodyonline.domain.ProgramType;
import com.mindbodyonline.domain.Rating;
import com.mindbodyonline.domain.apiModels.ErrorCodeResponse;
import com.mindbodyonline.domain.apiModels.VisitReview;
import com.newrelic.agent.android.api.v2.TraceFieldInterface;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.tracing.Trace;
import com.newrelic.agent.android.tracing.TraceMachine;
import java.util.Locale;
import kotlin.Lazy;
import org.koin.java.KoinJavaComponent;
import x1.v0;
@Instrumented
public class k0 extends DialogFragment implements TraceFieldInterface {
private View B;
private SwitchCompat C;
private String G;
private DialogInterface.OnDismissListener H;
public Trace J;
private RatingEntity f11055c;
private VisitEntity f11056d;
private TextView f11057e;
private RatingBar f11058k;
private EditText f11059n;
private TextView f11060p;
private TextView f11061q;
private TextView f11062r;
private TextView f11063t;
private View f11064v;
private Button f11065w;
private TaskCallback<RatingEntity> f11066x;
private boolean f11067y = false;
private boolean f11068z = true;
private boolean A = false;
private final Lazy<com.fitnessmobileapps.fma.feature.familyaccounts.domain.interactor.a> I = KoinJavaComponent.e(com.fitnessmobileapps.fma.feature.familyaccounts.domain.interactor.a.class);
private void J() {
i0(true, R.string.submitting_review_dialog);
K(L());
}
private void K(final VisitReview visitReview) {
if (visitReview != null) {
qf.f.n().r().a(visitReview, new Response.Listener() {
@Override
public final void onResponse(Object obj) {
k0.this.P(visitReview, (Void) obj);
}
}, new Response.ErrorListener() {
@Override
public final void onErrorResponse(VolleyError volleyError) {
k0.this.Q(visitReview, volleyError);
}
});
} else {
i0(false, 0);
l0(R.string.review_submission_error);
}
}
private VisitReview L() {
String a10 = this.I.getValue().a();
VisitEntity visitEntity = this.f11056d;
if (visitEntity == null) {
RatingEntity ratingEntity = this.f11055c;
if (ratingEntity != null) {
return new VisitReview(ratingEntity.getReviewType().getReviewTypeId(), this.f11055c.getLocationInfo().getSiteId(), this.f11055c.getVisitId(), this.f11058k.getProgress(), this.f11059n.getText().toString(), a10);
}
return null;
}
long siteVisitId = visitEntity.getSiteVisitId();
if (this.f11056d.getProgramType() == ProgramType.APPOINTMENT) {
siteVisitId = ((h1.Appointment) this.f11056d.getDetails()).getAppointmentDetails().getVisitDataId();
}
return new VisitReview(t1.q.a(this.f11056d.getProgramType()).getReviewTypeId(), this.f11056d.getLocation().getSiteId(), siteVisitId, this.f11058k.getProgress(), this.f11059n.getText().toString(), a10);
}
private void M() {
if (this.f11055c != null) {
i0(true, R.string.deleting_review_dialog);
qf.f.n().r().b(this.f11055c.getId(), new Response.Listener() {
@Override
public final void onResponse(Object obj) {
k0.this.S((Void) obj);
}
}, new Response.ErrorListener() {
@Override
public final void onErrorResponse(VolleyError volleyError) {
k0.this.T(volleyError);
}
});
}
}
private CharSequence N(boolean z10) {
String string = getString(R.string.class_text);
if (z10) {
string = getString(R.string.appointment_text);
}
return getString(R.string.class_review_header, string);
}
public void O(VolleyError volleyError) {
mo.a.g(volleyError, "Get all ratings failed", new Object[0]);
TaskCallback<RatingEntity> taskCallback = this.f11066x;
if (taskCallback != null) {
taskCallback.a(this.f11055c);
}
dismiss();
}
public void P(final VisitReview visitReview, Void r32) {
com.fitnessmobileapps.fma.util.f.b().k("AddReview");
qf.f.n().r().d(new Response.Listener() {
@Override
public final void onResponse(Object obj) {
k0.this.R(visitReview, (Rating[]) obj);
}
}, new Response.ErrorListener() {
@Override
public final void onErrorResponse(VolleyError volleyError) {
k0.this.O(volleyError);
}
});
}
public void Q(VisitReview visitReview, VolleyError volleyError) {
ErrorCodeResponse a10 = of.e.a(volleyError);
if (a10 != null && a10.ErrorCode == 617 && visitReview.getReviewTypeId() != 6) {
visitReview.setReviewTypeId(6);
K(visitReview);
} else {
mo.a.g(volleyError, "Network error submitting review", new Object[0]);
i0(false, 0);
l0(R.string.review_submission_error);
}
}
public void R(VisitReview visitReview, Rating[] ratingArr) {
qf.d.E().R(ratingArr);
i0(false, 0);
TaskCallback<RatingEntity> taskCallback = this.f11066x;
if (taskCallback != null) {
taskCallback.a(v0.a(qf.d.E().I(visitReview.getVisitId())));
}
dismiss();
}
public void S(Void r32) {
com.fitnessmobileapps.fma.util.f.b().k("DeleteReview");
i0(false, 0);
qf.d.E().P(this.f11055c.getVisitId());
TaskCallback<RatingEntity> taskCallback = this.f11066x;
if (taskCallback != null) {
taskCallback.a(null);
}
dismiss();
}
public void T(VolleyError volleyError) {
mo.a.g(volleyError, "Network error deleting review", new Object[0]);
i0(false, 0);
l0(R.string.review_deletion_error);
}
public void U(View view) {
dismiss();
}
public void V(View view) {
if (this.f11058k.getProgress() == 0) {
Toast.makeText(getContext(), R.string.no_star_rating_message, 1).show();
} else {
m0();
}
}
public void W(DialogInterface dialogInterface, int i10) {
M();
}
public void Y(View view) {
new AlertDialog.Builder(getContext()).setMessage(getString(R.string.delete_review_confirmation)).setPositiveButton(getString(R.string.delete_button), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i10) {
k0.this.W(dialogInterface, i10);
}
}).setNegativeButton(getString(R.string.cancel_button), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i10) {
dialogInterface.dismiss();
}
}).show();
}
public static boolean Z(View view, MotionEvent motionEvent) {
view.getParent().requestDisallowInterceptTouchEvent(motionEvent.getAction() != 1);
return false;
}
public void a0(CompoundButton compoundButton, boolean z10) {
PreferenceManager.getDefaultSharedPreferences(getContext()).edit().putBoolean(this.G, z10).apply();
}
public void b0(Void r22) {
com.fitnessmobileapps.fma.util.f.b().k("EditReviewDeleteAction");
K(L());
}
public void c0(VolleyError volleyError) {
mo.a.g(volleyError, "Network error deleting review", new Object[0]);
i0(false, 0);
l0(R.string.review_submission_error);
}
public static k0 d0(VisitEntity visitEntity, RatingEntity ratingEntity) {
return e0(visitEntity, ratingEntity, null);
}
public static k0 e0(VisitEntity visitEntity, RatingEntity ratingEntity, TaskCallback<RatingEntity> taskCallback) {
return g0(visitEntity, ratingEntity, taskCallback, false);
}
public static k0 f0(VisitEntity visitEntity, RatingEntity ratingEntity, TaskCallback<RatingEntity> taskCallback, DialogInterface.OnDismissListener onDismissListener, boolean z10) {
k0 k0Var = new k0();
k0Var.f11066x = taskCallback;
k0Var.H = onDismissListener;
Bundle bundle = new Bundle();
bundle.putParcelable("visit", visitEntity);
bundle.putParcelable("review", ratingEntity);
bundle.putBoolean("notificationPrompt", z10);
k0Var.setArguments(bundle);
return k0Var;
}
public static k0 g0(VisitEntity visitEntity, RatingEntity ratingEntity, TaskCallback<RatingEntity> taskCallback, boolean z10) {
return f0(visitEntity, ratingEntity, taskCallback, null, z10);
}
private void i0(boolean z10, @StringRes int i10) {
this.f11064v.setVisibility(z10 ? 0 : 8);
if (i10 != 0) {
this.f11063t.setText(i10);
} else {
this.f11063t.setText((CharSequence) null);
}
}
private void j0() {
this.f11058k.setRating(this.f11055c.getRating());
this.f11060p.setText(this.f11055c.getVisitName());
this.f11057e.setText(N(this.f11055c.getReviewType() == ReviewTypeEntity.APPOINTMENT));
String a10 = com.fitnessmobileapps.fma.feature.profile.presentation.mapper.l.a(this.f11055c.getStaffInfo());
if (!TextUtils.isEmpty(a10)) {
this.f11061q.setText(getString(R.string.visit_with, a10));
}
if (TextUtils.isEmpty(this.f11055c.getText())) {
return;
}
String trim = this.f11055c.getText().trim();
this.f11059n.setText(trim);
this.f11059n.setSelection(trim.length());
n0(500 - trim.length());
}
private void k0() {
this.f11058k.setRating(0.0f);
this.f11060p.setText(this.f11056d.getName());
StaffEntity staff = this.f11056d.getStaffState() instanceof w0.Named ? ((w0.Named) this.f11056d.getStaffState()).getStaff() : null;
if (staff != null && !TextUtils.isEmpty(com.fitnessmobileapps.fma.feature.profile.presentation.mapper.l.a(staff))) {
this.f11061q.setText(getString(R.string.visit_with, com.fitnessmobileapps.fma.feature.profile.presentation.mapper.l.a(staff)));
}
this.f11057e.setText(N(this.f11056d.getProgramType() == ProgramType.APPOINTMENT));
this.f11059n.setText("");
}
private void l0(@StringRes int i10) {
if (isAdded()) {
Toast makeText = Toast.makeText(getContext(), i10, 1);
makeText.setGravity(16, 0, 0);
makeText.show();
}
}
private void m0() {
if (this.f11055c == null) {
J();
} else {
o0();
}
}
public void n0(int i10) {
this.f11062r.setContentDescription(getString(R.string.character_count_description, Integer.valueOf(i10), 500));
this.f11062r.setText(String.format(Locale.getDefault(), "%d/%d", Integer.valueOf(i10), 500));
}
private void o0() {
i0(true, R.string.submitting_review_dialog);
qf.f.n().r().b(this.f11055c.getId(), new Response.Listener() {
@Override
public final void onResponse(Object obj) {
k0.this.b0((Void) obj);
}
}, new Response.ErrorListener() {
@Override
public final void onErrorResponse(VolleyError volleyError) {
k0.this.c0(volleyError);
}
});
}
@Override
public void dismiss() {
if (this.f11068z) {
this.f11067y = true;
} else {
super.dismiss();
}
}
public void h0(TaskCallback<RatingEntity> taskCallback) {
this.f11066x = taskCallback;
}
@Override
public void onCreate(Bundle bundle) {
TraceMachine.startTracing("RateReviewDialog");
try {
TraceMachine.enterMethod(this.J, "RateReviewDialog#onCreate", null);
} catch (NoSuchFieldError unused) {
TraceMachine.enterMethod(null, "RateReviewDialog#onCreate", null);
}
super.onCreate(bundle);
this.f11055c = (RatingEntity) getArguments().getParcelable("review");
this.f11056d = (VisitEntity) getArguments().getParcelable("visit");
this.A = getArguments().getBoolean("notificationPrompt");
TraceMachine.exitMethod();
}
@Override
public Dialog onCreateDialog(Bundle bundle) {
Dialog onCreateDialog = super.onCreateDialog(bundle);
onCreateDialog.getWindow().requestFeature(1);
return onCreateDialog;
}
@Override
@SuppressLint({"ClickableViewAccessibility"})
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
try {
TraceMachine.enterMethod(this.J, "RateReviewDialog#onCreateView", null);
} catch (NoSuchFieldError unused) {
TraceMachine.enterMethod(null, "RateReviewDialog#onCreateView", null);
}
View inflate = layoutInflater.inflate(R.layout.dialog_rate_review, viewGroup);
inflate.findViewById(R.id.dialog_review_cancel_delete_button).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
k0.this.U(view);
}
});
((Button) inflate.findViewById(R.id.dialog_review_submit_button)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
k0.this.V(view);
}
});
this.f11064v = inflate.findViewById(R.id.progress_bar);
this.f11063t = (TextView) inflate.findViewById(R.id.progress_text);
this.f11057e = (TextView) inflate.findViewById(R.id.dialog_rate_review_header);
Button button = (Button) inflate.findViewById(R.id.dialog_review_delete_button);
this.f11065w = button;
button.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
k0.this.Y(view);
}
});
this.f11060p = (TextView) inflate.findViewById(R.id.dialog_review_name);
this.f11061q = (TextView) inflate.findViewById(R.id.dialog_review_staff);
this.f11058k = (RatingBar) inflate.findViewById(R.id.dialog_review_rating);
EditText editText = (EditText) inflate.findViewById(R.id.dialog_review_text);
this.f11059n = editText;
editText.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
boolean Z;
Z = k0.Z(view, motionEvent);
return Z;
}
});
this.f11062r = (TextView) inflate.findViewById(R.id.dialog_review_remaining_characters);
this.B = inflate.findViewById(R.id.review_ask_each_time);
this.C = (SwitchCompat) inflate.findViewById(R.id.review_ask_each_time_switch);
TraceMachine.exitMethod();
return inflate;
}
@Override
public void onDismiss(DialogInterface dialogInterface) {
super.onDismiss(dialogInterface);
DialogInterface.OnDismissListener onDismissListener = this.H;
if (onDismissListener != null) {
onDismissListener.onDismiss(dialogInterface);
}
}
@Override
public void onPause() {
this.f11068z = true;
super.onPause();
}
@Override
public void onResume() {
super.onResume();
this.f11068z = false;
if (this.f11067y) {
this.f11067y = false;
super.dismiss();
}
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onViewCreated(View view, Bundle bundle) {
super.onViewCreated(view, bundle);
if (this.G == null) {
this.G = getString(R.string.preference_key_review_notification);
}
n0(500);
if (this.f11055c != null) {
this.f11065w.setVisibility(0);
j0();
} else if (this.f11056d != null) {
this.f11065w.setVisibility(8);
k0();
} else {
dismiss();
}
if (this.A) {
this.B.setVisibility(0);
this.C.setChecked(PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(this.G, true));
this.C.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(CompoundButton compoundButton, boolean z10) {
k0.this.a0(compoundButton, z10);
}
});
}
this.f11059n.addTextChangedListener(new a());
}
class a implements TextWatcher {
a() {
}
@Override
public void afterTextChanged(Editable editable) {
k0.this.n0(editable.length());
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
}
}