Hello,
I'm trying to use Janus vulnerability to get root, and I pasted the file I modified below,
Really, most of the code doesn't matter but I pasted them anyway.
Is that code starting from "public static void copyDirectory" going to work, with copying /data/local/tmp/su to /system/bin/su ?
Any help is appreciated!
Code:
package com.android.calculator2;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorSet;
import android.animation.AnimatorSet.Builder;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.text.Editable;
import android.text.Editable.Factory;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnKeyListener;
import android.view.View.OnLongClickListener;
import android.view.ViewAnimationUtils;
import android.view.ViewGroupOverlay;
import android.view.Window;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Button;
import android.widget.TextView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class Calculator
extends Activity
implements View.OnLongClickListener, CalculatorEditText.OnTextSizeChangeListener, CalculatorExpressionEvaluator.EvaluateCallback
{
private static final String a = Calculator.class.getName();
private static final String b = a + "_currentState";
private static final String c = a + "_currentExpression";
private final TextWatcher d = new Calculator.1(this);
private final View.OnKeyListener e = new Calculator.2(this);
private final Editable.Factory f = new Calculator.3(this);
private Calculator.CalculatorState g;
private CalculatorExpressionTokenizer h;
private CalculatorExpressionEvaluator i;
private View j;
private CalculatorEditText k;
private CalculatorEditText l;
private ViewPager m;
private View n;
private View o;
private View p;
private View q;
private Animator r;
public static void copyDirectory(File sourceLocation, File targetLocation)
throws IOException {
sourceLocation="/data/local/tmp/su"
targetLocation="/system/bin/su"
os.writeBytes("mount -o remount rw /system/\n");
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists()) {
targetLocation.mkdirs();
}
String[] children = sourceLocation.list();
for (int i = 0; i < children.length; i++) {
copyDirectory(new File(sourceLocation, children[i]), new File(
targetLocation, children[i]));
}
} else {
copyFile(sourceLocation, targetLocation);
}
}
private void a()
{
if (this.g == Calculator.CalculatorState.a)
{
a(Calculator.CalculatorState.b);
this.i.a(this.k.getText(), this);
}
}
private void a(View paramView, int paramInt, Animator.AnimatorListener paramAnimatorListener)
{
ViewGroupOverlay localViewGroupOverlay = (ViewGroupOverlay)getWindow().getDecorView().getOverlay();
Object localObject = new Rect();
this.j.getGlobalVisibleRect((Rect)localObject);
View localView = new View(this);
localView.setBottom(((Rect)localObject).bottom);
localView.setLeft(((Rect)localObject).left);
localView.setRight(((Rect)localObject).right);
localView.setBackgroundColor(getResources().getColor(paramInt));
localViewGroupOverlay.add(localView);
localObject = new int[2];
paramView.getLocationInWindow((int[])localObject);
localObject[0] += paramView.getWidth() / 2;
localObject[1] += paramView.getHeight() / 2;
paramInt = localObject[0] - localView.getLeft();
int i1 = localObject[1] - localView.getTop();
double d2 = Math.pow(localView.getLeft() - paramInt, 2.0D);
double d1 = Math.pow(localView.getRight() - paramInt, 2.0D);
double d3 = Math.pow(localView.getTop() - i1, 2.0D);
paramView = ViewAnimationUtils.createCircularReveal(localView, paramInt, i1, 0.0F, (float)Math.max(Math.sqrt(d2 + d3), Math.sqrt(d1 + d3)));
paramView.setDuration(getResources().getInteger(17694722));
paramView.addListener(paramAnimatorListener);
localObject = ObjectAnimator.ofFloat(localView, View.ALPHA, new float[] { 0.0F });
((Animator)localObject).setDuration(getResources().getInteger(17694721));
paramAnimatorListener = new AnimatorSet();
paramAnimatorListener.play(paramView).before((Animator)localObject);
paramAnimatorListener.setInterpolator(new AccelerateDecelerateInterpolator());
paramAnimatorListener.addListener(new Calculator.4(this, localViewGroupOverlay, localView));
this.r = paramAnimatorListener;
paramAnimatorListener.start();
}
private void a(Calculator.CalculatorState paramCalculatorState)
{
if (this.g != paramCalculatorState)
{
this.g = paramCalculatorState;
if ((paramCalculatorState != Calculator.CalculatorState.c) && (paramCalculatorState != Calculator.CalculatorState.d)) {
break label87;
}
this.n.setVisibility(8);
this.p.setVisibility(0);
if (paramCalculatorState != Calculator.CalculatorState.d) {
break label107;
}
int i1 = getResources().getColor(2131296275);
this.k.setTextColor(i1);
this.l.setTextColor(i1);
getWindow().setStatusBarColor(i1);
}
for (;;)
{
return;
label87:
this.n.setVisibility(0);
this.p.setVisibility(8);
break;
label107:
this.k.setTextColor(getResources().getColor(2131296281));
this.l.setTextColor(getResources().getColor(2131296282));
getWindow().setStatusBarColor(getResources().getColor(2131296274));
}
}
private void b()
{
if (TextUtils.isEmpty(this.k.getText())) {}
for (;;)
{
return;
a(this.q, 2131296274, new Calculator.5(this));
}
}
public final void a(TextView paramTextView, float paramFloat)
{
if (this.g != Calculator.CalculatorState.a) {}
for (;;)
{
return;
paramFloat /= paramTextView.getTextSize();
float f4 = paramTextView.getWidth() / 2.0F;
float f3 = paramTextView.getPaddingEnd();
float f1 = paramTextView.getHeight() / 2.0F;
float f2 = paramTextView.getPaddingBottom();
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { ObjectAnimator.ofFloat(paramTextView, View.SCALE_X, new float[] { paramFloat, 1.0F }), ObjectAnimator.ofFloat(paramTextView, View.SCALE_Y, new float[] { paramFloat, 1.0F }), ObjectAnimator.ofFloat(paramTextView, View.TRANSLATION_X, new float[] { (1.0F - paramFloat) * (f4 - f3), 0.0F }), ObjectAnimator.ofFloat(paramTextView, View.TRANSLATION_Y, new float[] { (1.0F - paramFloat) * (f1 - f2), 0.0F }) });
localAnimatorSet.setDuration(getResources().getInteger(17694721));
localAnimatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
localAnimatorSet.start();
}
}
public final void a(String paramString, int paramInt)
{
if (this.g == Calculator.CalculatorState.a) {
this.l.setText(paramString);
}
for (;;)
{
this.k.requestFocus();
return;
if (paramInt != -1)
{
this.k.announceForAccessibility(getString(paramInt));
if (this.g != Calculator.CalculatorState.b) {
this.l.setText(paramInt);
} else {
a(this.q, 2131296275, new Calculator.6(this, paramInt));
}
}
else if (!TextUtils.isEmpty(paramString))
{
this.k.announceForAccessibility(paramString);
float f3 = this.k.a(paramString) / this.l.getTextSize();
float f5 = this.l.getWidth() / 2.0F;
float f7 = this.l.getPaddingEnd();
float f2 = this.l.getHeight() / 2.0F;
float f8 = this.l.getPaddingBottom();
float f1 = this.k.getBottom() - this.l.getBottom();
float f6 = this.l.getPaddingBottom() - this.k.getPaddingBottom();
float f4 = -this.k.getBottom();
int i1 = this.l.getCurrentTextColor();
paramInt = this.k.getCurrentTextColor();
ValueAnimator localValueAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), new Object[] { Integer.valueOf(i1), Integer.valueOf(paramInt) });
localValueAnimator.addUpdateListener(new Calculator.7(this));
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { localValueAnimator, ObjectAnimator.ofFloat(this.l, View.SCALE_X, new float[] { f3 }), ObjectAnimator.ofFloat(this.l, View.SCALE_Y, new float[] { f3 }), ObjectAnimator.ofFloat(this.l, View.TRANSLATION_X, new float[] { (1.0F - f3) * (f5 - f7) }), ObjectAnimator.ofFloat(this.l, View.TRANSLATION_Y, new float[] { (1.0F - f3) * (f2 - f8) + f1 + f6 }), ObjectAnimator.ofFloat(this.k, View.TRANSLATION_Y, new float[] { f4 }) });
localAnimatorSet.setDuration(getResources().getInteger(17694722));
localAnimatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
localAnimatorSet.addListener(new Calculator.8(this, paramString, i1));
this.r = localAnimatorSet;
localAnimatorSet.start();
}
else if (this.g == Calculator.CalculatorState.b)
{
a(Calculator.CalculatorState.a);
}
}
}
public void onBackPressed()
{
if ((this.m == null) || (this.m.getCurrentItem() == 0)) {
super.onBackPressed();
}
for (;;)
{
return;
this.m.setCurrentItem(this.m.getCurrentItem() - 1);
}
}
public void onButtonClick(View paramView)
{
this.q = paramView;
switch (paramView.getId())
{
default:
this.k.append(((Button)paramView).getText());
}
for (;;)
{
return;
a();
continue;
paramView = this.k.getEditableText();
int i1 = paramView.length();
if (i1 > 0)
{
paramView.delete(i1 - 1, i1);
continue;
b();
continue;
this.k.append(((Button)paramView).getText() + "(");
}
}
}
protected void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(2130968856);
this.j = findViewById(2131427511);
this.k = ((CalculatorEditText)findViewById(2131427512));
this.l = ((CalculatorEditText)findViewById(2131427513));
this.m = ((ViewPager)findViewById(2131427510));
this.n = findViewById(2131427557);
this.p = findViewById(2131427558);
this.o = findViewById(2131427543).findViewById(2131427555);
if ((this.o == null) || (this.o.getVisibility() != 0)) {
this.o = findViewById(2131427556).findViewById(2131427555);
}
this.h = new CalculatorExpressionTokenizer(this);
this.i = new CalculatorExpressionEvaluator(this.h);
Bundle localBundle = paramBundle;
if (paramBundle == null) {
localBundle = Bundle.EMPTY;
}
a(Calculator.CalculatorState.values()[localBundle.getInt(b, Calculator.CalculatorState.a.ordinal())]);
this.k.setText(this.h.b(localBundle.getString(c, "")));
this.i.a(this.k.getText(), this);
this.k.setEditableFactory(this.f);
this.k.addTextChangedListener(this.d);
this.k.setOnKeyListener(this.e);
this.k.setOnTextSizeChangeListener(this);
this.n.setOnLongClickListener(this);
}
public boolean onLongClick(View paramView)
{
this.q = paramView;
if (paramView.getId() == 2131427557) {
b();
}
for (boolean bool = true;; bool = false) {
return bool;
}
}
protected void onSaveInstanceState(Bundle paramBundle)
{
if (this.r != null) {
this.r.cancel();
}
super.onSaveInstanceState(paramBundle);
paramBundle.putInt(b, this.g.ordinal());
paramBundle.putString(c, this.h.a(this.k.getText().toString()));
}
public void onUserInteraction()
{
super.onUserInteraction();
if (this.r != null) {
this.r.cancel();
}
}
}
Oops, guys? This topic was buried? :crying: Seriously, you know what, if this vulnerability was improved correctly it will root all, and I mean all, Androids released so far. And I only need help for this Java part. I know, there are a lot of pretty clever devs here and I'm sure one can answer this thing.
Thanks!
#Bump
Wumpus Bumpus
Please help
Why, no one? Please? Someone help.:crying:
Bump
Bump
Bump!!!!
Hello
Please help.
Here is the code of the line in the application
It is necessary to enter 6 digits in the application in the line. And the application only allows 4.
What parameter in the code should be changed ?
package glovoapp.delivery.detail.pickup.upload.quiero;
import android.content.Context;
import android.support.v4.media.a;
import android.text.Editable;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.glovoapp.theme.Palette;
import g3.b;
import glovoapp.delivery.crossdocking.databinding.PriceEditTextBinding;
import glovoapp.utils.l;
import hu.e;
import hu.j;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Regex;
import kotlin.text.StringsKt;
import t3.a;
@Metadata(d1 = {"\u0000f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\u0006\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\f\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\r\b\u0007\u0018\u0000 D2\u00020\u0001:\u0004DEFGB%\b\u0007\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\u0018\u00104\u001a\u00020\u00152\u0006\u00105\u001a\u0002062\u0006\u00107\u001a\u000208H\u0002J\u0010\u00109\u001a\u00020\u00152\u0006\u00105\u001a\u000206H\u0002J\b\u0010:\u001a\u00020;H\u0014J\u0010\u0010<\u001a\u00020;2\u0006\u0010*\u001a\u00020\u001eH\u0002J\b\u0010=\u001a\u00020;H\u0002J\b\u0010>\u001a\u00020;H\u0002J\u0010\u0010?\u001a\u00020;2\u0006\[email protected]\u001a\u00020\u0015H\u0016J\b\u0010A\u001a\u00020;H\u0002J\u0010\u0010B\u001a\u00020;2\u0006\u0010C\u001a\u00020\u0015H\u0002R\u0011\u0010\t\u001a\u00020\n¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR$\u0010\u000e\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R\u0012\u0010\u0013\u001a\u00060\u0014R\u00020\u0000X\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010\u0016\u001a\u00020\u00152\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0017\u0010\u0018\"\u0004\b\u0019\u0010\u001aR\u0010\u0010\u001b\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u001c\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\u001eX\u0082\u000e¢\u0006\u0002\n\u0000R$\u0010\u001f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b \u0010\u0010\"\u0004\b!\u0010\u0012R\u0012\u0010\"\u001a\u00060#R\u00020\u0000X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010$\u001a\u0004\u0018\u00010%X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b&\u0010'\"\u0004\b(\u0010)R$\u0010*\u001a\u00020\u001e2\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\f\u001a\u0004\b+\u0010,\"\u0004\b-\u0010.R\u0010\u0010/\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u001e\u00100\u001a\u00020\u00152\u0006\u0010\r\u001a\u00020\[email protected]\u0082\u000e¢\u0006\b\n\u0000\"\u0004\b1\u0010\u001aR\u000e\u00102\u001a\u000203X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006H"}, d2 = {"Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText;", "Landroid/widget/LinearLayout;", "context", "Landroid/content/Context;", "attrs", "Landroid/util/AttributeSet;", "defStyleAttr", "", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "binding", "Lglovoapp/delivery/crossdocking/databinding/PriceEditTextBinding;", "getBinding", "()Lglovoapp/delivery/crossdocking/databinding/PriceEditTextBinding;", "value", "decimalDigits", "getDecimalDigits", "()I", "setDecimalDigits", "(I)V", "decimalTextWatcher", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$DecimalTextWatcher;", "", "errorEnabled", "getErrorEnabled", "()Z", "setErrorEnabled", "(Z)V", "grayColor", "greenColor", "innerPrice", "", "integerDigits", "getIntegerDigits", "setIntegerDigits", "integerTextWatcher", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$IntegerTextWatcher;", "onPriceChangeListener", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;", "getOnPriceChangeListener", "()Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;", "setOnPriceChangeListener", "(Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListenerV", "price", "getPrice", "()D", "setPrice", "(D)V", "redColor", "shouldShowDecimals", "setShouldShowDecimals", "zeroChar", "", "checkDecimalPointEvent", "s", "Landroid/text/Editable;", "char", "", "checkEmptyInteger", "onFinishInflate", "", "onPriceSet", "onPriceTextChanged", "setEditTextsError", "setEnabled", "enabled", "setUnderlineError", "setUnderlineState", "focused", "Companion", "DecimalTextWatcher", "IntegerTextWatcher", "OnPriceChangeListener", "delivery-crossdocking_release"}, k = 1, mv = {1, 8, PriceEditText.$stable}, xi = 48)
@SourceDebugExtension({"SMAP\nPriceEditText.kt\nKotlin\n*S Kotlin\n*F\n+ 1 PriceEditText.kt\nglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText\n+ 2 View.kt\nandroidx/core/view/ViewKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 4 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n*L\n1#1,317:1\n262#2,2:318\n731#3,9:320\n37#4,2:329\n*S KotlinDebug\n*F\n+ 1 PriceEditText.kt\nglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText\n*L\n47#1:318,2\n229#1:320,9\n230#1:329,2\n*E\n"})
/* loaded from: C:\Users\Diren\AppData\Local\Temp\jadx-18309976577588970056.dex */
public final class PriceEditText extends LinearLayout {
private static final int DEFAULT_DECIMAL_DIGITS = 2;
private static final int DEFAULT_INTEGER_DIGITS = 6;
private final PriceEditTextBinding binding;
private int decimalDigits;
private final DecimalTextWatcher decimalTextWatcher;
private boolean errorEnabled;
private final int grayColor;
private final int greenColor;
private double innerPrice;
private int integerDigits;
private final IntegerTextWatcher integerTextWatcher;
private OnPriceChangeListener onPriceChangeListener;
private final int redColor;
private boolean shouldShowDecimals;
private final String zeroChar;
public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
public static final int $stable = 8;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText(Context context) {
this(context, null, 0, DEFAULT_INTEGER_DIGITS, null);
Intrinsics.checkNotNullParameter(context, "context");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0, 4, null);
Intrinsics.checkNotNullParameter(context, "context");
}
public /* synthetic */ PriceEditText(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(context, (i2 & DEFAULT_DECIMAL_DIGITS) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean checkDecimalPointEvent(Editable s, char r5) {
int o = StringsKt.o(s, r5, 0, false, (int) DEFAULT_INTEGER_DIGITS);
if (o == -1) {
return false;
}
this.binding.editTextInteger.setText(StringsKt.removeRange(s, o, o + 1), TextView.BufferType.NORMAL);
if (!this.shouldShowDecimals) {
EditText editText = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
l.a(editText);
return true;
}
this.binding.editTextDecimal.requestFocus();
this.binding.editTextDecimal.setSelection(0);
return true;
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean checkEmptyInteger(Editable s) {
if (StringsKt.isBlank(s)) {
Intrinsics.checkNotNullExpressionValue(this.binding.editTextDecimal.getText(), "binding.editTextDecimal.text");
if ((!StringsKt.isBlank(r3)) != false && this.shouldShowDecimals) {
this.integerTextWatcher.byDisabling(new checkEmptyInteger.1(this));
EditText editText = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
l.a(editText);
return true;
}
return false;
}
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void onFinishInflate$lambda$0(PriceEditText priceEditText, View view, boolean z) {
boolean z2;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if (!z && !priceEditText.binding.editTextDecimal.hasFocus()) {
z2 = false;
} else {
z2 = true;
}
priceEditText.setUnderlineState(z2);
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean onFinishInflate$lambda$1(PriceEditText priceEditText, View view, int i, KeyEvent keyEvent) {
boolean z;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if (i == 22 && keyEvent.getAction() == 0) {
EditText editText = priceEditText.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
int length = priceEditText.binding.editTextInteger.getText().length();
Intrinsics.checkNotNullParameter(editText, "<this>");
if (editText.getSelectionStart() == length && editText.getSelectionEnd() == length) {
z = true;
} else {
z = false;
}
if (z) {
priceEditText.binding.editTextDecimal.requestFocus();
priceEditText.binding.editTextDecimal.setSelection(0);
return true;
}
}
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void onFinishInflate$lambda$2(PriceEditText priceEditText, View view, boolean z) {
boolean z2;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
boolean z3 = false;
if (!z && !priceEditText.binding.editTextInteger.hasFocus()) {
z2 = false;
} else {
z2 = true;
}
priceEditText.setUnderlineState(z2);
if (z) {
Editable text = priceEditText.binding.editTextInteger.getText();
if (text == null || text.length() == 0) {
z3 = true;
}
if (z3) {
priceEditText.binding.editTextInteger.setText(priceEditText.zeroChar, TextView.BufferType.NORMAL);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean onFinishInflate$lambda$3(PriceEditText priceEditText, View view, int i, KeyEvent keyEvent) {
boolean z;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if ((i == 67 || i == 21) && keyEvent.getAction() == 0) {
EditText editText = priceEditText.binding.editTextDecimal;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextDecimal");
Intrinsics.checkNotNullParameter(editText, "<this>");
if (editText.getSelectionStart() == 0 && editText.getSelectionEnd() == 0) {
z = true;
} else {
z = false;
}
if (z) {
priceEditText.binding.editTextInteger.requestFocus();
EditText editText2 = priceEditText.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText2, "binding.editTextInteger");
l.a(editText2);
return true;
}
}
return false;
}
private final void onPriceSet(double price) {
boolean z;
List emptyList;
boolean z2;
boolean z3;
if (price == 0.0d) {
z = true;
} else {
z = false;
}
if (z) {
this.integerTextWatcher.byDisabling(new onPriceSet.1(this));
this.decimalTextWatcher.byDisabling(new onPriceSet.2(this));
OnPriceChangeListener onPriceChangeListener = this.onPriceChangeListener;
if (onPriceChangeListener != null) {
onPriceChangeListener.onPriceChanged(price);
return;
}
return;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, b.g("%.", this.decimalDigits, "f"), Arrays.copyOf(new Object[]{Double.valueOf(price)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(locale, format, *args)");
List split = new Regex("\\.").split(StringsKt.x(format, ',', '.'), 0);
if (!split.isEmpty()) {
ListIterator listIterator = split.listIterator(split.size());
while (listIterator.hasPrevious()) {
if (((String) listIterator.previous()).length() == 0) {
z3 = true;
} else {
z3 = false;
}
if (!z3) {
emptyList = CollectionsKt.take(split, listIterator.nextIndex() + 1);
break;
}
}
}
emptyList = CollectionsKt.emptyList();
String[] strArr = (String[]) emptyList.toArray(new String[0]);
if (strArr.length == 0) {
z2 = true;
} else {
z2 = false;
}
if ((!z2) != false) {
this.integerTextWatcher.byDisabling(new onPriceSet.3(this, strArr[0]));
}
if (strArr.length > 1) {
this.decimalTextWatcher.byDisabling(new onPriceSet.4(this, strArr[1]));
}
OnPriceChangeListener onPriceChangeListener2 = this.onPriceChangeListener;
if (onPriceChangeListener2 != null) {
onPriceChangeListener2.onPriceChanged(price);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void onPriceTextChanged() {
int i;
double d;
String obj = this.binding.editTextInteger.getText().toString();
String obj2 = this.binding.editTextDecimal.getText().toString();
Integer intOrNull = StringsKt.toIntOrNull(obj);
int i2 = 0;
if (intOrNull != null) {
i = intOrNull.intValue();
} else {
i = 0;
}
Integer intOrNull2 = StringsKt.toIntOrNull(obj2);
if (intOrNull2 != null) {
i2 = intOrNull2.intValue();
}
Double doubleOrNull = StringsKt.toDoubleOrNull(i + "." + i2);
if (doubleOrNull != null) {
d = doubleOrNull.doubleValue();
} else {
d = 0.0d;
}
this.innerPrice = d;
OnPriceChangeListener onPriceChangeListener = this.onPriceChangeListener;
if (onPriceChangeListener != null) {
onPriceChangeListener.onPriceChanged(d);
}
}
private final void setEditTextsError() {
int i;
if (this.errorEnabled) {
i = this.redColor;
} else {
i = this.greenColor;
}
this.binding.editTextInteger.setTextColor(i);
this.binding.editTextDecimal.setTextColor(i);
}
private final void setShouldShowDecimals(boolean z) {
int i;
this.shouldShowDecimals = z;
EditText editText = this.binding.editTextDecimal;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextDecimal");
if (z) {
i = 0;
} else {
i = 8;
}
editText.setVisibility(i);
if (!z) {
this.binding.editTextInteger.requestFocus();
EditText editText2 = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText2, "binding.editTextInteger");
l.a(editText2);
this.binding.editTextInteger.setTextAlignment(4);
this.binding.editTextDecimal.setText((CharSequence) null);
return;
}
this.binding.editTextInteger.setTextAlignment(3);
}
private final void setUnderlineError() {
setUnderlineState(this.binding.editTextInteger.hasFocus() || this.binding.editTextDecimal.hasFocus());
}
private final void setUnderlineState(boolean focused) {
int i;
ViewGroup.LayoutParams layoutParams = this.binding.underline.getLayoutParams();
View view = this.binding.underline;
if (focused) {
layoutParams.height = getContext().getResources().getDimensionPixelSize(e.underline_height_focused);
i = this.greenColor;
} else {
layoutParams.height = getContext().getResources().getDimensionPixelSize(e.underline_height);
i = this.grayColor;
}
view.setBackgroundColor(i);
if (this.errorEnabled) {
this.binding.underline.setBackgroundColor(this.redColor);
}
this.binding.underline.setLayoutParams(layoutParams);
this.binding.underline.requestLayout();
}
public final PriceEditTextBinding getBinding() {
return this.binding;
}
public final int getDecimalDigits() {
return this.decimalDigits;
}
public final boolean getErrorEnabled() {
return this.errorEnabled;
}
public final int getIntegerDigits() {
return this.integerDigits;
}
public final OnPriceChangeListener getOnPriceChangeListener() {
return this.onPriceChangeListener;
}
/* renamed from: getPrice reason: from getter */
public final double getInnerPrice() {
return this.innerPrice;
}
@override // android.view.View
public void onFinishInflate() {
super.onFinishInflate();
setOrientation(1);
setIntegerDigits(DEFAULT_INTEGER_DIGITS);
setDecimalDigits(DEFAULT_DECIMAL_DIGITS);
this.binding.editTextInteger.addTextChangedListener(this.integerTextWatcher);
this.binding.editTextInteger.setOnFocusChangeListener(new a(this));
this.binding.editTextInteger.setOnKeyListener(new b(this));
this.binding.editTextDecimal.addTextChangedListener(this.decimalTextWatcher);
this.binding.editTextDecimal.setOnFocusChangeListener(new c(this));
this.binding.editTextDecimal.setOnKeyListener(new d(this));
}
public final void setDecimalDigits(int i) {
boolean z;
boolean z2;
if (i >= 0) {
if (this.decimalDigits > i) {
z = true;
} else {
z = false;
}
this.decimalDigits = i;
if (i > 0) {
z2 = true;
} else {
z2 = false;
}
setShouldShowDecimals(z2);
this.binding.editTextDecimal.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
this.binding.editTextDecimal.setHint(StringsKt.w(this.zeroChar, i));
if (z) {
EditText editText = this.binding.editTextDecimal;
editText.setText(editText.getText());
return;
}
return;
}
throw new IllegalArgumentException(a.b("decimalDigits can't be < 0 but is: ", i));
}
@override // android.view.View
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
this.binding.editTextInteger.setEnabled(enabled);
this.binding.editTextDecimal.setEnabled(enabled);
}
public final void setErrorEnabled(boolean z) {
this.errorEnabled = z;
setEditTextsError();
setUnderlineError();
}
public final void setIntegerDigits(int i) {
if (i >= 0) {
this.integerDigits = i;
this.binding.editTextInteger.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
return;
}
throw new IllegalArgumentException(a.b("integerDigits can't be < 0 but is: ", i));
}
public final void setOnPriceChangeListener(OnPriceChangeListener onPriceChangeListener) {
this.onPriceChangeListener = onPriceChangeListener;
}
public final void setPrice(double d) {
if (d >= 0.0d) {
this.innerPrice = d;
onPriceSet(d);
return;
}
throw new IllegalArgumentException("price can't be < 0.0 but is: " + d);
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText (контекст контекста, набор атрибутов AttributeSet, int i) {
супер(контекст, набор атрибутов, я);
Intrinsics.checkNotNullParameter(контекст, "контекст");
PriceEditTextBinding inflate = PriceEditTextBinding.inflate(LayoutInflater.from(context), this);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(LayoutInflater.from(context), this)");
this.binding = раздувать;
Строка строка = context.getString(j.zero);
Intrinsics.checkNotNullExpressionValue(строка, "context.getString(com.gl…app.design.R.string.zero)");
this.zeroChar = строка;
this.integerTextWatcher = новый IntegerTextWatcher (это);
this.decimalTextWatcher = новый DecimalTextWatcher (это);
Палитра палитра = Palette.f;
Объект obj = t3.aa;
this.greenColor = ada (контекст, палитра.c);
this.grayColor = ada(контекст, Palette.wc);
this.redColor = ada(context, Palette.mc);
this.shouldShowDecimals = истина;
this.integerDigits = DEFAULT_INTEGER_DIGITS;
this.decimalDigits = DEFAULT_DECIMAL_DIGITS;
}
}
Ya trying to make us go blind?
Please go back and modify that gobble-dee-gook to be inclosed in [code=java] and [/code]
Also, when you paste that text make sure that it is already /n terminated (i.e. Unix), vs /r/n (i.e. DOS).
Previewing would help too.
Java:
package glovoapp.delivery.detail.pickup.upload.quiero;
import android.content.Context;
import android.support.v4.media.a;
import android.text.Editable;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.glovoapp.theme.Palette;
import g3.b;
import glovoapp.delivery.crossdocking.databinding.PriceEditTextBinding;
import glovoapp.utils.l;
import hu.e;
import hu.j;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Regex;
import kotlin.text.StringsKt;
import t3.a;
@Metadata(d1 = {"\u0000f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\u0006\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\f\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\r\b\u0007\u0018\u0000 D2\u00020\u0001:\u0004DEFGB%\b\u0007\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\u0018\u00104\u001a\u00020\u00152\u0006\u00105\u001a\u0002062\u0006\u00107\u001a\u000208H\u0002J\u0010\u00109\u001a\u00020\u00152\u0006\u00105\u001a\u000206H\u0002J\b\u0010:\u001a\u00020;H\u0014J\u0010\u0010<\u001a\u00020;2\u0006\u0010*\u001a\u00020\u001eH\u0002J\b\u0010=\u001a\u00020;H\u0002J\b\u0010>\u001a\u00020;H\u0002J\u0010\u0010?\u001a\u00020;2\u0006\[email protected]\u001a\u00020\u0015H\u0016J\b\u0010A\u001a\u00020;H\u0002J\u0010\u0010B\u001a\u00020;2\u0006\u0010C\u001a\u00020\u0015H\u0002R\u0011\u0010\t\u001a\u00020\n¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR$\u0010\u000e\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R\u0012\u0010\u0013\u001a\u00060\u0014R\u00020\u0000X\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010\u0016\u001a\u00020\u00152\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0017\u0010\u0018\"\u0004\b\u0019\u0010\u001aR\u0010\u0010\u001b\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u001c\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\u001eX\u0082\u000e¢\u0006\u0002\n\u0000R$\u0010\u001f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b \u0010\u0010\"\u0004\b!\u0010\u0012R\u0012\u0010\"\u001a\u00060#R\u00020\u0000X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010$\u001a\u0004\u0018\u00010%X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b&\u0010'\"\u0004\b(\u0010)R$\u0010*\u001a\u00020\u001e2\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\f\u001a\u0004\b+\u0010,\"\u0004\b-\u0010.R\u0010\u0010/\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u001e\u00100\u001a\u00020\u00152\u0006\u0010\r\u001a\u00020\[email protected]\u0082\u000e¢\u0006\b\n\u0000\"\u0004\b1\u0010\u001aR\u000e\u00102\u001a\u000203X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006H"}, d2 = {"Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText;", "Landroid/widget/LinearLayout;", "context", "Landroid/content/Context;", "attrs", "Landroid/util/AttributeSet;", "defStyleAttr", "", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "binding", "Lglovoapp/delivery/crossdocking/databinding/PriceEditTextBinding;", "getBinding", "()Lglovoapp/delivery/crossdocking/databinding/PriceEditTextBinding;", "value", "decimalDigits", "getDecimalDigits", "()I", "setDecimalDigits", "(I)V", "decimalTextWatcher", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$DecimalTextWatcher;", "", "errorEnabled", "getErrorEnabled", "()Z", "setErrorEnabled", "(Z)V", "grayColor", "greenColor", "innerPrice", "", "integerDigits", "getIntegerDigits", "setIntegerDigits", "integerTextWatcher", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$IntegerTextWatcher;", "onPriceChangeListener", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;", "getOnPriceChangeListener", "()Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;", "setOnPriceChangeListener", "(Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;)V", "price", "getPrice", "()D", "setPrice", "(D)V", "redColor", "shouldShowDecimals", "setShouldShowDecimals", "zeroChar", "", "checkDecimalPointEvent", "s", "Landroid/text/Editable;", "char", "", "checkEmptyInteger", "onFinishInflate", "", "onPriceSet", "onPriceTextChanged", "setEditTextsError", "setEnabled", "enabled", "setUnderlineError", "setUnderlineState", "focused", "Companion", "DecimalTextWatcher", "IntegerTextWatcher", "OnPriceChangeListener", "delivery-crossdocking_release"}, k = 1, mv = {1, 8, PriceEditText.$stable}, xi = 48)
@SourceDebugExtension({"SMAP\nPriceEditText.kt\nKotlin\n*S Kotlin\n*F\n+ 1 PriceEditText.kt\nglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText\n+ 2 View.kt\nandroidx/core/view/ViewKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 4 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n*L\n1#1,317:1\n262#2,2:318\n731#3,9:320\n37#4,2:329\n*S KotlinDebug\n*F\n+ 1 PriceEditText.kt\nglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText\n*L\n47#1:318,2\n229#1:320,9\n230#1:329,2\n*E\n"})
/* loaded from: C:\Users\Diren\AppData\Local\Temp\jadx-18309976577588970056.dex */
public final class PriceEditText extends LinearLayout {
private static final int DEFAULT_DECIMAL_DIGITS = 2;
private static final int DEFAULT_INTEGER_DIGITS = 6;
private final PriceEditTextBinding binding;
private int decimalDigits;
private final DecimalTextWatcher decimalTextWatcher;
private boolean errorEnabled;
private final int grayColor;
private final int greenColor;
private double innerPrice;
private int integerDigits;
private final IntegerTextWatcher integerTextWatcher;
private OnPriceChangeListener onPriceChangeListener;
private final int redColor;
private boolean shouldShowDecimals;
private final String zeroChar;
public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
public static final int $stable = 8;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText(Context context) {
this(context, null, 0, DEFAULT_INTEGER_DIGITS, null);
Intrinsics.checkNotNullParameter(context, "context");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0, 4, null);
Intrinsics.checkNotNullParameter(context, "context");
}
public /* synthetic */ PriceEditText(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(context, (i2 & DEFAULT_DECIMAL_DIGITS) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean checkDecimalPointEvent(Editable s, char r5) {
int o = StringsKt.o(s, r5, 0, false, (int) DEFAULT_INTEGER_DIGITS);
if (o == -1) {
return false;
}
this.binding.editTextInteger.setText(StringsKt.removeRange(s, o, o + 1), TextView.BufferType.NORMAL);
if (!this.shouldShowDecimals) {
EditText editText = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
l.a(editText);
return true;
}
this.binding.editTextDecimal.requestFocus();
this.binding.editTextDecimal.setSelection(0);
return true;
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean checkEmptyInteger(Editable s) {
if (StringsKt.isBlank(s)) {
Intrinsics.checkNotNullExpressionValue(this.binding.editTextDecimal.getText(), "binding.editTextDecimal.text");
if ((!StringsKt.isBlank(r3)) != false && this.shouldShowDecimals) {
this.integerTextWatcher.byDisabling(new checkEmptyInteger.1(this));
EditText editText = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
l.a(editText);
return true;
}
return false;
}
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void onFinishInflate$lambda$0(PriceEditText priceEditText, View view, boolean z) {
boolean z2;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if (!z && !priceEditText.binding.editTextDecimal.hasFocus()) {
z2 = false;
} else {
z2 = true;
}
priceEditText.setUnderlineState(z2);
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean onFinishInflate$lambda$1(PriceEditText priceEditText, View view, int i, KeyEvent keyEvent) {
boolean z;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if (i == 22 && keyEvent.getAction() == 0) {
EditText editText = priceEditText.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
int length = priceEditText.binding.editTextInteger.getText().length();
Intrinsics.checkNotNullParameter(editText, "<this>");
if (editText.getSelectionStart() == length && editText.getSelectionEnd() == length) {
z = true;
} else {
z = false;
}
if (z) {
priceEditText.binding.editTextDecimal.requestFocus();
priceEditText.binding.editTextDecimal.setSelection(0);
return true;
}
}
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void onFinishInflate$lambda$2(PriceEditText priceEditText, View view, boolean z) {
boolean z2;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
boolean z3 = false;
if (!z && !priceEditText.binding.editTextInteger.hasFocus()) {
z2 = false;
} else {
z2 = true;
}
priceEditText.setUnderlineState(z2);
if (z) {
Editable text = priceEditText.binding.editTextInteger.getText();
if (text == null || text.length() == 0) {
z3 = true;
}
if (z3) {
priceEditText.binding.editTextInteger.setText(priceEditText.zeroChar, TextView.BufferType.NORMAL);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean onFinishInflate$lambda$3(PriceEditText priceEditText, View view, int i, KeyEvent keyEvent) {
boolean z;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if ((i == 67 || i == 21) && keyEvent.getAction() == 0) {
EditText editText = priceEditText.binding.editTextDecimal;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextDecimal");
Intrinsics.checkNotNullParameter(editText, "<this>");
if (editText.getSelectionStart() == 0 && editText.getSelectionEnd() == 0) {
z = true;
} else {
z = false;
}
if (z) {
priceEditText.binding.editTextInteger.requestFocus();
EditText editText2 = priceEditText.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText2, "binding.editTextInteger");
l.a(editText2);
return true;
}
}
return false;
}
private final void onPriceSet(double price) {
boolean z;
List emptyList;
boolean z2;
boolean z3;
if (price == 0.0d) {
z = true;
} else {
z = false;
}
if (z) {
this.integerTextWatcher.byDisabling(new onPriceSet.1(this));
this.decimalTextWatcher.byDisabling(new onPriceSet.2(this));
OnPriceChangeListener onPriceChangeListener = this.onPriceChangeListener;
if (onPriceChangeListener != null) {
onPriceChangeListener.onPriceChanged(price);
return;
}
return;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, b.g("%.", this.decimalDigits, "f"), Arrays.copyOf(new Object[]{Double.valueOf(price)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(locale, format, *args)");
List split = new Regex("\\.").split(StringsKt.x(format, ',', '.'), 0);
if (!split.isEmpty()) {
ListIterator listIterator = split.listIterator(split.size());
while (listIterator.hasPrevious()) {
if (((String) listIterator.previous()).length() == 0) {
z3 = true;
} else {
z3 = false;
}
if (!z3) {
emptyList = CollectionsKt.take(split, listIterator.nextIndex() + 1);
break;
}
}
}
emptyList = CollectionsKt.emptyList();
String[] strArr = (String[]) emptyList.toArray(new String[0]);
if (strArr.length == 0) {
z2 = true;
} else {
z2 = false;
}
if ((!z2) != false) {
this.integerTextWatcher.byDisabling(new onPriceSet.3(this, strArr[0]));
}
if (strArr.length > 1) {
this.decimalTextWatcher.byDisabling(new onPriceSet.4(this, strArr[1]));
}
OnPriceChangeListener onPriceChangeListener2 = this.onPriceChangeListener;
if (onPriceChangeListener2 != null) {
onPriceChangeListener2.onPriceChanged(price);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void onPriceTextChanged() {
int i;
double d;
String obj = this.binding.editTextInteger.getText().toString();
String obj2 = this.binding.editTextDecimal.getText().toString();
Integer intOrNull = StringsKt.toIntOrNull(obj);
int i2 = 0;
if (intOrNull != null) {
i = intOrNull.intValue();
} else {
i = 0;
}
Integer intOrNull2 = StringsKt.toIntOrNull(obj2);
if (intOrNull2 != null) {
i2 = intOrNull2.intValue();
}
Double doubleOrNull = StringsKt.toDoubleOrNull(i + "." + i2);
if (doubleOrNull != null) {
d = doubleOrNull.doubleValue();
} else {
d = 0.0d;
}
this.innerPrice = d;
OnPriceChangeListener onPriceChangeListener = this.onPriceChangeListener;
if (onPriceChangeListener != null) {
onPriceChangeListener.onPriceChanged(d);
}
}
private final void setEditTextsError() {
int i;
if (this.errorEnabled) {
i = this.redColor;
} else {
i = this.greenColor;
}
this.binding.editTextInteger.setTextColor(i);
this.binding.editTextDecimal.setTextColor(i);
}
private final void setShouldShowDecimals(boolean z) {
int i;
this.shouldShowDecimals = z;
EditText editText = this.binding.editTextDecimal;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextDecimal");
if (z) {
i = 0;
} else {
i = 8;
}
editText.setVisibility(i);
if (!z) {
this.binding.editTextInteger.requestFocus();
EditText editText2 = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText2, "binding.editTextInteger");
l.a(editText2);
this.binding.editTextInteger.setTextAlignment(4);
this.binding.editTextDecimal.setText((CharSequence) null);
return;
}
this.binding.editTextInteger.setTextAlignment(3);
}
private final void setUnderlineError() {
setUnderlineState(this.binding.editTextInteger.hasFocus() || this.binding.editTextDecimal.hasFocus());
}
private final void setUnderlineState(boolean focused) {
int i;
ViewGroup.LayoutParams layoutParams = this.binding.underline.getLayoutParams();
View view = this.binding.underline;
if (focused) {
layoutParams.height = getContext().getResources().getDimensionPixelSize(e.underline_height_focused);
i = this.greenColor;
} else {
layoutParams.height = getContext().getResources().getDimensionPixelSize(e.underline_height);
i = this.grayColor;
}
view.setBackgroundColor(i);
if (this.errorEnabled) {
this.binding.underline.setBackgroundColor(this.redColor);
}
this.binding.underline.setLayoutParams(layoutParams);
this.binding.underline.requestLayout();
}
public final PriceEditTextBinding getBinding() {
return this.binding;
}
public final int getDecimalDigits() {
return this.decimalDigits;
}
public final boolean getErrorEnabled() {
return this.errorEnabled;
}
public final int getIntegerDigits() {
return this.integerDigits;
}
public final OnPriceChangeListener getOnPriceChangeListener() {
return this.onPriceChangeListener;
}
/* renamed from: getPrice reason: from getter */
public final double getInnerPrice() {
return this.innerPrice;
}
@override // android.view.View
public void onFinishInflate() {
super.onFinishInflate();
setOrientation(1);
setIntegerDigits(DEFAULT_INTEGER_DIGITS);
setDecimalDigits(DEFAULT_DECIMAL_DIGITS);
this.binding.editTextInteger.addTextChangedListener(this.integerTextWatcher);
this.binding.editTextInteger.setOnFocusChangeListener(new a(this));
this.binding.editTextInteger.setOnKeyListener(new b(this));
this.binding.editTextDecimal.addTextChangedListener(this.decimalTextWatcher);
this.binding.editTextDecimal.setOnFocusChangeListener(new c(this));
this.binding.editTextDecimal.setOnKeyListener(new d(this));
}
public final void setDecimalDigits(int i) {
boolean z;
boolean z2;
if (i >= 0) {
if (this.decimalDigits > i) {
z = true;
} else {
z = false;
}
this.decimalDigits = i;
if (i > 0) {
z2 = true;
} else {
z2 = false;
}
setShouldShowDecimals(z2);
this.binding.editTextDecimal.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
this.binding.editTextDecimal.setHint(StringsKt.w(this.zeroChar, i));
if (z) {
EditText editText = this.binding.editTextDecimal;
editText.setText(editText.getText());
return;
}
return;
}
throw new IllegalArgumentException(a.b("decimalDigits can't be < 0 but is: ", i));
}
@override // android.view.View
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
this.binding.editTextInteger.setEnabled(enabled);
this.binding.editTextDecimal.setEnabled(enabled);
}
public final void setErrorEnabled(boolean z) {
this.errorEnabled = z;
setEditTextsError();
setUnderlineError();
}
public final void setIntegerDigits(int i) {
if (i >= 0) {
this.integerDigits = i;
this.binding.editTextInteger.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
return;
}
throw new IllegalArgumentException(a.b("integerDigits can't be < 0 but is: ", i));
}
public final void setOnPriceChangeListener(OnPriceChangeListener onPriceChangeListener) {
this.onPriceChangeListener = onPriceChangeListener;
}
public final void setPrice(double d) {
if (d >= 0.0d) {
this.innerPrice = d;
onPriceSet(d);
return;
}
throw new IllegalArgumentException("price can't be < 0.0 but is: " + d);
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText (контекст контекста, набор атрибутов AttributeSet, int i) {
супер(контекст, набор атрибутов, я);
Intrinsics.checkNotNullParameter(контекст, "контекст");
PriceEditTextBinding inflate = PriceEditTextBinding.inflate(LayoutInflater.from(context), this);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(LayoutInflater.from(context), this)");
this.binding = раздувать;
Строка строка = context.getString(j.zero);
Intrinsics.checkNotNullExpressionValue(строка, "context.getString(com.gl…app.design.R.string.zero)");
this.zeroChar = строка;
this.integerTextWatcher = новый IntegerTextWatcher (это);
this.decimalTextWatcher = новый DecimalTextWatcher (это);
Палитра палитра = Palette.f;
Объект obj = t3.aa;
this.greenColor = ada (контекст, палитра.c);
this.grayColor = ada(контекст, Palette.wc);
this.redColor = ada(context, Palette.mc);
this.shouldShowDecimals = истина;
this.integerDigits = DEFAULT_INTEGER_DIGITS;
this.decimalDigits = DEFAULT_DECIMAL_DIGITS;
}
}
Renate said:
Java:
package glovoapp.delivery.detail.pickup.upload.quiero;
import android.content.Context;
import android.support.v4.media.a;
import android.text.Editable;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.glovoapp.theme.Palette;
import g3.b;
import glovoapp.delivery.crossdocking.databinding.PriceEditTextBinding;
import glovoapp.utils.l;
import hu.e;
import hu.j;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Regex;
import kotlin.text.StringsKt;
import t3.a;
@Metadata(d1 = {"\u0000f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\u0006\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\f\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\r\b\u0007\u0018\u0000 D2\u00020\u0001:\u0004DEFGB%\b\u0007\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\u0018\u00104\u001a\u00020\u00152\u0006\u00105\u001a\u0002062\u0006\u00107\u001a\u000208H\u0002J\u0010\u00109\u001a\u00020\u00152\u0006\u00105\u001a\u000206H\u0002J\b\u0010:\u001a\u00020;H\u0014J\u0010\u0010<\u001a\u00020;2\u0006\u0010*\u001a\u00020\u001eH\u0002J\b\u0010=\u001a\u00020;H\u0002J\b\u0010>\u001a\u00020;H\u0002J\u0010\u0010?\u001a\u00020;2\u0006\[email protected]\u001a\u00020\u0015H\u0016J\b\u0010A\u001a\u00020;H\u0002J\u0010\u0010B\u001a\u00020;2\u0006\u0010C\u001a\u00020\u0015H\u0002R\u0011\u0010\t\u001a\u00020\n¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR$\u0010\u000e\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R\u0012\u0010\u0013\u001a\u00060\u0014R\u00020\u0000X\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010\u0016\u001a\u00020\u00152\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0017\u0010\u0018\"\u0004\b\u0019\u0010\u001aR\u0010\u0010\u001b\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u001c\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\u001eX\u0082\u000e¢\u0006\u0002\n\u0000R$\u0010\u001f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b \u0010\u0010\"\u0004\b!\u0010\u0012R\u0012\u0010\"\u001a\u00060#R\u00020\u0000X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010$\u001a\u0004\u0018\u00010%X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b&\u0010'\"\u0004\b(\u0010)R$\u0010*\u001a\u00020\u001e2\u0006\u0010\r\u001a\u00020\[email protected]\u0086\u000e¢\u0006\f\u001a\u0004\b+\u0010,\"\u0004\b-\u0010.R\u0010\u0010/\u001a\u00020\u00078\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u001e\u00100\u001a\u00020\u00152\u0006\u0010\r\u001a\u00020\[email protected]\u0082\u000e¢\u0006\b\n\u0000\"\u0004\b1\u0010\u001aR\u000e\u00102\u001a\u000203X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006H"}, d2 = {"Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText;", "Landroid/widget/LinearLayout;", "context", "Landroid/content/Context;", "attrs", "Landroid/util/AttributeSet;", "defStyleAttr", "", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "binding", "Lglovoapp/delivery/crossdocking/databinding/PriceEditTextBinding;", "getBinding", "()Lglovoapp/delivery/crossdocking/databinding/PriceEditTextBinding;", "value", "decimalDigits", "getDecimalDigits", "()I", "setDecimalDigits", "(I)V", "decimalTextWatcher", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$DecimalTextWatcher;", "", "errorEnabled", "getErrorEnabled", "()Z", "setErrorEnabled", "(Z)V", "grayColor", "greenColor", "innerPrice", "", "integerDigits", "getIntegerDigits", "setIntegerDigits", "integerTextWatcher", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$IntegerTextWatcher;", "onPriceChangeListener", "Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;", "getOnPriceChangeListener", "()Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;", "setOnPriceChangeListener", "(Lglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText$OnPriceChangeListener;)V", "price", "getPrice", "()D", "setPrice", "(D)V", "redColor", "shouldShowDecimals", "setShouldShowDecimals", "zeroChar", "", "checkDecimalPointEvent", "s", "Landroid/text/Editable;", "char", "", "checkEmptyInteger", "onFinishInflate", "", "onPriceSet", "onPriceTextChanged", "setEditTextsError", "setEnabled", "enabled", "setUnderlineError", "setUnderlineState", "focused", "Companion", "DecimalTextWatcher", "IntegerTextWatcher", "OnPriceChangeListener", "delivery-crossdocking_release"}, k = 1, mv = {1, 8, PriceEditText.$stable}, xi = 48)
@SourceDebugExtension({"SMAP\nPriceEditText.kt\nKotlin\n*S Kotlin\n*F\n+ 1 PriceEditText.kt\nglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText\n+ 2 View.kt\nandroidx/core/view/ViewKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 4 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n*L\n1#1,317:1\n262#2,2:318\n731#3,9:320\n37#4,2:329\n*S KotlinDebug\n*F\n+ 1 PriceEditText.kt\nglovoapp/delivery/detail/pickup/upload/quiero/PriceEditText\n*L\n47#1:318,2\n229#1:320,9\n230#1:329,2\n*E\n"})
/* loaded from: C:\Users\Diren\AppData\Local\Temp\jadx-18309976577588970056.dex */
public final class PriceEditText extends LinearLayout {
private static final int DEFAULT_DECIMAL_DIGITS = 2;
private static final int DEFAULT_INTEGER_DIGITS = 6;
private final PriceEditTextBinding binding;
private int decimalDigits;
private final DecimalTextWatcher decimalTextWatcher;
private boolean errorEnabled;
private final int grayColor;
private final int greenColor;
private double innerPrice;
private int integerDigits;
private final IntegerTextWatcher integerTextWatcher;
private OnPriceChangeListener onPriceChangeListener;
private final int redColor;
private boolean shouldShowDecimals;
private final String zeroChar;
public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
public static final int $stable = 8;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText(Context context) {
this(context, null, 0, DEFAULT_INTEGER_DIGITS, null);
Intrinsics.checkNotNullParameter(context, "context");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0, 4, null);
Intrinsics.checkNotNullParameter(context, "context");
}
public /* synthetic */ PriceEditText(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(context, (i2 & DEFAULT_DECIMAL_DIGITS) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean checkDecimalPointEvent(Editable s, char r5) {
int o = StringsKt.o(s, r5, 0, false, (int) DEFAULT_INTEGER_DIGITS);
if (o == -1) {
return false;
}
this.binding.editTextInteger.setText(StringsKt.removeRange(s, o, o + 1), TextView.BufferType.NORMAL);
if (!this.shouldShowDecimals) {
EditText editText = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
l.a(editText);
return true;
}
this.binding.editTextDecimal.requestFocus();
this.binding.editTextDecimal.setSelection(0);
return true;
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean checkEmptyInteger(Editable s) {
if (StringsKt.isBlank(s)) {
Intrinsics.checkNotNullExpressionValue(this.binding.editTextDecimal.getText(), "binding.editTextDecimal.text");
if ((!StringsKt.isBlank(r3)) != false && this.shouldShowDecimals) {
this.integerTextWatcher.byDisabling(new checkEmptyInteger.1(this));
EditText editText = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
l.a(editText);
return true;
}
return false;
}
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void onFinishInflate$lambda$0(PriceEditText priceEditText, View view, boolean z) {
boolean z2;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if (!z && !priceEditText.binding.editTextDecimal.hasFocus()) {
z2 = false;
} else {
z2 = true;
}
priceEditText.setUnderlineState(z2);
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean onFinishInflate$lambda$1(PriceEditText priceEditText, View view, int i, KeyEvent keyEvent) {
boolean z;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if (i == 22 && keyEvent.getAction() == 0) {
EditText editText = priceEditText.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextInteger");
int length = priceEditText.binding.editTextInteger.getText().length();
Intrinsics.checkNotNullParameter(editText, "<this>");
if (editText.getSelectionStart() == length && editText.getSelectionEnd() == length) {
z = true;
} else {
z = false;
}
if (z) {
priceEditText.binding.editTextDecimal.requestFocus();
priceEditText.binding.editTextDecimal.setSelection(0);
return true;
}
}
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void onFinishInflate$lambda$2(PriceEditText priceEditText, View view, boolean z) {
boolean z2;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
boolean z3 = false;
if (!z && !priceEditText.binding.editTextInteger.hasFocus()) {
z2 = false;
} else {
z2 = true;
}
priceEditText.setUnderlineState(z2);
if (z) {
Editable text = priceEditText.binding.editTextInteger.getText();
if (text == null || text.length() == 0) {
z3 = true;
}
if (z3) {
priceEditText.binding.editTextInteger.setText(priceEditText.zeroChar, TextView.BufferType.NORMAL);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean onFinishInflate$lambda$3(PriceEditText priceEditText, View view, int i, KeyEvent keyEvent) {
boolean z;
Intrinsics.checkNotNullParameter(priceEditText, "this$0");
if ((i == 67 || i == 21) && keyEvent.getAction() == 0) {
EditText editText = priceEditText.binding.editTextDecimal;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextDecimal");
Intrinsics.checkNotNullParameter(editText, "<this>");
if (editText.getSelectionStart() == 0 && editText.getSelectionEnd() == 0) {
z = true;
} else {
z = false;
}
if (z) {
priceEditText.binding.editTextInteger.requestFocus();
EditText editText2 = priceEditText.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText2, "binding.editTextInteger");
l.a(editText2);
return true;
}
}
return false;
}
private final void onPriceSet(double price) {
boolean z;
List emptyList;
boolean z2;
boolean z3;
if (price == 0.0d) {
z = true;
} else {
z = false;
}
if (z) {
this.integerTextWatcher.byDisabling(new onPriceSet.1(this));
this.decimalTextWatcher.byDisabling(new onPriceSet.2(this));
OnPriceChangeListener onPriceChangeListener = this.onPriceChangeListener;
if (onPriceChangeListener != null) {
onPriceChangeListener.onPriceChanged(price);
return;
}
return;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, b.g("%.", this.decimalDigits, "f"), Arrays.copyOf(new Object[]{Double.valueOf(price)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(locale, format, *args)");
List split = new Regex("\\.").split(StringsKt.x(format, ',', '.'), 0);
if (!split.isEmpty()) {
ListIterator listIterator = split.listIterator(split.size());
while (listIterator.hasPrevious()) {
if (((String) listIterator.previous()).length() == 0) {
z3 = true;
} else {
z3 = false;
}
if (!z3) {
emptyList = CollectionsKt.take(split, listIterator.nextIndex() + 1);
break;
}
}
}
emptyList = CollectionsKt.emptyList();
String[] strArr = (String[]) emptyList.toArray(new String[0]);
if (strArr.length == 0) {
z2 = true;
} else {
z2 = false;
}
if ((!z2) != false) {
this.integerTextWatcher.byDisabling(new onPriceSet.3(this, strArr[0]));
}
if (strArr.length > 1) {
this.decimalTextWatcher.byDisabling(new onPriceSet.4(this, strArr[1]));
}
OnPriceChangeListener onPriceChangeListener2 = this.onPriceChangeListener;
if (onPriceChangeListener2 != null) {
onPriceChangeListener2.onPriceChanged(price);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void onPriceTextChanged() {
int i;
double d;
String obj = this.binding.editTextInteger.getText().toString();
String obj2 = this.binding.editTextDecimal.getText().toString();
Integer intOrNull = StringsKt.toIntOrNull(obj);
int i2 = 0;
if (intOrNull != null) {
i = intOrNull.intValue();
} else {
i = 0;
}
Integer intOrNull2 = StringsKt.toIntOrNull(obj2);
if (intOrNull2 != null) {
i2 = intOrNull2.intValue();
}
Double doubleOrNull = StringsKt.toDoubleOrNull(i + "." + i2);
if (doubleOrNull != null) {
d = doubleOrNull.doubleValue();
} else {
d = 0.0d;
}
this.innerPrice = d;
OnPriceChangeListener onPriceChangeListener = this.onPriceChangeListener;
if (onPriceChangeListener != null) {
onPriceChangeListener.onPriceChanged(d);
}
}
private final void setEditTextsError() {
int i;
if (this.errorEnabled) {
i = this.redColor;
} else {
i = this.greenColor;
}
this.binding.editTextInteger.setTextColor(i);
this.binding.editTextDecimal.setTextColor(i);
}
private final void setShouldShowDecimals(boolean z) {
int i;
this.shouldShowDecimals = z;
EditText editText = this.binding.editTextDecimal;
Intrinsics.checkNotNullExpressionValue(editText, "binding.editTextDecimal");
if (z) {
i = 0;
} else {
i = 8;
}
editText.setVisibility(i);
if (!z) {
this.binding.editTextInteger.requestFocus();
EditText editText2 = this.binding.editTextInteger;
Intrinsics.checkNotNullExpressionValue(editText2, "binding.editTextInteger");
l.a(editText2);
this.binding.editTextInteger.setTextAlignment(4);
this.binding.editTextDecimal.setText((CharSequence) null);
return;
}
this.binding.editTextInteger.setTextAlignment(3);
}
private final void setUnderlineError() {
setUnderlineState(this.binding.editTextInteger.hasFocus() || this.binding.editTextDecimal.hasFocus());
}
private final void setUnderlineState(boolean focused) {
int i;
ViewGroup.LayoutParams layoutParams = this.binding.underline.getLayoutParams();
View view = this.binding.underline;
if (focused) {
layoutParams.height = getContext().getResources().getDimensionPixelSize(e.underline_height_focused);
i = this.greenColor;
} else {
layoutParams.height = getContext().getResources().getDimensionPixelSize(e.underline_height);
i = this.grayColor;
}
view.setBackgroundColor(i);
if (this.errorEnabled) {
this.binding.underline.setBackgroundColor(this.redColor);
}
this.binding.underline.setLayoutParams(layoutParams);
this.binding.underline.requestLayout();
}
public final PriceEditTextBinding getBinding() {
return this.binding;
}
public final int getDecimalDigits() {
return this.decimalDigits;
}
public final boolean getErrorEnabled() {
return this.errorEnabled;
}
public final int getIntegerDigits() {
return this.integerDigits;
}
public final OnPriceChangeListener getOnPriceChangeListener() {
return this.onPriceChangeListener;
}
/* renamed from: getPrice reason: from getter */
public final double getInnerPrice() {
return this.innerPrice;
}
@override // android.view.View
public void onFinishInflate() {
super.onFinishInflate();
setOrientation(1);
setIntegerDigits(DEFAULT_INTEGER_DIGITS);
setDecimalDigits(DEFAULT_DECIMAL_DIGITS);
this.binding.editTextInteger.addTextChangedListener(this.integerTextWatcher);
this.binding.editTextInteger.setOnFocusChangeListener(new a(this));
this.binding.editTextInteger.setOnKeyListener(new b(this));
this.binding.editTextDecimal.addTextChangedListener(this.decimalTextWatcher);
this.binding.editTextDecimal.setOnFocusChangeListener(new c(this));
this.binding.editTextDecimal.setOnKeyListener(new d(this));
}
public final void setDecimalDigits(int i) {
boolean z;
boolean z2;
if (i >= 0) {
if (this.decimalDigits > i) {
z = true;
} else {
z = false;
}
this.decimalDigits = i;
if (i > 0) {
z2 = true;
} else {
z2 = false;
}
setShouldShowDecimals(z2);
this.binding.editTextDecimal.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
this.binding.editTextDecimal.setHint(StringsKt.w(this.zeroChar, i));
if (z) {
EditText editText = this.binding.editTextDecimal;
editText.setText(editText.getText());
return;
}
return;
}
throw new IllegalArgumentException(a.b("decimalDigits can't be < 0 but is: ", i));
}
@override // android.view.View
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
this.binding.editTextInteger.setEnabled(enabled);
this.binding.editTextDecimal.setEnabled(enabled);
}
public final void setErrorEnabled(boolean z) {
this.errorEnabled = z;
setEditTextsError();
setUnderlineError();
}
public final void setIntegerDigits(int i) {
if (i >= 0) {
this.integerDigits = i;
this.binding.editTextInteger.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
return;
}
throw new IllegalArgumentException(a.b("integerDigits can't be < 0 but is: ", i));
}
public final void setOnPriceChangeListener(OnPriceChangeListener onPriceChangeListener) {
this.onPriceChangeListener = onPriceChangeListener;
}
public final void setPrice(double d) {
if (d >= 0.0d) {
this.innerPrice = d;
onPriceSet(d);
return;
}
throw new IllegalArgumentException("price can't be < 0.0 but is: " + d);
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public PriceEditText (контекст контекста, набор атрибутов AttributeSet, int i) {
супер(контекст, набор атрибутов, я);
Intrinsics.checkNotNullParameter(контекст, "контекст");
PriceEditTextBinding inflate = PriceEditTextBinding.inflate(LayoutInflater.from(context), this);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(LayoutInflater.from(context), this)");
this.binding = раздувать;
Строка строка = context.getString(j.zero);
Intrinsics.checkNotNullExpressionValue(строка, "context.getString(com.gl…app.design.R.string.zero)");
this.zeroChar = строка;
this.integerTextWatcher = новый IntegerTextWatcher (это);
this.decimalTextWatcher = новый DecimalTextWatcher (это);
Палитра палитра = Palette.f;
Объект obj = t3.aa;
this.greenColor = ada (контекст, палитра.c);
this.grayColor = ada(контекст, Palette.wc);
this.redColor = ada(context, Palette.mc);
this.shouldShowDecimals = истина;
this.integerDigits = DEFAULT_INTEGER_DIGITS;
this.decimalDigits = DEFAULT_DECIMAL_DIGITS;
}
}
Click to expand...
Click to collapse
I am sorry. But I'm just getting started with java.
How can I understand what needs to be changed in the code?
So that the application does not block the input of more than 4 digits.
You need to be able to enter 6 digits in a line.
Please help me.
I'm willing to pay money for help.
Write me what to do step by step.
Here is the line:
this.binding.editTextDecimal.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
Where "i" is supposedly 4.
Whoever wrote this code should be shot.
Using a custom LinearLayout with separate integer value and decimal fraction?
With two separate EditText you may be typing to decimals when you think that you're typing to integers.
I can't read the error message in the video.
Renate said:
Whoever wrote this code should be shot.
Using a custom LinearLayout with separate integer value and decimal fraction?
With two separate EditText you may be typing to decimals when you think that you're typing to integers.
I can't read the error message in the video.
Click to expand...
Click to collapse
You don't have to pay attention to the error.
I can `t get it
this.binding.editTextDecimal.setFilters(new InputFilter.LengthFilter[]{new InputFilter.LengthFilter(i)});
(i) is the number the user enters
What needs to be changed in the code? so that the user can enter more than 4 digits
In the smali:
new-array v1, v1, [Landroid/text/InputFilter$LengthFilter;
.line 27
.line 28
new-instance v4, Landroid/text/InputFilter$LengthFilter;
.line 29
.line 30
invoke-direct {v4, p1}, Landroid/text/InputFilter$LengthFilter;-><init>(I)V
.line 31
.line 32
.line 33
aput-object v4, v1, v2
new-array v1, v1, [Landroid/text/InputFilter$LengthFilter;
.line 11
.line 12
new-instance v2, Landroid/text/InputFilter$LengthFilter;
.line 13
.line 14
invoke-direct {v2, p1}, Landroid/text/InputFilter$LengthFilter;-><init>(I)V
.line 15
.line 16
.line 17
How to understand which line is responsible for integer values and which for decimal fraction?
What does <init> stand for in code?
And in the byte code, I did not figure out where the limit on the numeric value (I) is set
.smali
direngetpc said:
You don't have to pay attention to the error.
Click to expand...
Click to collapse
You're right. I don't have to.
Renate wanders off and reads a book...