导航菜单

页面标题

页面副标题

Namma Yatri v3.3.7 - RideRequestActivity.java 源代码

正在查看: Namma Yatri v3.3.7 应用的 RideRequestActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package in.juspay.mobility.app;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.viewpager2.widget.ViewPager2;
import com.airbnb.lottie.LottieAnimationView;
import com.facebook.shimmer.ShimmerFrameLayout;
import com.google.android.material.progressindicator.LinearProgressIndicator;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import in.juspay.mobility.app.RideRequestActivity;
import in.juspay.mobility.app.SheetAdapter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class RideRequestActivity extends androidx.appcompat.app.d {
    private static final int MAX_RIDE_REQUESTS = 6;
    private static RideRequestActivity instance;
    private String DUMMY_FROM_LOCATION;
    Context context;
    private Timer countDownTimer;
    private volatile int currentMediaIndex;
    private volatile MediaPlayer currentMediaPlayer;
    private ArrayList<LinearLayout> indicatorList;
    private TextView indicatorText1;
    private TextView indicatorText2;
    private TextView indicatorText3;
    private TextView indicatorText4;
    private TextView indicatorText5;
    private TextView indicatorText6;
    private ArrayList<TextView> indicatorTextList;
    private ArrayList<TextView> indicatorTipBannerList;
    private ArrayList<LinearLayout> indicatorTipList;
    int isMediaPlayerPrepared;
    private final Handler mainLooper = new Handler(Looper.getMainLooper());
    private final ExecutorService mediaPlayerExecutor;
    private final MediaPlayer[] mediaPlayers;
    private LinearProgressIndicator progressIndicator1;
    private LinearProgressIndicator progressIndicator2;
    private LinearProgressIndicator progressIndicator3;
    private LinearProgressIndicator progressIndicator4;
    private LinearProgressIndicator progressIndicator5;
    private LinearProgressIndicator progressIndicator6;
    private ArrayList<LinearProgressIndicator> progressIndicatorsList;
    private CountDownTimer rideStatusListener;
    private String service;
    private SharedPreferences sharedPref;
    private final SheetAdapter sheetAdapter;
    private final ArrayList<SheetModel> sheetArrayList;
    private ShimmerFrameLayout shimmerTip1;
    private ShimmerFrameLayout shimmerTip2;
    private ShimmerFrameLayout shimmerTip3;
    private ShimmerFrameLayout shimmerTip4;
    private ShimmerFrameLayout shimmerTip5;
    private ShimmerFrameLayout shimmerTip6;
    private ArrayList<ShimmerFrameLayout> shimmerTipList;
    private int time;
    private TextView tipBanner1;
    private TextView tipBanner2;
    private TextView tipBanner3;
    private TextView tipBanner4;
    private TextView tipBanner5;
    private TextView tipBanner6;
    private TextView vehicleText1;
    private TextView vehicleText2;
    private TextView vehicleText3;
    private TextView vehicleText4;
    private TextView vehicleText5;
    private TextView vehicleText6;
    private ViewPager2 viewPager2;

    public class AnonymousClass1 implements SheetAdapter.OnItemClickListener {
        public AnonymousClass1() {
        }

        public void lambda$onViewHolderBind$0(SheetModel sheetModel, ExecutorService executorService) {
            ?? r0 = RideRequestActivity.this;
            if (RideRequestUtils.driverRespondApi(sheetModel, true, r0, ((RideRequestActivity) r0).sheetArrayList.indexOf(sheetModel)).booleanValue()) {
                Handler handler = RideRequestActivity.this.mainLooper;
                Objects.requireNonNull(executorService);
                handler.post(new RunnableC0651q0(executorService));
                RideRequestActivity.this.startLoader(sheetModel.getSearchRequestId());
            }
        }

        public void lambda$onViewHolderBind$1(final SheetModel sheetModel, int i, SheetAdapter.SheetViewHolder sheetViewHolder, View view) {
            if (sheetModel.getSearchRequestId().equals(RideRequestActivity.this.DUMMY_FROM_LOCATION)) {
                RideRequestActivity.this.respondDummyRequest();
                RideRequestActivity.this.removeCard(i);
            } else {
                sheetViewHolder.reqButton.setClickable(false);
                final ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();
                newSingleThreadExecutor.execute(new Runnable() {
                    @Override
                    public final void run() {
                        RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$0(sheetModel, newSingleThreadExecutor);
                    }
                });
            }
        }

        public static void lambda$onViewHolderBind$10(SheetModel sheetModel) {
            sheetModel.setButtonIncreasePriceAlpha(1.0f);
            sheetModel.setButtonIncreasePriceClickable(true);
        }

        public void lambda$onViewHolderBind$11(final SheetModel sheetModel, SheetAdapter.SheetViewHolder sheetViewHolder, int i, View view) {
            if (sheetModel.getOfferedPrice() > 0.0d) {
                if (sheetModel.getSpecialZonePickup() && sheetModel.getOfferedPrice() >= sheetModel.getDriverDefaultStepFee()) {
                    sheetViewHolder.specialLocExtraTip.setVisibility(8);
                }
                sheetModel.setUpdatedAmount(sheetModel.getUpdatedAmount() - sheetModel.getNegotiationUnit());
                sheetModel.setOfferedPrice(sheetModel.getOfferedPrice() - sheetModel.getNegotiationUnit());
                RideRequestActivity.this.sheetAdapter.notifyItemChanged(i, "inc");
                if (sheetModel.getOfferedPrice() == 0.0d) {
                    RideRequestActivity.this.mainLooper.post(new Runnable() {
                        @Override
                        public final void run() {
                            RideRequestActivity.AnonymousClass1.lambda$onViewHolderBind$9(SheetModel.this);
                        }
                    });
                } else {
                    RideRequestActivity.this.mainLooper.post(new Runnable() {
                        @Override
                        public final void run() {
                            RideRequestActivity.AnonymousClass1.lambda$onViewHolderBind$10(SheetModel.this);
                        }
                    });
                }
            }
        }

        public void lambda$onViewHolderBind$2(SheetModel sheetModel) {
            ?? r0 = RideRequestActivity.this;
            RideRequestUtils.driverRespondApi(sheetModel, false, r0, ((RideRequestActivity) r0).sheetArrayList.indexOf(sheetModel));
        }

        public void lambda$onViewHolderBind$3(int i, ExecutorService executorService) {
            RideRequestActivity.this.removeCard(i);
            executorService.shutdown();
            Toast.makeText(RideRequestActivity.this.getApplicationContext(), RideRequestActivity.this.getApplicationContext().getResources().getString(R.string.ride_rejected), 0).show();
        }

        public void lambda$onViewHolderBind$4(final SheetModel sheetModel, final int i, SheetAdapter.SheetViewHolder sheetViewHolder, final ExecutorService executorService) {
            if (sheetModel.getSearchRequestId().equals(RideRequestActivity.this.DUMMY_FROM_LOCATION)) {
                RideRequestActivity.this.respondDummyRequest();
                RideRequestActivity.this.removeCard(i);
            } else {
                new Thread(new Runnable() {
                    @Override
                    public final void run() {
                        RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$2(sheetModel);
                    }
                }).start();
                sheetViewHolder.rejectButton.setClickable(false);
                RideRequestActivity.this.mainLooper.post(new Runnable() {
                    @Override
                    public final void run() {
                        RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$3(i, executorService);
                    }
                });
            }
        }

        public void lambda$onViewHolderBind$5(final SheetModel sheetModel, final int i, final SheetAdapter.SheetViewHolder sheetViewHolder, View view) {
            final ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();
            newSingleThreadExecutor.execute(new Runnable() {
                @Override
                public final void run() {
                    RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$4(sheetModel, i, sheetViewHolder, newSingleThreadExecutor);
                }
            });
        }

        public static void lambda$onViewHolderBind$6(SheetModel sheetModel) {
            sheetModel.setButtonIncreasePriceAlpha(0.5f);
            sheetModel.setButtonIncreasePriceClickable(false);
            sheetModel.setButtonDecreasePriceAlpha(1.0f);
            sheetModel.setButtonDecreasePriceClickable(true);
        }

        public static void lambda$onViewHolderBind$7(SheetModel sheetModel) {
            sheetModel.setButtonDecreasePriceAlpha(1.0f);
            sheetModel.setButtonDecreasePriceClickable(true);
        }

        public void lambda$onViewHolderBind$8(final SheetModel sheetModel, int i, View view) {
            if (sheetModel.getOfferedPrice() <= sheetModel.getDriverMaxExtraFee() - sheetModel.getNegotiationUnit()) {
                sheetModel.setUpdatedAmount(sheetModel.getUpdatedAmount() + sheetModel.getNegotiationUnit());
                sheetModel.setOfferedPrice(sheetModel.getOfferedPrice() + sheetModel.getNegotiationUnit());
                RideRequestActivity.this.sheetAdapter.notifyItemChanged(i, "inc");
                if (sheetModel.getOfferedPrice() == sheetModel.getDriverMaxExtraFee()) {
                    RideRequestActivity.this.mainLooper.post(new Runnable() {
                        @Override
                        public final void run() {
                            RideRequestActivity.AnonymousClass1.lambda$onViewHolderBind$6(SheetModel.this);
                        }
                    });
                } else {
                    RideRequestActivity.this.mainLooper.post(new Runnable() {
                        @Override
                        public final void run() {
                            RideRequestActivity.AnonymousClass1.lambda$onViewHolderBind$7(SheetModel.this);
                        }
                    });
                }
            }
        }

        public static void lambda$onViewHolderBind$9(SheetModel sheetModel) {
            sheetModel.setButtonDecreasePriceAlpha(0.5f);
            sheetModel.setButtonDecreasePriceClickable(false);
            sheetModel.setButtonIncreasePriceAlpha(1.0f);
            sheetModel.setButtonIncreasePriceClickable(true);
        }

        @Override
        public void onViewHolderBind(final SheetAdapter.SheetViewHolder sheetViewHolder, final int i, ViewPager2 viewPager2, List<Object> list) {
            androidx.appcompat.app.d dVar;
            int i2;
            final SheetModel sheetModel = (SheetModel) RideRequestActivity.this.sheetArrayList.get(i);
            if ((!list.isEmpty() ? (String) list.get(0) : "").equals("inc")) {
                RideRequestActivity.this.updateIndicators();
                sheetViewHolder.baseFare.setText(String.valueOf(sheetModel.getBaseFare() + sheetModel.getUpdatedAmount()));
                sheetViewHolder.currency.setText(String.valueOf(sheetModel.getCurrency()));
                RideRequestActivity.this.updateIncreaseDecreaseButtons(sheetViewHolder, sheetModel);
                RideRequestUtils.updateRateView(sheetViewHolder, sheetModel);
                return;
            }
            sheetViewHolder.pickUpDistance.setText(sheetModel.getPickUpDistance() + " km ");
            sheetViewHolder.baseFare.setText(String.valueOf(((double) sheetModel.getBaseFare()) + sheetModel.getUpdatedAmount()));
            sheetViewHolder.distanceToBeCovered.setText(sheetModel.getDistanceToBeCovered() + " km");
            sheetViewHolder.tollTag.setVisibility(sheetModel.getTollCharges() > 0 ? 0 : 8);
            RideRequestUtils.handleDurationToPickup(sheetViewHolder, sheetModel, RideRequestActivity.this.mainLooper, RideRequestActivity.this);
            sheetViewHolder.sourceArea.setText(sheetModel.getSourceArea());
            sheetViewHolder.sourceAddress.setText(sheetModel.getSourceAddress());
            sheetViewHolder.destinationArea.setText(sheetModel.getDestinationArea());
            sheetViewHolder.destinationAddress.setText(sheetModel.getDestinationAddress());
            if (!sheetModel.isTranslated()) {
                RideRequestUtils.updateViewFromMlTranslation(sheetViewHolder, sheetModel, RideRequestActivity.this.sharedPref, RideRequestActivity.this);
            }
            sheetViewHolder.textIncPrice.setText(String.valueOf(sheetModel.getNegotiationUnit()));
            sheetViewHolder.textDecPrice.setText(String.valueOf(sheetModel.getNegotiationUnit()));
            sheetViewHolder.stopsInfo.setText(RideRequestActivity.this.getString(sheetModel.getTollCharges() > 0 ? R.string.stops : R.string.stops_info, Integer.valueOf(sheetModel.getStops())));
            sheetViewHolder.stopsInfo.setVisibility(sheetModel.getStops() > 0 ? 0 : 8);
            if (sheetModel.getSourcePinCode() == null || sheetModel.getSourcePinCode().trim().length() <= 0) {
                sheetViewHolder.sourceAddress.setMaxLines(2);
                sheetViewHolder.sourcePinCode.setVisibility(8);
            } else {
                sheetViewHolder.sourcePinCode.setText(sheetModel.getSourcePinCode().trim());
                sheetViewHolder.sourcePinCode.setVisibility(0);
            }
            if (sheetModel.getDestinationPinCode() == null || sheetModel.getDestinationPinCode().trim().length() <= 0) {
                sheetViewHolder.destinationAddress.setMaxLines(2);
                sheetViewHolder.destinationPinCode.setVisibility(8);
            } else {
                sheetViewHolder.destinationPinCode.setText(sheetModel.getDestinationPinCode());
                sheetViewHolder.destinationPinCode.setVisibility(0);
            }
            if (sheetModel.getspecialLocationTag() != null) {
                RideRequestUtils.setSpecialZoneAttrs(sheetViewHolder, sheetModel.getspecialLocationTag(), RideRequestActivity.this);
            }
            RideRequestActivity rideRequestActivity = RideRequestActivity.this;
            int rideRequestPopupDelayDuration = sheetModel.getRideRequestPopupDelayDuration();
            int startTime = sheetModel.getStartTime();
            if (sheetModel.isGotoTag()) {
                dVar = RideRequestActivity.this;
                i2 = R.string.accept_goto;
            } else {
                dVar = RideRequestActivity.this;
                i2 = R.string.accept_offer;
            }
            rideRequestActivity.updateAcceptButtonText(sheetViewHolder, rideRequestPopupDelayDuration, startTime, dVar.getString(i2));
            RideRequestUtils.updateStepFeeAndButtonAlpha(sheetViewHolder, sheetModel, RideRequestActivity.this.mainLooper);
            RideRequestActivity.this.updateIncreaseDecreaseButtons(sheetViewHolder, sheetModel);
            RideRequestActivity.this.updateTagsView(sheetViewHolder, sheetModel);
            RideRequestUtils.updateTierAndAC(sheetViewHolder, sheetModel, RideRequestActivity.this);
            RideRequestUtils.updateRateView(sheetViewHolder, sheetModel);
            RideRequestUtils.updateRentalView(sheetViewHolder, sheetModel, RideRequestActivity.this);
            RideRequestUtils.updateIntercityView(sheetViewHolder, sheetModel, RideRequestActivity.this);
            RideRequestUtils.updateExtraChargesString(sheetViewHolder, sheetModel, RideRequestActivity.this);
            RideRequestActivity.this.sharedPref.getString("VEHICLE_VARIANT", "");
            RideRequestActivity.this.findViewById(R.id.progress_loader).findViewById(R.id.lottie_view_waiting);
            sheetViewHolder.reqButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$1(sheetModel, i, sheetViewHolder, view);
                }
            });
            sheetViewHolder.rejectButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$5(sheetModel, i, sheetViewHolder, view);
                }
            });
            sheetViewHolder.buttonIncreasePrice.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$8(sheetModel, i, view);
                }
            });
            sheetViewHolder.buttonDecreasePrice.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    RideRequestActivity.AnonymousClass1.this.lambda$onViewHolderBind$11(sheetModel, sheetViewHolder, i, view);
                }
            });
            viewPager2.g(new ViewPager2.i() {
                public void onPageScrollStateChanged(int i3) {
                    RideRequestActivity.this.updateIndicators();
                    super.onPageScrollStateChanged(i3);
                }

                public void onPageScrolled(int i3, float f, int i4) {
                    RideRequestActivity.this.updateIndicators();
                    super.onPageScrolled(i3, f, i4);
                }

                public void onPageSelected(int i3) {
                    RideRequestActivity.this.updateMediaPlayer(i3);
                    NotificationUtils.firebaseLogEventWithParams(RideRequestActivity.this.context, "multiple_ride_selected", "position", i3 + "");
                    super.onPageSelected(i3);
                }
            });
        }
    }

    public class AnonymousClass2 extends TimerTask {
        public AnonymousClass2() {
        }

        public void lambda$run$0() {
            androidx.appcompat.app.d dVar;
            int i;
            for (int i2 = 0; i2 < RideRequestActivity.this.sheetArrayList.size(); i2++) {
                SheetModel sheetModel = (SheetModel) RideRequestActivity.this.sheetArrayList.get(i2);
                if ((sheetModel.getReqExpiryTime() + sheetModel.getStartTime()) - RideRequestActivity.this.time < 1) {
                    RideRequestActivity.this.removeCard(i2);
                } else {
                    SheetAdapter.SheetViewHolder holder = RideRequestActivity.this.sheetAdapter.getHolder(i2);
                    if (holder != null) {
                        RideRequestActivity rideRequestActivity = RideRequestActivity.this;
                        int rideRequestPopupDelayDuration = sheetModel.getRideRequestPopupDelayDuration();
                        int startTime = sheetModel.getStartTime();
                        if (sheetModel.isGotoTag()) {
                            dVar = RideRequestActivity.this;
                            i = R.string.accept_goto;
                        } else {
                            dVar = RideRequestActivity.this;
                            i = R.string.accept_offer;
                        }
                        rideRequestActivity.updateAcceptButtonText(holder, rideRequestPopupDelayDuration, startTime, dVar.getString(i));
                    }
                }
            }
            RideRequestActivity.this.updateProgressBars(true);
        }

        @Override
        public void run() {
            RideRequestActivity.access$1308(RideRequestActivity.this);
            RideRequestActivity.this.mainLooper.post(new Runnable() {
                @Override
                public final void run() {
                    RideRequestActivity.AnonymousClass2.this.lambda$run$0();
                }
            });
        }
    }

    public RideRequestActivity() {
        ArrayList<SheetModel> arrayList = new ArrayList<>();
        this.sheetArrayList = arrayList;
        this.time = 0;
        this.mediaPlayers = new MediaPlayer[3];
        this.currentMediaIndex = -1;
        this.isMediaPlayerPrepared = 0;
        this.service = "";
        this.DUMMY_FROM_LOCATION = "dummyFromLocation";
        this.mediaPlayerExecutor = Executors.newSingleThreadExecutor();
        this.sheetAdapter = new SheetAdapter(arrayList, this.viewPager2, new AnonymousClass1());
    }

    public static int access$1308(RideRequestActivity rideRequestActivity) {
        int i = rideRequestActivity.time;
        rideRequestActivity.time = i + 1;
        return i;
    }

    private boolean findCardById(String str) {
        try {
            if (this.sheetArrayList != null) {
                for (int i = 0; i < this.sheetArrayList.size(); i++) {
                    if (str.equals(this.sheetArrayList.get(i).getSearchRequestId())) {
                        return true;
                    }
                }
            }
            return false;
        } catch (Exception e) {
            FirebaseAnalytics.getInstance(this).c("Exception_in_findCardById", (Bundle) null);
            android.util.Log.e("RideRequestActivity", "Error in findCardById : " + e);
            return false;
        }
    }

    public static RideRequestActivity getInstance() {
        return instance;
    }

    public void lambda$addToList$2(SheetModel sheetModel, SharedPreferences sharedPreferences) {
        try {
            if (this.currentMediaIndex == -1) {
                this.currentMediaIndex = RideRequestUtils.getRideRequestSoundId(sheetModel.getRideProductType());
            }
            if (this.isMediaPlayerPrepared == 3) {
                if (this.currentMediaPlayer == null || !this.currentMediaPlayer.isPlaying()) {
                    this.currentMediaPlayer = this.mediaPlayers[this.currentMediaIndex];
                    if (this.currentMediaPlayer != null && !this.currentMediaPlayer.isPlaying()) {
                        this.currentMediaPlayer.start();
                    }
                    if (sharedPreferences.getString("AUTO_INCREASE_VOL", "true").equals("true")) {
                        RideRequestUtils.increaseVolume(this.context);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void lambda$addToList$3(Bundle bundle) {
        if (findCardById(bundle.getString(getResources().getString(R.string.SEARCH_REQUEST_ID)))) {
            return;
        }
        String string = bundle.getString(getResources().getString(R.string.SEARCH_REQ_VALID_TILL));
        float f = bundle.getInt(getResources().getString(R.string.DISTANCE_TO_PICKUP));
        float f2 = bundle.getInt(getResources().getString(R.string.DISTANCE_TO_BE_COVERED));
        int i = bundle.getInt("tollCharges");
        String string2 = bundle.getString("durationToPickup");
        DecimalFormat decimalFormat = new DecimalFormat();
        decimalFormat.setMaximumFractionDigits(2);
        String currentUTC = RideRequestUtils.getCurrentUTC();
        int calculateExpireTimer = RideRequestUtils.calculateExpireTimer(string, currentUTC);
        if (this.sheetArrayList.isEmpty()) {
            startTimer();
        }
        final SharedPreferences sharedPreferences = getApplication().getSharedPreferences(getApplicationContext().getString(R.string.preference_file_key), 0);
        final SheetModel sheetModel = new SheetModel(decimalFormat.format(f / 1000.0f), f2, i, RideRequestUtils.calculateDp(string2, decimalFormat), bundle.getString(getResources().getString(R.string.ADDRESS_PICKUP)), bundle.getString(getResources().getString(R.string.ADDRESS_DROP)), bundle.getInt(getResources().getString(R.string.BASE_FARE)), Math.min(calculateExpireTimer, 25), bundle.getString(getResources().getString(R.string.SEARCH_REQUEST_ID)), bundle.getString("destinationArea"), bundle.getString("sourceArea"), bundle.getString("currency"), this.time, bundle.getInt("driverMinExtraFee"), bundle.getInt("driverMaxExtraFee"), bundle.getInt("rideRequestPopupDelayDuration"), bundle.getInt("driverStepFeeWithCurrency", Integer.parseInt(sharedPreferences.getString("NEGOTIATION_UNIT", "10"))), bundle.getInt("customerExtraFee"), bundle.getInt("congestionCharges"), bundle.getInt("petCharges"), bundle.getString("specialLocationTag"), bundle.getString("sourcePinCode"), bundle.getString("destinationPinCode"), bundle.getString("requestedVehicleVariant"), bundle.getInt("coinsRewardedOnGoldTierRide"), Boolean.valueOf(bundle.getBoolean("disabilityTag")), Boolean.valueOf(bundle.getBoolean("isTranslated")), Boolean.valueOf(bundle.getBoolean("gotoTag")), bundle.getInt("driverPickUpCharges"), bundle.getDouble("srcLat"), bundle.getDouble("srcLng"), bundle.getDouble("destLat"), bundle.getDouble("destLng"), bundle.getBoolean("specialZonePickup"), bundle.getInt("driverDefaultStepFee"), bundle.getBoolean("downgradeEnabled", false), bundle.getInt("airConditioned", -1), bundle.getInt("ventilator", -1), bundle.getString("vehicleServiceTier", null), bundle.getString("rideProductType"), String.format("%02d:%02d Hr", Integer.valueOf(bundle.getInt("rideDuration") / 3600), Integer.valueOf((bundle.getInt("rideDuration") % 3600) / 60)), String.format("%d km", Integer.valueOf(bundle.getInt("rideDistance") / 1000)), bundle.getString("rideStartTime"), bundle.getString("rideStartDate"), bundle.getString("notificationSource"), Boolean.valueOf(bundle.getBoolean("isThirdPartyBooking")), Boolean.valueOf(bundle.getBoolean("isFavourite")), bundle.getDouble("parkingCharge"), currentUTC, bundle.getInt("middleStopCount", 0), bundle.getBoolean("roundTrip"));
        if (!this.mediaPlayerExecutor.isShutdown() && !this.mediaPlayerExecutor.isTerminated()) {
            this.mediaPlayerExecutor.execute(new Runnable() {
                @Override
                public final void run() {
                    RideRequestActivity.this.lambda$addToList$2(sheetModel, sharedPreferences);
                }
            });
        }
        this.sheetArrayList.add(sheetModel);
        this.sheetAdapter.updateSheetList(this.sheetArrayList);
        this.sheetAdapter.notifyItemInserted(this.sheetArrayList.indexOf(sheetModel));
        updateIndicators();
        updateProgressBars(false);
        RideRequestUtils.addRideReceivedEvent(null, bundle, null, "ride_request_popped_in_activity", this);
    }

    public void lambda$onCreate$0(MediaPlayer mediaPlayer) {
        this.isMediaPlayerPrepared++;
        mediaPlayer.setWakeMode(this, 1);
        if (this.isMediaPlayerPrepared != 3 || this.currentMediaIndex == -1) {
            return;
        }
        if (this.currentMediaPlayer == null || !this.currentMediaPlayer.isPlaying()) {
            this.currentMediaPlayer = this.mediaPlayers[this.currentMediaIndex];
            if (this.currentMediaPlayer != null && !this.currentMediaPlayer.isPlaying()) {
                this.currentMediaPlayer.start();
            }
            if (this.sharedPref.getString("AUTO_INCREASE_VOL", "true").equals("true")) {
                RideRequestUtils.increaseVolume(this.context);
            }
        }
    }

    public void lambda$onCreate$1() {
        for (int i = 0; i < 3; i++) {
            try {
                MediaPlayer[] mediaPlayerArr = this.mediaPlayers;
                if (mediaPlayerArr[i] == null) {
                    mediaPlayerArr[i] = MediaPlayer.create((Context) this, RideRequestUtils.getRideRequestSound(this, i));
                    this.mediaPlayers[i].setLooping(true);
                    this.mediaPlayers[i].setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                        @Override
                        public final void onPrepared(MediaPlayer mediaPlayer) {
                            RideRequestActivity.this.lambda$onCreate$0(mediaPlayer);
                        }
                    });
                }
            } catch (Exception e) {
                FirebaseCrashlytics.getInstance().recordException(new Exception("Error in onBind " + e));
                RideRequestUtils.firebaseLogEventWithParams("exception_in_on_bind", "on_create", String.valueOf(e), this);
                e.printStackTrace();
                return;
            }
        }
    }

    public void lambda$removeCard$9(int i) {
        if (this.sheetArrayList.size() <= i) {
            return;
        }
        if (i >= 0) {
            this.sheetArrayList.size();
            this.sheetArrayList.remove(i);
        }
        updateMediaPlayer(this.viewPager2.getCurrentItem());
        this.sheetAdapter.updateSheetList(this.sheetArrayList);
        this.sheetAdapter.notifyItemRemoved(i);
        this.sheetAdapter.notifyItemRangeChanged(i, this.sheetArrayList.size());
        updateIndicators();
        updateProgressBars(true);
        if (this.sheetArrayList.isEmpty()) {
            for (MediaPlayer mediaPlayer : this.mediaPlayers) {
                if (mediaPlayer != null) {
                    mediaPlayer.release();
                }
            }
            this.currentMediaPlayer = null;
            finish();
        }
    }

    public void lambda$respondDummyRequest$6() {
        Toast.makeText(getApplicationContext(), getString(R.string.test_request_successful), 0).show();
    }

    public void lambda$setIndicatorClickListener$12(int i) {
        ViewPager2 viewPager2 = this.viewPager2;
        if (viewPager2 == null) {
            return;
        }
        viewPager2.setCurrentItem(i);
        if (i < this.sheetArrayList.size()) {
            RideRequestUtils.firebaseLogEventWithParams("indicator_click", "index", String.valueOf(i), this);
        }
    }

    public void lambda$setIndicatorClickListener$13(final int i, View view) {
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$setIndicatorClickListener$12(i);
            }
        });
    }

    public void lambda$showAcknowledgement$8(View view, String str, int i) {
        TextView textView = (TextView) view.findViewById(R.id.text_waiting_for_customer);
        LottieAnimationView findViewById = view.findViewById(R.id.lottie_view_waiting);
        textView.setText(str);
        findViewById.setAnimation(i);
        findViewById.setProgress(0.0f);
        findViewById.setSpeed(1.2f);
        findViewById.x();
        CountDownTimer countDownTimer = this.rideStatusListener;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
    }

    public void lambda$startLoader$7(View view, final View view2, final String str) {
        view.setVisibility(8);
        view2.setVisibility(0);
        this.rideStatusListener = new CountDownTimer(getResources().getInteger(R.integer.LOADER_WAITING_TIME), 1000L) {
            @Override
            public void onFinish() {
                RideRequestActivity.this.getApplication().getSharedPreferences(RideRequestActivity.this.getApplicationContext().getString(R.string.preference_file_key), 0).edit().putString(RideRequestActivity.this.getResources().getString(R.string.RIDE_STATUS), "null").apply();
                RideRequestActivity.this.finish();
            }

            @Override
            public void onTick(long j) {
                SharedPreferences sharedPreferences = RideRequestActivity.this.getApplication().getSharedPreferences(RideRequestActivity.this.getApplicationContext().getString(R.string.preference_file_key), 0);
                ((TextView) view2.findViewById(R.id.text_waiting_for_customer)).setText(RideRequestActivity.this.getString(R.string.waiting_for_customer_response) + " (" + (j / 1000) + ") ...");
                if (sharedPreferences.getString(RideRequestActivity.this.getResources().getString(R.string.RIDE_STATUS), "null").equals(RideRequestActivity.this.getResources().getString(R.string.DRIVER_ASSIGNMENT))) {
                    sharedPreferences.edit().putString(RideRequestActivity.this.getResources().getString(R.string.RIDE_STATUS), "null").apply();
                    ?? r6 = RideRequestActivity.this;
                    r6.showAcknowledgement(r6.getString(R.string.DRIVER_ASSIGNMENT));
                } else if (sharedPreferences.getString(RideRequestActivity.this.getString(R.string.CLEAR_FARE), "null").equals(str)) {
                    ?? r62 = RideRequestActivity.this;
                    r62.showAcknowledgement(r62.getString(R.string.CLEAR_FARE));
                }
            }
        }.start();
    }

    public static void lambda$updateIncreaseDecreaseButtons$5(SheetAdapter.SheetViewHolder sheetViewHolder, SheetModel sheetModel) {
        sheetViewHolder.buttonIncreasePrice.setVisibility(sheetModel.getDriverMaxExtraFee() == 0 ? 8 : 0);
        sheetViewHolder.buttonDecreasePrice.setVisibility(sheetModel.getDriverMaxExtraFee() == 0 ? 8 : 0);
        sheetViewHolder.buttonDecreasePrice.setAlpha(sheetModel.getButtonDecreasePriceAlpha());
        sheetViewHolder.buttonDecreasePrice.setClickable(sheetModel.isButtonDecreasePriceClickable());
        sheetViewHolder.buttonIncreasePrice.setAlpha(sheetModel.getButtonIncreasePriceAlpha());
        sheetViewHolder.buttonIncreasePrice.setClickable(sheetModel.isButtonIncreasePriceClickable());
    }

    public void lambda$updateIndicators$11() {
        if (this.viewPager2 == null) {
            return;
        }
        if (this.indicatorText1 == null) {
            this.indicatorText1 = (TextView) findViewById(R.id.indicatorText1);
        }
        if (this.indicatorText2 == null) {
            this.indicatorText2 = (TextView) findViewById(R.id.indicatorText2);
        }
        if (this.indicatorText3 == null) {
            this.indicatorText3 = (TextView) findViewById(R.id.indicatorText3);
        }
        if (this.indicatorText4 == null) {
            this.indicatorText4 = (TextView) findViewById(R.id.indicatorText4);
        }
        if (this.indicatorText5 == null) {
            this.indicatorText5 = (TextView) findViewById(R.id.indicatorText5);
        }
        if (this.indicatorText6 == null) {
            this.indicatorText6 = (TextView) findViewById(R.id.indicatorText6);
        }
        if (this.progressIndicator1 == null) {
            this.progressIndicator1 = findViewById(R.id.progress_indicator_1);
        }
        if (this.progressIndicator2 == null) {
            this.progressIndicator2 = findViewById(R.id.progress_indicator_2);
        }
        if (this.progressIndicator3 == null) {
            this.progressIndicator3 = findViewById(R.id.progress_indicator_3);
        }
        if (this.progressIndicator4 == null) {
            this.progressIndicator4 = findViewById(R.id.progress_indicator_4);
        }
        if (this.progressIndicator5 == null) {
            this.progressIndicator5 = findViewById(R.id.progress_indicator_5);
        }
        if (this.progressIndicator6 == null) {
            this.progressIndicator6 = findViewById(R.id.progress_indicator_6);
        }
        if (this.indicatorTextList == null) {
            this.indicatorTextList = new ArrayList<>(Arrays.asList(this.indicatorText1, this.indicatorText2, this.indicatorText3, this.indicatorText4, this.indicatorText5, this.indicatorText6));
        }
        if (this.progressIndicatorsList == null) {
            this.progressIndicatorsList = new ArrayList<>(Arrays.asList(this.progressIndicator1, this.progressIndicator2, this.progressIndicator3, this.progressIndicator4, this.progressIndicator5, this.progressIndicator6));
        }
        if (this.indicatorList == null) {
            this.indicatorList = new ArrayList<>(Arrays.asList((LinearLayout) findViewById(R.id.indicator1), (LinearLayout) findViewById(R.id.indicator2), (LinearLayout) findViewById(R.id.indicator3), (LinearLayout) findViewById(R.id.indicator4), (LinearLayout) findViewById(R.id.indicator5), (LinearLayout) findViewById(R.id.indicator6)));
            setIndicatorClickListener();
        }
        if (this.indicatorTipList == null) {
            this.indicatorTipList = new ArrayList<>(Arrays.asList((LinearLayout) findViewById(R.id.tip_indicator_0), (LinearLayout) findViewById(R.id.tip_indicator_1), (LinearLayout) findViewById(R.id.tip_indicator_2), (LinearLayout) findViewById(R.id.tip_indicator_3), (LinearLayout) findViewById(R.id.tip_indicator_4), (LinearLayout) findViewById(R.id.tip_indicator_5)));
        }
        if (this.tipBanner1 == null) {
            this.tipBanner1 = (TextView) findViewById(R.id.tip_banner_view_0);
        }
        if (this.tipBanner2 == null) {
            this.tipBanner2 = (TextView) findViewById(R.id.tip_banner_view_1);
        }
        if (this.tipBanner3 == null) {
            this.tipBanner3 = (TextView) findViewById(R.id.tip_banner_view_2);
        }
        if (this.tipBanner4 == null) {
            this.tipBanner4 = (TextView) findViewById(R.id.tip_banner_view_3);
        }
        if (this.tipBanner5 == null) {
            this.tipBanner5 = (TextView) findViewById(R.id.tip_banner_view_4);
        }
        if (this.tipBanner6 == null) {
            this.tipBanner6 = (TextView) findViewById(R.id.tip_banner_view_5);
        }
        if (this.indicatorTipBannerList == null) {
            this.indicatorTipBannerList = new ArrayList<>(Arrays.asList(this.tipBanner1, this.tipBanner2, this.tipBanner3, this.tipBanner4, this.tipBanner5, this.tipBanner6));
        }
        if (this.shimmerTip1 == null) {
            this.shimmerTip1 = findViewById(R.id.shimmer_view_container_0);
        }
        if (this.shimmerTip2 == null) {
            this.shimmerTip2 = findViewById(R.id.shimmer_view_container_1);
        }
        if (this.shimmerTip3 == null) {
            this.shimmerTip3 = findViewById(R.id.shimmer_view_container_2);
        }
        if (this.shimmerTip4 == null) {
            this.shimmerTip4 = findViewById(R.id.shimmer_view_container_3);
        }
        if (this.shimmerTip5 == null) {
            this.shimmerTip5 = findViewById(R.id.shimmer_view_container_4);
        }
        if (this.shimmerTip6 == null) {
            this.shimmerTip6 = findViewById(R.id.shimmer_view_container_5);
        }
        if (this.shimmerTipList == null) {
            this.shimmerTipList = new ArrayList<>(Arrays.asList(this.shimmerTip1, this.shimmerTip2, this.shimmerTip3, this.shimmerTip4, this.shimmerTip5, this.shimmerTip6));
        }
        for (int i = 0; i < 6; i++) {
            if (i < this.sheetArrayList.size()) {
                this.shimmerTipList.get(i).setVisibility(0);
                updateTopBarBackground(i);
                this.indicatorTextList.get(i).setText(this.sharedPref.getString("CURRENCY", "₹") + (this.sheetArrayList.get(i).getBaseFare() + this.sheetArrayList.get(i).getUpdatedAmount()));
                this.progressIndicatorsList.get(i).setVisibility(0);
                updateTopBar(i);
            } else {
                this.indicatorTextList.get(i).setText("--");
                this.indicatorList.get(i).setBackgroundColor(getColor(R.color.white));
                this.indicatorTipBannerList.get(i).setText("NoNeed");
                this.shimmerTipList.get(i).setVisibility(8);
                this.progressIndicatorsList.get(i).setVisibility(8);
                this.indicatorTipBannerList.get(i).setVisibility(4);
            }
        }
    }

    public void lambda$updateMediaPlayer$10(int i) {
        if (i >= 0) {
            try {
                if (i >= this.sheetArrayList.size()) {
                    return;
                }
                if (this.currentMediaPlayer != null && this.currentMediaPlayer.isPlaying()) {
                    this.currentMediaPlayer.pause();
                }
                int rideRequestSoundId = RideRequestUtils.getRideRequestSoundId(this.sheetArrayList.get(i).getRideProductType());
                if (rideRequestSoundId == this.currentMediaIndex) {
                    return;
                }
                this.currentMediaIndex = rideRequestSoundId;
                this.currentMediaPlayer = this.mediaPlayers[this.currentMediaIndex];
                if (this.currentMediaPlayer == null || this.currentMediaPlayer.isPlaying()) {
                    return;
                }
                this.currentMediaPlayer.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public void lambda$updateTagsView$4(SheetModel sheetModel, SheetAdapter.SheetViewHolder sheetViewHolder) {
        boolean specialZonePickup = sheetModel.getSpecialZonePickup();
        String searchRequestId = sheetModel.getSearchRequestId();
        if (sheetModel.getCustomerTip() <= 0 && !sheetModel.getDisabilityTag().booleanValue() && !searchRequestId.equals(this.DUMMY_FROM_LOCATION) && !sheetModel.isGotoTag() && !specialZonePickup && !sheetModel.isFavourite().booleanValue() && sheetModel.getStops() <= 0 && !sheetModel.getRoundTrip() && sheetModel.getCoinsForGoldTierRide() <= 0 && sheetModel.getCongestionCharges() <= 0 && sheetModel.getPetCharges() <= 0) {
            sheetViewHolder.tagsBlock.setVisibility(8);
            return;
        }
        if (specialZonePickup && sheetModel.getDriverDefaultStepFee() == sheetModel.getOfferedPrice()) {
            sheetViewHolder.specialLocExtraTip.setText(sheetModel.getCurrency() + sheetModel.getDriverDefaultStepFee());
            sheetViewHolder.specialLocExtraTip.setVisibility(0);
        } else {
            sheetViewHolder.specialLocExtraTip.setVisibility(8);
        }
        sheetViewHolder.tagsBlock.setVisibility(0);
        sheetViewHolder.pointsTagText.setText(sheetModel.getCoinsForGoldTierRide() + " " + getString(R.string.points));
        sheetViewHolder.pointsTag.setVisibility(sheetModel.getCoinsForGoldTierRide() > 0 ? 0 : 8);
        sheetViewHolder.accessibilityTag.setVisibility(sheetModel.getDisabilityTag().booleanValue() ? 0 : 8);
        sheetViewHolder.specialLocTag.setVisibility(specialZonePickup ? 0 : 8);
        sheetViewHolder.customerTipText.setText(this.sharedPref.getString("CURRENCY", "₹") + " " + sheetModel.getCustomerTip() + " " + getString(R.string.tip));
        sheetViewHolder.customerTipTag.setVisibility(sheetModel.getCustomerTip() > 0 ? 0 : 8);
        sheetViewHolder.petTagText.setText(this.sharedPref.getString("CURRENCY", "₹") + " " + sheetModel.getPetCharges() + " " + getString(R.string.pet));
        sheetViewHolder.petTag.setVisibility(sheetModel.getPetCharges() > 0 ? 0 : 8);
        sheetViewHolder.congestionTagText.setText(sheetModel.getCongestionCharges() + " " + getString(R.string.extra));
        sheetViewHolder.congestionTag.setVisibility(sheetModel.getCongestionCharges() > 0 ? 0 : 8);
        sheetViewHolder.isFavouriteTag.setVisibility(sheetModel.isFavourite().booleanValue() ? 0 : 8);
        sheetViewHolder.testRequestTag.setVisibility(searchRequestId.equals(this.DUMMY_FROM_LOCATION) ? 0 : 8);
        sheetViewHolder.gotoTag.setVisibility(sheetModel.isGotoTag() ? 0 : 8);
        sheetViewHolder.reqButton.setTextColor(getColor(sheetModel.isGotoTag() ? R.color.yellow900 : R.color.white));
        sheetViewHolder.reqButton.setBackgroundTintList(sheetModel.isGotoTag() ? ColorStateList.valueOf(getColor(R.color.Black900)) : ColorStateList.valueOf(getColor(R.color.green900)));
        sheetViewHolder.rideTypeTag.setVisibility(8);
        sheetViewHolder.stopsTag.setVisibility(sheetModel.getStops() > 0 ? 0 : 8);
        sheetViewHolder.stopsTagText.setText(getString(R.string.stops, Integer.valueOf(sheetModel.getStops())));
        sheetViewHolder.roundTripRideTypeTag.setVisibility(sheetModel.getRoundTrip() ? 0 : 8);
    }

    public void removeCard(final int i) {
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$removeCard$9(i);
            }
        });
    }

    public void respondDummyRequest() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$respondDummyRequest$6();
            }
        });
    }

    private void setIndicatorClickListener() {
        if (this.viewPager2 == null) {
            return;
        }
        for (final int i = 0; i < 6; i++) {
            this.indicatorList.get(i).setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    RideRequestActivity.this.lambda$setIndicatorClickListener$13(i, view);
                }
            });
        }
    }

    public void showAcknowledgement(String str) {
        final String string = getString(str.equals(getString(R.string.DRIVER_ASSIGNMENT)) ? R.string.ride_assigned : R.string.ride_assigned_to_another_driver);
        getApplicationContext().getResources().getString(R.string.service);
        this.sharedPref.getString("VEHICLE_VARIANT", null);
        final View findViewById = findViewById(R.id.progress_loader);
        final int i = str.equals(getString(R.string.DRIVER_ASSIGNMENT)) ? R.raw.ride_accepted_lottie : R.raw.accepted_by_another_driver_lottie;
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$showAcknowledgement$8(findViewById, string, i);
            }
        });
        this.mainLooper.postDelayed(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.finish();
            }
        }, 1700L);
    }

    public void startLoader(final String str) {
        Timer timer = this.countDownTimer;
        if (timer != null) {
            timer.cancel();
        }
        for (MediaPlayer mediaPlayer : this.mediaPlayers) {
            if (mediaPlayer != null) {
                mediaPlayer.release();
            }
        }
        this.currentMediaPlayer = null;
        final View findViewById = findViewById(R.id.progress_loader);
        final View findViewById2 = findViewById(R.id.view_pager_parent);
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$startLoader$7(findViewById2, findViewById, str);
            }
        });
    }

    private void startTimer() {
        AnonymousClass2 anonymousClass2 = new AnonymousClass2();
        Timer timer = new Timer();
        this.countDownTimer = timer;
        timer.scheduleAtFixedRate(anonymousClass2, 1000L, 1000L);
    }

    public void updateAcceptButtonText(SheetAdapter.SheetViewHolder sheetViewHolder, int i, int i2, String str) {
        if (i <= 0 || this.time - i2 >= i) {
            sheetViewHolder.reqButton.setText(str);
            sheetViewHolder.reqButton.setAlpha(1.0f);
            sheetViewHolder.reqButton.setClickable(true);
            sheetViewHolder.rejectButton.setAlpha(1.0f);
            sheetViewHolder.rejectButton.setClickable(true);
            return;
        }
        sheetViewHolder.reqButton.setText(str + " (" + (i - (this.time - i2)) + " )");
        sheetViewHolder.reqButton.setAlpha(0.5f);
        sheetViewHolder.reqButton.setClickable(false);
        sheetViewHolder.rejectButton.setAlpha(0.5f);
        sheetViewHolder.rejectButton.setClickable(false);
    }

    public void updateIncreaseDecreaseButtons(final SheetAdapter.SheetViewHolder sheetViewHolder, final SheetModel sheetModel) {
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.lambda$updateIncreaseDecreaseButtons$5(SheetAdapter.SheetViewHolder.this, sheetModel);
            }
        });
    }

    public void updateIndicators() {
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$updateIndicators$11();
            }
        });
    }

    public void updateMediaPlayer(final int i) {
        if (this.mediaPlayerExecutor.isShutdown() || this.mediaPlayerExecutor.isTerminated()) {
            return;
        }
        this.mediaPlayerExecutor.execute(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$updateMediaPlayer$10(i);
            }
        });
    }

    public void updateProgressBars(boolean z) {
        if (this.sheetArrayList == null) {
            return;
        }
        try {
            this.progressIndicatorsList = new ArrayList<>(Arrays.asList(findViewById(R.id.progress_indicator_1), findViewById(R.id.progress_indicator_2), findViewById(R.id.progress_indicator_3), findViewById(R.id.progress_indicator_4), findViewById(R.id.progress_indicator_5), findViewById(R.id.progress_indicator_6)));
            for (int i = 0; i < this.sheetArrayList.size() && i < this.progressIndicatorsList.size(); i++) {
                int reqExpiryTime = (this.sheetArrayList.get(i).getReqExpiryTime() + this.sheetArrayList.get(i).getStartTime()) - this.time;
                this.progressIndicatorsList.get(i).o(reqExpiryTime * 4, z);
                if (reqExpiryTime <= 8) {
                    this.progressIndicatorsList.get(i).setIndicatorColor(new int[]{getColor(R.color.red900)});
                } else {
                    this.progressIndicatorsList.get(i).setIndicatorColor(new int[]{getColor(R.color.green900)});
                }
            }
        } catch (Exception unused) {
        }
    }

    public void updateTagsView(final SheetAdapter.SheetViewHolder sheetViewHolder, final SheetModel sheetModel) {
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$updateTagsView$4(sheetModel, sheetViewHolder);
            }
        });
    }

    private void updateTopBar(int i) {
        boolean specialZonePickup;
        int color;
        specialZonePickup = this.sheetArrayList.get(i).getSpecialZonePickup();
        String rideProductType = this.sheetArrayList.get(i).getRideProductType();
        int width = this.indicatorList.get(i).getWidth();
        if (width > 0) {
            this.indicatorTipList.get(i).setMinimumWidth((int) (width * 0.8d));
        }
        rideProductType.hashCode();
        switch (rideProductType) {
            case "Rental":
                this.indicatorTipBannerList.get(i).setVisibility(0);
                this.indicatorTipBannerList.get(i).setText(NotificationUtils.RENTAL);
                this.indicatorTipBannerList.get(i).setTextColor(getColor(R.color.white));
                this.shimmerTipList.get(i).setBackground(DrawableUtil.createRoundedDrawable(getColor(R.color.turquoise), 30.0f));
                break;
            case "InterCity":
                this.indicatorTipBannerList.get(i).setVisibility(0);
                this.indicatorTipBannerList.get(i).setText("Intercity");
                this.indicatorTipBannerList.get(i).setTextColor(getColor(R.color.white));
                this.shimmerTipList.get(i).setBackground(DrawableUtil.createRoundedDrawable(getColor(R.color.blue800), 30.0f));
                break;
            case "Delivery":
                this.indicatorTipBannerList.get(i).setVisibility(0);
                this.indicatorTipBannerList.get(i).setText(NotificationUtils.DELIVERY);
                this.indicatorTipBannerList.get(i).setTextColor(getColor(R.color.Black800));
                this.shimmerTipList.get(i).setBackground(DrawableUtil.createRoundedDrawable(Color.parseColor("#FEEBB9"), 30.0f));
                break;
            default:
                String str = "Favourite";
                if (this.sheetArrayList.get(i).getCustomerTip() <= 0 && this.sheetArrayList.get(i).getCongestionCharges() <= 0 && !specialZonePickup && !this.sheetArrayList.get(i).isFavourite().booleanValue()) {
                    this.indicatorTipBannerList.get(i).setText("Favourite");
                    this.shimmerTipList.get(i).setVisibility(4);
                    this.indicatorTipBannerList.get(i).setVisibility(4);
                    break;
                } else {
                    this.indicatorTipBannerList.get(i).setVisibility(0);
                    TextView textView = this.indicatorTipBannerList.get(i);
                    if (specialZonePickup) {
                        str = "Zone";
                    } else if (this.sheetArrayList.get(i).getCustomerTip() > 0) {
                        str = "TIP";
                    } else if (this.sheetArrayList.get(i).getCongestionCharges() > 0) {
                        str = this.sharedPref.getString("CURRENCY", "₹") + this.sharedPref.getString("CURRENCY", "₹");
                    }
                    textView.setText(str);
                    this.indicatorTipBannerList.get(i).setTextColor(getColor((!specialZonePickup && this.sheetArrayList.get(i).getCustomerTip() > 0) ? R.color.black650 : R.color.white));
                    ShimmerFrameLayout shimmerFrameLayout = this.shimmerTipList.get(i);
                    if (specialZonePickup) {
                        color = Color.parseColor("#53BB6F");
                    } else {
                        color = getColor(this.sheetArrayList.get(i).getCustomerTip() > 0 ? R.color.yellow900 : this.sheetArrayList.get(i).getCongestionCharges() > 0 ? R.color.orange900 : R.color.blue800);
                    }
                    shimmerFrameLayout.setBackground(DrawableUtil.createRoundedDrawable(color, 30.0f));
                    break;
                }
                break;
        }
    }

    private void updateTopBarBackground(int i) {
        boolean specialZonePickup;
        int currentItem = this.viewPager2.getCurrentItem();
        ArrayList<LinearLayout> arrayList = this.indicatorList;
        if (currentItem != arrayList.indexOf(arrayList.get(i))) {
            this.indicatorList.get(i).setBackgroundColor(getColor(R.color.white));
            this.progressIndicatorsList.get(i).setTrackColor(getColor(R.color.grey900));
            return;
        }
        specialZonePickup = this.sheetArrayList.get(i).getSpecialZonePickup();
        String rideProductType = this.sheetArrayList.get(i).getRideProductType();
        rideProductType.hashCode();
        switch (rideProductType) {
            case "Rental":
                this.indicatorList.get(i).setBackgroundColor(getColor(R.color.turquoise10));
                break;
            case "InterCity":
                this.indicatorList.get(i).setBackgroundColor(getColor(R.color.blue600));
                break;
            case "Delivery":
                this.indicatorList.get(i).setBackgroundColor(getColor(R.color.white));
                break;
            default:
                this.indicatorList.get(i).setBackgroundColor(getColor(specialZonePickup ? R.color.green100 : this.sheetArrayList.get(i).getCustomerTip() > 0 ? R.color.yellow200 : this.sheetArrayList.get(i).getCongestionCharges() > 0 ? R.color.orange100 : R.color.grey900));
                break;
        }
        this.progressIndicatorsList.get(i).setTrackColor(getColor(R.color.white));
    }

    public void addToList(final Bundle bundle) {
        ArrayList<SheetModel> arrayList;
        if (bundle == null || (arrayList = this.sheetArrayList) == null || arrayList.size() >= 6 || findCardById(bundle.getString(getResources().getString(R.string.SEARCH_REQUEST_ID)))) {
            return;
        }
        this.mainLooper.post(new Runnable() {
            @Override
            public final void run() {
                RideRequestActivity.this.lambda$addToList$3(bundle);
            }
        });
    }

    public void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        this.context = this;
        if (!this.mediaPlayerExecutor.isShutdown() && !this.mediaPlayerExecutor.isTerminated()) {
            this.mediaPlayerExecutor.execute(new Runnable() {
                @Override
                public final void run() {
                    RideRequestActivity.this.lambda$onCreate$1();
                }
            });
        }
        this.service = getApplicationContext().getResources().getString(R.string.service);
        instance = this;
        setContentView(R.layout.activity_ride_request);
        ViewPager2 findViewById = findViewById(R.id.view_pager);
        this.viewPager2 = findViewById;
        this.sheetAdapter.setViewPager(findViewById);
        this.viewPager2.setAdapter(this.sheetAdapter);
        if (this.sharedPref == null) {
            this.sharedPref = getApplication().getSharedPreferences(getApplicationContext().getString(R.string.preference_file_key), 0);
        }
        if (getIntent() != null) {
            addToList(getIntent().getExtras());
        }
    }

    public void onDestroy() {
        instance = null;
        this.time = 0;
        this.sheetArrayList.clear();
        Timer timer = this.countDownTimer;
        if (timer != null) {
            timer.cancel();
        }
        for (MediaPlayer mediaPlayer : this.mediaPlayers) {
            if (mediaPlayer != null) {
                mediaPlayer.release();
            }
        }
        this.currentMediaPlayer = null;
        NotificationUtils.lastRideReq.clear();
        RideRequestUtils.cancelRideReqNotification(this);
        this.mediaPlayerExecutor.shutdown();
        super.onDestroy();
    }

    public void onPause() {
        NotificationUtils.lastRideReq.clear();
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
    }

    public void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        RideRequestUtils.cancelRideReqNotification(this);
    }

    public boolean removeCardById(String str) {
        if (this.sheetArrayList.size() > 0) {
            for (int i = 0; i < this.sheetArrayList.size(); i++) {
                if (str.equals(this.sheetArrayList.get(i).getSearchRequestId())) {
                    removeCard(i);
                    return true;
                }
            }
        }
        return false;
    }
}