MD5 校验值:7cd346351ab05a28e42aff65173e0141
BaseActivity.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.leptonsoftware.fibernet; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlarmManager; import android.app.AlertDialog; import android.app.Dialog; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.location.Location; import android.location.LocationManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.SystemClock; import android.provider.Settings; import android.text.method.ScrollingMovementMethod; import android.util.Base64; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.d; import androidx.drawerlayout.widget.DrawerLayout; import com.android.volley.VolleyError; import com.android.volley.c; import com.android.volley.k; import com.android.volley.toolbox.h; import com.android.volley.toolbox.l; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; import com.leptonsoftware.fibernet.Interfaces; import com.leptonsoftware.fibernet.adapters.NavListAdapter; import com.leptonsoftware.fibernet.datamodel.BuisnessLayer; import com.leptonsoftware.fibernet.datamodel.LandBaseLayer; import com.leptonsoftware.fibernet.datamodel.MapElements; import com.leptonsoftware.fibernet.datamodel.ModuleDataModel; import com.leptonsoftware.fibernet.datamodel.NavDataModel; import com.leptonsoftware.fibernet.datamodel.NetworkLayer; import com.leptonsoftware.fibernet.jsonparser.ApiType; import com.leptonsoftware.fibernet.jsonparser.JsonParser; import com.leptonsoftware.fibernet.jsonparser.ScreenType; import com.leptonsoftware.fibernet.jsonparser.WebApi; import com.leptonsoftware.fibernet.logger.LepLogger; import com.leptonsoftware.fibernet.requests.BaseReq; import com.leptonsoftware.fibernet.requests.LogoutReq; import com.leptonsoftware.fibernet.requests.StaticPageReq; import com.leptonsoftware.fibernet.requests.TrackingRequest; import com.leptonsoftware.fibernet.toasty.Toasty; import com.leptonsoftware.fibernet.util.AppConstants; import com.leptonsoftware.fibernet.util.AppUtil; import com.leptonsoftware.fibernet.util.FloatingWidgetService; import com.leptonsoftware.fibernet.util.MyAlertBoxReciever; import com.leptonsoftware.fibernet.util.SharePrefConstants; import com.leptonsoftware.fibernet.util.SharePrefFactory; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import jxl.SheetSettings; import k4.a; import k4.e; import k4.j; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import p.b; import p4.n; import p4.o; import p4.p; import p4.q; import u4.i; public class BaseActivity extends d implements Interfaces.ModuleInteractionInterface { private static final long FASTEST_UPDATE_INTERVAL_IN_MILLISECONDS = 5000; public static final String IMAGE_DIRECTORY = Environment.getExternalStorageDirectory().getPath(); protected static final int PERMISSION_CONSTANT = 100; protected static final int REQUEST_CHECK_CAMERA_BARCODE = 105; protected static final int REQUEST_CHECK_SETTINGS = 104; private static final String TAG = "BaseActivity"; private static final long UPDATE_INTERVAL_IN_MILLISECONDS = 10000; AlertDialog alert; private AlarmManager am; private Intent broadcastintent; public CheckBox checkOffline; public TextView customerEmail; public TextView customerName; public DrawerLayout drawer; private Intent intent; public boolean isMapAgainLoaded; protected LinearLayout llBaseContainer; private LinearLayout llLogout; private LinearLayout lloffline; private ListView lv_nav_view; protected a mFusedLocationClient; public GeoCodeListener mGeoCodeListener; protected Location mLastKnownLocation; public LepLogger mLepLogger; protected LocationRequest mLocationRequest; protected e mLocationSettingsRequest; protected j mSettingsClient; public boolean non_first_time; private PendingIntent pendingIntent; private PendingIntent pendingIntent1; private PendingIntent pendingIntent2; public ProgressDialog progressDialog; public LatLngBounds selScreen; public NetworkLayer selected_create_element; private TextView tvClose; private TextView tvLogoutImage; private TextView tv_copyright; public TextView version; private final int interval = 5000; private Handler handler = new Handler(); public ArrayList<NetworkLayer> networkLayers = new ArrayList<>(); public ArrayList<LandBaseLayer> landBaseLayers = new ArrayList<>(); public ArrayList<BuisnessLayer> buisnessLayers = new ArrayList<>(); AdapterView.OnItemClickListener mOnItemClickListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i10, long j10) { NavDataModel navDataModel = (NavDataModel) view.getTag(com.jfp.prod.R.integer.data); if (BaseActivity.this.drawer.C(8388611)) { BaseActivity.this.drawer.d(8388611); } if (navDataModel.getTitle().equalsIgnoreCase("Home")) { BaseActivity.this.openActivity(ModuleActivity.class, true, null); } else if (navDataModel.getTitle().equalsIgnoreCase("App Info")) { BaseActivity.this.callStaticPage("AppInfo"); } } }; private Runnable runnable = new Runnable() { @Override public void run() { BaseActivity.this.getDeviceLocation(); } }; static class AnonymousClass35 { 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 void askPermission() { startActivityForResult(new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:" + getPackageName())), 2084); } public void callStaticPage(final String str) { final String stringPref = SharePrefFactory.getStringPref(this, SharePrefConstants.LOGIN_ACCESS_TOKEN); String convertBeanToJson = JsonParser.convertBeanToJson(new StaticPageReq(str)); BaseReq baseReq = new BaseReq(); baseReq.setData(convertBeanToJson); String convertBeanToJson2 = JsonParser.convertBeanToJson(baseReq); LepLogger lepLogger = this.mLepLogger; String str2 = TAG; lepLogger.info(str2, "callStaticPageReq(): Params:" + convertBeanToJson2); final com.android.volley.j a10 = l.a(getApplicationContext()); try { h hVar = new h(WebApi.getWebApi(ApiType.STATICPAGE), new JSONObject(convertBeanToJson2), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { BaseActivity.this.progressDialog.dismiss(); a10.e(); try { if (jSONObject.getString("status").equalsIgnoreCase("ok")) { BaseActivity.this.mLepLogger.debug(BaseActivity.TAG, "callStaticPageReq() onResponse():Logout successfully"); String optString = jSONObject.getJSONObject("results").getJSONArray("lstStaticPageMasterInfo").getJSONObject(0).optString("content"); Bundle bundle = new Bundle(); bundle.putString("html", optString); bundle.putString("type", str); BaseActivity.this.openActivity(WebPageActivity.class, false, bundle); } else { BaseActivity baseActivity = BaseActivity.this; baseActivity.alertDialog(baseActivity.getString(com.jfp.prod.R.string.error), jSONObject.optString("error_message")); BaseActivity.this.mLepLogger.debug(BaseActivity.TAG, "callStaticPageReq() onResponse() Error: " + jSONObject.optString("error_message")); } } catch (JSONException e10) { e10.printStackTrace(); BaseActivity.this.mLepLogger.error(BaseActivity.TAG, "callStaticPageReq(): onResponse(): JSONException:" + e10.getMessage()); BaseActivity baseActivity2 = BaseActivity.this; baseActivity2.alertDialog(baseActivity2.getString(com.jfp.prod.R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { BaseActivity.this.progressDialog.dismiss(); volleyError.printStackTrace(); BaseActivity baseActivity = BaseActivity.this; AppUtil.onVolleyErrorResponseHandling(baseActivity, baseActivity.mLepLogger, volleyError, BaseActivity.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + stringPref); BaseActivity.this.mLepLogger.info(BaseActivity.TAG, "callStaticPageReq(): getHeaders():" + hashMap.toString()); return hashMap; } }; this.mLepLogger.info(str2, "callStaticPageReq(): URL:" + hVar.getUrl()); hVar.setRetryPolicy(new c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); this.progressDialog = ProgressDialog.show(this, null, "Loading...", true); } catch (JSONException e10) { e10.printStackTrace(); this.mLepLogger.error(TAG, "Failed to create Request json:" + e10.getMessage()); } } private Location getLastKnownLocation() { Location location = this.mLastKnownLocation; if (location != null) { return location; } LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(AppConstants.Offline_Location_Action); Location location2 = null; for (String str : locationManager.getProviders(true)) { if (b.a(this, "android.permission.ACCESS_FINE_LOCATION") != 0 && b.a(this, "android.permission.ACCESS_COARSE_LOCATION") != 0) { return null; } Location lastKnownLocation = locationManager.getLastKnownLocation(str); if (lastKnownLocation != null && (location2 == null || lastKnownLocation.getAccuracy() < location2.getAccuracy())) { location2 = lastKnownLocation; } } return location2; } @SuppressLint({"RestrictedApi"}) private void initLocationComponents() { this.mFusedLocationClient = k4.d.a(this); this.mSettingsClient = k4.d.c(this); this.mLocationRequest = new LocationRequest().D0(UPDATE_INTERVAL_IN_MILLISECONDS).B0(FASTEST_UPDATE_INTERVAL_IN_MILLISECONDS).M0(100); e.a aVar = new e.a(); aVar.a(this.mLocationRequest); aVar.c(true); this.mLocationSettingsRequest = aVar.b(); } private void initialiseViews() { this.drawer = (DrawerLayout) findViewById(com.jfp.prod.R.id.drawer_layout); this.lv_nav_view = (ListView) findViewById(com.jfp.prod.R.id.lv_nav_view); this.llLogout = (LinearLayout) findViewById(com.jfp.prod.R.id.llLogout); this.lloffline = (LinearLayout) findViewById(com.jfp.prod.R.id.lloffline); this.tvClose = (TextView) findViewById(com.jfp.prod.R.id.ivClose); this.tvLogoutImage = (TextView) findViewById(com.jfp.prod.R.id.tvLogoutImage); this.customerName = (TextView) findViewById(com.jfp.prod.R.id.customerName); this.customerEmail = (TextView) findViewById(com.jfp.prod.R.id.customerEmail); this.tv_copyright = (TextView) findViewById(com.jfp.prod.R.id.tv_copyright); this.version = (TextView) findViewById(com.jfp.prod.R.id.version); this.checkOffline = (CheckBox) findViewById(com.jfp.prod.R.id.checkOffline); this.tvClose.setTypeface(AppUtil.getStaticIcomoonTypeface(this)); this.tvClose.setText(getString(com.jfp.prod.R.string.icon_close)); this.tvLogoutImage.setTypeface(AppUtil.getStaticIcomoonTypeface(this)); this.tvLogoutImage.setText(getString(com.jfp.prod.R.string.im_logout)); } public void logoutReq() { final String stringPref = SharePrefFactory.getStringPref(this, SharePrefConstants.LOGIN_ACCESS_TOKEN); String convertBeanToJson = JsonParser.convertBeanToJson(new LogoutReq(SharePrefFactory.getLongPref(getApplicationContext(), SharePrefConstants.USER_ID, 0L), SharePrefFactory.getStringPref(this, SharePrefConstants.MASTERLOGIN))); BaseReq baseReq = new BaseReq(); baseReq.setData(convertBeanToJson); String convertBeanToJson2 = JsonParser.convertBeanToJson(baseReq); LepLogger lepLogger = this.mLepLogger; String str = TAG; lepLogger.info(str, "logoutReq(): Params:" + convertBeanToJson2); final com.android.volley.j a10 = l.a(getApplicationContext()); try { h hVar = new h(WebApi.getWebApi(ApiType.LOGOUT), new JSONObject(convertBeanToJson2), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { BaseActivity.this.progressDialog.dismiss(); a10.e(); try { if (jSONObject.getString("status").equalsIgnoreCase("ok")) { BaseActivity.this.mLepLogger.error(BaseActivity.TAG, "logoutReq() onResponse(): AppUtil.logoutFromAppOnLogoutButton:" + jSONObject); AppUtil.logoutFromAppOnLogoutButton(BaseActivity.this); } else { BaseActivity baseActivity = BaseActivity.this; baseActivity.alertDialog(baseActivity.getString(com.jfp.prod.R.string.error), jSONObject.optString("error_message")); BaseActivity.this.mLepLogger.debug(BaseActivity.TAG, "logoutReq() onResponse() Error: " + jSONObject.optString("error_message")); } } catch (JSONException e10) { e10.printStackTrace(); BaseActivity.this.mLepLogger.error(BaseActivity.TAG, "logoutReq(): onResponse(): JSONException:" + e10.getMessage()); BaseActivity baseActivity2 = BaseActivity.this; baseActivity2.alertDialog(baseActivity2.getString(com.jfp.prod.R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { BaseActivity.this.progressDialog.dismiss(); volleyError.printStackTrace(); BaseActivity baseActivity = BaseActivity.this; AppUtil.onVolleyErrorResponseHandling(baseActivity, baseActivity.mLepLogger, volleyError, BaseActivity.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + stringPref); BaseActivity.this.mLepLogger.info(BaseActivity.TAG, "logoutReq(): getHeaders():" + hashMap.toString()); return hashMap; } }; this.mLepLogger.info(str, "logoutReq(): URL:" + hVar.getUrl()); hVar.setRetryPolicy(new c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); this.progressDialog = ProgressDialog.show(this, null, "Logging you out...", true); } catch (JSONException e10) { e10.printStackTrace(); this.mLepLogger.error(TAG, "Failed to create Request json:" + e10.getMessage()); } } public void logoutTracking() { AppUtil.stopCurrentLocationUpdate(this); AppUtil.stopJobScheduler(this, 100); Location lastKnownLocation = getLastKnownLocation(); if (lastKnownLocation == null) { this.mLepLogger.error(TAG, "current location is null"); alertDialog(getString(com.jfp.prod.R.string.error), "Unable to get current location"); return; } TrackingRequest build = new TrackingRequest.TrackingRequestBuilder().setUserId(SharePrefFactory.getLongPref(getApplicationContext(), SharePrefConstants.USER_ID, 0L)).setLatitude(lastKnownLocation.getLatitude()).setLongitude(lastKnownLocation.getLongitude()).setNetworkProvider(lastKnownLocation.getProvider()).setIsMasterLogin(SharePrefFactory.getStringPref(getApplication(), SharePrefConstants.MASTERLOGIN)).setLocationAccuracy(lastKnownLocation.getAccuracy()).setBattery_percentage(AppUtil.getBatteryPercentage(getApplication())).setLoginHistoryId(SharePrefFactory.getLongPref(getApplicationContext(), SharePrefConstants.LOGIN_HISTORY_ID, 0L)).setMobileTime(AppUtil.getDate(System.currentTimeMillis(), AppConstants.DD_MMM_YYYY_HH_MM_AA)).build(); ArrayList arrayList = new ArrayList(); arrayList.add(build); String q9 = new r6.e().q(arrayList); BaseReq baseReq = new BaseReq(); baseReq.setData(q9); String convertBeanToJson = JsonParser.convertBeanToJson(baseReq); LepLogger lepLogger = this.mLepLogger; String str = TAG; lepLogger.info(str, "logoutTracking(): Params:" + convertBeanToJson); final com.android.volley.j a10 = l.a(getApplicationContext()); try { h hVar = new h(WebApi.getWebApi(ApiType.SAVE_USER_LOCATION), new JSONObject(convertBeanToJson), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { BaseActivity.this.progressDialog.dismiss(); a10.e(); try { if (jSONObject.getString("status").equalsIgnoreCase("ok")) { BaseActivity.this.mLepLogger.debug(BaseActivity.TAG, "logoutTracking(): onResponse(): logout tracking successfully sent:"); BaseActivity.this.logoutReq(); } else { BaseActivity.this.mLepLogger.error(BaseActivity.TAG, "logoutTracking(): onResponse(): logout tracking error" + jSONObject.optString("error_message")); BaseActivity baseActivity = BaseActivity.this; baseActivity.alertDialog(baseActivity.getString(com.jfp.prod.R.string.error), jSONObject.optString("error_message")); } } catch (JSONException e10) { e10.printStackTrace(); BaseActivity.this.mLepLogger.error(BaseActivity.TAG, "logoutTracking(): onResponse(): JSONException:" + e10.getMessage()); BaseActivity baseActivity2 = BaseActivity.this; baseActivity2.alertDialog(baseActivity2.getString(com.jfp.prod.R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { BaseActivity.this.progressDialog.dismiss(); volleyError.printStackTrace(); BaseActivity baseActivity = BaseActivity.this; AppUtil.onVolleyErrorResponseHandling(baseActivity, baseActivity.mLepLogger, volleyError, BaseActivity.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(BaseActivity.this.getApplicationContext(), SharePrefConstants.LOGIN_ACCESS_TOKEN)); BaseActivity.this.mLepLogger.info(BaseActivity.TAG, "logoutTracking(): getHeaders():" + hashMap.toString()); return hashMap; } }; this.mLepLogger.info(str, "logoutTracking(): URL: " + hVar.getUrl()); hVar.setRetryPolicy(new c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); this.progressDialog = ProgressDialog.show(this, null, "Sending your location ...", true); } catch (JSONException e10) { e10.printStackTrace(); this.mLepLogger.error(TAG, "logoutTracking(): Failed to create Request json:" + e10.getMessage()); } } public static String saveDocFile(String str, String str2) { if (str != null && str2 != null) { try { File file = new File(IMAGE_DIRECTORY, Environment.DIRECTORY_DOWNLOADS); if (!file.exists()) { file.mkdir(); } File file2 = new File(file.getAbsolutePath(), str2); if (file2.exists()) { file2.delete(); file2.createNewFile(); } byte[] decode = Base64.decode(str, 0); FileOutputStream fileOutputStream = new FileOutputStream(file2, false); fileOutputStream.write(decode); fileOutputStream.flush(); fileOutputStream.close(); return file2.getAbsolutePath(); } catch (Exception unused) { } } return null; } private void setListners() { this.lv_nav_view.setOnItemClickListener(this.mOnItemClickListener); this.llLogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { BaseActivity.this.confirmLogoutDialog("Alert !", "Are you sure you want to logout?"); } }); this.tvClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (BaseActivity.this.drawer.C(8388611)) { BaseActivity.this.drawer.d(8388611); } } }); } private void setNavAdapter() { NavDataModel navDataModel = new NavDataModel("Home", getString(com.jfp.prod.R.string.icon_home)); NavDataModel navDataModel2 = new NavDataModel("App Info", getString(com.jfp.prod.R.string.icon_Contact)); new NavDataModel("About Us", getString(com.jfp.prod.R.string.icon_about_us)); ArrayList arrayList = new ArrayList(); arrayList.add(navDataModel); arrayList.add(navDataModel2); this.lv_nav_view.setAdapter((ListAdapter) new NavListAdapter(this, arrayList)); } public void alertBox() { AlertDialog.Builder builder = new AlertDialog.Builder(this); View inflate = getLayoutInflater().inflate(com.jfp.prod.R.layout.custom_alert, (ViewGroup) null); builder.setView(inflate); ((Button) inflate.findViewById(com.jfp.prod.R.id.btn_ok)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { BaseActivity.this.alert.dismiss(); } }); AlertDialog create = builder.create(); this.alert = create; if (Build.VERSION.SDK_INT < 26) { create.getWindow().setType(2003); } else { create.getWindow().setType(2038); } this.alert.show(); } public void alertBuilderWithPositive(String str, String str2, View.OnClickListener onClickListener) { Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); textView.setText(str); ImageView imageView = (ImageView) dialog.findViewById(com.jfp.prod.R.id.iv_icon); if (str.equalsIgnoreCase(getString(com.jfp.prod.R.string.info))) { imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.alert)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_info)); } else if (str.equalsIgnoreCase(getString(com.jfp.prod.R.string.error))) { imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.error)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_error)); } else if (str.equalsIgnoreCase(getString(com.jfp.prod.R.string.success))) { imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.success)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_info)); } textView2.setText(str2); button.setTag(dialog); button2.setTag(dialog); button2.setVisibility(8); button.setOnClickListener(onClickListener); dialog.show(); } public void alertBuilderWithPositiveNegative(String str, String str2, String str3, View.OnClickListener onClickListener, View.OnClickListener onClickListener2, String str4) { Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); button.setText(str3); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); button2.setText(str4); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); textView.setText(str); textView2.setText(str2); button.setTag(dialog); button2.setTag(dialog); button2.setVisibility(0); button.setOnClickListener(onClickListener); button2.setOnClickListener(onClickListener2); dialog.show(); } public void alertDialog(String str, String str2) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(true); ImageView imageView = (ImageView) dialog.findViewById(com.jfp.prod.R.id.iv_icon); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); if (str.equalsIgnoreCase(getString(com.jfp.prod.R.string.info))) { imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.alert)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_info)); } else if (str.equalsIgnoreCase(getString(com.jfp.prod.R.string.error))) { imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.error)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_error)); } else if (str.equalsIgnoreCase(getString(com.jfp.prod.R.string.success))) { imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.success)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.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 void alertDialogAutoDismiss(String str, String str2, long j10) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(true); ImageView imageView = (ImageView) dialog.findViewById(com.jfp.prod.R.id.iv_icon); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.alert)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_info)); textView.setText(str); button2.setVisibility(8); 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(); if (j10 > 0) { final Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { dialog.dismiss(); timer.cancel(); } }, j10 * 1000); } } protected void alertResetDialog(String str) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(true); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); ImageView imageView = (ImageView) dialog.findViewById(com.jfp.prod.R.id.iv_icon); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.alert)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_info)); button2.setVisibility(0); textView2.setMovementMethod(new ScrollingMovementMethod()); textView.setText("Reset Path?"); textView2.setText("Are you sure you want to reset path?\nYou won’t be able to restore it."); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); } public void buildAlertMessageNoGps() { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(true); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); button2.setVisibility(8); textView.setText(getString(com.jfp.prod.R.string.alert)); textView2.setText(getString(com.jfp.prod.R.string.no_gps_message)); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); BaseActivity.this.startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS")); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); } public void callNextActivity(ScreenType screenType) { if (AnonymousClass35.$SwitchMap$com$leptonsoftware$fibernet$jsonparser$ScreenType[screenType.ordinal()] != 1) { return; } if (AppUtil.isJioPartnerFiber()) { startActivity(new Intent(this, (Class<?>) com.leptonsoftware.fibernet.jioscreens.LoginActivity.class)); } else { startActivity(new Intent(this, (Class<?>) LoginActivity.class)); } } public void changeDrawerState() { if (this.drawer.C(8388611)) { this.drawer.d(8388611); } else { this.drawer.J(8388611); } } public void confirmLogoutDialog(String str, String str2) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); ((ImageView) dialog.findViewById(com.jfp.prod.R.id.iv_icon)).setImageResource(com.jfp.prod.R.drawable.alert); button2.setVisibility(0); textView.setText(str); textView2.setText(str2); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); } BaseActivity.this.logoutTracking(); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); } } }); dialog.show(); } @Override public boolean dispatchTouchEvent(MotionEvent motionEvent) { View currentFocus; boolean dispatchTouchEvent; boolean z9 = false; try { currentFocus = getCurrentFocus(); dispatchTouchEvent = super.dispatchTouchEvent(motionEvent); } catch (Exception e10) { e = e10; } try { if (!(currentFocus instanceof EditText)) { return dispatchTouchEvent; } getCurrentFocus().getLocationOnScreen(new int[2]); float rawX = (motionEvent.getRawX() + r1.getLeft()) - r3[0]; float rawY = (motionEvent.getRawY() + r1.getTop()) - r3[1]; if (motionEvent.getAction() != 1) { return dispatchTouchEvent; } if (rawX >= r1.getLeft() && rawX < r1.getRight() && rawY >= r1.getTop() && rawY <= r1.getBottom()) { return dispatchTouchEvent; } ((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0); return dispatchTouchEvent; } catch (Exception e11) { e = e11; z9 = dispatchTouchEvent; e.getMessage(); return z9; } } public MapElements drawMarker(n4.c cVar, LatLng latLng, String str) { return new MapElements.MapElementsBuilder().setMarker(cVar.b(new p4.k().l1(new LatLng(latLng.f5531b, latLng.f5532c)).o1(str).g1(p4.b.c(com.jfp.prod.R.drawable.arrow_marker)))).setCenterPoint(latLng).build(); } public MapElements drawPolyLine(n4.c cVar, ArrayList<LatLng> arrayList) { if (cVar == null || arrayList == null || arrayList.size() <= 0) { return null; } q qVar = new q(); qVar.B0(false); LatLngBounds.a aVar = new LatLngBounds.a(); qVar.w0(arrayList); Iterator<LatLng> it = arrayList.iterator(); while (it.hasNext()) { aVar.b(it.next()); } p d10 = cVar.d(qVar); LatLngBounds a10 = aVar.a(); LatLng w02 = a10.w0(); d10.f(-16776961); return new MapElements.MapElementsBuilder().setPolyline(d10).setLatLngBounds(a10).setCenterPoint(w02).build(); } public MapElements drawPolygon(n4.c cVar, ArrayList<LatLng> arrayList) { if (cVar == null || arrayList == null || arrayList.size() <= 0) { return null; } o oVar = new o(); oVar.w0(false); LatLngBounds.a aVar = new LatLngBounds.a(); oVar.r0(arrayList); Iterator<LatLng> it = arrayList.iterator(); while (it.hasNext()) { aVar.b(it.next()); } n c10 = cVar.c(oVar); LatLngBounds a10 = aVar.a(); LatLng w02 = a10.w0(); c10.g(1.0f); c10.e(Color.argb(30, 50, 0, SheetSettings.DEFAULT_DEFAULT_ROW_HEIGHT)); c10.f(-16776961); return new MapElements.MapElementsBuilder().setPolygon(c10).setLatLngBounds(a10).setCenterPoint(w02).build(); } public void focusOnEdittextView(EditText editText) { if (editText != null) { editText.setFocusableInTouchMode(true); editText.requestFocus(); editText.setSelection(editText.getText().length()); } } protected void getDeviceLocation() { a aVar; try { if (!isLocationPermissionsGranted() || (aVar = this.mFusedLocationClient) == null) { return; } aVar.r().b(this, new u4.d<Location>() { @Override public void onComplete(i<Location> iVar) { if (!iVar.s()) { Log.d(BaseActivity.TAG, "Current location is null. Using defaults."); Log.e(BaseActivity.TAG, "Exception: %s", iVar.o()); } else { BaseActivity.this.mLastKnownLocation = iVar.p(); } } }); } catch (SecurityException e10) { Log.e("Exception: %s", e10.getMessage()); } } public void initLogger() { LepLogger lepLogger = LepLogger.getInstance(); this.mLepLogger = lepLogger; if (!lepLogger.init(getResources().getString(com.jfp.prod.R.string.app_name))) { System.out.println("Unable to init logger."); finish(); } this.mLepLogger.setCurrentLogLevel(0); } protected boolean isCameraPermissionsGranted() { if (Build.VERSION.SDK_INT >= 23) { if (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 boolean isLocationPermissionsGranted() { if (Build.VERSION.SDK_INT >= 23) { if (checkSelfPermission("android.permission.ACCESS_FINE_LOCATION") == 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 boolean isNotNull(Object obj) { return obj != null; } public boolean isNull(Object obj) { return obj == null; } public boolean isStoragePermissionGranted() { if (Build.VERSION.SDK_INT >= 23) { if (checkSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") == 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; } @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(com.jfp.prod.R.layout.activity_base); this.llBaseContainer = (LinearLayout) findViewById(com.jfp.prod.R.id.llBaseContainer); this.selScreen = AppConstants.curScreen; initialiseViews(); String stringPref = SharePrefFactory.getStringPref(this, SharePrefConstants.IS_OFFLINE_ENABLED); if (stringPref != null && stringPref.equalsIgnoreCase(AppConstants.SUPER_ADMIN_ROLE_ID)) { findViewById(com.jfp.prod.R.id.lloffline).setVisibility(0); findViewById(com.jfp.prod.R.id.vwLineoffline).setVisibility(0); if (SharePrefFactory.getBooleanPref(this, SharePrefConstants.Offline_Checkbox, false)) { this.checkOffline.setChecked(true); } else { this.checkOffline.setChecked(false); } } setListners(); if (isStoragePermissionGranted()) { initLogger(); } initLocationComponents(); setNavAdapter(); this.tv_copyright.setText("© " + Calendar.getInstance().get(1) + " " + getString(com.jfp.prod.R.string.company_name)); this.customerName.setText(SharePrefFactory.getStringPref(this, SharePrefConstants.USER_NAME)); this.customerEmail.setText(SharePrefFactory.getStringPref(this, SharePrefConstants.EMAIL)); this.lloffline.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (BaseActivity.this.checkOffline.isChecked()) { BaseActivity.this.checkOffline.setChecked(false); } else { BaseActivity.this.checkOffline.setChecked(true); } } }); this.checkOffline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean z9) { Activity activeActivity = ((FiberNetApplication) BaseActivity.this.getApplication()).getActiveActivity(); if (z9) { SharePrefFactory.setBooleanPref(BaseActivity.this, SharePrefConstants.Offline_Checkbox, true); if (activeActivity == null || !(activeActivity instanceof ModuleActivity)) { BaseActivity.this.startActivity(new Intent(activeActivity, (Class<?>) ModuleActivity.class)); } else { ModuleActivity moduleActivity = (ModuleActivity) activeActivity; moduleActivity.ivoffline.setVisibility(0); AppUtil.changeOfflineStatusBar(BaseActivity.this); moduleActivity.displayOfflineModules(); } } else { SharePrefFactory.setBooleanPref(BaseActivity.this, SharePrefConstants.Offline_Checkbox, false); if (activeActivity == null || !(activeActivity instanceof ModuleActivity)) { BaseActivity.this.startActivity(new Intent(activeActivity, (Class<?>) ModuleActivity.class)); } else { ModuleActivity moduleActivity2 = (ModuleActivity) activeActivity; moduleActivity2.ivoffline.setVisibility(8); AppUtil.changeOnlineStatusBar(BaseActivity.this); moduleActivity2.getModule(); } } BaseActivity.this.drawer.d(8388611); } }); if (!BuildConfig.FLAVOR.toLowerCase().contains("jio")) { this.tv_copyright.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(Uri.parse("https://www.leptonsoftware.com/")); BaseActivity.this.startActivity(intent); } }); } String flavourName = AppUtil.getFlavourName("PROD"); this.version.setText("Version 5.2.0 (" + flavourName + ")"); this.handler.postDelayed(this.runnable, FASTEST_UPDATE_INTERVAL_IN_MILLISECONDS); } public void onCreateErrorDialog(String str, String str2) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); button2.setVisibility(8); textView.setText(str); textView2.setText(str2); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); BaseActivity.this.finish(); } }); dialog.show(); } @Override public void onDestroy() { ProgressDialog progressDialog = this.progressDialog; if (progressDialog != null) { progressDialog.dismiss(); } this.progressDialog = null; super.onDestroy(); } @Override public void onModuleInteraction(ModuleDataModel moduleDataModel) { if (moduleDataModel.getId().equalsIgnoreCase("SURVAY")) { openActivity(SurveyHomeActivity.class, false, null); return; } if (moduleDataModel.getId().equalsIgnoreCase("MANAGE_ENTITIES")) { openActivity(ManageEntitiesActivity.class, false, null); } else if (moduleDataModel.getId().equalsIgnoreCase("CUSTOMER_MANAGEMENT")) { openActivity(OpenTicketsActivity.class, false, null); } else if (moduleDataModel.getId().equalsIgnoreCase("LOGOUT")) { confirmLogoutDialog("Alert !", "Are you sure you want to logout?"); } } @Override public void onPause() { Intent intent = this.intent; if (intent != null) { stopService(intent); } PendingIntent pendingIntent = this.pendingIntent; if (pendingIntent != null && this.am != null) { pendingIntent.cancel(); this.am.cancel(this.pendingIntent); } super.onPause(); } @Override public void onRequestPermissionsResult(int i10, String[] strArr, int[] iArr) { super.onRequestPermissionsResult(i10, strArr, iArr); if (i10 == 105) { AppUtil.showBarcode(this); } } @Override public void onResume() { super.onResume(); Activity activeActivity = ((FiberNetApplication) getApplication()).getActiveActivity(); if ((activeActivity instanceof LoginActivity) || (activeActivity instanceof splash) || (activeActivity instanceof com.leptonsoftware.fibernet.jioscreens.LoginActivity) || (activeActivity instanceof OTPActivity) || (activeActivity instanceof WebPageActivity)) { return; } showObjectBox(); if (SharePrefFactory.getStringPref(this, SharePrefConstants.MASTERLOGIN).equalsIgnoreCase("False") && SharePrefFactory.getIntPref(this, SharePrefConstants.IsLocationValidationEnabled, 0) == 1) { AppUtil.startCurrentLocationUpdate(getApplicationContext()); } } @Override public void onStop() { super.onStop(); } @Override public void onUserInteraction() { super.onUserInteraction(); } public void openActivity(Class<?> cls, boolean z9, Bundle bundle) { Intent intent = new Intent(this, cls); if (bundle != null) { intent.putExtras(bundle); } startActivity(intent); if (z9) { finish(); } } public String resoureString(String str) { return AppUtil.getResourceValue(this, str); } protected void reverseGeoCoding(double d10, double d11) { final com.android.volley.j a10 = l.a(this); com.android.volley.toolbox.k kVar = new com.android.volley.toolbox.k(0, constants.reverse_geocode + "latlng=" + String.valueOf(d10) + "," + String.valueOf(d11) + "&key=" + AppUtil.fromBase64(SharePrefFactory.getStringPref(this, SharePrefConstants.gck)) + AppUtil.fromBase64(SharePrefFactory.getStringPref(this, SharePrefConstants.gck2)), new k.b<String>() { @Override public void onResponse(String str) { a10.e(); try { JSONArray jSONArray = new JSONArray(new JSONObject(str).getString("results")); if (jSONArray.length() <= 0) { BaseActivity.this.mLepLogger.error(BaseActivity.TAG, "reverseGeoCoding(): onResponse(): response is null"); BaseActivity.this.showToastWarn("Unable to geocode result is empty."); } else { String obj = new JSONObject(jSONArray.get(0).toString()).get("formatted_address").toString(); GeoCodeListener geoCodeListener = BaseActivity.this.mGeoCodeListener; if (geoCodeListener != null) { geoCodeListener.geoCoding(obj); } } } catch (JSONException e10) { BaseActivity.this.mLepLogger.error(BaseActivity.TAG, "reverseGeoCoding(): onResponse(): JSONException:" + e10.getMessage()); BaseActivity.this.showToastWarn("Unable to geocode your location. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { BaseActivity baseActivity = BaseActivity.this; AppUtil.onVolleyErrorResponseHandling(baseActivity, baseActivity.mLepLogger, volleyError, BaseActivity.TAG); a10.e(); } }); kVar.setRetryPolicy(new c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(kVar); } public void showObject() { this.am = (AlarmManager) getSystemService("alarm"); this.broadcastintent = new Intent(getApplicationContext(), (Class<?>) MyAlertBoxReciever.class); this.pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, this.broadcastintent, 134217728); this.pendingIntent1 = PendingIntent.getBroadcast(getApplicationContext(), 1, this.broadcastintent, 134217728); this.pendingIntent2 = PendingIntent.getBroadcast(getApplicationContext(), 2, this.broadcastintent, 134217728); this.am.set(2, SystemClock.elapsedRealtime() + FASTEST_UPDATE_INTERVAL_IN_MILLISECONDS, this.pendingIntent); this.am.set(2, SystemClock.elapsedRealtime() + 15000, this.pendingIntent1); } public void showObjectBox() { if (Build.VERSION.SDK_INT >= 23 && !Settings.canDrawOverlays(this)) { alertDialog("Overlays permission is mandatory for the application to function properly. Please give the access."); return; } if (this.intent == null) { this.intent = new Intent(this, (Class<?>) FloatingWidgetService.class); } startService(this.intent); } public void showToast(String str) { Toast.makeText(this, str, 0).show(); } protected void showToastSuccess(String str) { Toasty.success((Context) this, (CharSequence) str, 1, true).show(); } public void showToastWarn(String str) { Toasty.warning((Context) this, (CharSequence) str, 1, true).show(); } public static Location getLastKnownLocation(Context context) { if (context == null) { return null; } LocationManager locationManager = (LocationManager) context.getSystemService(AppConstants.Offline_Location_Action); Location location = null; for (String str : locationManager.getProviders(true)) { if (b.a(context, "android.permission.ACCESS_FINE_LOCATION") != 0 && b.a(context, "android.permission.ACCESS_COARSE_LOCATION") != 0) { return null; } Location lastKnownLocation = locationManager.getLastKnownLocation(str); if (lastKnownLocation != null && (location == null || lastKnownLocation.getAccuracy() < location.getAccuracy())) { location = lastKnownLocation; } } return location; } public void alertDialog(String str) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(1); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(com.jfp.prod.R.layout.custom_alert); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(true); ImageView imageView = (ImageView) dialog.findViewById(com.jfp.prod.R.id.iv_icon); Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok); Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel); TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title); TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message); imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.alert)); button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_info)); textView.setText("Info"); button2.setVisibility(8); textView2.setText(str); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); BaseActivity.this.askPermission(); } } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (dialog.isShowing()) { dialog.dismiss(); } } }); dialog.show(); } }