MD5 校验值:7cd346351ab05a28e42aff65173e0141
AppUtil.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.leptonsoftware.fibernet.util; import android.annotation.SuppressLint; import android.app.Activity; import android.app.ActivityManager; import android.app.Dialog; import android.app.job.JobInfo; import android.app.job.JobScheduler; import android.content.ClipData; import android.content.ClipboardManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Typeface; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.location.Location; import android.location.LocationManager; import android.media.ExifInterface; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.BatteryManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.StatFs; import android.os.SystemClock; import android.provider.Settings; import android.text.InputFilter; import android.text.Spanned; import android.text.TextUtils; import android.util.Base64; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.animation.BounceInterpolator; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.SpinnerAdapter; import android.widget.TextView; import androidx.core.content.FileProvider; import androidx.fragment.app.Fragment; import androidx.fragment.app.d; import com.android.volley.AuthFailureError; import com.android.volley.NetworkError; import com.android.volley.NoConnectionError; import com.android.volley.ParseError; import com.android.volley.ServerError; import com.android.volley.TimeoutError; import com.android.volley.VolleyError; import com.crashlytics.android.Crashlytics; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; import com.google.firebase.analytics.FirebaseAnalytics; import com.jfp.prod.R; import com.leptonsoftware.fibernet.BuildConfig; import com.leptonsoftware.fibernet.ManageEntitiesActivity; import com.leptonsoftware.fibernet.ModuleActivity; import com.leptonsoftware.fibernet.TrackingService; import com.leptonsoftware.fibernet.constants; import com.leptonsoftware.fibernet.datamodel.BuisnessLayer; import com.leptonsoftware.fibernet.datamodel.LandBaseLayer; import com.leptonsoftware.fibernet.datamodel.NetworkLayer; import com.leptonsoftware.fibernet.datamodel.ObjDynamicModel; import com.leptonsoftware.fibernet.datamodel.OfflineElementInitialModel; import com.leptonsoftware.fibernet.datamodel.OfflineElementModel; import com.leptonsoftware.fibernet.datamodel.ProvinceDataModel; import com.leptonsoftware.fibernet.datamodel.ResourceLang; import com.leptonsoftware.fibernet.datamodel.VoiceActionSpecsModel; import com.leptonsoftware.fibernet.datamodel.VoiceDataModel; import com.leptonsoftware.fibernet.jioscreens.LoginActivity; import com.leptonsoftware.fibernet.jsonparser.ApiType; import com.leptonsoftware.fibernet.jsonparser.DynamicControl; import com.leptonsoftware.fibernet.jsonparser.GeoJsonType; import com.leptonsoftware.fibernet.jsonparser.JsonParser; import com.leptonsoftware.fibernet.jsonparser.ScreenType; import com.leptonsoftware.fibernet.logger.LepLogger; import com.leptonsoftware.fibernet.responses.BaseResp; import com.leptonsoftware.fibernet.responses.LangResourceResp; import com.leptonsoftware.fibernet.responses.TokenResponse; import com.leptonsoftware.fibernet.services.CurrentLocationTracking; import com.leptonsoftware.fibernet.services.LogoutService; import com.leptonsoftware.fibernet.services.TrackingJobService; import com.leptonsoftware.fibernet.toasty.Toasty; import com.leptonsoftware.fibernet.ui_v2.activity.EntityDashboardActivity; import com.leptonsoftware.fibernet.util.database.appDatabase; import com.leptonsoftware.fibernet.util.mlkit.SimpleScannerActivity; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.math.RoundingMode; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.cert.X509Certificate; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.regex.Pattern; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import n4.c; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import p.b; import p4.a; import p4.h; import p4.i; import p4.j; import p4.l; import p4.p; import p4.q; import r6.e; import y6.g; public class AppUtil { static final boolean $assertionsDisabled = false; private static final float ACCURACY = 0.01f; private static final double ASSUMED_INIT_LATLNG_DIFF = 1.0d; private static final String TAG = "AppUtil"; public static class AnonymousClass13 { static final int[] $SwitchMap$com$leptonsoftware$fibernet$jsonparser$ScreenType; static { int[] iArr = new int[ScreenType.values().length]; $SwitchMap$com$leptonsoftware$fibernet$jsonparser$ScreenType = iArr; try { iArr[ScreenType.LOGIN.ordinal()] = 1; } catch (NoSuchFieldError unused) { } } } public static void alertDialog(Activity activity, String str, String str2) { if (activity == null) { return; } final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(true); ImageView imageView = (ImageView) dialog.findViewById(R.id.iv_icon); Button button = (Button) dialog.findViewById(R.id.btn_ok); Button button2 = (Button) dialog.findViewById(R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(R.id.tv_message); if (str.equalsIgnoreCase(activity.getString(R.string.info))) { imageView.setBackground(dialog.getContext().getDrawable(R.drawable.alert)); button.setBackground(dialog.getContext().getDrawable(R.drawable.btn_alert_ok_info)); } else if (str.equalsIgnoreCase(activity.getString(R.string.error))) { imageView.setBackground(dialog.getContext().getDrawable(R.drawable.error)); button.setBackground(dialog.getContext().getDrawable(R.drawable.btn_alert_ok_error)); } else if (str.equalsIgnoreCase(activity.getString(R.string.success))) { imageView.setBackground(dialog.getContext().getDrawable(R.drawable.success)); button.setBackground(dialog.getContext().getDrawable(R.drawable.btn_alert_ok_info)); } textView.setText(str); textView2.setText(str2); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); } } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); } } }); dialog.show(); } public static Bitmap base64ToBitmapImage(String str) { if (str == null || str.isEmpty()) { return null; } byte[] decode = Base64.decode(str.replace("data:image//png;base64,", "").getBytes(), 0); Bitmap decodeByteArray = BitmapFactory.decodeByteArray(decode, 0, decode.length, new BitmapFactory.Options()); System.gc(); return decodeByteArray; } public static a bitmapDescriptorFromVector(Context context, int i10) { Drawable e10 = b.e(context, i10); e10.setBounds(0, 0, e10.getIntrinsicWidth(), e10.getIntrinsicHeight()); Bitmap createBitmap = Bitmap.createBitmap(e10.getIntrinsicWidth(), e10.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); e10.draw(new Canvas(createBitmap)); return p4.b.b(createBitmap); } public static LatLngBounds boundsWithCenterAndLatLngDistance(LatLng latLng, float f10, float f11) { float abs; float f12; float f13 = f10 / 2.0f; float f14 = f11 / 2.0f; LatLngBounds.a F = LatLngBounds.F(); float[] fArr = new float[1]; double d10 = 1.0d; double d11 = 0.0d; double d12 = 1.0d; double d13 = 0.0d; boolean z9 = false; do { double d14 = latLng.f5531b; double d15 = latLng.f5532c; Location.distanceBetween(d14, d15, d14, d15 + d12, fArr); if (fArr[0] - f14 < 0.0f) { double d16 = !z9 ? d12 * 2.0d : d12 + ((d12 - d13) / 2.0d); d13 = d12; d12 = d16; } else { d12 -= (d12 - d13) / 2.0d; z9 = true; } } while (Math.abs(fArr[0] - f14) > f14 * ACCURACY); F.b(new LatLng(latLng.f5531b, latLng.f5532c + d12)); F.b(new LatLng(latLng.f5531b, latLng.f5532c - d12)); double d17 = 1.0d; double d18 = 0.0d; boolean z10 = false; do { double d19 = latLng.f5531b; double d20 = latLng.f5532c; Location.distanceBetween(d19, d20, d19 + d17, d20, fArr); if (fArr[0] - f13 < 0.0f) { double d21 = !z10 ? d17 * 2.0d : d17 + ((d17 - d18) / 2.0d); d18 = d17; d17 = d21; } else { d17 -= (d17 - d18) / 2.0d; z10 = true; } abs = Math.abs(fArr[0] - f13); f12 = f13 * ACCURACY; } while (abs > f12); F.b(new LatLng(latLng.f5531b + d17, latLng.f5532c)); boolean z11 = false; do { double d22 = latLng.f5531b; double d23 = latLng.f5532c; Location.distanceBetween(d22, d23, d22 - d10, d23, fArr); if (fArr[0] - f13 < 0.0f) { double d24 = !z11 ? d10 * 2.0d : ((d10 - d11) / 2.0d) + d10; d11 = d10; d10 = d24; } else { d10 -= (d10 - d11) / 2.0d; z11 = true; } } while (Math.abs(fArr[0] - f13) > f12); F.b(new LatLng(latLng.f5531b - d10, latLng.f5532c)); return F.a(); } public static void bypassSSLValidation() { try { TrustManager[] trustManagerArr = {new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) { } @Override public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) { } @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } }}; SSLContext sSLContext = SSLContext.getInstance("SSL"); sSLContext.init(null, trustManagerArr, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sSLContext.getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String str, SSLSession sSLSession) { Log.i(AppUtil.TAG, "NK:Verify"); return true; } }); } catch (KeyManagementException e10) { e = e10; e.printStackTrace(); } catch (NoSuchAlgorithmException e11) { e = e11; e.printStackTrace(); } catch (Exception e12) { e12.printStackTrace(); } } public static double calculateMiles(p pVar) { return formatDecimalValueUptoTwoDigit(g.a(pVar.a())); } public static double calculationByDistance(LatLng latLng, LatLng latLng2) { if (latLng == null) { return 0.0d; } double d10 = latLng.f5531b; double d11 = latLng2.f5531b; double d12 = latLng.f5532c; double d13 = latLng2.f5532c; double radians = Math.toRadians(d11 - d10) / 2.0d; double radians2 = Math.toRadians(d13 - d12) / 2.0d; double asin = 6371 * Math.asin(Math.sqrt((Math.sin(radians) * Math.sin(radians)) + (Math.cos(Math.toRadians(d10)) * Math.cos(Math.toRadians(d11)) * Math.sin(radians2) * Math.sin(radians2)))) * 2.0d * 1000.0d; if (Double.isNaN(asin)) { return 0.0d; } return asin; } public static String capitalizeFirstLetter(String str) { if (str == null || str.length() == 0) { return str; } String[] split = str.split(io.fabric.sdk.android.services.events.b.ROLL_OVER_FILE_NAME_SEPARATOR); String str2 = ""; for (int i10 = 0; i10 < split.length; i10++) { if (split[i10].length() > 0) { str2 = str2 + " " + split[i10].substring(0, 1).toUpperCase() + split[i10].substring(1); } } return str2; } public static double[] centroid(List<LatLng> list) { double[] dArr = {0.0d, 0.0d}; for (int i10 = 0; i10 < list.size(); i10++) { dArr[0] = dArr[0] + list.get(i10).f5531b; dArr[1] = dArr[1] + list.get(i10).f5532c; } double size = list.size(); dArr[0] = dArr[0] / size; dArr[1] = dArr[1] / size; return dArr; } private static void changeExpireTime(long j10, Context context) { Calendar calendar = Calendar.getInstance(); calendar.add(13, (int) j10); SharePrefFactory.setStringPref(context, SharePrefConstants.TIME_REMAINING, String.valueOf(calendar.getTimeInMillis())); System.out.println("Time" + calendar.getTime()); } public static void changeOfflineStatusBar(Activity activity) { if (Build.VERSION.SDK_INT >= 21) { Window window = activity.getWindow(); window.addFlags(Integer.MIN_VALUE); window.clearFlags(67108864); window.setStatusBarColor(activity.getResources().getColor(R.color.grey_statusbar)); } } public static void changeOnlineStatusBar(Activity activity) { if (Build.VERSION.SDK_INT >= 21) { Window window = activity.getWindow(); window.addFlags(Integer.MIN_VALUE); window.clearFlags(67108864); window.setStatusBarColor(activity.getResources().getColor(R.color.statusBarColor)); } } public static boolean checkDatabaseDataExist(Activity activity) { return getDb(activity).getDropDownQuery().countUsers() > 0; } public static boolean checkGPSStatus(Context context) { return ((LocationManager) context.getSystemService(AppConstants.Offline_Location_Action)).isProviderEnabled("gps"); } public static void clearData() { } public static boolean connectGisApp(Intent intent, Activity activity) { String action = intent.getAction(); String type = intent.getType(); Uri data = intent.getData(); if ("com.lepton.fibernet.gisapp".equals(action) && type != null) { if (!"text/plain".equals(type) || intent.getStringExtra("LoginId") == null) { return false; } if (SharePrefFactory.getLongPref(activity.getApplicationContext(), SharePrefConstants.USER_ID, 0L) != 0 && !SharePrefFactory.getStringPref(activity.getApplicationContext(), SharePrefConstants.LOGIN_ACCESS_TOKEN).isEmpty()) { AppConstants.MAP_FILES_PROVIDER_PATH_WITH_LABEL = SharePrefFactory.getStringPref(activity, SharePrefConstants.WMS_FILES_PATH_WITH_LABEL); AppConstants.MAP_FILES_PROVIDER_PATH_NO_LABEL = SharePrefFactory.getStringPref(activity, SharePrefConstants.WMS_FILES_PATH_NO_LABEL); activity.startActivity(new Intent(activity, (Class<?>) ModuleActivity.class)); activity.finish(); } else { Intent intent2 = getIntent(activity, ScreenType.LOGIN); intent2.putExtra("LoginId", intent.getStringExtra("LoginId")); intent2.putExtra("Password", intent.getStringExtra("Password")); activity.startActivity(intent2); activity.finish(); } return true; } if (data == null || data.toString().isEmpty()) { return false; } if (SharePrefFactory.getLongPref(activity.getApplicationContext(), SharePrefConstants.USER_ID, 0L) != 0 && !SharePrefFactory.getStringPref(activity.getApplicationContext(), SharePrefConstants.LOGIN_ACCESS_TOKEN).isEmpty()) { AppConstants.MAP_FILES_PROVIDER_PATH_WITH_LABEL = SharePrefFactory.getStringPref(activity, SharePrefConstants.WMS_FILES_PATH_WITH_LABEL); AppConstants.MAP_FILES_PROVIDER_PATH_NO_LABEL = SharePrefFactory.getStringPref(activity, SharePrefConstants.WMS_FILES_PATH_NO_LABEL); AppConstants.LandBaseEntitiesWithLabel = SharePrefFactory.getStringPref(activity, SharePrefConstants.LANDBASE_FILES_PATH_WITH_LABEL); AppConstants.LandBaseEntitiesNoLabel = SharePrefFactory.getStringPref(activity, SharePrefConstants.LANDBASE_FILES_PATH_NO_LABEL); activity.startActivity(new Intent(activity, (Class<?>) ModuleActivity.class)); activity.finish(); } else { data.toString(); data.getAuthority(); data.getPath(); data.getQueryParameterNames(); Intent intent3 = getIntent(activity, ScreenType.LOGIN); intent3.putExtra("LoginId", data.getQueryParameter("userid")); intent3.putExtra("Password", data.getQueryParameter("pwd")); activity.startActivity(intent3); activity.finish(); } return true; } public static String convertToCompleteNetworkStatus(String str) { return str == null ? "" : str.equalsIgnoreCase("P") ? "Planned" : str.equalsIgnoreCase("A") ? "AsBuilt" : str.equalsIgnoreCase("D") ? "Dormant" : str; } public static String convertToCompleteStatus(String str) { return str == null ? "" : str.equalsIgnoreCase("A") ? AppConstants.BUILDING_STATUS_APPROVED : str.equalsIgnoreCase("P") ? "Planned" : str.equalsIgnoreCase("D") ? "Draft" : str; } public static void copyText(Activity activity, String str) { ((ClipboardManager) activity.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("label", str)); } public static void debugLog(String str, String str2) { Crashlytics.log(3, str, str2); } private static double deg2rad(double d10) { return (d10 * 3.141592653589793d) / 180.0d; } public static void disableEditText(EditText editText) { if (editText != null) { editText.setFocusable(false); editText.setEnabled(false); editText.setCursorVisible(false); editText.setKeyListener(null); } } public static void disableTextView(TextView textView) { if (textView != null) { textView.setFocusable(false); textView.setEnabled(false); textView.setCursorVisible(false); textView.setKeyListener(null); } } public static double distance(double d10, double d11, double d12, double d13) { if (d10 == d12 && d11 == d13) { return 0.0d; } return distance(d10, d11, d12, d13, 'K'); } public static int dp2px(Context context, float f10) { return (int) ((f10 * context.getResources().getDisplayMetrics().density) + 0.5f); } public static void errorLog(String str, String str2) { Crashlytics.log(6, str, str2); } public static boolean existInCentroid(LatLng latLng, ArrayList<LatLng> arrayList, int i10) { double[] centroid = centroid(arrayList); if (centroid.length != 2) { if (centroid.length < 2) { return false; } for (int i11 = 1; i11 < centroid.length; i11++) { if (calculationByDistance(latLng, new LatLng(centroid[i11 - 1], centroid[i11])) >= i10) { } } return false; } if (calculationByDistance(latLng, new LatLng(centroid[0], centroid[1])) >= i10) { return false; } return true; } public static BuisnessLayer findBuissnessLayerById(String str) { BuisnessLayer buisnessLayer = new BuisnessLayer(); Iterator<BuisnessLayer> it = AppConstants.buissnessLayerConstant.iterator(); while (it.hasNext()) { BuisnessLayer next = it.next(); if (next.getId() == parseInt(str)) { buisnessLayer = next; } } return buisnessLayer; } public static double formatDecimalValue(double d10) { double parseDouble = parseDouble(new DecimalFormat("####0.000000").format(d10)); return parseDouble == 0.0d ? d10 : parseDouble; } public static double formatDecimalValueUptoTwoDigit(double d10) { double parseDouble = parseDouble(new DecimalFormat("####0.00").format(d10)); return parseDouble == 0.0d ? d10 : parseDouble; } public static String formatDouble(double d10) { try { return new DecimalFormat("#0.00").format(d10); } catch (NumberFormatException e10) { e10.printStackTrace(); return ""; } } public static String formatDoubleuptoSix(double d10) { try { return new DecimalFormat("#0.000000").format(d10); } catch (NumberFormatException e10) { e10.printStackTrace(); return ""; } } public static String formatFileSize(long j10) { double d10 = j10 / 1024.0d; double d11 = d10 / 1024.0d; double d12 = d11 / 1024.0d; DecimalFormat decimalFormat = new DecimalFormat("0.00"); if (d12 > 1.0d) { return decimalFormat.format(d12).concat(" GB"); } if (d11 > 1.0d) { return decimalFormat.format(d11).concat(" MB"); } if (d10 > 1.0d) { return decimalFormat.format(d11).concat(" KB"); } return j10 + " Byte"; } public static String fromBase64(String str) { try { return new String(Base64.decode(str, 0), "UTF-8"); } catch (UnsupportedEncodingException e10) { e10.printStackTrace(); return null; } } public static VoiceActionSpecsModel getActionModel(Context context, String str) { VoiceActionSpecsModel voiceActionSpecsModel = null; if (context == null) { return null; } VoiceDataModel voiceJson = getVoiceJson(context); if (voiceJson != null && str != null && !str.isEmpty()) { voiceActionSpecsModel = new VoiceActionSpecsModel(); Iterator<String> it = voiceJson.getAction().keySet().iterator(); while (true) { int i10 = 0; if (!it.hasNext()) { break; } String next = it.next(); System.out.println(next + ":" + voiceJson.getAction().get(next)); String[] strArr = voiceJson.getAction().get(next); int length = strArr.length; while (true) { if (i10 >= length) { break; } if (str.contains(strArr[i10].toLowerCase())) { voiceActionSpecsModel.setAction(next); break; } i10++; } } for (String str2 : voiceJson.getEntity().keySet()) { System.out.println(str2 + ":" + voiceJson.getEntity().get(str2)); String[] strArr2 = voiceJson.getEntity().get(str2); int length2 = strArr2.length; int i11 = 0; while (true) { if (i11 >= length2) { break; } if (str.contains(strArr2[i11].toLowerCase())) { voiceActionSpecsModel.setEntity(str2); break; } i11++; } } for (String str3 : voiceJson.getBom().keySet()) { System.out.println(str3 + ":" + voiceJson.getBom().get(str3)); String[] strArr3 = voiceJson.getBom().get(str3); int length3 = strArr3.length; int i12 = 0; while (true) { if (i12 >= length3) { break; } if (str.contains(strArr3[i12].toLowerCase())) { voiceActionSpecsModel.setBom(str3); break; } i12++; } } Iterator<VoiceDataModel.SpecificationLstObj> it2 = voiceJson.getSpecificationlst().iterator(); while (it2.hasNext()) { VoiceDataModel.SpecificationLstObj next2 = it2.next(); if (voiceActionSpecsModel.getEntity() != null && voiceActionSpecsModel.getEntity().equalsIgnoreCase(next2.getEntity())) { for (String str4 : next2.getSpecification().keySet()) { System.out.println(str4 + ":" + next2.getSpecification().get(str4)); String[] strArr4 = next2.getSpecification().get(str4); int length4 = strArr4.length; int i13 = 0; while (true) { if (i13 >= length4) { break; } if (str.contains(strArr4[i13].toLowerCase())) { voiceActionSpecsModel.setSpecification(str4); break; } i13++; } } } } } return voiceActionSpecsModel; } public static String getAppVersion(Context context) { if (context == null) { return ""; } try { return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException e10) { throw new RuntimeException("Could not get package name: " + e10); } } public static String getAttributefromKey(String str, String str2) { String str3 = ""; try { JSONObject jSONObject = new JSONObject(str); Iterator<String> keys = jSONObject.keys(); while (keys.hasNext()) { String next = keys.next(); String string = jSONObject.getString(next); if (string != null && !string.equalsIgnoreCase("null") && next.equalsIgnoreCase(str2)) { str3 = string; } } } catch (JSONException e10) { e10.printStackTrace(); } return str3; } public static String getBase64FromString(String str) { try { return Base64.encodeToString(str.getBytes("UTF-8"), 0); } catch (UnsupportedEncodingException unused) { return null; } } public static int getBatteryPercentage(Context context) { if (Build.VERSION.SDK_INT >= 21) { return ((BatteryManager) context.getSystemService("batterymanager")).getIntProperty(4); } Intent registerReceiver = context.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED")); return (int) (((registerReceiver != null ? registerReceiver.getIntExtra("level", -1) : -1) / (registerReceiver != null ? registerReceiver.getIntExtra("scale", -1) : -1)) * 100.0d); } public static LatLngBounds getBoundsBounds(LatLng latLng, double d10) { if (latLng == null || d10 == 0.0d) { return null; } double sqrt = d10 * Math.sqrt(2.0d); return new LatLngBounds(g.b(latLng, sqrt, 225.0d), g.b(latLng, sqrt, 45.0d)); } public static ArrayList<BuisnessLayer> getBuissness(Context context) { return (ArrayList) new e().i(SharePrefFactory.getStringPref(context, SharePrefConstants.BuissnessLayerState), new com.google.gson.reflect.a<ArrayList<BuisnessLayer>>() { }.getType()); } public static String getCableColor(OfflineElementModel offlineElementModel) { String attributefromKey = getAttributefromKey(offlineElementModel.getEntity_attribute(), "cable_type"); return attributefromKey.equalsIgnoreCase("Underground") ? "#0404ff" : attributefromKey.equalsIgnoreCase("Overhead") ? "#ff15ca" : attributefromKey.equalsIgnoreCase("Wall Clamped") ? "#ff0404" : "#ffffff"; } public static String getCommaSeparatedLayers(List<String> list) { return (list == null || list.isEmpty()) ? "" : TextUtils.join(",", list); } private double getConvertedDistance(LatLng latLng, LatLng latLng2) { return new BigDecimal(distance(latLng.f5531b, latLng.f5532c, latLng2.f5531b, latLng2.f5532c)).setScale(3, RoundingMode.DOWN).doubleValue(); } public static String getCurentDate() { return new SimpleDateFormat(AppConstants.YYYY_MM_DD_T_HH_MM_SS).format(Calendar.getInstance().getTime()); } public static String getCurrentYear() { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy", Locale.ENGLISH); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); return simpleDateFormat.format(calendar.getTime()); } public static String getDate(long j10, String str) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str, Locale.ENGLISH); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(j10); return simpleDateFormat.format(calendar.getTime()); } public static appDatabase getDb(Context context) { return appDatabase.getAppDatabase(context); } @SuppressLint({"Range"}) public static String getFileName(Context context, Uri uri) { String str = null; if (uri.getScheme().equals("content")) { Cursor query = context.getContentResolver().query(uri, null, null, null, null); if (query != null) { try { if (query.moveToFirst()) { str = query.getString(query.getColumnIndex("_display_name")); } } finally { query.close(); } } } if (str != null) { return str; } String path = uri.getPath(); int lastIndexOf = path.lastIndexOf(47); return lastIndexOf != -1 ? path.substring(lastIndexOf + 1) : path; } public static String getFirstAlpha(String str) { return (str == null || str.isEmpty()) ? "" : str.substring(0, 1); } public static String getFlavourName(String str) { return str + "-JIO"; } public static String getFormatDate(String str, String str2, String str3) { if (str == null || str.isEmpty()) { return ""; } try { Locale locale = Locale.ENGLISH; return new SimpleDateFormat(str3, locale).format(new SimpleDateFormat(str2, locale).parse(str)); } catch (ParseException e10) { e10.printStackTrace(); return str; } } public static String getGeom(String str, String str2) { if (!str2.equalsIgnoreCase("Point")) { return ""; } String str3 = "POINT(" + str + ")"; Log.i(TAG, "Geom: " + str3); return str3; } public static OfflineElementInitialModel getInitialObjFromElementModel(OfflineElementModel offlineElementModel) { OfflineElementInitialModel offlineElementInitialModel = new OfflineElementInitialModel(); offlineElementInitialModel.setCreateelement_sid(offlineElementModel.getCreateelement_sid()); if (offlineElementModel.getNetwork_id() != null) { offlineElementInitialModel.setNetwork_id(offlineElementModel.getNetwork_id()); } if (offlineElementModel.getEntity_attribute() != null) { offlineElementInitialModel.setEntity_attribute(offlineElementModel.getEntity_attribute()); } if (offlineElementModel.getDisplay_attribute() != null) { offlineElementInitialModel.setDisplay_attribute(offlineElementModel.getDisplay_attribute()); } if (offlineElementModel.getNetwork_status() != null) { offlineElementInitialModel.setNetwork_status(offlineElementModel.getNetwork_status()); } if (offlineElementModel.getGeom_type() != null) { offlineElementInitialModel.setGeom_type(offlineElementModel.getGeom_type()); } if (offlineElementModel.getGeom() != null) { offlineElementInitialModel.setGeom(offlineElementModel.getGeom()); } if (offlineElementModel.getLayer_title() != null) { offlineElementInitialModel.setLayer_title(offlineElementModel.getLayer_title()); } if (offlineElementModel.getEntity_type() != null) { offlineElementInitialModel.setEntity_type(offlineElementModel.getEntity_type()); } if (offlineElementModel.getEntity_category() != null) { offlineElementInitialModel.setEntity_category(offlineElementModel.getEntity_category()); } if (offlineElementModel.getBarcode() != null) { offlineElementInitialModel.setBarcode(offlineElementModel.getBarcode()); } if (offlineElementModel.getSystem_id() != null) { offlineElementInitialModel.setSystem_id(offlineElementModel.getSystem_id()); } return offlineElementInitialModel; } public static InputFilter getInputFilter(final int i10, final int i11) { return new InputFilter() { @Override public CharSequence filter(CharSequence charSequence, int i12, int i13, Spanned spanned, int i14, int i15) { StringBuilder sb = new StringBuilder(spanned); sb.replace(i14, i15, charSequence.subSequence(i12, i13).toString()); String sb2 = sb.toString(); StringBuilder sb3 = new StringBuilder(); sb3.append("(([0-9]{1})([0-9]{0,"); sb3.append(i10 - 1); sb3.append("})?)?(\\.[0-9]{0,"); sb3.append(i11); sb3.append("})?"); if (sb2.matches(sb3.toString())) { return null; } return charSequence.length() == 0 ? spanned.subSequence(i14, i15) : ""; } }; } private static Intent getIntent(Context context, ScreenType screenType) { Intent intent; if (AnonymousClass13.$SwitchMap$com$leptonsoftware$fibernet$jsonparser$ScreenType[screenType.ordinal()] != 1) { return null; } if (isJioPartnerFiber()) { intent = new Intent(context, (Class<?>) LoginActivity.class); } else { intent = new Intent(context, (Class<?>) com.leptonsoftware.fibernet.LoginActivity.class); } return intent; } public static long getInternalSpace() { long blockSize; long availableBlocks; StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath()); if (Build.VERSION.SDK_INT >= 18) { blockSize = statFs.getBlockSizeLong(); availableBlocks = statFs.getAvailableBlocksLong(); } else { blockSize = statFs.getBlockSize(); availableBlocks = statFs.getAvailableBlocks(); } long j10 = (blockSize * availableBlocks) / 1048576; Log.e("", "Available MB : " + j10); return j10; } public static String getJsonOther(Activity activity, ObjDynamicModel objDynamicModel, LinearLayout linearLayout, int i10) { if (activity == null || objDynamicModel == null || objDynamicModel.getLstFormControls() == null || objDynamicModel.getLstFormControls().size() == 0) { return null; } JSONObject jSONObject = new JSONObject(); try { jSONObject.put("record_system_id", String.valueOf(i10)); } catch (JSONException e10) { e10.printStackTrace(); } for (int i11 = 0; i11 < linearLayout.getChildCount(); i11++) { Object tag = linearLayout.getChildAt(i11).getTag(); if (activity instanceof EntityDashboardActivity) { try { jSONObject.put("record_system_id", "0"); } catch (JSONException e11) { e11.printStackTrace(); } } if (tag instanceof TextInputEditText) { TextInputEditText textInputEditText = (TextInputEditText) tag; if (textInputEditText.getTag() != null && (textInputEditText.getTag() instanceof ObjDynamicModel.lstFormControlObj)) { try { jSONObject.put(((ObjDynamicModel.lstFormControlObj) textInputEditText.getTag()).getField_name(), textInputEditText.getText().toString()); } catch (JSONException e12) { e12.printStackTrace(); } } } else if (tag instanceof Spinner) { Spinner spinner = (Spinner) tag; if (spinner.getTag() != null && (spinner.getTag() instanceof ObjDynamicModel.lstFormControlObj) && spinner.getSelectedItemPosition() > 0) { ObjDynamicModel.lstFormControlObj lstformcontrolobj = (ObjDynamicModel.lstFormControlObj) spinner.getTag(); try { Object selectedItem = spinner.getSelectedItem(); if (selectedItem instanceof ObjDynamicModel.lstFormDDLValuesObj) { jSONObject.put(lstformcontrolobj.getField_name(), ((ObjDynamicModel.lstFormDDLValuesObj) selectedItem).getValue_text()); } } catch (JSONException e13) { e13.printStackTrace(); } } } } return jSONObject.toString(); } public static ArrayList<LandBaseLayer> getLandbase(Context context) { return (ArrayList) new e().i(SharePrefFactory.getStringPref(context, SharePrefConstants.LandBaseLayerState), new com.google.gson.reflect.a<ArrayList<LandBaseLayer>>() { }.getType()); } public static int getLayerIcon(String str) { if (str.equalsIgnoreCase(AppConstants.POLE)) { return R.drawable.pole_layer; } if (str.equalsIgnoreCase(AppConstants.MANHOLE)) { return R.drawable.manhole_layer; } if (str.equalsIgnoreCase(AppConstants.SPLICECLOSURE)) { return R.drawable.spliceclosure_layer; } if (str.equalsIgnoreCase(AppConstants.ADB)) { return R.drawable.adb_layer; } if (str.equalsIgnoreCase(AppConstants.SPLITTER)) { return R.drawable.splitter_layer; } if (str.equalsIgnoreCase(AppConstants.ONT)) { return R.drawable.ont_layer; } if (str.equalsIgnoreCase(AppConstants.BDB)) { return R.drawable.bdb__layer; } if (str.equalsIgnoreCase(AppConstants.FDB)) { return R.drawable.fdb_layer; } if (str.equalsIgnoreCase(AppConstants.CDB)) { return R.drawable.cdb_layer; } if (str.equalsIgnoreCase(AppConstants.LOOP)) { return R.drawable.loop_layer; } if (str.equalsIgnoreCase(AppConstants.CABLE)) { return R.drawable.cable_layer; } if (str.equalsIgnoreCase(AppConstants.TREE)) { return R.drawable.tree_layer; } if (str.equalsIgnoreCase(AppConstants.WALL_MOUNT)) { return R.drawable.wallmount_layer; } if (str.equalsIgnoreCase(AppConstants.AREA)) { return R.drawable.area_layer; } if (str.equalsIgnoreCase(AppConstants.SubArea)) { return R.drawable.subarea_layer; } if (str.equalsIgnoreCase(AppConstants.DSA)) { return R.drawable.dsa_layer; } if (str.equalsIgnoreCase(AppConstants.CSA)) { return R.drawable.csa_layer; } if (str.equalsIgnoreCase(AppConstants.BUILDING)) { return R.drawable.building_layer; } if (str.equalsIgnoreCase("Duct")) { return R.drawable.duct_layer; } if (str.equalsIgnoreCase("Trench")) { return R.drawable.trench_layer; } if (str.equalsIgnoreCase("Mpod")) { return R.drawable.mpod_layer; } if (str.equalsIgnoreCase("Pod")) { return R.drawable.pod_layer; } if (str.equalsIgnoreCase(AppConstants.HTB)) { return R.drawable.htb_layer; } if (str.equalsIgnoreCase("cabinet")) { return R.drawable.cabinet_layer; } if (str.equalsIgnoreCase("competitor")) { return R.drawable.competitor_layer; } if (str.equalsIgnoreCase("conduit")) { return R.drawable.conduit_layer; } if (str.equalsIgnoreCase("customer")) { return R.drawable.customer_layer; } if (str.equalsIgnoreCase("duct")) { return R.drawable.duct_layer; } if (str.equalsIgnoreCase("coupler")) { return R.drawable.coupler_layer; } if (str.equalsIgnoreCase("fault")) { return R.drawable.fault_layer; } if (str.equalsIgnoreCase("Structure")) { return R.drawable.structure_layer; } if (str.equalsIgnoreCase("fms")) { return R.drawable.fms_layer; } return 0; } public static long getLayerIdfromLayerName(String str) { for (int i10 = 0; i10 < AppConstants.netWorkLayersConstant.size(); i10++) { if (AppConstants.netWorkLayersConstant.get(i10).getLayerName().equalsIgnoreCase(str)) { return AppConstants.netWorkLayersConstant.get(i10).getLayerId(); } } return 0L; } public static NetworkLayer getLayerfromLayerName(String str) { if (str == null) { return null; } for (int i10 = 0; i10 < AppConstants.netWorkLayersConstant.size(); i10++) { if (AppConstants.netWorkLayersConstant.get(i10).getLayerName().equalsIgnoreCase(str)) { return AppConstants.netWorkLayersConstant.get(i10); } } return null; } public static NetworkLayer getLayerfromLayerNameVisibleOnMobileMap(String str) { if (str == null) { return null; } for (int i10 = 0; i10 < AppConstants.netWorkLayersConstant.size(); i10++) { if (AppConstants.netWorkLayersConstant.get(i10).getLayerName().equalsIgnoreCase(str.toLowerCase()) && AppConstants.netWorkLayersConstant.get(i10).isIs_visible_in_mobile_lib()) { Log.i(TAG, "isIs_visible_in_mobile_lib::" + str + "::" + AppConstants.netWorkLayersConstant.get(i10).isIs_visible_in_mobile_lib() + "::::" + AppConstants.netWorkLayersConstant.get(i10)); return AppConstants.netWorkLayersConstant.get(i10); } } return null; } public static NetworkLayer getLayerfromLayerNamewithContains(String str) { if (str == null) { return null; } for (int i10 = 0; i10 < AppConstants.netWorkLayersConstant.size(); i10++) { if (AppConstants.netWorkLayersConstant.get(i10).getLayerName().equalsIgnoreCase(str.toLowerCase())) { return AppConstants.netWorkLayersConstant.get(i10); } } return null; } public static NetworkLayer getLayerfromLayerTitle(String str) { for (int i10 = 0; i10 < AppConstants.netWorkLayersConstant.size(); i10++) { if (str.toLowerCase().contains(AppConstants.netWorkLayersConstant.get(i10).getLayerTitle().toLowerCase())) { return AppConstants.netWorkLayersConstant.get(i10); } } return null; } public static String getMacAddress(Context context) { return context == null ? "" : Settings.Secure.getString(context.getContentResolver(), "android_id"); } public static a getMapIconBitmapDescriptor(Context context, String str) { if (str.equalsIgnoreCase(AppConstants.POLE)) { return bitmapDescriptorFromVector(context, R.drawable.pole_other); } if (str.equalsIgnoreCase(AppConstants.MANHOLE)) { return bitmapDescriptorFromVector(context, R.drawable.manhole); } if (str.equalsIgnoreCase(AppConstants.SPLICECLOSURE)) { return bitmapDescriptorFromVector(context, R.drawable.spliceclosure); } if (str.equalsIgnoreCase(AppConstants.ADB)) { return bitmapDescriptorFromVector(context, R.drawable.adb); } if (str.equalsIgnoreCase(AppConstants.SPLITTER)) { return bitmapDescriptorFromVector(context, R.drawable.splittericon); } if (str.equalsIgnoreCase(AppConstants.ONT)) { return bitmapDescriptorFromVector(context, R.drawable.ont); } if (str.equalsIgnoreCase(AppConstants.BDB)) { return bitmapDescriptorFromVector(context, R.drawable.bdb_map); } if (str.equalsIgnoreCase(AppConstants.FDB)) { return bitmapDescriptorFromVector(context, R.drawable.fdb_map); } if (str.equalsIgnoreCase(AppConstants.CDB)) { return bitmapDescriptorFromVector(context, R.drawable.cdb_map); } if (str.equalsIgnoreCase(AppConstants.LOOP)) { return bitmapDescriptorFromVector(context, R.drawable.loop_map); } if (str.equalsIgnoreCase(AppConstants.TREE)) { return bitmapDescriptorFromVector(context, R.drawable.tree); } if (str.equalsIgnoreCase(AppConstants.WALL_MOUNT)) { return bitmapDescriptorFromVector(context, R.drawable.wallmount); } if (str.equalsIgnoreCase(AppConstants.BUILDING)) { return bitmapDescriptorFromVector(context, R.drawable.building_icon_map); } if (str.equalsIgnoreCase(AppConstants.POD)) { return bitmapDescriptorFromVector(context, R.drawable.pod_map); } return bitmapDescriptorFromVector(context, com.leptonsoftware.fibernet.R.drawable.marker_default); } public static void getMapType(Context context, c cVar) { int intPref = SharePrefFactory.getIntPref(context, SharePrefConstants.defaultMapType, 0); cVar.t(intPref); if (intPref == 0) { AppConstants.CURRENT_MAP_TYPE = "nomap"; } if (intPref == 1) { AppConstants.CURRENT_MAP_TYPE = "normal"; return; } if (intPref == 2) { AppConstants.CURRENT_MAP_TYPE = "satellite"; } else if (intPref == 3) { AppConstants.CURRENT_MAP_TYPE = "terrain"; } else if (intPref == 4) { AppConstants.CURRENT_MAP_TYPE = "hybrid"; } } public static String[] getMaskIdsArr(String str) { if (str == null || str.isEmpty()) { return null; } int indexOf = str.indexOf("x") < 0 ? 0 : str.indexOf("x"); int indexOf2 = str.indexOf("n") < 0 ? 0 : str.indexOf("n"); if (indexOf <= 0 || indexOf2 <= 0) { indexOf = Math.max(indexOf, indexOf2); } else if (indexOf >= indexOf2) { indexOf = indexOf2; } return new String[]{str.substring(0, indexOf), str.substring(indexOf)}; } public static String getMethodName(int i10) { return Thread.currentThread().getStackTrace()[(r0.length - 1) - i10].getMethodName(); } public static String getNamefromAttr(String str, String str2) { if (str.equalsIgnoreCase(AppConstants.POLE)) { return getAttributefromKey(str2, "pole_name"); } if (str.equalsIgnoreCase(AppConstants.MANHOLE)) { return getAttributefromKey(str2, "manhole_name"); } return str.equalsIgnoreCase(AppConstants.FDB) ? getAttributefromKey(str2, "fdb_name") : " "; } public static ArrayList<NetworkLayer> getNetwork(Context context) { return (ArrayList) new e().i(SharePrefFactory.getStringPref(context, SharePrefConstants.NetworkLayerState), new com.google.gson.reflect.a<ArrayList<NetworkLayer>>() { }.getType()); } public static String getNetworkidfromAttr(String str) { return getAttributefromKey(str, "network_id"); } public static int getNumber(String str) { HashMap hashMap = new HashMap(); hashMap.put("one", 1); hashMap.put("two", 2); hashMap.put("three", 3); hashMap.put("four", 4); hashMap.put("five", 5); hashMap.put("six", 6); hashMap.put("seven", 7); hashMap.put("eight", 8); hashMap.put("nine", 9); hashMap.put("ten", 10); hashMap.put("to", 2); if (hashMap.get(str) == null) { return -1; } return ((Integer) hashMap.get(str)).intValue(); } private LatLng getPolygonCenterPoint(ArrayList<LatLng> arrayList) { LatLngBounds.a aVar = new LatLngBounds.a(); for (int i10 = 0; i10 < arrayList.size(); i10++) { aVar.b(arrayList.get(i10)); } return aVar.a().w0(); } public static String getPolygonColor(OfflineElementModel offlineElementModel) { return (offlineElementModel.getEntity_type().equalsIgnoreCase(AppConstants.AREA) || offlineElementModel.getEntity_type().equalsIgnoreCase("ROW") || offlineElementModel.getEntity_type().equalsIgnoreCase(AppConstants.DSA)) ? "#80bcecff" : "#80cfeaa5"; } public static String getPortInfo(String str, String str2, String str3) { if (!str.equalsIgnoreCase("false")) { return ""; } if (!str2.toUpperCase().equalsIgnoreCase(AppConstants.CABLE) && !str2.toUpperCase().equalsIgnoreCase("CUSTOMER")) { if (str3.substring(0, 1).equalsIgnoreCase("-")) { return "[ " + str3.replace("-", "") + " IN ]"; } return "[ " + str3 + " OUT ]"; } return "[ " + str3 + " ]"; } public static String getPortInfowithoutBracket(String str, String str2, String str3) { if (!str.equalsIgnoreCase("false")) { return ""; } if (str2.toUpperCase().equalsIgnoreCase(AppConstants.CABLE) || str2.toUpperCase().equalsIgnoreCase("CUSTOMER")) { return str3; } if (str3.substring(0, 1).equalsIgnoreCase("-")) { return str3.replace("-", "") + " IN"; } return str3 + " OUT"; } public static String getReadableCurentDate() { return new SimpleDateFormat(AppConstants.DD_MMM_YY_HH_MM_AA).format(Calendar.getInstance().getTime()); } public static ProvinceDataModel getRegionProvince(String str, Activity activity) { ArrayList<LatLng> parseGeoJson = JsonParser.parseGeoJson(GeoJsonType.MULTI_POLYGON, str); ProvinceDataModel provinceDataModel = new ProvinceDataModel(); List<ProvinceDataModel> all = getDb(activity).provinceListQuery().getAll(); if (parseGeoJson == null || parseGeoJson.size() <= 0) { return provinceDataModel; } for (int i10 = 0; i10 < all.size(); i10++) { ArrayList<LatLng> parseGeoJson2 = JsonParser.parseGeoJson(GeoJsonType.MULTI_POLYGON, all.get(i10).getProvince_geom()); if (parseGeoJson2 != null && isPointInPolygon(parseGeoJson.get(0), parseGeoJson2)) { return all.get(i10); } } return provinceDataModel; } public static String getResourceValue(Context context, String str) { ArrayList<ResourceLang> arrayList = AppConstants.lstresurce; if (arrayList == null || arrayList.size() == 0) { initResources(context); } Iterator<ResourceLang> it = AppConstants.lstresurce.iterator(); while (it.hasNext()) { ResourceLang next = it.next(); if (next != null && next.getKey().equalsIgnoreCase(str)) { return next.getValue(); } } return str; } public static String getSdkBuildVersionNumber() { return Build.VERSION.SDK_INT + ""; } public static BuisnessLayer getSharedBuissnessLayerfromLayerName(String str, ArrayList<BuisnessLayer> arrayList) { for (int i10 = 0; i10 < arrayList.size(); i10++) { if (arrayList.get(i10).getLayer_name().equalsIgnoreCase(str)) { return arrayList.get(i10); } } return null; } public static LandBaseLayer getSharedLandbaseLayerfromLayerName(String str, ArrayList<LandBaseLayer> arrayList) { for (int i10 = 0; i10 < arrayList.size(); i10++) { if (arrayList.get(i10).getLayer_name().equalsIgnoreCase(str)) { return arrayList.get(i10); } } return null; } public static NetworkLayer getSharedNetworkLayerfromLayerName(String str, ArrayList<NetworkLayer> arrayList) { for (int i10 = 0; i10 < arrayList.size(); i10++) { if (arrayList.get(i10).getLayerName().equalsIgnoreCase(str)) { return arrayList.get(i10); } } return null; } public static Typeface getStaticBombayConcertTypeface(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/bombay_gas_concertOne.ttf"); } public static Typeface getStaticIcomoonTypeface(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/icomoon.ttf"); } public static Typeface getStaticIcomoonWebTypeface(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/icomoonweb.ttf"); } public static boolean getStaticIsDirectSaveForOffline(NetworkLayer networkLayer) { if (networkLayer != null) { if (networkLayer.getLayerName().equalsIgnoreCase(AppConstants.POLE)) { return false; } networkLayer.getLayerName().equalsIgnoreCase(AppConstants.MANHOLE); } return true; } public static Typeface getStaticJioTypeBoldTypeface(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/jio_type_bold.ttf"); } public static Typeface getStaticJioTypeMediumTypeface(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/jio_type_medium.ttf"); } public static Typeface getStaticRobotoMediumTypeface(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/roboto_medium.ttf"); } public static Typeface getStaticSpectraTypeface(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/spectra_regular.ttf"); } public static String getTimeDiff(Long l10, String str) { Long valueOf = Long.valueOf(l10.longValue() * 1000); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(AppConstants.YYYY_MM_DD_T_HH_MM_SS); SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("YYYY/MM/DD"); if (valueOf.longValue() == 0) { return ""; } String format = simpleDateFormat.format(new Date()); Calendar calendar = Calendar.getInstance(); long longValue = valueOf.longValue(); calendar.setTimeInMillis(longValue); simpleDateFormat.format(calendar.getTime()); try { long abs = Math.abs(simpleDateFormat.parse(format).getTime() - simpleDateFormat.parse(str).getTime()); long j10 = abs / 86400000; long j11 = abs % 86400000; long j12 = j11 / 3600000; long j13 = j11 % 3600000; long j14 = j13 / 60000; long j15 = (j13 % 60000) / 1000; if (j10 == 0) { if (j12 != 0) { return String.valueOf(j12) + " hours ago"; } if (j14 != 0) { return String.valueOf(j14) + " minutes ago"; } if (j15 < 0) { return "0 second"; } if (j15 <= 0 || j15 >= 59) { return "0 second ago"; } return j15 + " seconds ago"; } if (j10 == 1) { return "yesterday"; } if (j10 <= 29) { return String.valueOf(j10) + " days ago"; } if (j10 > 29 && j10 <= 58) { return "1 month ago"; } if (j10 > 58 && j10 <= 87) { return "2 months ago"; } if (j10 > 87 && j10 <= 116) { return "3 months ago"; } if (j10 > 116 && j10 <= 145) { return "4 months ago"; } if (j10 > 145 && j10 <= 174) { return "5 months ago"; } if (j10 > 174 && j10 <= 203) { return "6 months ago"; } if (j10 > 203 && j10 <= 232) { return "7 months ago"; } if (j10 > 232 && j10 <= 261) { return "8 months ago"; } if (j10 > 261 && j10 <= 290) { return "9 months ago"; } if (j10 > 290 && j10 <= 319) { return "10 months ago"; } if (j10 > 319 && j10 <= 348) { return "11 months ago"; } if (j10 > 348 && j10 <= 360) { return "12 months ago"; } if (j10 > 360 && j10 <= 720) { return "1 year ago"; } if (j10 <= 720) { return "0 second ago"; } Calendar calendar2 = Calendar.getInstance(); calendar2.setTimeInMillis(longValue); return simpleDateFormat2.format(calendar2.getTime()) + ""; } catch (ParseException e10) { e10.printStackTrace(); return "0 second ago"; } } public static Bitmap getUprightImage(String str) { ExifInterface exifInterface; try { exifInterface = new ExifInterface(str); } catch (IOException e10) { e10.printStackTrace(); exifInterface = null; } int attributeInt = exifInterface.getAttributeInt("Orientation", 1); int i10 = 0; if (attributeInt == 3) { i10 = 180; } else if (attributeInt == 6) { i10 = 90; } else if (attributeInt == 8) { i10 = 270; } new Matrix().postRotate(i10); try { try { return BitmapFactory.decodeFile(str); } catch (OutOfMemoryError unused) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 2; return BitmapFactory.decodeFile(str, options); } } catch (Exception e11) { e11.printStackTrace(); throw null; } } public static VoiceDataModel getVoiceJson(Context context) { if (context == null) { return null; } return (VoiceDataModel) JsonParser.convertJsonToBean(ApiType.VOICE_COMMAND, readRawTextFile(context, R.raw.voicejsonfile_jio)); } public static int getWmsIcon(Context context, OfflineElementModel offlineElementModel, String str) { int i10; String entity_type = offlineElementModel.getEntity_type(); if (entity_type.equalsIgnoreCase(AppConstants.POLE)) { String attributefromKey = getAttributefromKey(offlineElementModel.getEntity_attribute(), "pole_type"); if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { if (attributefromKey.equalsIgnoreCase("Electrical")) { i10 = R.drawable.electric_pole_p; } else { if (!attributefromKey.equalsIgnoreCase("Light")) { if (attributefromKey.equalsIgnoreCase("Other")) { i10 = R.drawable.otherpole_p; } return 0; } i10 = R.drawable.lightpole_p; } return i10; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { if (attributefromKey.equalsIgnoreCase("Electrical")) { i10 = R.drawable.electric_pole_a; } else { if (!attributefromKey.equalsIgnoreCase("Light")) { if (attributefromKey.equalsIgnoreCase("Other")) { i10 = R.drawable.otherpole_a; } return 0; } i10 = R.drawable.lightpole_a; } return i10; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { if (attributefromKey.equalsIgnoreCase("Electrical")) { i10 = R.drawable.electric_pole_d; } else if (attributefromKey.equalsIgnoreCase("Light")) { i10 = R.drawable.lightpole_d; } else if (attributefromKey.equalsIgnoreCase("Other")) { i10 = R.drawable.otherpole_d; } return i10; } return 0; } if (entity_type.equalsIgnoreCase(AppConstants.MANHOLE)) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.manhole_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.manhole_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.manhole_d; } } else if (entity_type.equalsIgnoreCase(AppConstants.SPLICECLOSURE)) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.spliceclosure_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.spliceclosure_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.spliceclosure_d; } } else if (entity_type.equalsIgnoreCase(AppConstants.ADB)) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.adb_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.adb_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.adb_d; } } else if (entity_type.equalsIgnoreCase(AppConstants.SPLITTER)) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P") || offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.splitter_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.splitter_d; } } else { if (entity_type.equalsIgnoreCase(AppConstants.ONT)) { if (!offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { if (!offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.ont_d; } } return R.drawable.ont_a; } return R.drawable.ont_p; } if (entity_type.equalsIgnoreCase(AppConstants.BDB)) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.bdb_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.bdb_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.bdb_d; } } else if (entity_type.equalsIgnoreCase(AppConstants.FDB)) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.fdb_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.fdb_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.fdb_d; } } else if (entity_type.equalsIgnoreCase(AppConstants.CDB)) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.cdb_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.cdb_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.cdb_d; } } else { if (entity_type.equalsIgnoreCase(AppConstants.LOOP)) { return R.drawable.loop_map; } if (entity_type.equalsIgnoreCase("pod")) { String attributefromKey2 = getAttributefromKey(offlineElementModel.getEntity_attribute(), "pod_type"); if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { if (attributefromKey2.equalsIgnoreCase("Aggregate")) { i10 = R.drawable.aggreation_pod_p; } else if (attributefromKey2.equalsIgnoreCase("Core")) { i10 = R.drawable.corepod_p; } return i10; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { if (attributefromKey2.equalsIgnoreCase("Aggregate")) { i10 = R.drawable.aggregationpod_a; } else if (attributefromKey2.equalsIgnoreCase("Core")) { i10 = R.drawable.corepod_a; } return i10; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { if (attributefromKey2.equalsIgnoreCase("Aggregate")) { i10 = R.drawable.aggregationpod_d; } else if (attributefromKey2.equalsIgnoreCase("Core")) { i10 = R.drawable.corepod_d; } return i10; } } else if (entity_type.equalsIgnoreCase("mpod")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.mpod_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.mpod_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.mpod_d; } } else if (entity_type.equalsIgnoreCase("basemount")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.basemountbdbbox_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.basemountbdb_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.basemountbdbbox_d; } } else if (entity_type.equalsIgnoreCase("cabinet")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.cabinet_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.cabinet_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.cabinet_d; } } else if (entity_type.equalsIgnoreCase("coupler")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.coupler_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.coupler_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.coupler_d; } } else if (entity_type.equalsIgnoreCase("customer")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.customer_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.customer_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.customer_d; } } else if (entity_type.equalsIgnoreCase("equipment")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.equipment_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.equipment_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.equipment_d; } } else if (entity_type.equalsIgnoreCase("fms")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.fms_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.fms_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.fms_d; } } else if (entity_type.equalsIgnoreCase("handhole")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.handhole_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.handhole_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.handhole_d; } } else if (entity_type.equalsIgnoreCase("htb")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.htb_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.htb_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.htb_d; } } else { if (entity_type.equalsIgnoreCase("ont")) { if (!offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { if (!offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.ont_d; } } return R.drawable.ont_a; } return R.drawable.ont_p; } if (entity_type.equalsIgnoreCase("rack")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.rack_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.rack_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.rack_d; } } else if (entity_type.equalsIgnoreCase("tree")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.tree_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.tree_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.tree_d; } } else if (entity_type.equalsIgnoreCase("vault")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.vault_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.vault_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.vault_d; } } else if (entity_type.equalsIgnoreCase("wallmount")) { if (offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) { return R.drawable.wallmount_p; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) { return R.drawable.wallmount_a; } if (offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) { return R.drawable.wallmount_d; } } } } } return 0; } public static List<l> getpattern(OfflineElementModel offlineElementModel) { ArrayList arrayList = new ArrayList(); return (offlineElementModel.getNetwork_status() == null || !offlineElementModel.getNetwork_status().equalsIgnoreCase("P")) ? (offlineElementModel.getNetwork_status() == null || !offlineElementModel.getNetwork_status().equalsIgnoreCase("D")) ? (offlineElementModel.getNetwork_status() == null || !offlineElementModel.getNetwork_status().equalsIgnoreCase("A")) ? arrayList : Arrays.asList(new p4.g(100.0f)) : Arrays.asList(new p4.g(50.0f), new i(10.0f), new h(), new i(10.0f)) : Arrays.asList(new p4.g(60.0f), new i(10.0f)); } public static void infoLog(String str, String str2) { Crashlytics.log(4, str, str2); } public static boolean initResources(Context context) { String stringPref = SharePrefFactory.getStringPref(context, SharePrefConstants.ResString); if (stringPref == null) { return false; } LangResourceResp langResourceResp = (LangResourceResp) JsonParser.convertJsonToBean(ApiType.LANG_RES, stringPref); AppConstants.lstresurce.clear(); if (langResourceResp == null || langResourceResp.getResulta() == null || langResourceResp.getResulta().getLstResKeys() == null) { return true; } AppConstants.lstresurce.addAll(langResourceResp.getResulta().getLstResKeys()); return true; } public static boolean isCameraPermissionsGranted(Activity activity) { if (Build.VERSION.SDK_INT >= 23) { if (activity.checkSelfPermission("android.permission.CAMERA") == 0) { Log.v(TAG, "Permission is granted"); return true; } Log.v(TAG, "Permission is revoked"); return false; } Log.v(TAG, "Permission is granted"); return true; } public static boolean isFibernet() { return true; } public static boolean isFloat(String str) { return Pattern.compile("[\\x00-\\x20]*[+-]?(NaN|Infinity|((((\\p{Digit}+)(\\.)?((\\p{Digit}+)?)([eE][+-]?(\\p{Digit}+))?)|(\\.((\\p{Digit}+))([eE][+-]?(\\p{Digit}+))?)|(((0[xX](\\p{XDigit}+)(\\.)?)|(0[xX](\\p{XDigit}+)?(\\.)(\\p{XDigit}+)))[pP][+-]?(\\p{Digit}+)))[fFdD]?))[\\x00-\\x20]*").matcher(str).matches(); } public static boolean isJioPartnerFiber() { return true; } public static boolean isMobileDataConnected(Context context) { NetworkInfo networkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getNetworkInfo(0); return networkInfo != null && networkInfo.isConnected(); } public static boolean isMyServiceRunning(Context context, Class<?> cls) { if (context != null && cls != null) { Iterator<ActivityManager.RunningServiceInfo> it = ((ActivityManager) context.getSystemService("activity")).getRunningServices(Integer.MAX_VALUE).iterator(); while (it.hasNext()) { if (cls.getName().equals(it.next().service.getClassName())) { Log.i(TAG, "true"); return true; } } Log.i(TAG, "false"); } return false; } public static boolean isNetworkConnected(Context context) { NetworkInfo activeNetworkInfo; return (context == null || (activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo()) == null || !activeNetworkInfo.isConnectedOrConnecting()) ? false : true; } public static boolean isPointInPolygon(LatLng latLng, ArrayList<LatLng> arrayList) { int i10 = 0; int i11 = 0; while (i10 < arrayList.size() - 1) { LatLng latLng2 = arrayList.get(i10); i10++; if (rayCastIntersect(latLng, latLng2, arrayList.get(i10))) { i11++; } } return i11 % 2 == 1; } public static boolean isPolygonEntity(String str) { return str.equalsIgnoreCase(AppConstants.AREA) || str.equalsIgnoreCase(AppConstants.PROVINCE) || str.equalsIgnoreCase(AppConstants.DSA) || str.equalsIgnoreCase(AppConstants.CSA) || str.equalsIgnoreCase(AppConstants.SubArea); } public static boolean isvalidEntity(String str) { return getLayerfromLayerNamewithContains(str) != null; } public static boolean isvalidEntityForVoice(String str) { return getLayerfromLayerNameVisibleOnMobileMap(str) != null; } public static boolean isvalidcolor(String str) { return str != null && str.length() == 9; } public static void logInfo(Context context, String str) { FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(context); Bundle bundle = new Bundle(); bundle.putString("item_id", String.valueOf(Math.random())); bundle.putString("item_name", "info"); bundle.putString("content_type", str); firebaseAnalytics.b(String.valueOf(SharePrefFactory.getLongPref(context, SharePrefConstants.USER_ID, 0L))); firebaseAnalytics.a("select_content", bundle); Bundle bundle2 = new Bundle(); bundle2.putString("screen_name", "Default"); bundle2.putString("screen_class", "MainActivity"); firebaseAnalytics.a("screen_view", bundle2); Crashlytics.log(0, TAG, str); } public static void logoutAlertDialog(final Activity activity, String str, String str2) { if (activity == null) { return; } final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(true); ImageView imageView = (ImageView) dialog.findViewById(R.id.iv_icon); Button button = (Button) dialog.findViewById(R.id.btn_ok); Button button2 = (Button) dialog.findViewById(R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(R.id.tv_message); if (str.equalsIgnoreCase(activity.getString(R.string.info))) { imageView.setBackground(dialog.getContext().getDrawable(R.drawable.alert)); button.setBackground(dialog.getContext().getDrawable(R.drawable.btn_alert_ok_info)); } else if (str.equalsIgnoreCase(activity.getString(R.string.error))) { imageView.setBackground(dialog.getContext().getDrawable(R.drawable.error)); button.setBackground(dialog.getContext().getDrawable(R.drawable.btn_alert_ok_error)); } else if (str.equalsIgnoreCase(activity.getString(R.string.success))) { imageView.setBackground(dialog.getContext().getDrawable(R.drawable.success)); button.setBackground(dialog.getContext().getDrawable(R.drawable.btn_alert_ok_info)); } textView.setText(str); textView2.setText(str2); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); AppUtil.logoutFromAppOnLogoutButton(activity); } } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); } } }); dialog.show(); } public static void logoutFromApp(Activity activity) { } public static void logoutFromApp(Context context) { if (context != null) { SharePrefFactory.clearSharePref(context); stopCurrentLocationUpdate(context); stopJobScheduler(context, 100); } } public static void logoutFromAppOnLogoutButton(Activity activity) { if (activity != null) { String stringPref = SharePrefFactory.getStringPref(activity, SharePrefConstants.MAPDownloadedProvince); String stringPref2 = SharePrefFactory.getStringPref(activity, SharePrefConstants.DownloadedNetworkName); String stringPref3 = SharePrefFactory.getStringPref(activity, SharePrefConstants.DownloadedNetworkTime); SharePrefFactory.clearSharePref(activity); if (stringPref != null && !stringPref.isEmpty()) { SharePrefFactory.setStringPref(activity, SharePrefConstants.MAPDownloadedProvince, stringPref); } if (stringPref2 != null && !stringPref2.isEmpty()) { SharePrefFactory.setStringPref(activity, SharePrefConstants.DownloadedNetworkName, stringPref2); } if (stringPref3 != null && !stringPref3.isEmpty()) { SharePrefFactory.setStringPref(activity, SharePrefConstants.DownloadedNetworkTime, stringPref3); } stopCurrentLocationUpdate(activity); stopJobScheduler(activity, 100); Intent intent = getIntent(activity, ScreenType.LOGIN); intent.setFlags(335577088); activity.startActivity(intent); activity.finish(); } } public static LatLng movePoint(double d10, double d11, double d12, double d13) { double radians = Math.toRadians(d13); double radians2 = Math.toRadians(d10); double radians3 = Math.toRadians(d11); double d14 = d12 / 6371000; double asin = Math.asin((Math.sin(radians2) * Math.cos(d14)) + (Math.cos(radians2) * Math.sin(d14) * Math.cos(radians))); double atan2 = (((radians3 + Math.atan2((Math.sin(radians) * Math.sin(d14)) * Math.cos(radians2), Math.cos(d14) - (Math.sin(radians2) * Math.sin(asin)))) + 9.42477796076938d) % 6.283185307179586d) - 3.141592653589793d; LatLng latLng = new LatLng(Math.toDegrees(asin), Math.toDegrees(atan2)); System.out.println("latitude: " + Math.toDegrees(asin) + ", longitude: " + Math.toDegrees(atan2)); return latLng; } public static void onVolleyErrorResponseHandling(Activity activity, LepLogger lepLogger, VolleyError volleyError, String str) { if (activity == null || lepLogger == null) { return; } try { if (volleyError != null) { int i10 = volleyError.f3453b.f3484b; lepLogger.error(str, "onErrorResponse():statusCode:: " + i10); String volleyErrorMessage = volleyErrorMessage(volleyError); if (volleyError instanceof NetworkError) { String string = activity.getString(R.string.err_networkerror); alertDialog(activity, activity.getString(R.string.info), string); lepLogger.error(str, "onErrorResponse():" + string); return; } if (volleyError instanceof ServerError) { if (volleyErrorMessage == null || volleyErrorMessage.isEmpty()) { volleyErrorMessage = activity.getString(R.string.err_serverNotFound); } alertDialog(activity, activity.getString(R.string.error), volleyErrorMessage); lepLogger.error(str, "onErrorResponse():" + volleyErrorMessage); return; } if (volleyError instanceof AuthFailureError) { if (volleyErrorMessage == null || volleyErrorMessage.isEmpty()) { volleyErrorMessage = activity.getString(R.string.err_authFailure); } lepLogger.error(str, "onErrorResponse():" + volleyErrorMessage); lepLogger.error(str, "onErrorResponse():AuthFailureError:: " + i10); logoutAlertDialog(activity, activity.getString(R.string.error), volleyErrorMessage); return; } if (volleyError instanceof ParseError) { if (volleyErrorMessage == null || volleyErrorMessage.isEmpty()) { volleyErrorMessage = activity.getString(R.string.err_parseErr); } alertDialog(activity, activity.getString(R.string.error), volleyErrorMessage); lepLogger.error(str, "onErrorResponse():" + volleyErrorMessage); return; } if (volleyError instanceof NoConnectionError) { if (volleyErrorMessage == null || volleyErrorMessage.isEmpty()) { volleyErrorMessage = activity.getString(R.string.err_noConection); } alertDialog(activity, activity.getString(R.string.error), volleyErrorMessage); lepLogger.error(str, "onErrorResponse():" + volleyErrorMessage); return; } if (volleyError instanceof TimeoutError) { if (volleyErrorMessage == null || volleyErrorMessage.isEmpty()) { volleyErrorMessage = activity.getString(R.string.err_timeout); } alertDialog(activity, activity.getString(R.string.error), volleyErrorMessage); lepLogger.error(str, "onErrorResponse():" + volleyErrorMessage); return; } if (volleyErrorMessage == null || volleyErrorMessage.isEmpty()) { volleyErrorMessage = activity.getString(R.string.uncknown_error); } Log.e(str, "Unknown error:" + volleyError); alertDialog(activity, activity.getString(R.string.error), volleyErrorMessage); lepLogger.error(str, "onErrorResponse(): unknown error type"); return; } alertDialog(activity, activity.getString(R.string.error), activity.getString(R.string.uncknown_error)); lepLogger.error(str, "onErrorResponse(): volleyError is null"); } catch (Exception e10) { e10.printStackTrace(); lepLogger.error(str, "onErrorResponse():Exception:" + e10.getMessage()); } } public static double parseDouble(String str) { try { return Double.parseDouble(str); } catch (NumberFormatException e10) { e10.printStackTrace(); return 0.0d; } } public static int parseInt(String str) { if (str != null) { try { if (!str.isEmpty()) { return Integer.parseInt(str); } } catch (NumberFormatException e10) { e10.printStackTrace(); } } return 0; } public static long parseLong(String str) { if (str != null && !str.isEmpty()) { try { return Long.parseLong(str); } catch (NumberFormatException e10) { e10.printStackTrace(); } } return 0L; } public static void processDynamicView(Activity activity, ObjDynamicModel objDynamicModel, LinearLayout linearLayout, String str, LinearLayout linearLayout2) { JSONObject jSONObject; Iterator<ObjDynamicModel.lstFormControlObj> it; if (AppConstants.ticketObject != null || activity == null || objDynamicModel == null || objDynamicModel.getLstFormControls() == null || objDynamicModel.getLstFormControls().size() == 0) { return; } LayoutInflater from = LayoutInflater.from(activity); linearLayout.removeAllViews(); int i10 = 0; linearLayout2.setVisibility(0); linearLayout.setVisibility(0); ViewGroup viewGroup = null; if (str != null) { try { jSONObject = new JSONObject(str); } catch (JSONException e10) { e10.printStackTrace(); } it = objDynamicModel.getLstFormControls().iterator(); while (it.hasNext()) { ObjDynamicModel.lstFormControlObj next = it.next(); if (next.getControl_type().equalsIgnoreCase(DynamicControl.Strings.TEXT.toString())) { linearLayout.getChildCount(); ?? inflate = from.inflate(R.layout.formeditinput, viewGroup); TextInputLayout textInputLayout = (TextInputLayout) inflate.findViewById(R.id.tl_input); ?? r11 = (TextInputEditText) inflate.findViewById(R.id.et_edittext); InputFilter[] inputFilterArr = new InputFilter[1]; inputFilterArr[i10] = new InputFilter.LengthFilter(next.getMax_length()); r11.setFilters(inputFilterArr); if (next.getControl_value_type().equalsIgnoreCase(DynamicControl.Strings.ALPHANUMERIC.toString())) { r11.setInputType(147457); } else if (next.getControl_value_type().equalsIgnoreCase(DynamicControl.Strings.Integer.toString())) { r11.setInputType(2); } else if (next.getControl_value_type().equalsIgnoreCase(DynamicControl.Strings.Float.toString())) { r11.setInputType(8194); } else { r11.setInputType(131073); } r11.setTag(next); ?? optString = jSONObject != null ? jSONObject.optString(next.getField_name()) : viewGroup; if (optString != 0) { r11.setText(optString); } else if (next.getDefault_value() != null) { r11.setText(next.getDefault_value()); } if (next.isRequired()) { textInputLayout.setHint(next.getField_label() + " *"); } else { textInputLayout.setHint(next.getField_label()); } inflate.setTag(r11); linearLayout.addView(inflate); } else if (next.getControl_type().equalsIgnoreCase(DynamicControl.Strings.DROPDOWN.toString())) { linearLayout.getChildCount(); View inflate2 = from.inflate(R.layout.formeddropdown, viewGroup); Spinner spinner = (Spinner) inflate2.findViewById(R.id.sp_element_type); if (objDynamicModel.getLstFormDDLValues() != null) { ArrayList arrayList = new ArrayList(); ObjDynamicModel.lstFormDDLValuesObj lstformddlvaluesobj = new ObjDynamicModel.lstFormDDLValuesObj(); if (next.isRequired()) { lstformddlvaluesobj.setDisplay_text("Select " + next.getField_label() + " *"); } else { lstformddlvaluesobj.setDisplay_text("Select " + next.getField_label()); } lstformddlvaluesobj.setControl_id(next.getFieldID()); lstformddlvaluesobj.setValue_text(""); arrayList.add(lstformddlvaluesobj); ?? optString2 = jSONObject != null ? jSONObject.optString(next.getField_name()) : viewGroup; if (next.getDefault_value() != null && !next.getDefault_value().isEmpty()) { next.getDefault_value(); } Iterator<ObjDynamicModel.lstFormDDLValuesObj> it2 = objDynamicModel.getLstFormDDLValues().iterator(); int i11 = i10; int i12 = i11; while (it2.hasNext()) { ObjDynamicModel.lstFormDDLValuesObj next2 = it2.next(); if (next2.getControl_id() == next.getFieldID()) { if (i11 == 0 && optString2 != 0 && optString2.equalsIgnoreCase(next2.getValue_text())) { i11 = arrayList.size(); } if (next2.isIs_default()) { i12 = arrayList.size(); } arrayList.add(next2); } } spinner.setAdapter((SpinnerAdapter) new DropDownDynamicControlSpinnerAdapter(activity, R.layout.drop_down_item, R.id.tv_drop_down_title, arrayList)); spinner.setTag(next); if (i11 > 0) { spinner.setSelection(i11); } else if (i12 > 0 && optString2 == 0) { spinner.setSelection(i12); } } inflate2.setTag(spinner); linearLayout.addView(inflate2); } i10 = 0; viewGroup = null; } } jSONObject = null; it = objDynamicModel.getLstFormControls().iterator(); while (it.hasNext()) { } } public static int px2dp(Context context, float f10) { return (int) (f10 / (context.getResources().getDisplayMetrics().densityDpi / 160.0f)); } private static double rad2deg(double d10) { return (d10 * 180.0d) / 3.141592653589793d; } private static boolean rayCastIntersect(LatLng latLng, LatLng latLng2, LatLng latLng3) { double d10 = latLng2.f5531b; double d11 = latLng3.f5531b; double d12 = latLng2.f5532c; double d13 = latLng3.f5532c; double d14 = latLng.f5531b; double d15 = latLng.f5532c; if ((d10 > d14 && d11 > d14) || ((d10 < d14 && d11 < d14) || (d12 < d15 && d13 < d15))) { return false; } double d16 = (d10 - d11) / (d12 - d13); return (d14 - (((-d12) * d16) + d10)) / d16 > d15; } public static String readRawTextFile(Context context, int i10) { InputStream openRawResource = context.getResources().openRawResource(i10); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { for (int read = openRawResource.read(); read != -1; read = openRawResource.read()) { byteArrayOutputStream.write(read); } openRawResource.close(); return byteArrayOutputStream.toString(); } catch (IOException unused) { return null; } } public static void saveNetwork(ArrayList<NetworkLayer> arrayList, ArrayList<LandBaseLayer> arrayList2, ArrayList<BuisnessLayer> arrayList3, Context context) { e eVar = new e(); SharePrefFactory.setStringPref(context, SharePrefConstants.NetworkLayerState, eVar.q(arrayList)); SharePrefFactory.setStringPref(context, SharePrefConstants.LandBaseLayerState, eVar.q(arrayList2)); SharePrefFactory.setStringPref(context, SharePrefConstants.BuissnessLayerState, eVar.q(arrayList3)); } public static void scanUsingZbar(Fragment fragment, int i10) { if (fragment == null) { return; } fragment.startActivityForResult(new Intent(fragment.getActivity(), (Class<?>) SimpleScannerActivity.class), i10); } private static void scan_using_mlkit(Activity activity) { Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); if (intent.resolveActivity(activity.getPackageManager()) != null) { try { Uri e10 = FileProvider.e(activity, "com.leptonsoftware.fibernet.fileprovider", ((ManageEntitiesActivity) activity).getBarcodeImageFileHolder(activity)); intent.putExtra("android.intent.extra.finishOnCompletion", true); intent.putExtra("output", e10); activity.startActivityForResult(intent, 100); } catch (IOException unused) { Toasty.info(activity, "Please try again."); } } } public static void scheduleJob(Context context) { JobInfo.Builder builder = new JobInfo.Builder(0, new ComponentName(context, (Class<?>) TrackingJobService.class)); long longPref = SharePrefFactory.getLongPref(context, SharePrefConstants.TRACKING_TIME, 0L); builder.setPeriodic(longPref); Log.e("Tag", "" + longPref); builder.setPersisted(true); if (Build.VERSION.SDK_INT >= 23) { ((JobScheduler) context.getSystemService(JobScheduler.class)).schedule(builder.build()); } } public static void selectLayerListfromvoice(String str, ArrayList<NetworkLayer> arrayList, boolean z9) { ArrayList arrayList2 = new ArrayList(); if (str == null) { return; } boolean contains = str.contains("all"); for (int i10 = 0; i10 < arrayList.size(); i10++) { if (arrayList.get(i10).isIs_visible_on_mobile_map() && (contains || str.toLowerCase().contains(arrayList.get(i10).getLayerTitle().toLowerCase()))) { arrayList.get(i10).setPChecked(z9); arrayList.get(i10).setSelected(z9); if (!z9) { arrayList.get(i10).setAChecked(z9); arrayList.get(i10).setDChecked(z9); } ArrayList<NetworkLayer> arrayList3 = AppConstants.netWorkLayersConstant; if (arrayList3 != null && i10 < arrayList3.size()) { AppConstants.netWorkLayersConstant.get(i10).setPChecked(z9); AppConstants.netWorkLayersConstant.get(i10).setSelected(z9); if (!z9) { AppConstants.netWorkLayersConstant.get(i10).setAChecked(z9); AppConstants.netWorkLayersConstant.get(i10).setDChecked(z9); } } arrayList2.add(arrayList.get(i10)); } } } public static Bitmap setCameraPicOrientation(String str) { int i10; int attributeInt; if (str == null) { return null; } try { attributeInt = new ExifInterface(str).getAttributeInt("Orientation", 1); } catch (Exception e10) { e10.printStackTrace(); } if (attributeInt == 3) { i10 = 180; } else if (attributeInt != 6) { if (attributeInt == 8) { i10 = 270; } i10 = 0; } else { i10 = 90; } Matrix matrix = new Matrix(); matrix.postRotate(i10); BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(str, options); int min = Math.min(options.outWidth / 640, options.outHeight / 640); options.inJustDecodeBounds = false; options.inSampleSize = min; options.inPurgeable = true; Bitmap decodeFile = BitmapFactory.decodeFile(str, options); return (decodeFile == null || decodeFile.getWidth() <= 0 || decodeFile.getHeight() <= 0) ? decodeFile : Bitmap.createBitmap(decodeFile, 0, 0, decodeFile.getWidth(), decodeFile.getHeight(), matrix, true); } public static boolean setGlobalSettingData(TokenResponse tokenResponse, LepLogger lepLogger, Context context, String str) { String str2; JSONArray jSONArray; int i10; int i11; String str3; String str4 = SharePrefConstants.validDocumentTypes; String str5 = SharePrefConstants.validImageTypes; String str6 = SharePrefConstants.MaxFileUploadSizeLimit; if (tokenResponse.getGlobalSettings() == null || tokenResponse.getGlobalSettings().isEmpty()) { return false; } try { JSONArray jSONArray2 = new JSONArray(tokenResponse.getGlobalSettings()); int length = jSONArray2.length(); int i12 = 0; while (i12 < length) { JSONObject jSONObject = (JSONObject) jSONArray2.get(i12); if (jSONObject != null) { jSONArray = jSONArray2; long j10 = 3600000; i10 = length; i11 = i12; String str7 = str4; String str8 = str5; if (jSONObject.optString("key").equalsIgnoreCase("trackingTime")) { if (jSONObject.optString("description").contains("seconds")) { j10 = 1000; } else if (jSONObject.optString("description").contains("minutes")) { j10 = 60000; } else if (!jSONObject.optString("description").contains("hours")) { j10 = 1; } long parseLong = Long.parseLong(jSONObject.optString("value")) * j10; constants.Location_Track_TIME = parseLong; SharePrefFactory.setLongPref(context, SharePrefConstants.TRACKING_TIME, parseLong); } else { String str9 = str6; if (jSONObject.optString("key").equalsIgnoreCase("logoutTime")) { if (jSONObject.optString("description").contains("seconds")) { j10 = 1000; } else if (jSONObject.optString("description").contains("minutes")) { j10 = 60000; } else if (!jSONObject.optString("description").contains("hours")) { j10 = 1; } long parseLong2 = Long.parseLong(jSONObject.optString("value")) * j10; constants.Auto_Logout_TIME = parseLong2; SharePrefFactory.setLongPref(context, SharePrefConstants.LOGOUT_TIME, parseLong2); } else if (jSONObject.optString("key").equalsIgnoreCase("appVersion")) { String optString = jSONObject.optString("value"); constants.API_VERSION = optString.trim(); SharePrefFactory.setStringPref(context, SharePrefConstants.API_VERSION, optString.trim()); } else if (jSONObject.optString("key").equalsIgnoreCase("NearByBuildingbuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.BUFFER_FOR_BUILDING_CHECK, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("minBufferFromCurrentLocation")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MIN_BUFFER_FROM_CURRENT_LOCATION, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("isGeoCodeEnabled")) { SharePrefFactory.setIntPref(context, SharePrefConstants.GEO_CODE_ENABLE, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("MinTrackingDistanceDifference")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MIN_TRACKING_DISTANCE_DIFFERENCE, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("apkPath")) { SharePrefFactory.setStringPref(context, SharePrefConstants.APK_PATH, jSONObject.optString("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("entityAssociateBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.ENTITY_ASSOCIATE_BUFFER, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("wmsFilePath")) { String optString2 = jSONObject.optString("value"); String str10 = optString2.endsWith("/") ? "" : "/"; SharePrefFactory.setStringPref(context, SharePrefConstants.WMS_FILES_PATH_NO_LABEL, optString2 + str10 + "NetworkEntitiesNoLabelMobile.map"); SharePrefFactory.setStringPref(context, SharePrefConstants.WMS_FILES_PATH_WITH_LABEL, optString2 + str10 + "NetworkEntitiesLabelMobile.map"); SharePrefFactory.setStringPref(context, SharePrefConstants.LANDBASE_FILES_PATH_NO_LABEL, optString2 + str10 + "LandBaseEntitiesNoLabelMobile.map"); SharePrefFactory.setStringPref(context, SharePrefConstants.LANDBASE_FILES_PATH_WITH_LABEL, optString2 + str10 + "LandBaseEntitiesLabelMobile.map"); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.NearBySplitterBuffer)) { SharePrefFactory.setIntPref(context, SharePrefConstants.NearBySplitterBuffer, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("nearByDBBufferCRFS")) { SharePrefFactory.setIntPref(context, SharePrefConstants.NEARBYDBBUFFER_CRFS, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("nearByDBBufferARFS")) { SharePrefFactory.setIntPref(context, SharePrefConstants.NEARBYDBBUFFER_ARFS, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("maxARFSBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MAX_ADB_BUFFER, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("MaxOfflineNetworkBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MaxOfflineNetworkBuffer, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("MinOfflineNetworkBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MinOfflineNetworkBuffer, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("maxCRFSBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MAX_CDB_BUFFER, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("minCRFSBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MIN_CDB_BUFFER, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("minARFSBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.MIN_ADB_BUFFER, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("IsBarcodeEnabled")) { SharePrefFactory.setStringPref(context, SharePrefConstants.IS_BARCODE_ENABLED, jSONObject.optString("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("isOfflineEnabled")) { SharePrefFactory.setStringPref(context, SharePrefConstants.IS_OFFLINE_ENABLED, jSONObject.optString("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("minDownloadNetwork")) { SharePrefFactory.setStringPref(context, SharePrefConstants.MiN_DOWNLOAD_NETWORK, jSONObject.optString("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("maxDownloadNetwork")) { SharePrefFactory.setStringPref(context, SharePrefConstants.MAX_DOWNLOAD_NETWORK, jSONObject.optString("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("isterminationpointenable")) { SharePrefFactory.setIntPref(context, SharePrefConstants.IsTerminationpointenable, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("terminationPointsBuffer")) { SharePrefFactory.setIntPref(context, SharePrefConstants.TerminationPointsBuffer, jSONObject.optInt("value")); } else { str6 = str9; if (jSONObject.optString("key").equalsIgnoreCase(str6)) { SharePrefFactory.setIntPref(context, str6, jSONObject.optInt("value")); } else { str3 = str8; if (jSONObject.optString("key").equalsIgnoreCase(str3)) { SharePrefFactory.setStringPref(context, str3, jSONObject.optString("value")); str2 = str7; } else { str2 = str7; if (jSONObject.optString("key").equalsIgnoreCase(str2)) { SharePrefFactory.setStringPref(context, str2, jSONObject.optString("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.minLayersZoom)) { int optInt = jSONObject.optInt("value"); AppConstants.ZOOM_LEVEL = optInt; SharePrefFactory.setIntPref(context, SharePrefConstants.minLayersZoom, optInt); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.isEntityCreationAllowed)) { SharePrefFactory.setIntPref(context, SharePrefConstants.isEntityCreationAllowed, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.IsLocationValidationEnabled)) { SharePrefFactory.setIntPref(context, SharePrefConstants.IsLocationValidationEnabled, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.NetworkLayerOpacity)) { SharePrefFactory.setStringPref(context, SharePrefConstants.NetworkLayerOpacity, jSONObject.optString("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.IsNEBufferAllowed)) { SharePrefFactory.setIntPref(context, SharePrefConstants.IsNEBufferAllowed, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.NEDefaultBuffer)) { SharePrefFactory.setIntPref(context, SharePrefConstants.NEDefaultBuffer, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.Offline_download_data_batch_size)) { SharePrefFactory.setIntPref(context, SharePrefConstants.Offline_download_data_batch_size, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.Offline_max_download_data_count)) { SharePrefFactory.setIntPref(context, SharePrefConstants.Offline_max_download_data_count, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.isLbInfoActionEnabled)) { SharePrefFactory.setIntPref(context, SharePrefConstants.isLbInfoActionEnabled, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.IsGetAddressActionEnabled)) { SharePrefFactory.setIntPref(context, SharePrefConstants.IsGetAddressActionEnabled, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.IsDormantEnabled)) { SharePrefFactory.setIntPref(context, SharePrefConstants.IsDormantEnabled, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.defaultMapType)) { SharePrefFactory.setIntPref(context, SharePrefConstants.defaultMapType, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.isVoiceFeatureEnbaled)) { SharePrefFactory.setIntPref(context, SharePrefConstants.isVoiceFeatureEnbaled, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.isExistingNetworkVisible)) { SharePrefFactory.setIntPref(context, SharePrefConstants.isExistingNetworkVisible, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.isTileSkipEnabled)) { SharePrefFactory.setIntPref(context, SharePrefConstants.isTileSkipEnabled, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.WMSTileSize)) { SharePrefFactory.setIntPref(context, SharePrefConstants.WMSTileSize, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.gck)) { String optString3 = jSONObject.optString("value"); if (optString3 != null && !optString3.isEmpty() && optString3.length() > 10) { String str11 = TAG; Log.i(str11, "NK1" + optString3); String substring = optString3.substring(0, 10); Log.i(str11, "NK1-GCP1" + substring); SharePrefFactory.setStringPref(context, SharePrefConstants.gck, substring); String substring2 = optString3.substring(10); Log.i(str11, "NK1-GCP2" + substring2); SharePrefFactory.setStringPref(context, SharePrefConstants.gck2, substring2); } } else if (jSONObject.optString("key").equalsIgnoreCase(SharePrefConstants.IsBarcodeRequired)) { SharePrefFactory.setIntPref(context, SharePrefConstants.IsBarcodeRequired, jSONObject.optInt("value")); } else if (jSONObject.optString("key").equalsIgnoreCase("isPatternLockEnable")) { SharePrefFactory.setIntPref(context, SharePrefConstants.isPatternLockEnable, jSONObject.optInt("value")); } } } } str2 = str7; str3 = str8; str6 = str9; } str2 = str7; str3 = str8; } else { str2 = str4; jSONArray = jSONArray2; i10 = length; i11 = i12; str3 = str5; } i12 = i11 + 1; str5 = str3; str4 = str2; jSONArray2 = jSONArray; length = i10; } SharePrefFactory.setStringPref(context, SharePrefConstants.USER_NAME, tokenResponse.getUserName()); SharePrefFactory.setStringPref(context, SharePrefConstants.EMAIL, tokenResponse.getEmail()); SharePrefFactory.setStringPref(context, SharePrefConstants.USERROLEID, tokenResponse.getUserRoleId()); SharePrefFactory.setStringPref(context, SharePrefConstants.USER_ROLE, tokenResponse.getUserRole()); SharePrefFactory.setLongPref(context, SharePrefConstants.USER_ID, tokenResponse.getUserId()); SharePrefFactory.setStringPref(context, SharePrefConstants.LOGIN_ACCESS_TOKEN, tokenResponse.getAccess_token()); SharePrefFactory.setStringPref(context, SharePrefConstants.LOGIN_REFRESH_TOKEN, tokenResponse.getRefresh_token()); SharePrefFactory.setLongPref(context, SharePrefConstants.LOGIN_HISTORY_ID, tokenResponse.getLoginHistoryId()); SharePrefFactory.setStringPref(context, SharePrefConstants.PASSWORD, str); changeExpireTime(tokenResponse.getExpires_in(), context); AppConstants.MAP_FILES_PROVIDER_PATH_WITH_LABEL = SharePrefFactory.getStringPref(context, SharePrefConstants.WMS_FILES_PATH_WITH_LABEL); AppConstants.MAP_FILES_PROVIDER_PATH_NO_LABEL = SharePrefFactory.getStringPref(context, SharePrefConstants.WMS_FILES_PATH_NO_LABEL); AppConstants.LandBaseEntitiesWithLabel = SharePrefFactory.getStringPref(context, SharePrefConstants.LANDBASE_FILES_PATH_WITH_LABEL); AppConstants.LandBaseEntitiesNoLabel = SharePrefFactory.getStringPref(context, SharePrefConstants.LANDBASE_FILES_PATH_NO_LABEL); return true; } catch (JSONException e10) { e10.printStackTrace(); lepLogger.error(TAG, "setGlobalSettingData():" + e10.getMessage()); return false; } } public static void setLegendIcon(d dVar, ImageView imageView, String str) { String replaceAll = str.replaceAll("-", io.fabric.sdk.android.services.events.b.ROLL_OVER_FILE_NAME_SEPARATOR); if (replaceAll.equalsIgnoreCase("P_OH.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.p_oh)); return; } if (replaceAll.equalsIgnoreCase("A_OH.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.a_oh)); return; } if (replaceAll.equalsIgnoreCase("D_OH.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.d_oh)); return; } if (replaceAll.equalsIgnoreCase("P_UG.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.p_ug)); return; } if (replaceAll.equalsIgnoreCase("A_UG.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.a_ug)); return; } if (replaceAll.equalsIgnoreCase("D_UG.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.d_ug)); return; } if (replaceAll.equalsIgnoreCase("P_WC.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.p_wc)); return; } if (replaceAll.equalsIgnoreCase("A_WC.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.a_wc)); return; } if (replaceAll.equalsIgnoreCase("D_WC.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.d_wc)); return; } if (replaceAll.equalsIgnoreCase("FDB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.fdb_leg)); return; } if (replaceAll.equalsIgnoreCase("approved.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.approved)); return; } if (replaceAll.equalsIgnoreCase("Surveyed.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.surveyed_leg)); return; } if (replaceAll.equalsIgnoreCase("Resurveyed.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.resurveyed_leg)); return; } if (replaceAll.equalsIgnoreCase("Electrical.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.electrical)); return; } if (replaceAll.equalsIgnoreCase("Light.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.light)); return; } if (replaceAll.equalsIgnoreCase("TelephoneandOther.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.telephoneandother_leg)); return; } if (replaceAll.equalsIgnoreCase("area.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.area)); return; } if (replaceAll.equalsIgnoreCase("surveyarea.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.surveyarea_leg)); return; } if (replaceAll.equalsIgnoreCase("subarea.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.subarea_leg)); return; } if (replaceAll.equalsIgnoreCase("MicroPOD.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.micropod)); return; } if (replaceAll.equalsIgnoreCase("Structure.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.structure_leg)); return; } if (replaceAll.equalsIgnoreCase("PADB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.padb)); return; } if (replaceAll.equalsIgnoreCase("ADB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.adb)); return; } if (replaceAll.equalsIgnoreCase("PBDB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.pbdb)); return; } if (replaceAll.equalsIgnoreCase("SecondaryBDB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.secondarybdb)); return; } if (replaceAll.equalsIgnoreCase("PCDB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.pcdb)); return; } if (replaceAll.equalsIgnoreCase("CDB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.cdb)); return; } if (replaceAll.equalsIgnoreCase("PrimarySplitter.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.primarysplitter)); return; } if (replaceAll.equalsIgnoreCase("SecondarySplitter.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.secondarysplitter)); return; } if (replaceAll.equalsIgnoreCase("Pod.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.pod)); return; } if (replaceAll.equalsIgnoreCase("spliceclosure.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.spliceclosure)); return; } if (replaceAll.equalsIgnoreCase("Customer.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.customer)); return; } if (replaceAll.equalsIgnoreCase("ont.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.ont)); return; } if (replaceAll.equalsIgnoreCase("tree.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.tree_leg)); return; } if (replaceAll.equalsIgnoreCase("manhole.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.manhole)); return; } if (replaceAll.equalsIgnoreCase("WallMount.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.wallmount_leg)); return; } if (replaceAll.equalsIgnoreCase("N-RFSResidentialHighRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommercialresidential)); return; } if (replaceAll.equalsIgnoreCase("N-RFSResidentialLowRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommerciallowrise)); return; } if (replaceAll.equalsIgnoreCase("N-RFSCommercialHighRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommercialhighrise)); return; } if (replaceAll.equalsIgnoreCase("N-RFSCommercialLowRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommerciallowrise)); return; } if (replaceAll.equalsIgnoreCase("N-RFSCommercialResidential.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommerciallowrise)); return; } if (replaceAll.equalsIgnoreCase("RFSResidentialHighRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.rfscommercialhighrise)); return; } if (replaceAll.equalsIgnoreCase("RFSResidentialLowRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.rfscommerciallowrise)); return; } if (replaceAll.equalsIgnoreCase("RFSCommercialHighRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.rfscommercialhighrise)); return; } if (replaceAll.equalsIgnoreCase("RFSCommercialLowRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.rfscommerciallowrise)); return; } if (replaceAll.equalsIgnoreCase("RFSCommercialResidential.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.rfscommerciallowrise)); return; } if (replaceAll.equalsIgnoreCase("Duct.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.duct)); return; } if (replaceAll.equalsIgnoreCase("Trench.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.trench_leg)); return; } if (replaceAll.equalsIgnoreCase("ROW.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.row__leg)); return; } if (replaceAll.equalsIgnoreCase("HTB.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.htb_leg)); return; } if (replaceAll.equalsIgnoreCase("N-RFECommercialLowRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommerciallowrise)); return; } if (replaceAll.equalsIgnoreCase("N-RFECommercialHighRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommercialhighrise)); return; } if (replaceAll.equalsIgnoreCase("N-RFECommercialResidential.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.n_rfecommercialresidential)); return; } if (replaceAll.equalsIgnoreCase("N-RFEResidentialHighRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.a_oh)); return; } if (replaceAll.equalsIgnoreCase("N-RFEResidentialLowRise.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.a_oh)); return; } if (replaceAll.equalsIgnoreCase("v_spliceclosure.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.v_spliceclosure)); return; } if (replaceAll.equalsIgnoreCase("PolygonStructure.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.polygonstructure)); return; } if (replaceAll.equalsIgnoreCase("v_manhole.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.v_manhole)); return; } if (replaceAll.equalsIgnoreCase("DSA.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.dsa)); return; } if (replaceAll.equalsIgnoreCase("CSA.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.csa)); return; } if (replaceAll.equalsIgnoreCase("fms.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.fms)); return; } if (replaceAll.equalsIgnoreCase("NewROW.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.newrow)); return; } if (replaceAll.equalsIgnoreCase("AppliedROW.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.appliedrow)); return; } if (replaceAll.equalsIgnoreCase("ApprovedROW.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.approvedrow)); return; } if (replaceAll.equalsIgnoreCase("RejectROW.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.rejectrow)); return; } if (replaceAll.equalsIgnoreCase("RACK.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.rack)); } else if (replaceAll.equalsIgnoreCase("EQUIPMENT.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.equipment)); } else if (replaceAll.equalsIgnoreCase("handhole.png")) { imageView.setImageDrawable(dVar.getDrawable(R.drawable.handhole)); } } public static void setMarkerBounce(final j jVar) { final Handler handler = new Handler(); final long uptimeMillis = SystemClock.uptimeMillis(); final BounceInterpolator bounceInterpolator = new BounceInterpolator(); handler.post(new Runnable() { @Override public void run() { float max = Math.max(1.0f - bounceInterpolator.getInterpolation(((float) (SystemClock.uptimeMillis() - uptimeMillis)) / 2000.0f), 0.0f); jVar.j(0.5f, 1.0f + max); if (max > 0.0d) { handler.postDelayed(this, 16L); } else { AppUtil.setMarkerBounce(jVar); } } }); } public static Map<String, String> setTokenParams(EditText editText, EditText editText2, boolean z9, Context context) { HashMap hashMap = new HashMap(); hashMap.put("grant_type", "password"); hashMap.put("username", getBase64FromString(editText.getText().toString().trim()).trim()); hashMap.put("password", getBase64FromString(editText2.getText().toString()).trim().trim()); hashMap.put("osName", "Android"); hashMap.put("osType", "Android"); hashMap.put("osVersion", getSdkBuildVersionNumber()); hashMap.put("macAddress", getMacAddress(context)); hashMap.put("appVersion", "v" + getAppVersion(context)); hashMap.put("forceLogin", String.valueOf(z9)); hashMap.put("Source", "Mobile"); return hashMap; } public static void setUserDetailsForCrashlytics(String str, String str2) { Crashlytics.setUserName(str); Crashlytics.setUserIdentifier(str2); } public static void showBarcode(Activity activity) { if (isCameraPermissionsGranted(activity)) { scanUsingZbar(activity); } else { androidx.core.app.a.o(activity, new String[]{"android.permission.CAMERA"}, 1); } } public static String[] splitStringFromSpecificChar(String str, String str2) { if (str == null || str.isEmpty() || !str.contains(str2)) { return null; } int length = str.length(); int indexOf = str.indexOf(str2); return new String[]{str.substring(0, indexOf), str.substring(indexOf, length)}; } public static void startCurrentLocationUpdate(Context context) { if (context == null) { return; } try { if (isMyServiceRunning(context, CurrentLocationTracking.class)) { return; } Intent intent = new Intent(context, (Class<?>) CurrentLocationTracking.class); intent.setAction(AppConstants.ACTION_START_FOREGROUND_ACTION); if (Build.VERSION.SDK_INT >= 26) { context.startForegroundService(intent); } else { context.startService(intent); } LepLogger lepLogger = LepLogger.getInstance(); if (!lepLogger.init(context.getResources().getString(R.string.app_name))) { System.out.println("Unable to init logger."); } logInfo(context, "Current Location startCurrentLocationUpdate called"); lepLogger.setCurrentLogLevel(0); lepLogger.info(TAG, "Current Location startCurrentLocationUpdate called"); } catch (Exception e10) { e10.printStackTrace(); } } public static void stopCurrentLocationUpdate(Context context) { if (context == null) { return; } try { if (isMyServiceRunning(context, CurrentLocationTracking.class)) { LepLogger lepLogger = LepLogger.getInstance(); if (!lepLogger.init(context.getResources().getString(R.string.app_name))) { System.out.println("Unable to init logger."); } lepLogger.setCurrentLogLevel(0); lepLogger.info(TAG, "Current Location stopCurrentLocationUpdate called"); Intent intent = new Intent(context, (Class<?>) CurrentLocationTracking.class); intent.setAction(AppConstants.ACTION_STOP_FOREGROUND_ACTION); if (Build.VERSION.SDK_INT >= 26) { context.startForegroundService(intent); } else { context.startService(intent); } } } catch (Exception e10) { e10.printStackTrace(); } } public static void stopJobScheduler(Context context, int i10) { if (context == null) { return; } try { if (Build.VERSION.SDK_INT >= 23) { ((JobScheduler) context.getSystemService(JobScheduler.class)).cancelAll(); } } catch (Exception unused) { } } public static void stopService(Context context) { if (context != null) { context.stopService(new Intent(context, (Class<?>) TrackingService.class)); context.stopService(new Intent(context, (Class<?>) LogoutService.class)); } } public static String transformCreateSpeechText(String str) { return str.toLowerCase().replace("to", "2").replace("app", "F"); } public static String transformSpeechText(String str) { String replace = str.toLowerCase().replace("table", "cable").replace("xoom", "zoom").replace("dhoom", "zoom").replace("june", "zoom").replace("jump", "zoom").replace("roman", "zoom").replace("times", "time"); return (replace.contains(" time") || replace.contains(" x")) ? replace : replace.replace("2", "to"); } public static boolean validateCurrentLocation(Context context, LatLng latLng) { return false; } public static String validateDynamicField(Activity activity, ObjDynamicModel objDynamicModel, LinearLayout linearLayout) { ObjDynamicModel.lstFormControlObj lstformcontrolobj; ObjDynamicModel.lstFormControlObj lstformcontrolobj2; if (activity != null && objDynamicModel != null && objDynamicModel.getLstFormControls() != null && objDynamicModel.getLstFormControls().size() != 0) { for (int i10 = 0; i10 < linearLayout.getChildCount(); i10++) { Object tag = linearLayout.getChildAt(i10).getTag(); if (tag instanceof TextInputEditText) { TextInputEditText textInputEditText = (TextInputEditText) tag; if (textInputEditText.getTag() != null && (textInputEditText.getTag() instanceof ObjDynamicModel.lstFormControlObj) && (lstformcontrolobj2 = (ObjDynamicModel.lstFormControlObj) textInputEditText.getTag()) != null && lstformcontrolobj2.isRequired()) { if (textInputEditText.getText().toString().isEmpty()) { return "Enter " + lstformcontrolobj2.getField_label(); } if (!lstformcontrolobj2.getControl_value_type().equalsIgnoreCase(DynamicControl.Strings.ALPHANUMERIC.toString()) && !lstformcontrolobj2.getControl_value_type().equalsIgnoreCase(DynamicControl.Strings.Character.toString())) { if ((lstformcontrolobj2.getControl_value_type().equalsIgnoreCase(DynamicControl.Strings.Integer.toString()) || lstformcontrolobj2.getControl_value_type().equalsIgnoreCase(DynamicControl.Strings.Float.toString())) && (parseInt(textInputEditText.getText().toString()) < lstformcontrolobj2.getMin_length() || parseInt(textInputEditText.getText().toString()) > lstformcontrolobj2.getMax_length())) { return lstformcontrolobj2.getField_label() + " value must be mimimum of " + lstformcontrolobj2.getMin_length() + " and maximum of " + lstformcontrolobj2.getMax_length(); } } else if (textInputEditText.getText().toString().length() < lstformcontrolobj2.getMin_length()) { return lstformcontrolobj2.getField_label() + " length must be mimimum of " + lstformcontrolobj2.getMin_length() + " character"; } } } else if (tag instanceof Spinner) { Spinner spinner = (Spinner) tag; if (spinner.getTag() != null && (spinner.getTag() instanceof ObjDynamicModel.lstFormControlObj) && (lstformcontrolobj = (ObjDynamicModel.lstFormControlObj) spinner.getTag()) != null && lstformcontrolobj.isRequired() && spinner.getSelectedItemPosition() == 0) { return "Select " + lstformcontrolobj.getField_label(); } } else { continue; } } } return ""; } public static boolean validateIncorrectGeomPoints(String str, String str2) { if (str2 == null || str2.isEmpty() || str == null) { return true; } return str.equalsIgnoreCase(AppConstants.CABLE) && str2.split(",").length <= 1; } public static boolean validateMinMaxzoom(NetworkLayer networkLayer, int i10) { return networkLayer != null && i10 >= networkLayer.getMinZoomLevel(); } public static boolean verifyGeomInBound(LatLngBounds latLngBounds, ArrayList<LatLng> arrayList) { Iterator<LatLng> it = arrayList.iterator(); while (it.hasNext()) { if (latLngBounds.r0(it.next())) { return true; } } return false; } public static boolean verifyGeomInPolygon(String str, Activity activity) { ArrayList<LatLng> parseGeoJson = JsonParser.parseGeoJson(GeoJsonType.MULTI_POLYGON, str); List<ProvinceDataModel> all = getDb(activity).provinceListQuery().getAll(); if (parseGeoJson == null) { return true; } for (int i10 = 0; i10 < parseGeoJson.size(); i10++) { for (int i11 = 0; i11 < all.size(); i11++) { ArrayList<LatLng> parseGeoJson2 = JsonParser.parseGeoJson(GeoJsonType.MULTI_POLYGON, all.get(i11).getProvince_geom()); if (parseGeoJson2 != null) { isPointInPolygon(parseGeoJson.get(i10), parseGeoJson2); } } } return true; } public static boolean verifyStoragePermissions(Activity activity) { return true; } public static boolean verifyVisibleBoundwithGeometry(LatLng latLng, ArrayList<LatLng> arrayList) { return y6.b.d(latLng, arrayList, true, 1.0d); } public static String volleyErrorMessage(VolleyError volleyError) { String str; com.android.volley.h hVar; byte[] bArr; if (volleyError == null || (hVar = volleyError.f3453b) == null || (bArr = hVar.f3485c) == null) { str = ""; } else { try { str = new String(bArr, "utf-8"); BaseResp baseResp = (BaseResp) JsonParser.convertJsonToBean(ApiType.BASE_RESPONSE, str); if (baseResp != null) { if (baseResp.getError_message() != null) { str = baseResp.getError_message(); } else if (baseResp.getMessage() != null) { str = baseResp.getMessage(); } } } catch (UnsupportedEncodingException e10) { e10.printStackTrace(); str = "UnsupportedEncodingException... Please try later"; } } return str != null ? str : ""; } public static File writeImage(Context context, Uri uri, File file) { InputStream openInputStream; String name; File file2; File file3 = null; if (context == null || (uri == null && file == null)) { return null; } try { if (file != null) { openInputStream = new FileInputStream(file); } else { openInputStream = context.getContentResolver().openInputStream(uri); } File externalFilesDir = context.getExternalFilesDir(null); Objects.requireNonNull(externalFilesDir); File file4 = new File(externalFilesDir.getAbsolutePath()); file4.mkdirs(); if (uri != null) { name = getFileName(context, uri); } else { name = file.getName(); } file2 = new File(file4, name); } catch (Exception e10) { e = e10; } try { if (file2.exists()) { file2.delete(); } FileOutputStream fileOutputStream = new FileOutputStream(file2); byte[] bArr = new byte[1024]; while (true) { int read = openInputStream.read(bArr); if (read != -1) { fileOutputStream.write(bArr, 0, read); } else { fileOutputStream.close(); openInputStream.close(); return file2; } } } catch (Exception e11) { e = e11; file3 = file2; e.printStackTrace(); return file3; } } public void drawDashedPolyLine(c cVar, ArrayList<LatLng> arrayList, int i10) { int i11; int i12 = 0; boolean z9 = false; while (i12 < arrayList.size() - 1) { int i13 = i12 + 1; double convertedDistance = getConvertedDistance(arrayList.get(i12), arrayList.get(i13)); if (convertedDistance >= 0.002d) { int i14 = (int) (convertedDistance / 0.002d); double d10 = i14; double d11 = (arrayList.get(i13).f5531b - arrayList.get(i12).f5531b) / d10; i11 = i13; int i15 = i12; double d12 = (arrayList.get(i13).f5532c - arrayList.get(i12).f5532c) / d10; LatLng latLng = new LatLng(arrayList.get(i15).f5531b, arrayList.get(i15).f5532c); z9 = z9; int i16 = 0; while (i16 < i14) { double d13 = d11; LatLng latLng2 = new LatLng(latLng.f5531b + d11, latLng.f5532c + d12); if (z9) { z9 = false; } else { cVar.d(new q().F(latLng).F(latLng2).D0(i10)); z9 = true; } i16++; latLng = latLng2; d11 = d13; } } else if (z9) { i11 = i13; z9 = false; } else { cVar.d(new q().F(arrayList.get(i12)).F(arrayList.get(i13)).D0(i10)); z9 = true; i11 = i13; } i12 = i11; } } public static double distance(double d10, double d11, double d12, double d13, char c10) { double d14; double rad2deg = rad2deg(Math.acos((Math.sin(deg2rad(d10)) * Math.sin(deg2rad(d12))) + (Math.cos(deg2rad(d10)) * Math.cos(deg2rad(d12)) * Math.cos(deg2rad(d11 - d13))))) * 60.0d * 1.1515d; if (c10 == 'K') { d14 = 1.609344d; } else { if (c10 != 'N') { return rad2deg; } d14 = 0.8684d; } return rad2deg * d14; } private static void scanUsingZbar(Activity activity) { if (activity == null) { return; } if (activity.getCallingActivity() != null && (activity.getCallingActivity() == null || !activity.getCallingActivity().getPackageName().equalsIgnoreCase(BuildConfig.APPLICATION_ID))) { activity.finish(); } else { activity.startActivityForResult(new Intent(activity, (Class<?>) SimpleScannerActivity.class), 100); } } public static void setMarkerBounce(final com.androidmapsextensions.b bVar) { final Handler handler = new Handler(); final long uptimeMillis = SystemClock.uptimeMillis(); final BounceInterpolator bounceInterpolator = new BounceInterpolator(); handler.post(new Runnable() { @Override public void run() { float max = Math.max(1.0f - bounceInterpolator.getInterpolation(((float) (SystemClock.uptimeMillis() - uptimeMillis)) / 2000.0f), 0.0f); bVar.A(0.5f, 1.0f + max); if (max > 0.0d) { handler.postDelayed(this, 16L); } else { AppUtil.setMarkerBounce(bVar); } } }); } }