System App reverse enginnering - Android Q&A, Help & Troubleshooting

Hello there!
I would need some help reverse engineering an app and recompiling it with some different code afterwards.
The App coordinates all the different components of my phone to work properly.
When you press the two fingerprint sensors, the app gives you haptic feedback and turns the screen from front to back or vice versa, depending on which side is facing up.
I need the app to do exactly that once when i wake up my phone either with fingerprint or power button, so the display illuminates which is facing up, and not the one i used recently.
I have some experience with java, but all i got are the .smali documents.
Is there any way to reliably get smali into java and back?
Code:
Code:
package org.mokee.settings.keyhandler;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
import android.os.Vibrator;
import android.provider.Settings.Secure;
import android.provider.Settings.System;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import com.android.internal.os.DeviceKeyHandler;
import org.mokee.internal.util.FileUtils;
import org.mokee.internal.util.PowerMenuConstants;
import org.mokee.settings.detector.MotionDetector;
import org.mokee.settings.detector.MotionDetector.MotionListener;
import org.mokee.settings.dualscreen.ScreenHelper;
public class KeyHandler implements DeviceKeyHandler {
private static final long DEBOUNCE_DELAY_MILLIS = 150;
public static final String FINGER_SWITCH_SETTING_KEY = "finger_switch_switch";
public static final String FORCE_FRONT_ON_CALL = "force_front_on_call";
public static final int FP_LEFT_KEY = 133;
public static final int FP_RIGHT_KEY = 134;
private static final int SWITCH_WAKELOCK_DURATION = 3000;
public static final String WAKE_FRONT_ON_CALL = "wake_front_on_call";
/* access modifiers changed from: private */
public static boolean sForceFrontOnRinging = true;
/* access modifiers changed from: private */
public static boolean sInCallRinging = false;
/* access modifiers changed from: private */
public static boolean sPressSwitch = true;
/* access modifiers changed from: private */
public static boolean sScreenTurnedOn = true;
/* access modifiers changed from: private */
public static boolean sWakeFrontOnRinging = true;
private KeyguardManager keyguardManager;
/* access modifiers changed from: private */
public final Context mContext;
private long mLeftFpDownTime = 0;
private boolean mLeftKeyPressed = false;
/* access modifiers changed from: private */
public MotionDetector mMotionDetector;
private final PowerManager mPowerManager;
private long mRightFpDownTime = 0;
private boolean mRightKeyPressed = false;
private final BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.intent.action.SCREEN_OFF")) {
KeyHandler.sScreenTurnedOn = false;
} else if (intent.getAction().equals("android.intent.action.SCREEN_ON")) {
KeyHandler.sScreenTurnedOn = true;
if (KeyHandler.sInCallRinging && KeyHandler.sWakeFrontOnRinging) {
KeyHandler.this.mSwitchScreenHandler.post(new SwitchRunnable(1));
}
} else if (intent.getAction().equals("android.intent.action.PHONE_STATE")) {
if (KeyHandler.this.mTelephonyManager == null) {
KeyHandler.this.mTelephonyManager = (TelephonyManager) KeyHandler.this.mContext.getSystemService("phone");
}
if (KeyHandler.this.mTelephonyManager.getCallState() == 1) {
KeyHandler.sInCallRinging = true;
if (KeyHandler.sScreenTurnedOn && KeyHandler.sForceFrontOnRinging) {
KeyHandler.this.mSwitchScreenHandler.post(new SwitchRunnable(1));
return;
}
return;
}
KeyHandler.sInCallRinging = false;
}
}
};
/* access modifiers changed from: private */
public ScreenHelper mSwitchHelper;
/* access modifiers changed from: private */
public Handler mSwitchScreenHandler;
private WakeLock mSwitchWakeLock;
/* access modifiers changed from: private */
public TelephonyManager mTelephonyManager;
private final Vibrator mVibrator;
class SettingsObserver extends ContentObserver {
public SettingsObserver(Handler handler) {
super(handler);
}
/* access modifiers changed from: 0000 */
public void observe() {
ContentResolver contentResolver = KeyHandler.this.mContext.getContentResolver();
contentResolver.registerContentObserver(System.getUriFor(KeyHandler.WAKE_FRONT_ON_CALL), false, this, -1);
contentResolver.registerContentObserver(System.getUriFor(KeyHandler.FORCE_FRONT_ON_CALL), false, this, -1);
contentResolver.registerContentObserver(System.getUriFor(KeyHandler.FINGER_SWITCH_SETTING_KEY), false, this, -1);
update();
}
public void onChange(boolean z) {
update();
}
/* access modifiers changed from: 0000 */
public void update() {
ContentResolver contentResolver = KeyHandler.this.mContext.getContentResolver();
boolean z = true;
KeyHandler.sPressSwitch = System.getInt(contentResolver, KeyHandler.FINGER_SWITCH_SETTING_KEY, 1) == 1;
KeyHandler.sWakeFrontOnRinging = System.getInt(contentResolver, KeyHandler.WAKE_FRONT_ON_CALL, 1) == 1;
if (System.getInt(contentResolver, KeyHandler.FORCE_FRONT_ON_CALL, 1) != 1) {
z = false;
}
KeyHandler.sForceFrontOnRinging = z;
}
}
private class SwitchRunnable implements Runnable {
private long mSwitchCompleteTime = 0;
private int mTarget;
public SwitchRunnable(int i) {
this.mTarget = i;
}
public void run() {
if (this.mTarget != ScreenHelper.getHelper().getCurrentDisplayId()) {
doSwitch();
}
}
private void doSwitch() {
if (this.mSwitchCompleteTime > 0 && SystemClock.uptimeMillis() - this.mSwitchCompleteTime < 50) {
try {
Thread.sleep(Math.abs(SystemClock.uptimeMillis() - this.mSwitchCompleteTime));
} catch (Exception e) {
}
}
KeyHandler.this.mSwitchHelper.setCurrentDisplay(this.mTarget);
readLcdState(this.mTarget);
KeyHandler.this.mMotionDetector.setCurrentDisplayId(this.mTarget);
FileUtils.writeLine("/sys/class/backlight/panel0-backlight/brightness", FileUtils.readOneLine("/sys/class/backlight/panel0-backlight/brightness"));
this.mSwitchCompleteTime = SystemClock.uptimeMillis();
}
private void readLcdState(int i) {
int i2 = 0;
while (i2 < 200) {
int parseInt = Integer.parseInt(FileUtils.readOneLine("/sys/kernel/lcd_enhance/lcd_state"));
if (i == parseInt || parseInt > 1) {
i2++;
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
return;
}
}
}
}
public KeyHandler(Context context) {
this.mContext = context;
this.mVibrator = (Vibrator) context.getSystemService(Vibrator.class);
this.mPowerManager = (PowerManager) context.getSystemService(PowerMenuConstants.GLOBAL_ACTION_KEY_POWER);
this.mSwitchWakeLock = this.mPowerManager.newWakeLock(1, "NubiaPartsGestureWakeLock:");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.SCREEN_ON");
intentFilter.addAction("android.intent.action.PHONE_STATE");
context.registerReceiver(this.mScreenStateReceiver, intentFilter);
this.mSwitchHelper = ScreenHelper.getHelper();
this.mSwitchScreenHandler = new Handler(this.mSwitchHelper.getLooper());
initMotionDetector();
initSettingsObserver();
}
private void initSettingsObserver() {
new SettingsObserver(new Handler()).observe();
}
private void initMotionDetector() {
this.mMotionDetector = new MotionDetector(this.mContext);
this.mMotionDetector.setMotionListener(new MotionListener() {
public void onMotionChange(int i) {
if (KeyHandler.sScreenTurnedOn) {
KeyHandler.this.mSwitchScreenHandler.post(new SwitchRunnable(i));
}
}
});
this.mMotionDetector.setCurrentDisplayId(ScreenHelper.getHelper().getCurrentDisplayId());
}
public KeyEvent handleKeyEvent(KeyEvent keyEvent) {
if (!hasSetupCompleted()) {
return keyEvent;
}
if (this.keyguardManager == null) {
this.keyguardManager = (KeyguardManager) this.mContext.getSystemService(KeyguardManager.class);
}
if (this.keyguardManager.isKeyguardLocked() || !sScreenTurnedOn) {
return keyEvent;
}
int keyCode = keyEvent.getKeyCode();
if (keyCode != 133 && keyCode != 134) {
return keyEvent;
}
boolean z = true;
if (keyEvent.getAction() != 1) {
z = false;
}
if (z) {
return interceptFpKeyUp(keyEvent);
}
return interceptFpKeyDown(keyEvent);
}
private KeyEvent interceptFpKeyDown(KeyEvent keyEvent) {
switch (keyEvent.getKeyCode()) {
case 133:
if (!this.mLeftKeyPressed && (keyEvent.getFlags() & 1024) == 0) {
this.mLeftKeyPressed = true;
this.mLeftFpDownTime = keyEvent.getDownTime();
triggerDoubleFpAction();
break;
}
case 134:
if (!this.mRightKeyPressed && (keyEvent.getFlags() & 1024) == 0) {
this.mRightKeyPressed = true;
this.mRightFpDownTime = keyEvent.getDownTime();
triggerDoubleFpAction();
break;
}
}
return null;
}
private KeyEvent interceptFpKeyUp(KeyEvent keyEvent) {
switch (keyEvent.getKeyCode()) {
case 133:
this.mLeftKeyPressed = false;
this.mLeftFpDownTime = 0;
break;
case 134:
this.mRightKeyPressed = false;
this.mRightFpDownTime = 0;
break;
}
if (this.mMotionDetector.isEnable()) {
this.mMotionDetector.disable();
}
return null;
}
private void triggerDoubleFpAction() {
if (this.mLeftKeyPressed && this.mRightKeyPressed && sPressSwitch) {
long uptimeMillis = SystemClock.uptimeMillis();
if (uptimeMillis <= this.mLeftFpDownTime + DEBOUNCE_DELAY_MILLIS && uptimeMillis <= this.mRightFpDownTime + DEBOUNCE_DELAY_MILLIS) {
this.mSwitchWakeLock.acquire(3000);
doHapticFeedback();
this.mMotionDetector.enable();
}
}
}
private void doHapticFeedback() {
if (this.mVibrator != null && this.mVibrator.hasVibrator()) {
this.mVibrator.vibrate(50);
}
}
private boolean hasSetupCompleted() {
return Secure.getInt(this.mContext.getContentResolver(), "user_setup_complete", 0) != 0;
}
}
Sorry for my bad english!
Thanks!

Tom04 said:
Hello there!
I would need some help reverse engineering an app and recompiling it with some different code afterwards.
The App coordinates all the different components of my phone to work properly.
When you press the two fingerprint sensors, the app gives you haptic feedback and turns the screen from front to back or vice versa, depending on which side is facing up.
I need the app to do exactly that once when i wake up my phone either with fingerprint or power button, so the display illuminates which is facing up, and not the one i used recently.
I have some experience with java, but all i got are the .smali documents.
Is there any way to reliably get smali into java and back?
Code:
Sorry for my bad english!
Thanks!
Click to expand...
Click to collapse
Try APKtool, open source, most used out there.
"apktool d (nameof the app).apk"
"apktool b (name of the app).apk" to recompile
If it's a system file, make sure you don't modify the original signature by adding -c to the last command.
Have a good day

Related

[Q] Android Maps draw path problem

I am developing an application which draws the path of the user as he moves and calculates the area .
This is the code i am trying my problem is at the start of recording the path the path is drawn even if the user has not moved and sometimes when even if user is moving the path is not drawn .
RouteOverlay class:
public class RouteOverlay extends Overlay {
private GeoPoint gp1;
private GeoPoint gp2;
private int mode = 1;
public RouteOverlay(GeoPoint paramGeoPoint1, GeoPoint paramGeoPoint2,int paramInt)
{
this.gp1 = paramGeoPoint1;
this.gp2 = paramGeoPoint2;
this.mode = paramInt;
}
public void draw(Canvas paramCanvas, MapView paramMapView,
boolean paramShadow)
{
super.draw(paramCanvas, paramMapView, paramShadow);
Projection projection = paramMapView.getProjection();
Paint mPaint = new Paint();
mPaint.setDither(true);
mPaint.setAntiAlias(true);
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(3);
mPaint.setAlpha(120);
Point p1 = new Point();
Point p2 = new Point();
Path path = new Path();
projection.toPixels(gp1, p1);
projection.toPixels(gp2, p2);
path.moveTo(p2.x,p2.y);
path.lineTo(p1.x,p1.y);
paramCanvas.drawPath(path, mPaint);
}
MainActivity:
public class MainActivity extends MapActivity {
public final LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
coordinates.add(location);
mapView.getController().animateTo(getGeoByLocation(location));
drawRoute(coordinates, mapView);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_area_measurement);
this.mapView = ((MapView) findViewById(R.id.mapview));
this.mapView.setBuiltInZoomControls(false);
this.mapView.getController().setZoom(17);
this.coordinates = new ArrayList<Location>();
}
protected boolean isRouteDisplayed() {
return false;
}
private GeoPoint getGeoByLocation(Location location) {
GeoPoint gp = null;
try {
if (location != null) {
double geoLatitude = location.getLatitude() * 1E6;
double geoLongitude = location.getLongitude() * 1E6;
gp = new GeoPoint((int) geoLatitude, (int) geoLongitude);
}
} catch (Exception e) {
e.printStackTrace();
}
return gp;
}
public String getLocationProvider(LocationManager paramLocationManager) {
try {
Criteria localCriteria = new Criteria();
localCriteria.setAccuracy(1);
localCriteria.setAltitudeRequired(false);
localCriteria.setBearingRequired(false);
localCriteria.setCostAllowed(true);
localCriteria.setPowerRequirement(3);
String str = paramLocationManager.getBestProvider(localCriteria,
true);
return str;
} catch (Exception localException) {
while (true) {
localException.printStackTrace();
}
}
}
private void drawRoute(ArrayList<Location> paramArrayList,MapView paramMapView) {
List<Overlay> overlays = paramMapView.getOverlays();
//Changed for smooth rendering
overlays.clear();
for (int i = 1; i < paramArrayList.size(); i++) {
overlays.add(new RouteOverlay(getGeoByLocation(paramArrayList.get(i - 1)), getGeoByLocation(paramArrayList.get(i)),2));
}
}
public void startRecording() {
this.isMeasuring = true;
lm = (LocationManager) getSystemService(LOCATION_SERVICE);
lm.requestLocationUpdates(getLocationProvider(lm),500,2,this.locationListener);
/*if (lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)){
gpsstatus.setText("Gps Is Enabled");
}else
{ gpsstatus.setText("Gps Is disabled");}*/
}
This probably has to do with the accuracy of the GPS. I didn't really look at your code but maybe you should add some kind of buffer. if (movement>5m){//draw stuff}

Help for Avin App or Auxiliary in

I have a problem that my monkeyboard Dab receiver needs audio in. This can be switched with the avin app. But I only need the Audio switched not the video. Is it possible to make a Task with Tasker or similar to run some code or script to switch the audio.
Because also after boot the avin app is blocking the system. For example pppwidget starts only after exiting the avin app.
I also did take a look at the code of the app but I am a completely noob at java app programming and could not identify the code for switching the audio.
Can anyone understand and help me please?
Thanks
I am on malaysk kitkat rom.
here is the code i could decompile. Maybe it is useful for my Problem
MTCAVIN.apk com microntek avin AVINActivity.java
package com.microntek.avin;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings.System;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.ImageView;
public class AVINActivity extends Activity {
private static boolean activityVisible;
private static boolean statusbarshow;
private static boolean videoEnable;
private BroadcastReceiver AVINBootReceiver;
private final int MSG_CAPTURE_OFF;
private final int MSG_CAPTURE_ON;
private final int MSG_TIME_TICK;
private final int MSG_VIDEO_CHECK;
private AudioManager am;
private Handler mHandler;
private ImageView mImageBlack;
private ImageView mImageScreen;
private boolean mInChannel;
private boolean mIsSignal;
private View mTextWarning;
private View signalshow;
private int startbackflag;
private int statusbarhidetime;
/* renamed from: com.microntek.avin.AVINActivity.1 */
class C00001 extends Handler {
C00001() {
}
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 65281:
AVINActivity.this.captureOn();
case 65282:
AVINActivity.this.captureOff();
case 65283:
AVINActivity.this.videoCheck();
case 65284:
AVINActivity.this.refresTick();
AVINActivity.this.mHandler.sendEmptyMessageDelayed(65284, 1000);
default:
}
}
}
/* renamed from: com.microntek.avin.AVINActivity.2 */
class C00012 implements OnClickListener {
C00012() {
}
public void onClick(View v) {
if (!AVINActivity.statusbarshow) {
AVINActivity.statusbarshow = true;
AVINActivity.this.mHandler.removeMessages(65284);
AVINActivity.this.mHandler.sendEmptyMessageDelayed(65284, 1000);
AVINActivity.this.statusbarhidetime = 0;
AVINActivity.this.resumeStatusBar();
} else if (AVINActivity.this.mIsSignal && AVINActivity.videoEnable) {
AVINActivity.statusbarshow = false;
AVINActivity.this.hideStatusBar();
}
}
}
/* renamed from: com.microntek.avin.AVINActivity.3 */
class C00023 extends BroadcastReceiver {
C00023() {
}
public void onReceive(Context arg0, Intent arg1) {
String action = arg1.getAction();
if (action.equals("com.microntek.bootcheck")) {
String classname = arg1.getStringExtra("class");
if (!classname.equals("com.microntek.avin") && !classname.equals("phonecallin") && !classname.equals("phonecallout")) {
AVINActivity.this.sendFinish();
}
} else if (action.equals("com.microntek.carstatechange")) {
if (AVINActivity.activityVisible && arg1.getStringExtra("type").equals("SAFE")) {
AVINActivity.videoEnable = AVINActivity.this.GetDrivingVideoEnable();
AVINActivity.this.mHandler.removeMessages(65283);
AVINActivity.this.mHandler.sendEmptyMessageDelayed(65283, 100);
}
} else if (action.equals("com.microntek.videosignalchange") && arg1.getStringExtra("type").equals("avin")) {
AVINActivity.this.mIsSignal = arg1.getBooleanExtra("sta", true);
AVINActivity.videoEnable = AVINActivity.this.GetDrivingVideoEnable();
AVINActivity.this.mHandler.removeMessages(65283);
AVINActivity.this.mHandler.sendEmptyMessageDelayed(65283, 100);
}
}
}
public AVINActivity() {
this.MSG_CAPTURE_ON = 65281;
this.MSG_CAPTURE_OFF = 65282;
this.MSG_VIDEO_CHECK = 65283;
this.MSG_TIME_TICK = 65284;
this.mImageBlack = null;
this.mTextWarning = null;
this.signalshow = null;
this.mImageScreen = null;
this.mIsSignal = true;
this.startbackflag = 0;
this.statusbarhidetime = 0;
this.am = null;
this.mInChannel = false;
this.mHandler = new C00001();
this.AVINBootReceiver = new C00023();
}
static {
videoEnable = false;
activityVisible = false;
statusbarshow = true;
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.startbackflag = getIntent().getIntExtra("start", 0);
if (this.startbackflag != 0) {
moveTaskToBack(true);
}
Intent it1 = new Intent("com.microntek.bootcheck");
it1.putExtra("class", "com.microntek.avin");
sendBroadcast(it1);
this.am = (AudioManager) getSystemService("audio");
this.statusbarhidetime = 0;
setContentView(R.layout.main);
this.signalshow = findViewById(R.id.signalshow);
this.mImageScreen = (ImageView) findViewById(R.id.screen);
this.mImageScreen.setOnClickListener(new C00012());
this.mImageBlack = (ImageView) findViewById(R.id.black);
this.mTextWarning = findViewById(R.id.safewarning);
IntentFilter itfl = new IntentFilter();
itfl.addAction("com.microntek.bootcheck");
itfl.addAction("com.microntek.carstatechange");
itfl.addAction("com.microntek.videosignalchange");
registerReceiver(this.AVINBootReceiver, itfl);
deviceOn();
sendCanBusAvinOn();
this.mHandler.sendEmptyMessageDelayed(65284, 1000);
}
private void sendFinish() {
deviceOff();
finish();
}
private void deviceOn() {
if (!this.mInChannel) {
this.am.setParameters("av_channel_enter=line");
this.mInChannel = true;
}
}
private void deviceOff() {
if (this.mInChannel) {
this.mInChannel = false;
this.am.setParameters("av_channel_exit=line");
}
}
private void sendCanBusAvinOn() {
Intent it1 = new Intent("com.microntek.canbusdisplay");
it1.putExtra("type", "avin-on");
sendBroadcast(it1);
}
private void sendCanBusAvinOff() {
Intent it1 = new Intent("com.microntek.canbusdisplay");
it1.putExtra("type", "avin-off");
sendBroadcast(it1);
}
public void onBackPressed() {
sendFinish();
}
private void refresTick() {
if (!this.mIsSignal) {
boolean en = GetDrivingVideoEnable();
if (videoEnable != en) {
videoEnable = en;
this.mHandler.removeMessages(65283);
this.mHandler.sendEmptyMessageDelayed(65283, 100);
}
}
if (this.statusbarhidetime < 10) {
this.statusbarhidetime++;
if (this.statusbarhidetime == 10 && videoEnable && statusbarshow) {
statusbarshow = false;
hideStatusBar();
}
}
}
private boolean GetDrivingVideoEnable() {
if (System.getInt(getContentResolver(), "DrivingVideoEN", 0) != 0) {
return true;
}
if (this.am.getParameters("sta_driving=").equals("true")) {
return false;
}
return true;
}
public void hideStatusBar() {
if (this.mIsSignal) {
Window win = getWindow();
LayoutParams winParams = win.getAttributes();
winParams.flags |= 1024;
win.setAttributes(winParams);
}
}
public void resumeStatusBar() {
Window win = getWindow();
LayoutParams winParams = win.getAttributes();
winParams.flags &= -1025;
win.setAttributes(winParams);
}
protected void onResume() {
super.onResume();
statusbarshow = true;
activityVisible = true;
resumeStatusBar();
captureOn();
videoEnable = GetDrivingVideoEnable();
this.mHandler.sendEmptyMessageDelayed(65283, 100);
sendBroadcast(new Intent("com.microntek.musicclockreset"));
}
protected void onPause() {
activityVisible = false;
captureOff();
super.onPause();
}
protected void onDestroy() {
this.mHandler.removeCallbacksAndMessages(null);
unregisterReceiver(this.AVINBootReceiver);
deviceOff();
sendCanBusAvinOff();
super.onDestroy();
}
protected void videoCheck() {
if (videoEnable) {
this.mTextWarning.setVisibility(4);
} else {
this.mTextWarning.setVisibility(0);
}
if (this.mIsSignal) {
this.signalshow.setVisibility(8);
return;
}
this.signalshow.setVisibility(0);
this.statusbarhidetime = 0;
if (!statusbarshow) {
resumeStatusBar();
}
statusbarshow = true;
}
protected void captureOn() {
this.am.setParameters("ctl_capture_on=line");
this.mImageBlack.setVisibility(4);
}
protected void captureOff() {
this.mImageBlack.setVisibility(0);
this.am.setParameters("ctl_capture_off=line");
}
}
Privacy Policy
Maybe simple shell command or something? Anyone?
I did a simple Tweak in the Avin app. Now it launches without Ui. For audio in only and only for kitkat roms.
I have a typo in the attached APK...
Hey there, sorry to disturb the old thread I need avin.apk only to show video input, and not cut audio in background for Spotify. Do you think I have a chance?
I suppose It is the direct oppossite of yours.
ivellios said:
Hey there, sorry to disturb the old thread I need avin.apk only to show video input, and not cut audio in background for Spotify. Do you think I have a chance?
I suppose It is the direct oppossite of yours.
Click to expand...
Click to collapse
2nd - if you're still around - can you recompile with this ?
Might be as simple as commenting out the this.am.setParameters calls
Sorry, this is not possible for me. I did not figure it out how to disable the video.

Any Errors on this Source Code? Please help?

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!!!!

Someone can tell me why it wouldn't show USB disk mount after I first read USB disk message?

My OS: Android9
Fuction: Showing USB disk's images and copy images to this device when I insert the usb disk
My question:
1.It can read the disk's path and name when I first insert the usb disk, but I can't showing the image from the disk whether using setImageBitmap(bitmap) and setImageURI(uri) of ImageView control
2.It can't show the path on the adb : /mnt/media_rw/, in commont it is will show the usb disk's name , like this: mnt/media_rw/20D3-1E69
my code is below, someone can help me , thanks!
Java:
public class TestActivity2 extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
activityLoginBinding = ActivityLoginBinding.inflate(LayoutInflater.from(this));
setContentView(activityLoginBinding.getRoot());
activityLoginBinding.button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendBroadcast(new Intent(ACTION_USB_PERMISSION));
}
});
}
/**
* 读取u盘文件
* @param device UsbMassStorageDevice实例对象
*/
private void readAllPicFromUSB(UsbMassStorageDevice device) {
// listImageUSBInfo.clear(); //清空list初始化
try { //遍历文件名
device.init();
// 设备分区
partition = device.getPartitions().get(0);
// 文件系统
currentFs = partition.getFileSystem();
// 获取 U 盘的根目录
mRootFolder = currentFs.getRootDirectory();
readAllPicFromUSB(mRootFolder,currentFs); //递归读取文件
Log.i(TAG, "picSize:" + picSize);
Log.i(TAG,"all pic count:" + picCount + ",all size:" + (long)(picSize / 1024) + "M"); //单位大小为M
picCount = 0; //归零
//所有文件加入list后通知livew刷新
Log.i(TAG,"list size----------------" + listImageUSBInfo.size());
sendBroadcast(new Intent(ACTION_USB_UPDATE_LISTVIEW));
//
} catch (Exception e) {
e.printStackTrace();
Log.i(TAG, "readDevice error:" + e.toString());
}
return;
}
/**
* 获取 U盘读写权限的申请
* @param context 上下文对象
*/
private void permissionRequest(Context context) {
Log.i(TAG,"开始申请设备权限");
try {
// 设备管理器
UsbManager usbManager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
// 获取 U 盘存储设备
UsbMassStorageDevice[] storageDevices = UsbMassStorageDevice.getMassStorageDevices(context.getApplicationContext());
PendingIntent pendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(),
0, new Intent(ACTION_USB_PERMISSION), 0);
if(storageDevices.length == 0){
Log.i(TAG,"请插入可用的 U 盘");
}else{
//可能有几个 一般只有一个 因为大部分手机只有1个otg插口
for (UsbMassStorageDevice device : storageDevices) {
if (usbManager.hasPermission(device.getUsbDevice())) {
Log.i(TAG,"USB已经获取权限");
} else {//无权限申请权限
usbManager.requestPermission(device.getUsbDevice(), pendingIntent);
}
}
}
} catch (Exception e) {
Log.i(TAG,"申请权限异常:" +e.toString());
}
}//end permissionRequest
/**
* USBDevice 转换成UsbMassStorageDevice 对象
* @param usbDevice UsbDevice对象
*/
private UsbMassStorageDevice getUsbMass(UsbDevice usbDevice) {
UsbMassStorageDevice[] storageDevices = UsbMassStorageDevice.getMassStorageDevices(mContext);
for (UsbMassStorageDevice device : storageDevices) {
if (usbDevice.equals(device.getUsbDevice())) {
return device;
}
}
return null;
}//end
@Override
protected void onResume() {
super.onResume();
initUSBService();
Log.i(TAG,"enter onResume");
}//end onresume
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(usbBroadcast); //注销广播
}
private void initUSBService() { //初始化广播监听器
usbDeviceStateFilter = new IntentFilter();
usbDeviceStateFilter.addAction(ACTION_USB_IN);
usbDeviceStateFilter.addAction(ACTION_USB_OUT);
usbDeviceStateFilter.addAction(ACTION_USB_PERMISSION);
usbDeviceStateFilter.addAction(ACTION_USB_UPDATE_LISTVIEW);
registerReceiver(usbBroadcast,usbDeviceStateFilter);
}
/**
* 广播监听u盘拔插情况
*/
private BroadcastReceiver usbBroadcast = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
mContext=context;
String action=intent.getAction();
switch (action){
case ACTION_USB_PERMISSION: //自定义广播读取u盘文件
try {
UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED,
false)){
Log.i(TAG,"已经有权限111111111111");
if (usbDevice != null) {
readAllPicFromUSB(getUsbMass(usbDevice)); //读取u盘文件
}
else
Log.i(TAG,"没有插入U盘");
}else {
Log.i(TAG,"没有获取读写权限!,开始获取22222222222222");
permissionRequest(mContext); //获取权限
}
}catch (Exception e){
Log.i(TAG, "ACTION_USB_PERMISSION error:" + e.toString());
}
break;
case ACTION_USB_IN:
Log.i(TAG, "插入了u盘");
break;
case ACTION_USB_OUT:
Log.i(TAG,"拔出了u盘");
break;
}
}
};
/**
* 获取本机设备读写权限
*/
private static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
private static int REQUEST_PERMISSION_CODE = 1;
private int ANDROID_VERSION_CURRENT = Build.VERSION.SDK_INT;
private void requestReadAndWriteAccess() {
Log.i(TAG,"now android version is :" + ANDROID_VERSION_CURRENT);
if (ANDROID_VERSION_CURRENT > Build.VERSION_CODES.LOLLIPOP){
if(ActivityCompat.checkSelfPermission(TestActivity2.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)!=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(TestActivity2.this, PERMISSIONS_STORAGE, REQUEST_PERMISSION_CODE);
Log.i(TAG,"已经获取读写权限");
}
}
}//end requestReadAndWriteAccess
/**
* 递归读取u盘文件图片文件
* @param usbFile 根文件夹
* @param fileSystem 文件系统
*/
private void readAllPicFromUSB(UsbFile usbFile, FileSystem fileSystem) {
try {
long tmp = 0;
String imgPath = "";
String imgName = "";
UsbFile[] usbFileList = usbFile.listFiles();
for (UsbFile usbFileItem:usbFileList){
if (!usbFileItem.isDirectory()){
String FileEnd = usbFileItem.getName().substring(usbFileItem.getName().lastIndexOf(".") + 1,
usbFileItem.getName().length()).toLowerCase(); //后缀名
if(FileEnd.equals("jpg") || FileEnd.equals("png") || FileEnd.equals("gif")
|| FileEnd.equals("jpeg")|| FileEnd.equals("bmp")){ //过滤出照片
tmp = usbFileItem.getLength() / 1024;
imgPath = USB_PATH_PREFIX + usbFileItem.getAbsolutePath(); //需要绝对地址
imgName = usbFileItem.getName();
Log.i(TAG,"img name:" + imgName + ",path:" + imgPath + ",size:" + tmp + "K");
picCount++;
picSize += tmp; //大小为K
// 加入到list
listImageUSBInfo.add(new ImageInfo(imgPath,imgName));
}
}else
readAllPicFromUSB(usbFileItem,fileSystem);
}
} catch (Exception e) {
e.printStackTrace();
Log.i(TAG,"readDevice error:"+e.toString());
}
}//end
}

Help with java code

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...

Categories

Resources