正在查看: Namma Yatri v3.3.7 应用的 OverlaySheetService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Namma Yatri v3.3.7 应用的 OverlaySheetService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.juspay.mobility.app;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
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.OverlaySheetService;
import in.juspay.mobility.app.RemoteConfigs.MobilityRemoteConfigs;
import in.juspay.mobility.app.SheetAdapter;
import in.juspay.mobility.app.callbacks.CallBack;
import in.juspay.mobility.common.services.MobilityCallAPI;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.json.JSONException;
import org.json.JSONObject;
public class OverlaySheetService extends Service implements View.OnTouchListener {
private static final int MAX_RIDE_REQUESTS = 6;
private static final String TAG = "OverlaySheetService";
private static final String TAG_MEDIA_PLAYER = "OverlaySheetService:MediaPlayer";
private static final ArrayList<CallBack> callBack = new ArrayList<>();
private static MobilityRemoteConfigs remoteConfigs = new MobilityRemoteConfigs(false, true);
private final String AC_TAXI;
private final String BRAND_VIVO;
private String DUMMY_FROM_LOCATION;
private final String NON_AC;
private View apiLoader;
private Context context;
private Timer countDownTimer;
private volatile int currentMediaIndex;
private volatile MediaPlayer currentMediaPlayer;
ExecutorService executor;
private View floatyView;
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;
private Boolean isRideAcceptedOrRejected;
private boolean isServiceDestroyed = false;
private String key;
private FirebaseAnalytics mFirebaseAnalytics;
private final Handler mainLooper;
private ExecutorService mediaPlayerExecutor;
private final MediaPlayer[] mediaPlayers;
private SheetModel modelForLogs;
private WindowManager.LayoutParams params;
private View progressDialog;
private LinearProgressIndicator progressIndicator1;
private LinearProgressIndicator progressIndicator2;
private LinearProgressIndicator progressIndicator3;
private LinearProgressIndicator progressIndicator4;
private LinearProgressIndicator progressIndicator5;
private LinearProgressIndicator progressIndicator6;
private ArrayList<LinearProgressIndicator> progressIndicatorsList;
private int retryAddViewCount;
private CountDownTimer rideStatusListener;
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 viewPager;
private WindowManager windowManager;
public class AnonymousClass3 extends TimerTask {
public AnonymousClass3() {
}
public void lambda$run$0() {
OverlaySheetService overlaySheetService;
int i;
for (int i2 = 0; i2 < OverlaySheetService.this.sheetArrayList.size(); i2++) {
SheetModel sheetModel = (SheetModel) OverlaySheetService.this.sheetArrayList.get(i2);
if ((sheetModel.getReqExpiryTime() + sheetModel.getStartTime()) - OverlaySheetService.this.time < 1) {
OverlaySheetService.this.removeCard(i2);
} else {
SheetAdapter.SheetViewHolder holder = OverlaySheetService.this.sheetAdapter.getHolder(i2);
if (holder != null) {
OverlaySheetService overlaySheetService2 = OverlaySheetService.this;
int rideRequestPopupDelayDuration = sheetModel.getRideRequestPopupDelayDuration();
int startTime = sheetModel.getStartTime();
if (sheetModel.isGotoTag()) {
overlaySheetService = OverlaySheetService.this;
i = R.string.accept_goto;
} else {
overlaySheetService = OverlaySheetService.this;
i = R.string.accept_offer;
}
overlaySheetService2.updateAcceptButtonText(holder, rideRequestPopupDelayDuration, startTime, overlaySheetService.getString(i));
}
}
}
OverlaySheetService.this.updateProgressBars(true);
}
@Override
public void run() {
OverlaySheetService.access$1608(OverlaySheetService.this);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.AnonymousClass3.this.lambda$run$0();
}
});
}
}
public class OverlayBinder extends Binder {
public OverlayBinder() {
}
public OverlaySheetService getService() {
return OverlaySheetService.this;
}
}
public OverlaySheetService() {
ArrayList<SheetModel> arrayList = new ArrayList<>();
this.sheetArrayList = arrayList;
this.mainLooper = new Handler(Looper.getMainLooper());
this.executor = Executors.newSingleThreadExecutor();
this.mediaPlayers = new MediaPlayer[3];
this.currentMediaIndex = -1;
this.time = 0;
this.retryAddViewCount = 10;
this.isRideAcceptedOrRejected = Boolean.FALSE;
this.key = "";
this.DUMMY_FROM_LOCATION = "dummyFromLocation";
this.BRAND_VIVO = "vivo";
this.NON_AC = "Non AC";
this.AC_TAXI = "AC Taxi";
this.mediaPlayerExecutor = Executors.newSingleThreadExecutor();
this.sheetAdapter = new SheetAdapter(arrayList, this.viewPager, new SheetAdapter.OnItemClickListener() {
@Override
public void onViewHolderBind(SheetAdapter.SheetViewHolder sheetViewHolder, int i, ViewPager2 viewPager2, List<Object> list) {
OverlaySheetService overlaySheetService;
int i2;
SheetModel sheetModel = (SheetModel) OverlaySheetService.this.sheetArrayList.get(i);
OverlaySheetService.this.modelForLogs = sheetModel;
if ((list.size() > 0 ? (String) list.get(0) : "").equals("inc")) {
OverlaySheetService.this.updateIndicators();
sheetViewHolder.baseFare.setText(String.valueOf(sheetModel.getBaseFare() + sheetModel.getUpdatedAmount()));
sheetViewHolder.currency.setText(String.valueOf(sheetModel.getCurrency()));
OverlaySheetService.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.currency.setText(String.valueOf(sheetModel.getCurrency()));
sheetViewHolder.distanceToBeCovered.setText(sheetModel.getDistanceToBeCovered() + " km");
sheetViewHolder.tollTag.setVisibility(sheetModel.getTollCharges() > 0 ? 0 : 8);
RideRequestUtils.handleDurationToPickup(sheetViewHolder, sheetModel, OverlaySheetService.this.mainLooper, OverlaySheetService.this);
sheetViewHolder.sourceArea.setText(sheetModel.getSourceArea());
sheetViewHolder.sourceAddress.setText(sheetModel.getSourceAddress());
sheetViewHolder.destinationArea.setText(sheetModel.getDestinationArea());
sheetViewHolder.destinationAddress.setText(sheetModel.getDestinationAddress());
sheetViewHolder.stopsInfo.setText(OverlaySheetService.this.getString(sheetModel.getTollCharges() > 0 ? R.string.stops : R.string.stops_info, Integer.valueOf(sheetModel.getStops())));
sheetViewHolder.stopsInfo.setVisibility(sheetModel.getStops() > 0 ? 0 : 8);
sheetViewHolder.textIncPrice.setText(String.valueOf(sheetModel.getNegotiationUnit()));
sheetViewHolder.textDecPrice.setText(String.valueOf(sheetModel.getNegotiationUnit()));
OverlaySheetService.this.handlePinCode(sheetModel, sheetViewHolder);
if (sheetModel.getspecialLocationTag() != null) {
RideRequestUtils.setSpecialZoneAttrs(sheetViewHolder, sheetModel.getspecialLocationTag(), OverlaySheetService.this);
}
OverlaySheetService overlaySheetService2 = OverlaySheetService.this;
overlaySheetService2.sharedPref = overlaySheetService2.getApplication().getSharedPreferences(OverlaySheetService.this.context.getString(R.string.preference_file_key), 0);
if (OverlaySheetService.this.sharedPref.getString("USE_ML_TRANSLATE", "false").equals("false") && !sheetModel.isTranslated()) {
RideRequestUtils.updateViewFromMlTranslation(sheetViewHolder, sheetModel, OverlaySheetService.this.sharedPref, OverlaySheetService.this);
}
OverlaySheetService overlaySheetService3 = OverlaySheetService.this;
int rideRequestPopupDelayDuration = sheetModel.getRideRequestPopupDelayDuration();
int startTime = sheetModel.getStartTime();
if (sheetModel.isGotoTag()) {
overlaySheetService = OverlaySheetService.this;
i2 = R.string.accept_goto;
} else {
overlaySheetService = OverlaySheetService.this;
i2 = R.string.accept_offer;
}
overlaySheetService3.updateAcceptButtonText(sheetViewHolder, rideRequestPopupDelayDuration, startTime, overlaySheetService.getString(i2));
RideRequestUtils.updateStepFeeAndButtonAlpha(sheetViewHolder, sheetModel, OverlaySheetService.this.mainLooper);
OverlaySheetService.this.updateIncreaseDecreaseButtons(sheetViewHolder, sheetModel);
OverlaySheetService.this.updateTagsView(sheetViewHolder, sheetModel);
RideRequestUtils.updateRateView(sheetViewHolder, sheetModel);
RideRequestUtils.updateTierAndAC(sheetViewHolder, sheetModel, OverlaySheetService.this);
RideRequestUtils.updateRentalView(sheetViewHolder, sheetModel, OverlaySheetService.this);
RideRequestUtils.updateIntercityView(sheetViewHolder, sheetModel, OverlaySheetService.this);
RideRequestUtils.updateExtraChargesString(sheetViewHolder, sheetModel, OverlaySheetService.this);
OverlaySheetService.this.requestButtonClickListener(sheetViewHolder, sheetModel, i);
OverlaySheetService.this.rejectButtonClickListener(sheetViewHolder, sheetModel, i);
OverlaySheetService.this.increaseButtonClickListener(sheetViewHolder, sheetModel, i);
OverlaySheetService.this.decreaseButtonClickListener(sheetViewHolder, sheetModel, i);
OverlaySheetService.this.pagerCallbackListener();
}
});
}
public static int access$1608(OverlaySheetService overlaySheetService) {
int i = overlaySheetService.time;
overlaySheetService.time = i + 1;
return i;
}
private void addPagerLayoutToWindow() {
if (!Build.MANUFACTURER.equals("vivo")) {
this.windowManager.addView(this.floatyView, this.params);
return;
}
try {
int i = this.retryAddViewCount;
if (i > 1) {
this.retryAddViewCount = i - 1;
this.windowManager.addView(this.floatyView, this.params);
} else {
firebaseLogEvent("not_able_to_add_view_to_window");
cleanUp();
}
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in addPagerLayoutToWindow " + e));
Iterator it = new ArrayList(Arrays.asList(this.floatyView, this.progressDialog, this.apiLoader)).iterator();
while (it.hasNext()) {
View view = (View) it.next();
if (view != null && view.isAttachedToWindow()) {
this.windowManager.removeViewImmediate(view);
}
}
addPagerLayoutToWindow();
}
}
public void checkDriverRideList() {
final ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();
newSingleThreadExecutor.execute(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$checkDriverRideList$32(newSingleThreadExecutor);
}
});
}
public void cleanUp() {
if (!this.isRideAcceptedOrRejected.booleanValue()) {
firebaseLogEvent("ride_ignored");
RideRequestUtils.addRideReceivedEvent(null, null, this.modelForLogs, "ride_ignored", this);
}
try {
this.retryAddViewCount = 10;
callBack.clear();
this.countDownTimer.cancel();
this.sheetAdapter.updateSheetList(new ArrayList<>());
this.viewPager = null;
CountDownTimer countDownTimer = this.rideStatusListener;
if (countDownTimer != null) {
countDownTimer.cancel();
this.rideStatusListener = null;
}
View view = this.floatyView;
if (view != null && view.getParent() != null) {
this.windowManager.removeViewImmediate(this.floatyView);
}
View view2 = this.progressDialog;
if (view2 != null && view2.isAttachedToWindow() && this.progressDialog.getParent() != null) {
this.windowManager.removeViewImmediate(this.progressDialog);
}
View view3 = this.apiLoader;
if (view3 != null && view3.getParent() != null) {
this.windowManager.removeViewImmediate(this.apiLoader);
}
this.floatyView = null;
this.progressDialog = null;
this.apiLoader = null;
for (MediaPlayer mediaPlayer : this.mediaPlayers) {
if (mediaPlayer != null && mediaPlayer.isPlaying()) {
mediaPlayer.pause();
}
}
this.currentMediaPlayer = null;
this.currentMediaIndex = -1;
this.time = 0;
this.sheetArrayList.clear();
NotificationUtils.binder = null;
NotificationUtils.listData = new ArrayList<>();
stopSelf();
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in CleanUp " + e));
firebaseLogEventWithParams("exception_in_clean_up", "clean_up", String.valueOf(e));
android.util.Log.e("EXCEPTION", e.toString());
}
}
public static void deRegisterCallback(CallBack callBack2) {
callBack.remove(callBack2);
}
public void decreaseButtonClickListener(final SheetAdapter.SheetViewHolder sheetViewHolder, final SheetModel sheetModel, final int i) {
sheetViewHolder.buttonDecreasePrice.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
OverlaySheetService.this.lambda$decreaseButtonClickListener$4(sheetModel, sheetViewHolder, i, view);
}
});
}
private java.lang.Boolean driverRespondApi(in.juspay.mobility.app.SheetModel r17, boolean r18, int r19) {
throw new UnsupportedOperationException("Method not decompiled: in.juspay.mobility.app.OverlaySheetService.driverRespondApi(in.juspay.mobility.app.SheetModel, boolean, int):java.lang.Boolean");
}
private boolean findCardById(String str) {
for (int i = 0; i < this.sheetArrayList.size(); i++) {
try {
if (str.equals(this.sheetArrayList.get(i).getSearchRequestId())) {
return true;
}
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in findCardById " + e));
this.mFirebaseAnalytics.c("Exception_in_findCardById", (Bundle) null);
android.util.Log.e(TAG, "Error in findCardById " + e);
return false;
}
}
return false;
}
public void handlePinCode(final SheetModel sheetModel, final SheetAdapter.SheetViewHolder sheetViewHolder) {
if (sheetModel.getSourcePinCode() != null && sheetModel.getSourcePinCode().trim().length() > 0) {
sheetViewHolder.sourcePinCode.setText(sheetModel.getSourcePinCode().trim());
sheetViewHolder.sourcePinCode.setVisibility(0);
} else if (remoteConfigs.hasKey("enable_pincode") && remoteConfigs.getBoolean("enable_pincode")) {
new Thread(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$handlePinCode$17(sheetModel, sheetViewHolder);
}
}).start();
}
if (sheetModel.getDestinationPinCode() != null && sheetModel.getDestinationPinCode().trim().length() > 0) {
sheetViewHolder.destinationPinCode.setText(sheetModel.getDestinationPinCode());
sheetViewHolder.destinationPinCode.setVisibility(0);
} else if (remoteConfigs.hasKey("enable_pincode") && remoteConfigs.getBoolean("enable_pincode")) {
new Thread(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$handlePinCode$19(sheetModel, sheetViewHolder);
}
}).start();
}
}
public void increaseButtonClickListener(SheetAdapter.SheetViewHolder sheetViewHolder, final SheetModel sheetModel, final int i) {
sheetViewHolder.buttonIncreasePrice.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
OverlaySheetService.this.lambda$increaseButtonClickListener$7(sheetModel, i, view);
}
});
}
public void lambda$addToList$24(SheetModel sheetModel) {
try {
if (this.currentMediaIndex == -1) {
this.currentMediaIndex = RideRequestUtils.getRideRequestSoundId(sheetModel.getRideProductType());
}
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 == null) {
this.sharedPref = getApplication().getSharedPreferences(this.context.getString(R.string.preference_file_key), 0);
}
if (this.sharedPref.getString("AUTO_INCREASE_VOL", "true").equals("true")) {
RideRequestUtils.increaseVolume(this.context);
}
}
} catch (Exception e) {
android.util.Log.e(TAG_MEDIA_PLAYER, e.toString());
}
}
public void lambda$addToList$25(Bundle bundle, String str) {
String str2;
String string = bundle.getString(getResources().getString(R.string.SEARCH_REQ_VALID_TILL));
int i = bundle.getInt(getResources().getString(R.string.BASE_FARE));
String string2 = bundle.getString("currency");
float f = bundle.getInt(getResources().getString(R.string.DISTANCE_TO_PICKUP));
float f2 = bundle.getInt(getResources().getString(R.string.DISTANCE_TO_BE_COVERED));
int i2 = bundle.getInt("tollCharges");
String string3 = bundle.getString(getResources().getString(R.string.ADDRESS_PICKUP));
String string4 = bundle.getString(getResources().getString(R.string.ADDRESS_DROP));
String string5 = bundle.getString("sourceArea");
String string6 = bundle.getString("destinationArea");
int i3 = bundle.getInt("driverMaxExtraFee");
String string7 = bundle.getString("durationToPickup");
int i4 = bundle.getInt("driverMinExtraFee");
int i5 = bundle.getInt("rideRequestPopupDelayDuration");
String string8 = bundle.getString("specialLocationTag");
String string9 = bundle.getString("sourcePinCode");
String string10 = bundle.getString("destinationPinCode");
DecimalFormat decimalFormat = new DecimalFormat("###.##", new DecimalFormatSymbols(new Locale("en", "us")));
String string11 = bundle.getString("requestedVehicleVariant");
int i6 = bundle.getInt("coinsRewardedOnGoldTierRide");
Boolean valueOf = Boolean.valueOf(bundle.getBoolean("disabilityTag"));
Boolean valueOf2 = Boolean.valueOf(bundle.getBoolean("isTranslated"));
int i7 = bundle.getInt("driverPickUpCharges");
int i8 = bundle.getInt("driverDefaultStepFee");
boolean z = bundle.getBoolean("specialZonePickup");
decimalFormat.setMaximumFractionDigits(2);
String currentUTC = RideRequestUtils.getCurrentUTC();
int calculateExpireTimer = RideRequestUtils.calculateExpireTimer(string, currentUTC);
if (this.sharedPref == null) {
str2 = currentUTC;
this.sharedPref = getApplication().getSharedPreferences(this.context.getString(R.string.preference_file_key), 0);
} else {
str2 = currentUTC;
}
int i9 = bundle.getInt("driverStepFeeWithCurrency", Integer.parseInt(this.sharedPref.getString("NEGOTIATION_UNIT", "10")));
int parseInt = Integer.parseInt(this.sharedPref.getString("RIDE_REQUEST_BUFFER", "2"));
int i10 = bundle.getInt("customerExtraFee");
int i11 = bundle.getInt("congestionCharges");
int i12 = bundle.getInt("petCharges");
boolean z2 = bundle.getBoolean("gotoTag");
double d = bundle.getDouble("srcLat");
double d2 = bundle.getDouble("srcLng");
double d3 = bundle.getDouble("destLat");
double d4 = bundle.getDouble("destLng");
boolean z3 = bundle.getBoolean("downgradeEnabled", false);
int i13 = bundle.getInt("airConditioned", -1);
int i14 = bundle.getInt("ventilator", -1);
String string12 = bundle.getString("vehicleServiceTier", null);
String string13 = bundle.getString("rideProductType");
String format = String.format("%02d:%02d hr", Integer.valueOf(bundle.getInt("rideDuration") / 3600), Integer.valueOf((bundle.getInt("rideDuration") % 3600) / 60));
String format2 = String.format("%d km", Integer.valueOf(bundle.getInt("rideDistance") / 1000));
String string14 = bundle.getString("rideStartTime");
String string15 = bundle.getString("rideStartDate");
String string16 = bundle.getString("notificationSource");
boolean z4 = bundle.getBoolean("isThirdPartyBooking");
Boolean valueOf3 = Boolean.valueOf(bundle.getBoolean("isFavourite"));
double d5 = bundle.getDouble("parkingCharge", 0.0d);
int i15 = bundle.getInt("middleStopCount", 0);
boolean z5 = bundle.getBoolean("roundTrip");
if (calculateExpireTimer > parseInt) {
calculateExpireTimer -= parseInt;
}
final SheetModel sheetModel = new SheetModel(decimalFormat.format(f / 1000.0f), f2, i2, RideRequestUtils.calculateDp(string7, decimalFormat), string3, string4, i, calculateExpireTimer, str, string6, string5, string2, this.time, i4, i3, i5, i9, i10, i11, i12, string8, string9, string10, string11, i6, valueOf, valueOf2, Boolean.valueOf(z2), i7, d, d2, d3, d4, z, i8, z3, i13, i14, string12, string13, format, format2, string14, string15, string16, Boolean.valueOf(z4), valueOf3, d5, str2, i15, z5);
if (!this.mediaPlayerExecutor.isShutdown() && !this.mediaPlayerExecutor.isTerminated()) {
this.mediaPlayerExecutor.execute(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$addToList$24(sheetModel);
}
});
}
if (this.floatyView == null) {
startTimer();
showOverLayPopup(bundle);
}
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", this);
}
public void lambda$addToList$26(final Bundle bundle, Handler handler) {
final String string = bundle.getString("searchRequestId");
HashMap<String, Long> hashMap = MyFirebaseMessagingService.clearedRideRequest;
boolean containsKey = hashMap.containsKey(string);
boolean findCardById = findCardById(string);
if (this.sheetArrayList.size() < 6 && !findCardById && !containsKey) {
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$addToList$25(bundle, string);
}
});
return;
}
if (containsKey) {
hashMap.remove(string);
}
String str = "ride_ignored_while_adding_to_list";
RideRequestUtils.addRideReceivedEvent(null, bundle, null, "ride_ignored_while_adding_to_list", this);
if (this.sheetArrayList.size() >= 6) {
str = "ride_ignored_list_full";
} else if (findCardById) {
str = "ride_ignored_already_present";
} else if (containsKey) {
str = "ride_ignored_already_cleared";
}
firebaseLogEvent(str);
}
public void lambda$addToList$27(final Bundle bundle, final Handler handler) {
this.executor.execute(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$addToList$26(bundle, handler);
}
});
}
public void lambda$checkDriverRideList$31(SharedPreferences sharedPreferences) {
sharedPreferences.edit().putString(getResources().getString(R.string.IS_RIDE_ACTIVE), "true").apply();
sharedPreferences.edit().putString(getResources().getString(R.string.RIDE_STATUS), "null").apply();
showAcknowledgement(getString(R.string.DRIVER_ASSIGNMENT));
RideRequestUtils.openApplication(this);
NotificationUtils.updateLocationUpdateDisAndFreq(NotificationUtils.DRIVER_ASSIGNMENT, sharedPreferences);
}
public void lambda$checkDriverRideList$32(ExecutorService executorService) {
final SharedPreferences sharedPreferences = getSharedPreferences(getString(R.string.preference_file_key), 0);
try {
JSONObject jSONObject = new JSONObject(MobilityCallAPI.getInstance(this.context).callAPI(sharedPreferences.getString("BASE_URL", "null") + "/driver/ride/list?limit=1&offset=0&onlyActive=true", MobilityCallAPI.getBaseHeaders(this), (String) null, "GET", Boolean.FALSE).getResponseBody());
if (jSONObject.has("list") && jSONObject.getJSONArray("list").length() > 0) {
this.mainLooper.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$checkDriverRideList$31(sharedPreferences);
}
});
}
executorService.shutdown();
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Exception in checkDriverRideList " + e));
}
}
public static void lambda$decreaseButtonClickListener$2(SheetModel sheetModel) {
sheetModel.setButtonDecreasePriceAlpha(0.5f);
sheetModel.setButtonDecreasePriceClickable(false);
sheetModel.setButtonIncreasePriceAlpha(1.0f);
sheetModel.setButtonIncreasePriceClickable(true);
}
public static void lambda$decreaseButtonClickListener$3(SheetModel sheetModel) {
sheetModel.setButtonIncreasePriceAlpha(1.0f);
sheetModel.setButtonIncreasePriceClickable(true);
}
public void lambda$decreaseButtonClickListener$4(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());
firebaseLogEvent("price_is_decreased");
sheetModel.setOfferedPrice(sheetModel.getOfferedPrice() - sheetModel.getNegotiationUnit());
this.sheetAdapter.notifyItemChanged(i, "inc");
Handler handler = new Handler(Looper.getMainLooper());
if (sheetModel.getOfferedPrice() == 0.0d) {
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.lambda$decreaseButtonClickListener$2(SheetModel.this);
}
});
} else {
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.lambda$decreaseButtonClickListener$3(SheetModel.this);
}
});
}
}
}
public void lambda$driverRespondApi$29(JSONObject jSONObject) {
try {
Toast.makeText(this.context, jSONObject.getString(getString(R.string.ERROR_MESSAGE)), 0).show();
} catch (JSONException e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in response respondAPI " + e));
e.printStackTrace();
}
}
public void lambda$driverRespondApi$30() {
Toast.makeText(this.context, "Request Timeout", 0).show();
}
public static void lambda$handlePinCode$16(SheetAdapter.SheetViewHolder sheetViewHolder, String str) {
TextView textView;
if (sheetViewHolder == null || (textView = sheetViewHolder.sourcePinCode) == null) {
return;
}
if (str != null) {
textView.setText(str);
sheetViewHolder.sourcePinCode.setVisibility(0);
} else {
sheetViewHolder.sourceAddress.setMaxLines(2);
sheetViewHolder.sourcePinCode.setVisibility(8);
}
}
public void lambda$handlePinCode$17(SheetModel sheetModel, final SheetAdapter.SheetViewHolder sheetViewHolder) {
final String pinCodeFromRR = RideRequestUtils.getPinCodeFromRR(sheetModel.getSrcLat(), sheetModel.getSrcLng(), this);
this.mainLooper.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.lambda$handlePinCode$16(SheetAdapter.SheetViewHolder.this, pinCodeFromRR);
}
});
}
public static void lambda$handlePinCode$18(SheetAdapter.SheetViewHolder sheetViewHolder, String str) {
if (sheetViewHolder == null || sheetViewHolder.sourcePinCode == null) {
return;
}
if (str != null) {
sheetViewHolder.destinationPinCode.setText(str);
sheetViewHolder.destinationPinCode.setVisibility(0);
} else {
sheetViewHolder.destinationAddress.setMaxLines(2);
sheetViewHolder.destinationPinCode.setVisibility(8);
}
}
public void lambda$handlePinCode$19(SheetModel sheetModel, final SheetAdapter.SheetViewHolder sheetViewHolder) {
final String pinCodeFromRR = RideRequestUtils.getPinCodeFromRR(sheetModel.getDestLat(), sheetModel.getDestLng(), this);
this.mainLooper.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.lambda$handlePinCode$18(SheetAdapter.SheetViewHolder.this, pinCodeFromRR);
}
});
}
public static void lambda$increaseButtonClickListener$5(SheetModel sheetModel) {
sheetModel.setButtonIncreasePriceAlpha(0.5f);
sheetModel.setButtonIncreasePriceClickable(false);
sheetModel.setButtonDecreasePriceAlpha(1.0f);
sheetModel.setButtonDecreasePriceClickable(true);
}
public static void lambda$increaseButtonClickListener$6(SheetModel sheetModel) {
sheetModel.setButtonDecreasePriceAlpha(1.0f);
sheetModel.setButtonDecreasePriceClickable(true);
}
public void lambda$increaseButtonClickListener$7(final SheetModel sheetModel, int i, View view) {
if (sheetModel.getOfferedPrice() <= sheetModel.getDriverMaxExtraFee() - sheetModel.getNegotiationUnit()) {
sheetModel.setUpdatedAmount(sheetModel.getUpdatedAmount() + sheetModel.getNegotiationUnit());
firebaseLogEvent("price_is_increased");
sheetModel.setOfferedPrice(sheetModel.getOfferedPrice() + sheetModel.getNegotiationUnit());
this.sheetAdapter.notifyItemChanged(i, "inc");
Handler handler = new Handler(Looper.getMainLooper());
if (sheetModel.getOfferedPrice() == sheetModel.getDriverMaxExtraFee()) {
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.lambda$increaseButtonClickListener$5(SheetModel.this);
}
});
} else {
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.lambda$increaseButtonClickListener$6(SheetModel.this);
}
});
}
}
}
public void lambda$onBind$22(MediaPlayer mediaPlayer) {
mediaPlayer.setWakeMode(this.context, 1);
}
public void lambda$onBind$23() {
for (int i = 0; i < 3; i++) {
MediaPlayer[] mediaPlayerArr = this.mediaPlayers;
if (mediaPlayerArr[i] == null) {
Context context = this.context;
mediaPlayerArr[i] = MediaPlayer.create(context, RideRequestUtils.getRideRequestSound(context, i));
this.mediaPlayers[i].setLooping(true);
this.mediaPlayers[i].setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public final void onPrepared(MediaPlayer mediaPlayer) {
OverlaySheetService.this.lambda$onBind$22(mediaPlayer);
}
});
}
}
}
public void lambda$rejectButtonClickListener$10(final SheetModel sheetModel, final int i, SheetAdapter.SheetViewHolder sheetViewHolder, Handler handler, final ExecutorService executorService) {
try {
if (sheetModel.getSearchRequestId().equals(this.DUMMY_FROM_LOCATION)) {
respondDummyRequest();
removeCard(i);
} else {
new Thread(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$rejectButtonClickListener$8(sheetModel);
}
}).start();
this.isRideAcceptedOrRejected = Boolean.TRUE;
sheetViewHolder.rejectButton.setClickable(false);
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$rejectButtonClickListener$9(i, executorService);
}
});
}
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in RejectButton " + e));
firebaseLogEventWithParams("exception_reject_button_click", "reject_button_click", String.valueOf(e));
System.out.println("reject exception: " + e);
}
}
public void lambda$rejectButtonClickListener$11(final SheetModel sheetModel, final int i, final SheetAdapter.SheetViewHolder sheetViewHolder, View view) {
final ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();
final Handler handler = new Handler(Looper.getMainLooper());
newSingleThreadExecutor.execute(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$rejectButtonClickListener$10(sheetModel, i, sheetViewHolder, handler, newSingleThreadExecutor);
}
});
}
public void lambda$rejectButtonClickListener$8(SheetModel sheetModel) {
driverRespondApi(sheetModel, false, this.sheetArrayList.indexOf(sheetModel));
}
public void lambda$rejectButtonClickListener$9(int i, ExecutorService executorService) {
String str = this.sharedPref.getString(Utils.DRIVER_STATUS, "null").equals("Silent") ? "silent_ride_declined" : "ride_declined";
String str2 = this.sharedPref.getString(Utils.DRIVER_STATUS, "null").equals("Silent") ? "silent_ride_rejected" : "ride_rejected";
Utils.logEvent(str, this.context);
RideRequestUtils.addRideReceivedEvent(null, null, this.modelForLogs, str2, this);
removeCard(i);
executorService.shutdown();
Toast.makeText(this.context, getString(R.string.ride_rejected), 0).show();
}
public void lambda$removeCard$21(int i) {
if (this.sheetArrayList.size() <= i) {
return;
}
if (i >= 0) {
this.sheetArrayList.remove(i);
}
this.sheetAdapter.updateSheetList(this.sheetArrayList);
this.sheetAdapter.notifyItemRemoved(i);
this.sheetAdapter.notifyItemRangeChanged(i, this.sheetArrayList.size());
updateIndicators();
ViewPager2 viewPager2 = this.viewPager;
if (viewPager2 != null) {
updateMediaPlayer(viewPager2.getCurrentItem());
}
updateProgressBars(false);
if (this.sheetArrayList.isEmpty()) {
cleanUp();
}
}
public void lambda$requestButtonClickListener$12(SheetModel sheetModel, ExecutorService executorService) {
startLoader(sheetModel.getSearchRequestId());
executorService.shutdown();
}
public void lambda$requestButtonClickListener$13(int i, SheetAdapter.SheetViewHolder sheetViewHolder, ExecutorService executorService) {
removeCard(i);
View view = this.apiLoader;
if (view != null && view.isAttachedToWindow()) {
this.windowManager.removeViewImmediate(this.apiLoader);
this.apiLoader = null;
}
if (!this.sheetArrayList.isEmpty()) {
sheetViewHolder.reqButton.setClickable(true);
} else {
cleanUp();
executorService.shutdown();
}
}
public void lambda$requestButtonClickListener$14(final SheetModel sheetModel, final SheetAdapter.SheetViewHolder sheetViewHolder, Handler handler, final ExecutorService executorService, final int i) {
try {
if (!driverRespondApi(sheetModel, true, this.sheetArrayList.indexOf(sheetModel)).booleanValue()) {
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$requestButtonClickListener$13(i, sheetViewHolder, executorService);
}
});
return;
}
int i2 = 0;
sheetViewHolder.reqButton.setClickable(false);
updateSharedPreferences();
while (true) {
ArrayList<CallBack> arrayList = callBack;
if (i2 >= arrayList.size()) {
break;
}
arrayList.get(i2).driverCallBack("RIDE_REQUESTED", "{}");
i2++;
}
String str = this.sharedPref.getString(Utils.DRIVER_STATUS, "null").equals("Silent") ? "silent_ride_accepted" : "ride_accepted";
firebaseLogEvent(str);
RideRequestUtils.addRideReceivedEvent(null, null, this.modelForLogs, str, this);
this.isRideAcceptedOrRejected = Boolean.TRUE;
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$requestButtonClickListener$12(sheetModel, executorService);
}
});
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in RequestButton " + e));
firebaseLogEventWithParams("exception_request_button_click", "request_button_click", String.valueOf(e));
cleanUp();
}
}
public void lambda$requestButtonClickListener$15(final SheetModel sheetModel, final int i, final SheetAdapter.SheetViewHolder sheetViewHolder, View view) {
if (sheetModel.getSearchRequestId().equals(this.DUMMY_FROM_LOCATION)) {
respondDummyRequest();
removeCard(i);
return;
}
sheetViewHolder.reqButton.setClickable(false);
String str = this.key;
if (str != null && str.equals("nammayatriprovider")) {
startApiLoader();
}
final ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();
final Handler handler = new Handler(Looper.getMainLooper());
newSingleThreadExecutor.execute(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$requestButtonClickListener$14(sheetModel, sheetViewHolder, handler, newSingleThreadExecutor, i);
}
});
}
public void lambda$respondDummyRequest$20() {
Toast.makeText(this.context, getString(R.string.test_request_successful), 0).show();
}
public void lambda$setIndicatorClickListener$35(int i) {
ViewPager2 viewPager2 = this.viewPager;
if (viewPager2 == null) {
return;
}
viewPager2.setCurrentItem(i);
if (i < this.sheetArrayList.size()) {
firebaseLogEventWithParams("indicator_click", "index", String.valueOf(i));
}
}
public void lambda$setIndicatorClickListener$36(final int i, View view) {
this.mainLooper.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$setIndicatorClickListener$35(i);
}
});
}
public void lambda$showAcknowledgement$33(String str, int i) {
View view = this.progressDialog;
if (view != null) {
TextView textView = (TextView) view.findViewById(R.id.text_waiting_for_customer);
LottieAnimationView findViewById = this.progressDialog.findViewById(R.id.lottie_view_waiting);
textView.setText(str);
if (findViewById.getVisibility() != 8) {
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$showOverLayPopup$28(View view) {
new Handler(Looper.getMainLooper()).post(new RunnableC0616h1(this));
}
public static void lambda$updateIncreaseDecreaseButtons$1(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$34() {
View view = this.floatyView;
if (view == null || this.viewPager == null) {
return;
}
this.indicatorText1 = (TextView) view.findViewById(R.id.indicatorText1);
this.indicatorText2 = (TextView) this.floatyView.findViewById(R.id.indicatorText2);
this.indicatorText3 = (TextView) this.floatyView.findViewById(R.id.indicatorText3);
this.indicatorText4 = (TextView) this.floatyView.findViewById(R.id.indicatorText4);
this.indicatorText5 = (TextView) this.floatyView.findViewById(R.id.indicatorText5);
this.indicatorText6 = (TextView) this.floatyView.findViewById(R.id.indicatorText6);
this.progressIndicator1 = this.floatyView.findViewById(R.id.progress_indicator_1);
this.progressIndicator2 = this.floatyView.findViewById(R.id.progress_indicator_2);
this.progressIndicator3 = this.floatyView.findViewById(R.id.progress_indicator_3);
this.progressIndicator4 = this.floatyView.findViewById(R.id.progress_indicator_4);
this.progressIndicator5 = this.floatyView.findViewById(R.id.progress_indicator_5);
this.progressIndicator6 = this.floatyView.findViewById(R.id.progress_indicator_6);
this.indicatorTextList = new ArrayList<>(Arrays.asList(this.indicatorText1, this.indicatorText2, this.indicatorText3, this.indicatorText4, this.indicatorText5, this.indicatorText6));
this.progressIndicatorsList = new ArrayList<>(Arrays.asList(this.progressIndicator1, this.progressIndicator2, this.progressIndicator3, this.progressIndicator4, this.progressIndicator5, this.progressIndicator6));
this.indicatorList = new ArrayList<>(Arrays.asList((LinearLayout) this.floatyView.findViewById(R.id.indicator1), (LinearLayout) this.floatyView.findViewById(R.id.indicator2), (LinearLayout) this.floatyView.findViewById(R.id.indicator3), (LinearLayout) this.floatyView.findViewById(R.id.indicator4), (LinearLayout) this.floatyView.findViewById(R.id.indicator5), (LinearLayout) this.floatyView.findViewById(R.id.indicator6)));
this.indicatorTipList = new ArrayList<>(Arrays.asList((LinearLayout) this.floatyView.findViewById(R.id.tip_indicator_0), (LinearLayout) this.floatyView.findViewById(R.id.tip_indicator_1), (LinearLayout) this.floatyView.findViewById(R.id.tip_indicator_2), (LinearLayout) this.floatyView.findViewById(R.id.tip_indicator_3), (LinearLayout) this.floatyView.findViewById(R.id.tip_indicator_4), (LinearLayout) this.floatyView.findViewById(R.id.tip_indicator_5)));
this.tipBanner1 = (TextView) this.floatyView.findViewById(R.id.tip_banner_view_0);
this.tipBanner2 = (TextView) this.floatyView.findViewById(R.id.tip_banner_view_1);
this.tipBanner3 = (TextView) this.floatyView.findViewById(R.id.tip_banner_view_2);
this.tipBanner4 = (TextView) this.floatyView.findViewById(R.id.tip_banner_view_3);
this.tipBanner5 = (TextView) this.floatyView.findViewById(R.id.tip_banner_view_4);
this.tipBanner6 = (TextView) this.floatyView.findViewById(R.id.tip_banner_view_5);
this.indicatorTipBannerList = new ArrayList<>(Arrays.asList(this.tipBanner1, this.tipBanner2, this.tipBanner3, this.tipBanner4, this.tipBanner5, this.tipBanner6));
this.shimmerTip1 = this.floatyView.findViewById(R.id.shimmer_view_container_0);
this.shimmerTip2 = this.floatyView.findViewById(R.id.shimmer_view_container_1);
this.shimmerTip3 = this.floatyView.findViewById(R.id.shimmer_view_container_2);
this.shimmerTip4 = this.floatyView.findViewById(R.id.shimmer_view_container_3);
this.shimmerTip5 = this.floatyView.findViewById(R.id.shimmer_view_container_4);
this.shimmerTip6 = this.floatyView.findViewById(R.id.shimmer_view_container_5);
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);
this.sheetArrayList.get(i).getSpecialZonePickup();
updateTopBar(i);
} else {
this.indicatorTextList.get(i).setText("--");
this.indicatorList.get(i).setBackgroundColor(getColor(R.color.white));
this.indicatorTipBannerList.get(i).setText("Favourite");
this.shimmerTipList.get(i).setVisibility(4);
this.progressIndicatorsList.get(i).setVisibility(8);
this.indicatorTipBannerList.get(i).setVisibility(4);
}
}
}
public void lambda$updateMediaPlayer$37(int i) {
int rideRequestSoundId;
if (i >= 0) {
try {
if (i < this.sheetArrayList.size() && (rideRequestSoundId = RideRequestUtils.getRideRequestSoundId(this.sheetArrayList.get(i).getRideProductType())) != this.currentMediaIndex) {
if (this.currentMediaPlayer != null && this.currentMediaPlayer.isPlaying()) {
this.currentMediaPlayer.pause();
}
this.currentMediaIndex = rideRequestSoundId;
this.currentMediaPlayer = this.mediaPlayers[this.currentMediaIndex];
if (this.currentMediaPlayer == null || this.currentMediaPlayer.isPlaying()) {
return;
}
this.currentMediaPlayer.start();
}
} catch (Exception e) {
android.util.Log.e(TAG_MEDIA_PLAYER, e.toString());
}
}
}
public void lambda$updateTagsView$0(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 pagerCallbackListener() {
this.viewPager.g(new ViewPager2.i() {
public void onPageScrollStateChanged(int i) {
OverlaySheetService.this.updateIndicators();
super.onPageScrollStateChanged(i);
}
public void onPageScrolled(int i, float f, int i2) {
OverlaySheetService.this.updateIndicators();
super.onPageScrolled(i, f, i2);
}
public void onPageSelected(int i) {
OverlaySheetService.this.updateMediaPlayer(i);
NotificationUtils.firebaseLogEventWithParams(OverlaySheetService.this.context, "multiple_ride_selected", "position", i + "");
super.onPageSelected(i);
}
});
}
public static void registerCallback(CallBack callBack2) {
callBack.add(callBack2);
}
public void rejectButtonClickListener(final SheetAdapter.SheetViewHolder sheetViewHolder, final SheetModel sheetModel, final int i) {
sheetViewHolder.rejectButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
OverlaySheetService.this.lambda$rejectButtonClickListener$11(sheetModel, i, sheetViewHolder, view);
}
});
}
public void removeCard(final int i) {
try {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$removeCard$21(i);
}
});
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in RemovingCard " + e));
firebaseLogEventWithParams("exception_in_remove_card", "remove_card", String.valueOf(e));
e.printStackTrace();
}
}
public void requestButtonClickListener(final SheetAdapter.SheetViewHolder sheetViewHolder, final SheetModel sheetModel, final int i) {
this.sharedPref.getString("VEHICLE_VARIANT", null);
this.progressDialog.findViewById(R.id.lottie_view_waiting);
sheetViewHolder.reqButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
OverlaySheetService.this.lambda$requestButtonClickListener$15(sheetModel, i, sheetViewHolder, view);
}
});
}
private void respondDummyRequest() {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$respondDummyRequest$20();
}
});
}
private void setIndicatorClickListener() {
if (this.viewPager == null || this.floatyView == null) {
return;
}
this.indicatorList = new ArrayList<>(Arrays.asList((LinearLayout) this.floatyView.findViewById(R.id.indicator1), (LinearLayout) this.floatyView.findViewById(R.id.indicator2), (LinearLayout) this.floatyView.findViewById(R.id.indicator3), (LinearLayout) this.floatyView.findViewById(R.id.indicator4), (LinearLayout) this.floatyView.findViewById(R.id.indicator5), (LinearLayout) this.floatyView.findViewById(R.id.indicator6)));
for (final int i = 0; i < 6; i++) {
this.indicatorList.get(i).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
OverlaySheetService.this.lambda$setIndicatorClickListener$36(i, view);
}
});
}
}
public void showAcknowledgement(String str) {
Handler handler = new Handler(Looper.getMainLooper());
final String string = getString(str.equals(getString(R.string.DRIVER_ASSIGNMENT)) ? R.string.ride_assigned : R.string.ride_assigned_to_another_driver);
this.sharedPref.getString("VEHICLE_VARIANT", null);
final int i = str.equals(getString(R.string.DRIVER_ASSIGNMENT)) ? R.raw.ride_accepted_lottie : R.raw.accepted_by_another_driver_lottie;
handler.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$showAcknowledgement$33(string, i);
}
});
handler.postDelayed(new RunnableC0616h1(this), 1700L);
}
private void showOverLayPopup(Bundle bundle) {
String str;
if (Settings.canDrawOverlays(this.context)) {
this.windowManager = (WindowManager) getSystemService("window");
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(-1, -1, Build.VERSION.SDK_INT >= 26 ? 2038 : 2002, 2097154, -2);
this.params = layoutParams;
layoutParams.dimAmount = 0.6f;
layoutParams.gravity = 17;
layoutParams.screenOrientation = 1;
LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService("layout_inflater");
View inflate = layoutInflater.inflate(R.layout.viewpager_layout_view, (ViewGroup) null);
this.floatyView = inflate;
TextView textView = (TextView) inflate.findViewById(R.id.merchantLogo);
try {
str = getApplicationInfo().loadLabel(getPackageManager()).toString();
} catch (Exception e) {
e.printStackTrace();
str = "";
}
String str2 = this.key;
if (str2 == null || !str2.equals("yatrisathiprovider")) {
String str3 = this.key;
if (str3 == null || !str3.equals("yatriprovider")) {
String str4 = this.key;
if (str4 != null && str4.equals("passcultureprovider")) {
textView.setText("Alliance Taxis");
} else if (str.contains("Mana")) {
textView.setText("Mana Yatri");
} else if (str.contains("Kerala")) {
textView.setText("Kerala Savaari");
}
} else {
textView.setText("Yatri Driver");
}
} else {
textView.setText("yatri\nsathi");
ImageView imageView = (ImageView) this.floatyView.findViewById(R.id.merchantLogoIcon);
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(100, 100);
layoutParams2.rightMargin = 12;
imageView.setLayoutParams(layoutParams2);
textView.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
}
this.progressDialog = layoutInflater.inflate(R.layout.loading_screen_overlay, (ViewGroup) null);
this.apiLoader = layoutInflater.inflate(R.layout.api_loader, (ViewGroup) null);
this.sharedPref.getString("VEHICLE_VARIANT", "null");
this.progressDialog.findViewById(R.id.loaderOverlay).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
OverlaySheetService.this.lambda$showOverLayPopup$28(view);
}
});
ViewPager2 findViewById = this.floatyView.findViewById(R.id.view_pager);
this.viewPager = findViewById;
this.sheetAdapter.setViewPager(findViewById);
this.viewPager.setAdapter(this.sheetAdapter);
if (remoteConfigs.hasKey("add_view_fallback") && remoteConfigs.getBoolean("add_view_fallback")) {
addPagerLayoutToWindow();
} else {
this.windowManager.addView(this.floatyView, this.params);
}
setIndicatorClickListener();
firebaseLogEvent("Overlay_is_popped_up");
RideRequestUtils.addRideReceivedEvent(null, bundle, null, "overlay_is_popped_up", this);
}
}
private void startApiLoader() {
try {
if (this.currentMediaPlayer != null && this.currentMediaPlayer.isPlaying()) {
this.currentMediaPlayer.pause();
}
View view = this.apiLoader;
if (view != null) {
this.windowManager.addView(view, this.params);
}
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in startAPILoader " + e));
firebaseLogEventWithParams("exception_in_start_api_loader", "start_api_loader", String.valueOf(e));
e.printStackTrace();
}
}
private void startLoader(final String str) {
try {
if (this.currentMediaPlayer != null && this.currentMediaPlayer.isPlaying()) {
this.currentMediaPlayer.pause();
}
View view = this.floatyView;
if (view != null && view.getParent() != null) {
this.windowManager.removeViewImmediate(this.floatyView);
}
View view2 = this.apiLoader;
if (view2 != null && view2.getParent() != null) {
this.windowManager.removeViewImmediate(this.apiLoader);
}
View view3 = this.progressDialog;
if (view3 != null) {
this.windowManager.addView(view3, this.params);
}
Timer timer = this.countDownTimer;
if (timer != null) {
timer.cancel();
}
this.rideStatusListener = new CountDownTimer(getResources().getInteger(R.integer.LOADER_WAITING_TIME), 1000L) {
@Override
public void onFinish() {
OverlaySheetService.this.sharedPref.edit().putString(OverlaySheetService.this.getResources().getString(R.string.RIDE_STATUS), "null").apply();
OverlaySheetService.this.cleanUp();
}
@Override
public void onTick(long j) {
OverlaySheetService overlaySheetService = OverlaySheetService.this;
overlaySheetService.sharedPref = overlaySheetService.getApplication().getSharedPreferences(OverlaySheetService.this.context.getString(R.string.preference_file_key), 0);
if (OverlaySheetService.this.progressDialog != null) {
((TextView) OverlaySheetService.this.progressDialog.findViewById(R.id.text_waiting_for_customer)).setText(OverlaySheetService.this.getString(R.string.waiting_for_customer_response) + " (" + (j / 1000) + ") ...");
}
if (OverlaySheetService.this.sharedPref.getString(OverlaySheetService.this.getResources().getString(R.string.RIDE_STATUS), "null").equals(OverlaySheetService.this.getResources().getString(R.string.DRIVER_ASSIGNMENT))) {
OverlaySheetService.this.sharedPref.edit().putString(OverlaySheetService.this.getResources().getString(R.string.RIDE_STATUS), "null").apply();
OverlaySheetService overlaySheetService2 = OverlaySheetService.this;
overlaySheetService2.showAcknowledgement(overlaySheetService2.getString(R.string.DRIVER_ASSIGNMENT));
} else if (OverlaySheetService.this.sharedPref.getString(OverlaySheetService.this.getString(R.string.CLEAR_FARE), "null").equals(str)) {
OverlaySheetService overlaySheetService3 = OverlaySheetService.this;
overlaySheetService3.showAcknowledgement(overlaySheetService3.getString(R.string.CLEAR_FARE));
} else if (OverlaySheetService.remoteConfigs.hasKey("pool_for_ride") && OverlaySheetService.remoteConfigs.getBoolean("pool_for_ride") && (j / 1000) % 3 == 0) {
OverlaySheetService.this.checkDriverRideList();
}
}
}.start();
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in StartLoader " + e));
firebaseLogEventWithParams("exception_in_start_loader", "start_loader", String.valueOf(e));
cleanUp();
e.printStackTrace();
}
}
private void startTimer() {
AnonymousClass3 anonymousClass3 = new AnonymousClass3();
Timer timer = new Timer();
this.countDownTimer = timer;
timer.scheduleAtFixedRate(anonymousClass3, 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() {
OverlaySheetService.lambda$updateIncreaseDecreaseButtons$1(SheetAdapter.SheetViewHolder.this, sheetModel);
}
});
}
public void updateIndicators() {
this.mainLooper.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$updateIndicators$34();
}
});
}
public void updateMediaPlayer(final int i) {
if (this.mediaPlayerExecutor.isTerminated() || this.mediaPlayerExecutor.isShutdown()) {
return;
}
this.mediaPlayerExecutor.execute(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$updateMediaPlayer$37(i);
}
});
}
public void updateProgressBars(boolean z) {
try {
if (this.floatyView == null) {
return;
}
if (this.progressIndicatorsList == null) {
this.progressIndicatorsList = new ArrayList<>(Arrays.asList(this.floatyView.findViewById(R.id.progress_indicator_1), this.floatyView.findViewById(R.id.progress_indicator_2), this.floatyView.findViewById(R.id.progress_indicator_3), this.floatyView.findViewById(R.id.progress_indicator_4), this.floatyView.findViewById(R.id.progress_indicator_5), this.floatyView.findViewById(R.id.progress_indicator_6)));
}
for (int i = 0; i < this.sheetArrayList.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 e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in UpdateProgress " + e));
this.mFirebaseAnalytics.c("Exception_in_updateProgressBars", (Bundle) null);
android.util.Log.e(TAG, "Error in updateProgressBars " + e);
}
}
private void updateSharedPreferences() {
Context context = this.context;
context.getSharedPreferences(context.getString(R.string.preference_file_key), 0).edit().putString(getString(R.string.LOCAL_STAGE), getString(R.string.RideRequested)).apply();
this.sharedPref.edit().putString(getString(R.string.RIDE_REQUEST_TIME), new SimpleDateFormat("EE MMM d y H:m:s ZZZ", new Locale("en", "US")).format(new Date())).apply();
}
public void updateTagsView(final SheetAdapter.SheetViewHolder sheetViewHolder, final SheetModel sheetModel) {
this.mainLooper.post(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$updateTagsView$0(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;
ViewPager2 viewPager2 = this.viewPager;
if (viewPager2 == null) {
return;
}
int currentItem = 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) {
try {
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$addToList$27(bundle, handler);
}
}, bundle.getInt("keepHiddenForSeconds", 0) * 1000);
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in add_to_list " + e));
firebaseLogEventWithParams("exception_in_add_to_list", "add_to_list", String.valueOf(e));
e.printStackTrace();
}
}
public void firebaseLogEvent(String str) {
Bundle bundle = new Bundle();
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
this.mFirebaseAnalytics = firebaseAnalytics;
firebaseAnalytics.c(str, bundle);
}
public void firebaseLogEventWithParams(String str, String str2, String str3) {
Bundle bundle = new Bundle();
bundle.putString(str2, str3);
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
this.mFirebaseAnalytics = firebaseAnalytics;
firebaseAnalytics.c(str, bundle);
}
public boolean getIsServiceDestroyed() {
return this.isServiceDestroyed;
}
@Override
public IBinder onBind(Intent intent) {
try {
if (!this.mediaPlayerExecutor.isShutdown() && !this.mediaPlayerExecutor.isTerminated()) {
this.mediaPlayerExecutor.execute(new Runnable() {
@Override
public final void run() {
OverlaySheetService.this.lambda$onBind$23();
}
});
}
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(new Exception("Error in onBind " + e));
firebaseLogEventWithParams("exception_in_on_bind", "on_bind", String.valueOf(e));
e.printStackTrace();
}
return new OverlayBinder();
}
@Override
public void onCreate() {
super.onCreate();
if (this.mediaPlayerExecutor.isTerminated() || this.mediaPlayerExecutor.isShutdown()) {
this.mediaPlayerExecutor = Executors.newSingleThreadExecutor();
}
Context applicationContext = getApplicationContext();
this.context = applicationContext;
this.key = applicationContext.getResources().getString(R.string.service);
this.isServiceDestroyed = false;
}
@Override
public void onDestroy() {
this.isServiceDestroyed = true;
View view = this.floatyView;
if (view != null) {
try {
this.windowManager.removeViewImmediate(view);
for (MediaPlayer mediaPlayer : this.mediaPlayers) {
if (mediaPlayer != null) {
mediaPlayer.release();
}
}
this.currentMediaPlayer = null;
this.currentMediaIndex = -1;
} catch (Exception e) {
e.printStackTrace();
}
this.floatyView = null;
}
this.mediaPlayerExecutor.shutdown();
super.onDestroy();
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
this.isServiceDestroyed = false;
if (!this.mediaPlayerExecutor.isTerminated() && !this.mediaPlayerExecutor.isShutdown()) {
return 1;
}
this.mediaPlayerExecutor = Executors.newSingleThreadExecutor();
return 1;
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
view.performClick();
return true;
}
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;
}
}