MD5 校验值:7cd346351ab05a28e42aff65173e0141
LogicalEqpFrag.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.leptonsoftware.fibernet.fragments; import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.AsyncTask; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.Button; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.Spinner; import android.widget.SpinnerAdapter; import androidx.appcompat.widget.f0; import androidx.databinding.f; import com.android.volley.VolleyError; import com.android.volley.j; import com.android.volley.k; import com.android.volley.toolbox.h; import com.android.volley.toolbox.l; import com.crashlytics.android.core.CrashlyticsCore; import com.jfp.prod.R; import com.leptonsoftware.fibernet.EntityDetailActivity; import com.leptonsoftware.fibernet.ManageEntitiesActivity; import com.leptonsoftware.fibernet.adapters.EntitySpinnerAdapter; import com.leptonsoftware.fibernet.adapters.LegendListAdapter; import com.leptonsoftware.fibernet.adapters.cpf.ConnectionFinedListAdapter; import com.leptonsoftware.fibernet.adapters.logical.EntityEqpLogicalBaseAdapter; import com.leptonsoftware.fibernet.adapters.logical.LogicalEntityEqpIdAdapter; import com.leptonsoftware.fibernet.constants; import com.leptonsoftware.fibernet.databinding.FragmentLogicalEqpBinding; import com.leptonsoftware.fibernet.datamodel.NetworkLayer; import com.leptonsoftware.fibernet.fragments.cpf.LogicalHostFragment; import com.leptonsoftware.fibernet.jsonparser.ApiType; import com.leptonsoftware.fibernet.jsonparser.AppNetwork; import com.leptonsoftware.fibernet.jsonparser.JsonParser; import com.leptonsoftware.fibernet.jsonparser.WebApi; import com.leptonsoftware.fibernet.repository.NetworkRespCodes; import com.leptonsoftware.fibernet.requests.BaseReq; import com.leptonsoftware.fibernet.requests.GetConnectionInfoReq; import com.leptonsoftware.fibernet.requests.GetSplitterPortReq; import com.leptonsoftware.fibernet.requests.NetworkLayerReq; import com.leptonsoftware.fibernet.requests.SearchEntityReq; import com.leptonsoftware.fibernet.responses.ConnectionInfoResp; import com.leptonsoftware.fibernet.responses.ConnectionPortResp; import com.leptonsoftware.fibernet.responses.CustomerInfoResp; import com.leptonsoftware.fibernet.responses.EntitiesResp; import com.leptonsoftware.fibernet.responses.GetStructureDetailsResp; import com.leptonsoftware.fibernet.responses.LogicalEntityResp; import com.leptonsoftware.fibernet.responses.NetworkLayerResp; import com.leptonsoftware.fibernet.responses.SearchEntityResp; import com.leptonsoftware.fibernet.util.AppConstants; import com.leptonsoftware.fibernet.util.AppUtil; import com.leptonsoftware.fibernet.util.SharePrefConstants; import com.leptonsoftware.fibernet.util.SharePrefFactory; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; public class LogicalEqpFrag extends BaseFragment { private ConnectionInfoResp connectionDetailsResp; EntitiesResp.Entity curEntity; private Dialog dialog; ArrayList<ConnectionInfoResp.ConnectionInfoModel> downConnectionList; private EntityEqpLogicalBaseAdapter entityEqpLogicalBaseAdapter; private ArrayList<LogicalEntityResp.EquipementSearchDataModel> entitySearchList; ArrayList<ConnectionInfoResp.ConnectionCommonModel> filDownConnectionList; ArrayList<ConnectionInfoResp.ConnectionCommonModel> filUpConnectionList; private FragmentLogicalEqpBinding fragmentLogicalEqpBinding; private boolean fromEntityDetail; private ArrayList<ConnectionPortResp.EquipementPortDataModel> lstSpiliterPortElement; SearchEntityResp.EntityResult mBarcodeEntity; private ConnectionPortResp mConnectionPortResp; private CustomerInfoResp mCustomerInfoResp; private LegendListAdapter mLegendListAdapter; private f0 mListSpliterWindow; private GetStructureDetailsResp.lstElementDetails mLstElementDetails; View.OnClickListener mOnClickListener; private ConnectionFinedListAdapter mPortListAdapter; ArrayList<NetworkLayer> networkLayerList; private boolean preventEntityApi; private boolean retainState; public LogicalEntityResp.EquipementSearchDataModel selectedObj; private String strEntityType; private String strPortValue; private String strSelectedPort; ArrayList<ConnectionInfoResp.ConnectionInfoModel> upConnectionList; public class BarcodeAsynk extends AsyncTask<String, String, SearchEntityResp.EntityResult> { private String entity; private String networkId; public BarcodeAsynk(String str, String str2) { this.entity = str; this.networkId = str2; } @Override protected void onPreExecute() { LogicalEqpFrag.this.mBarcodeEntity = null; } @Override public SearchEntityResp.EntityResult doInBackground(String... strArr) { SearchEntityResp searchEntityResp; String convertBeanToJson = JsonParser.convertBeanToJson(new SearchEntityReq(this.entity + ":" + this.networkId)); BaseReq baseReq = new BaseReq(); baseReq.setData(convertBeanToJson); String convertBeanToJson2 = JsonParser.convertBeanToJson(baseReq); Context context = LogicalEqpFrag.this.getContext(); if (context == null) { LogicalEqpFrag.this.getActivity(); } String stringPref = context != null ? SharePrefFactory.getStringPref(context, SharePrefConstants.LOGIN_ACCESS_TOKEN) : ""; AppNetwork appNetwork = AppNetwork.getInstance(); ApiType apiType = ApiType.ENTITY_SEARCH_RESULT; String sendHttpPostRequest = appNetwork.sendHttpPostRequest(WebApi.POST, WebApi.getWebApi(apiType), convertBeanToJson2, stringPref); Log.i(CrashlyticsCore.TAG, "Response" + sendHttpPostRequest); if (sendHttpPostRequest != null && !sendHttpPostRequest.isEmpty() && (searchEntityResp = (SearchEntityResp) JsonParser.convertJsonToBean(apiType, sendHttpPostRequest)) != null && searchEntityResp.getResults() != null && searchEntityResp.getResults().size() > 0) { LogicalEqpFrag.this.mBarcodeEntity = searchEntityResp.getResults().get(0); } return LogicalEqpFrag.this.mBarcodeEntity; } @Override public void onPostExecute(SearchEntityResp.EntityResult entityResult) { if (entityResult != null) { LogicalEqpFrag.this.fragmentLogicalEqpBinding.etCableEqp.setText(LogicalEqpFrag.this.mBarcodeEntity.getValue()); if (LogicalEqpFrag.this.dialog != null) { LogicalEqpFrag.this.dialog.dismiss(); LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.selectedObj = new LogicalEntityResp.EquipementSearchDataModel(String.valueOf(logicalEqpFrag.mBarcodeEntity.getSystemId()), LogicalEqpFrag.this.mBarcodeEntity.getEntityName(), LogicalEqpFrag.this.mBarcodeEntity.getEntityName(), LogicalEqpFrag.this.mBarcodeEntity.getGeomType()); LogicalEqpFrag logicalEqpFrag2 = LogicalEqpFrag.this; logicalEqpFrag2.getSplliterPortApi(String.valueOf(logicalEqpFrag2.mBarcodeEntity.getSystemId()), LogicalEqpFrag.this.mBarcodeEntity.getEntityName()); return; } return; } LogicalEqpFrag.this.getContext(); if (LogicalEqpFrag.this.getActivity() != null) { LogicalEqpFrag logicalEqpFrag3 = LogicalEqpFrag.this; logicalEqpFrag3.alertDialog(logicalEqpFrag3.getString(R.string.info), "No Entity Found for\nBarcode: " + this.networkId); } } } public LogicalEqpFrag(EntitiesResp.Entity entity) { this.strPortValue = ""; this.strEntityType = ""; this.strSelectedPort = ""; this.lstSpiliterPortElement = new ArrayList<>(); this.fromEntityDetail = false; this.retainState = false; this.mOnClickListener = b.f7371b; this.curEntity = entity; this.selectedObj = new LogicalEntityResp.EquipementSearchDataModel(String.valueOf(entity.getSystem_id()), entity.getCommon_name(), entity.getEntity_type(), entity.getCommon_name()); this.fromEntityDetail = true; } public void barcodeDialog() { Dialog dialog = new Dialog(this.mActivity); this.dialog = dialog; dialog.requestWindowFeature(1); this.dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); this.dialog.setContentView(R.layout.custom_barcode_alert); this.dialog.setCanceledOnTouchOutside(false); this.dialog.setCancelable(true); Button button = (Button) this.dialog.findViewById(R.id.btn_ok); Button button2 = (Button) this.dialog.findViewById(R.id.btn_cancel); ImageView imageView = (ImageView) this.dialog.findViewById(R.id.ivBarcode); final Spinner spinner = (Spinner) this.dialog.findViewById(R.id.sp_entity_type); spinner.setAdapter((SpinnerAdapter) new EntitySpinnerAdapter(getContext(), R.layout.drop_down_item, R.id.tv_drop_down_title, this.networkLayerList)); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i10, long j10) { AppConstants.LAYER_SELECTED = ((NetworkLayer) spinner.getSelectedItem()).getLayerName(); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (spinner.getSelectedItemPosition() != 0) { LogicalEqpFrag.this.dialog.dismiss(); if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).BarcodeAction = "logical"; } LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.mBarcodeEntity = null; AppUtil.showBarcode(logicalEqpFrag.mActivity); return; } LogicalEqpFrag logicalEqpFrag2 = LogicalEqpFrag.this; logicalEqpFrag2.alertDialog(logicalEqpFrag2.getString(R.string.info), "Please select entity type"); } }); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogicalEqpFrag.this.dialog.dismiss(); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogicalEqpFrag.this.dialog.dismiss(); } }); this.dialog.show(); } public void getEntitiesId(String str) { if (!AppUtil.isNetworkConnected(this.mActivity)) { alertDialog(getString(R.string.alert), getString(R.string.message_noInternet)); return; } SharePrefFactory.getIntPref(this.mActivity, SharePrefConstants.BUFFER_FOR_BUILDING_CHECK, 0); SharePrefFactory.getLongPref(getContext(), SharePrefConstants.USER_ID, 0L); String convertBeanToJson = JsonParser.convertBeanToJson(new SearchEntityReq(str)); BaseReq baseReq = new BaseReq(); baseReq.setData(convertBeanToJson); String convertBeanToJson2 = JsonParser.convertBeanToJson(baseReq); viewLepLog(CrashlyticsCore.TAG, "getEntitiesApiReq(): Params:" + convertBeanToJson2); final j a10 = l.a(this.mActivity); try { h hVar = new h(WebApi.getWebApi(ApiType.Eqp_Search_Logical), new JSONObject(convertBeanToJson2), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { LogicalEqpFrag.this.fragmentLogicalEqpBinding.ivLoader.setVisibility(8); if (LogicalEqpFrag.this.fragmentLogicalEqpBinding.etCableEqp.getText().toString().length() > 0) { LogicalEqpFrag.this.fragmentLogicalEqpBinding.ivCross.setVisibility(0); } a10.e(); Log.i(CrashlyticsCore.TAG, "Response getEntitiesApiReq" + jSONObject.toString()); try { if (jSONObject.toString().isEmpty()) { Log.i(CrashlyticsCore.TAG, "getEntitiesApiReq():onResponse(): Response is null"); return; } LogicalEntityResp logicalEntityResp = (LogicalEntityResp) JsonParser.convertJsonToBean(ApiType.Eqp_Search_Logical, jSONObject.toString()); if (logicalEntityResp == null) { Log.i(CrashlyticsCore.TAG, "getEntitiesApiReq():onResponse(): Parsing error response is:" + jSONObject.toString()); return; } if (logicalEntityResp.getStatus().equalsIgnoreCase(NetworkRespCodes.OK)) { if (logicalEntityResp.getResults() != null && logicalEntityResp.getResults().getLstLogicalViewEquipementSearch() != null) { LogicalEqpFrag.this.entitySearchList = logicalEntityResp.getResults().getLstLogicalViewEquipementSearch(); } else { LogicalEqpFrag.this.entitySearchList = new ArrayList(); LogicalEqpFrag.this.entitySearchList.add(new LogicalEntityResp.EquipementSearchDataModel(" No Match Found", "0")); } LogicalEqpFrag.this.setEqpAdapter(); return; } Log.i(CrashlyticsCore.TAG, "getEntitiesApiReq():onResponse(): Error while checking nearby building."); } catch (Exception e10) { e10.printStackTrace(); Log.i(CrashlyticsCore.TAG, "getEntitiesApiReq(): onResponse(): JSONException:" + e10.getMessage()); LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.alertDialog(logicalEqpFrag.getString(R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } volleyError.printStackTrace(); AppUtil.onVolleyErrorResponseHandling(LogicalEqpFrag.this.getActivity(), LogicalEqpFrag.this.mLepLogger, volleyError, CrashlyticsCore.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(LogicalEqpFrag.this.getActivity(), SharePrefConstants.LOGIN_ACCESS_TOKEN)); Log.i(CrashlyticsCore.TAG, "getEntitiesApiReq(): getHeaders():" + hashMap.toString()); return hashMap; } }; Log.i(CrashlyticsCore.TAG, "getEntitiesApiReq(): URL:" + hVar.getUrl()); hVar.setRetryPolicy(new com.android.volley.c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); this.fragmentLogicalEqpBinding.ivLoader.setVisibility(0); this.fragmentLogicalEqpBinding.ivCross.setVisibility(8); } catch (JSONException e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "getLegendseApiReq(): Failed to create Request json:" + e10.getMessage()); } } private void getPortDetail(String str) { if (!AppUtil.isNetworkConnected(this.mActivity)) { alertDialog(getString(R.string.alert), getString(R.string.message_noInternet)); return; } SharePrefFactory.getIntPref(this.mActivity, SharePrefConstants.BUFFER_FOR_BUILDING_CHECK, 0); SharePrefFactory.getLongPref(getContext(), SharePrefConstants.USER_ID, 0L); String convertBeanToJson = JsonParser.convertBeanToJson(new GetConnectionInfoReq(this.selectedObj.getSystem_id(), this.selectedObj.getEntity_type(), str)); BaseReq baseReq = new BaseReq(); baseReq.setData(convertBeanToJson); String convertBeanToJson2 = JsonParser.convertBeanToJson(baseReq); Log.i(CrashlyticsCore.TAG, "getPortDetailReq(): Params:" + convertBeanToJson2); if (getActivity() instanceof ManageEntitiesActivity) { Activity activity = this.mActivity; ((ManageEntitiesActivity) activity).progressDialog = ProgressDialog.show(activity, null, "Loading.", true); } else { Activity activity2 = this.mActivity; ((EntityDetailActivity) activity2).progressDialog = ProgressDialog.show(activity2, null, "Loading.", true); } final j a10 = l.a(this.mActivity); try { h hVar = new h(WebApi.getWebApi(ApiType.Get_Connection_Info), new JSONObject(convertBeanToJson2), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } a10.e(); try { Log.i(CrashlyticsCore.TAG, "getPortDetailReq():onResponse()" + jSONObject); if (jSONObject != null && !jSONObject.toString().isEmpty()) { LogicalEqpFrag.this.connectionDetailsResp = (ConnectionInfoResp) JsonParser.convertJsonToBean(ApiType.Get_Connection_Info, jSONObject.toString()); if (LogicalEqpFrag.this.connectionDetailsResp != null) { if (!LogicalEqpFrag.this.connectionDetailsResp.getStatus().equalsIgnoreCase(NetworkRespCodes.OK)) { LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.alertDialog(logicalEqpFrag.getString(R.string.error), LogicalEqpFrag.this.connectionDetailsResp.getError_message()); Log.e(CrashlyticsCore.TAG, "getPortDetailReq():onResponse(): Error while checking nearby building."); } } else { Log.e(CrashlyticsCore.TAG, "getPortDetailReq():onResponse(): Parsing error response is:" + jSONObject.toString()); } } Log.e(CrashlyticsCore.TAG, "getPortDetailReq():onResponse(): Response is null"); } catch (Exception e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "getPortDetailReq(): onResponse(): JSONException:" + e10.getMessage()); LogicalEqpFrag logicalEqpFrag2 = LogicalEqpFrag.this; logicalEqpFrag2.alertDialog(logicalEqpFrag2.getString(R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } volleyError.printStackTrace(); AppUtil.onVolleyErrorResponseHandling(LogicalEqpFrag.this.getActivity(), LogicalEqpFrag.this.mLepLogger, volleyError, CrashlyticsCore.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(LogicalEqpFrag.this.getActivity(), SharePrefConstants.LOGIN_ACCESS_TOKEN)); Log.i(CrashlyticsCore.TAG, "getPortDetailReq(): getHeaders():" + hashMap.toString()); return hashMap; } }; Log.i(CrashlyticsCore.TAG, "getPortDetailReq(): URL:" + hVar.getUrl()); hVar.setRetryPolicy(new com.android.volley.c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); } catch (JSONException e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "getPortDetailReq(): Failed to create Request json:" + e10.getMessage()); } } public void getSplliterPortApi(String str, String str2) { if (!AppUtil.isNetworkConnected(this.mActivity)) { alertDialog(getString(R.string.alert), getString(R.string.message_noInternet)); return; } SharePrefFactory.getIntPref(this.mActivity, SharePrefConstants.BUFFER_FOR_BUILDING_CHECK, 0); SharePrefFactory.getLongPref(getContext(), SharePrefConstants.USER_ID, 0L); String convertBeanToJson = JsonParser.convertBeanToJson(new GetSplitterPortReq(str, str2)); BaseReq baseReq = new BaseReq(); baseReq.setData(convertBeanToJson); String convertBeanToJson2 = JsonParser.convertBeanToJson(baseReq); Log.i(CrashlyticsCore.TAG, "getSplliterPortReq(): Params:" + convertBeanToJson2); if (getActivity() instanceof ManageEntitiesActivity) { Activity activity = this.mActivity; ((ManageEntitiesActivity) activity).progressDialog = ProgressDialog.show(activity, null, "Loading.", true); } else { Activity activity2 = this.mActivity; ((EntityDetailActivity) activity2).progressDialog = ProgressDialog.show(activity2, null, "Loading.", true); } final j a10 = l.a(this.mActivity); try { h hVar = new h(WebApi.getWebApi(ApiType.Get_Equipment_Port_Info), new JSONObject(convertBeanToJson2), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } a10.e(); Log.i(CrashlyticsCore.TAG, "Response getSplliterPortReq" + jSONObject.toString()); try { if (jSONObject.toString().isEmpty()) { Log.e(CrashlyticsCore.TAG, "getSplliterPortReq():onResponse(): Response is null"); } else { LogicalEqpFrag.this.mConnectionPortResp = (ConnectionPortResp) JsonParser.convertJsonToBean(ApiType.Get_Equipment_Port_Info, jSONObject.toString()); if (LogicalEqpFrag.this.mConnectionPortResp != null) { if (LogicalEqpFrag.this.mConnectionPortResp.getStatus().equalsIgnoreCase(NetworkRespCodes.OK)) { if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } } else { LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.alertDialog(logicalEqpFrag.getString(R.string.error), LogicalEqpFrag.this.mConnectionPortResp.getError_message()); Log.e(CrashlyticsCore.TAG, "getSplliterPortReq():onResponse(): Error while checking nearby building."); } } else { Log.e(CrashlyticsCore.TAG, "getSplliterPortReq():onResponse(): Parsing error response is:" + jSONObject.toString()); } } } catch (Exception e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "getSplliterAndDistributioneReq(): onResponse(): JSONException:" + e10.getMessage()); LogicalEqpFrag logicalEqpFrag2 = LogicalEqpFrag.this; logicalEqpFrag2.alertDialog(logicalEqpFrag2.getString(R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); volleyError.printStackTrace(); AppUtil.onVolleyErrorResponseHandling(LogicalEqpFrag.this.getActivity(), LogicalEqpFrag.this.mLepLogger, volleyError, CrashlyticsCore.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(LogicalEqpFrag.this.getActivity(), SharePrefConstants.LOGIN_ACCESS_TOKEN)); Log.i(CrashlyticsCore.TAG, "getSplliterAndDistributioneReq(): getHeaders():" + hashMap.toString()); return hashMap; } }; Log.i(CrashlyticsCore.TAG, "getSplliterAndDistributioneReq(): URL:" + hVar.getUrl()); hVar.setRetryPolicy(new com.android.volley.c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); } catch (JSONException e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "getSplliterAndDistributioneReq(): Failed to create Request json:" + e10.getMessage()); } } private void initalize() { this.fragmentLogicalEqpBinding.header.tvToolbarTitle.setText("Logical Diagram"); this.fragmentLogicalEqpBinding.header.ivBack.setTypeface(AppUtil.getStaticIcomoonTypeface(getContext())); this.fragmentLogicalEqpBinding.header.ivBack.setText(getString(R.string.icon_back)); this.fragmentLogicalEqpBinding.header.ivBack.setVisibility(0); this.fragmentLogicalEqpBinding.header.ivBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogicalEqpFrag.this.getActivity().onBackPressed(); } }); if (this.fromEntityDetail) { this.fragmentLogicalEqpBinding.etCableEqp.setText(this.curEntity.getCommon_name()); this.fragmentLogicalEqpBinding.etCableEqp.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); this.fragmentLogicalEqpBinding.etCableEqp.setEnabled(false); this.fragmentLogicalEqpBinding.ivBarcode.setVisibility(8); this.fragmentLogicalEqpBinding.etCableEqp.setBackgroundColor(Color.parseColor("#1A454D63")); } else { if (this.entitySearchList == null) { this.entitySearchList = new ArrayList<>(); } new LogicalEntityEqpIdAdapter(getContext(), android.R.layout.simple_dropdown_item_1line, android.R.id.text1, this.entitySearchList); this.fragmentLogicalEqpBinding.rlParent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogicalEqpFrag.this.fragmentLogicalEqpBinding.lvSuggestion.setVisibility(8); } }); this.fragmentLogicalEqpBinding.ivCross.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogicalEqpFrag.this.fragmentLogicalEqpBinding.etCableEqp.getText().clear(); } }); this.fragmentLogicalEqpBinding.etCableEqp.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable editable) { if (editable == null || editable.length() <= 0) { LogicalEqpFrag.this.fragmentLogicalEqpBinding.ivCross.setVisibility(8); LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.selectedObj = null; logicalEqpFrag.entitySearchList = new ArrayList(); LogicalEqpFrag.this.setEqpAdapter(); LogicalEqpFrag.this.fragmentLogicalEqpBinding.lvSuggestion.setVisibility(8); return; } LogicalEqpFrag.this.fragmentLogicalEqpBinding.ivCross.setVisibility(0); if (LogicalEqpFrag.this.preventEntityApi) { LogicalEqpFrag.this.preventEntityApi = false; return; } if (LogicalEqpFrag.this.retainState) { LogicalEqpFrag.this.retainState = false; return; } LogicalEqpFrag logicalEqpFrag2 = LogicalEqpFrag.this; logicalEqpFrag2.selectedObj = null; logicalEqpFrag2.lstSpiliterPortElement = new ArrayList(); LogicalEqpFrag.this.getEntitiesId(editable.toString()); } @Override public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) { } @Override public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) { } }); this.fragmentLogicalEqpBinding.acCableEqp.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i10, long j10) { LogicalEqpFrag.this.selectedObj = (LogicalEntityResp.EquipementSearchDataModel) adapterView.getAdapter().getItem(i10); LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.getSplliterPortApi(logicalEqpFrag.selectedObj.getSystem_id(), LogicalEqpFrag.this.selectedObj.getEntity_type()); } }); this.fragmentLogicalEqpBinding.acCableEqp.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable editable) { if (LogicalEqpFrag.this.retainState) { LogicalEqpFrag.this.retainState = false; } else { LogicalEqpFrag.this.selectedObj = null; } } @Override public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) { } @Override public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) { } }); } this.fragmentLogicalEqpBinding.ivBarcode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!AppUtil.isNetworkConnected(LogicalEqpFrag.this.getContext())) { LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.alertDialog(logicalEqpFrag.getString(R.string.alert), LogicalEqpFrag.this.getString(R.string.message_noInternet)); return; } LogicalEqpFrag logicalEqpFrag2 = LogicalEqpFrag.this; if (logicalEqpFrag2.networkLayerList != null) { logicalEqpFrag2.barcodeDialog(); } else { logicalEqpFrag2.networkLayerReq(false); } } }); this.fragmentLogicalEqpBinding.btnShowRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; if (logicalEqpFrag.selectedObj == null) { logicalEqpFrag.showToastWarn("Please select valid equipment id"); return; } LogicalHostFragment logicalHostFragment = new LogicalHostFragment(LogicalEqpFrag.this.selectedObj); Bundle bundle = new Bundle(); bundle.putString("EqpId", LogicalEqpFrag.this.fragmentLogicalEqpBinding.etCableEqp.getText().toString()); bundle.putString("CorePort", LogicalEqpFrag.this.strPortValue); bundle.putString("EnityType", LogicalEqpFrag.this.selectedObj.getEntity_type()); bundle.putString("EntitySystemID", LogicalEqpFrag.this.selectedObj.getSystem_id()); bundle.putBoolean("fromEntityDetail", LogicalEqpFrag.this.fromEntityDetail); logicalHostFragment.setArguments(bundle); LogicalEqpFrag.this.retainState = true; if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).replaceFragment(logicalHostFragment); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).replaceFragment(logicalHostFragment); } } }); } public void setEqpAdapter() { this.entityEqpLogicalBaseAdapter = new EntityEqpLogicalBaseAdapter(getActivity(), this.entitySearchList); if (BaseFragment.isNotNull(this.entitySearchList) && this.entitySearchList.size() > 0 && this.fragmentLogicalEqpBinding.etCableEqp.getText().toString().length() > 0) { this.fragmentLogicalEqpBinding.lvSuggestion.setVisibility(0); } else { this.fragmentLogicalEqpBinding.lvSuggestion.setVisibility(8); } this.fragmentLogicalEqpBinding.lvSuggestion.setAdapter((ListAdapter) this.entityEqpLogicalBaseAdapter); this.fragmentLogicalEqpBinding.lvSuggestion.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i10, long j10) { LogicalEntityResp.EquipementSearchDataModel equipementSearchDataModel = (LogicalEntityResp.EquipementSearchDataModel) view.getTag(R.integer.data); if (equipementSearchDataModel.getSystem_id().equalsIgnoreCase("0")) { return; } LogicalEqpFrag.this.preventEntityApi = true; LogicalEqpFrag.this.fragmentLogicalEqpBinding.etCableEqp.setText(equipementSearchDataModel.getDisplay_name()); LogicalEqpFrag.this.fragmentLogicalEqpBinding.etCableEqp.setTextColor(p.b.c(LogicalEqpFrag.this.getActivity(), R.color.black)); LogicalEqpFrag.this.fragmentLogicalEqpBinding.lvSuggestion.setVisibility(8); LogicalEqpFrag.this.selectedObj = equipementSearchDataModel; if (equipementSearchDataModel.getSystem_id() != null) { LogicalEqpFrag.this.strPortValue = ""; } } }); } private void setListener() { } private void viewLepLog(String str, String str2) { Log.i(CrashlyticsCore.TAG, str2); } public void networkLayerReq(boolean z9) { if (!AppUtil.isNetworkConnected(getContext())) { alertDialog(getString(R.string.alert), getString(R.string.message_noInternet)); return; } String convertBeanToJson = JsonParser.convertBeanToJson(new NetworkLayerReq(SharePrefFactory.getLongPref(getContext(), SharePrefConstants.USER_ID, 0L), 0L, z9)); BaseReq baseReq = new BaseReq(); baseReq.setData(convertBeanToJson); String convertBeanToJson2 = JsonParser.convertBeanToJson(baseReq); Log.i(CrashlyticsCore.TAG, "networkLayerReq(): Params:" + convertBeanToJson2); final j a10 = l.a(getContext()); try { h hVar = new h(WebApi.getWebApi(ApiType.NETWORK_LAYERS), new JSONObject(convertBeanToJson2), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } a10.e(); if (jSONObject != null) { try { if (!jSONObject.toString().isEmpty()) { NetworkLayerResp networkLayerResp = (NetworkLayerResp) JsonParser.convertJsonToBean(ApiType.NETWORK_LAYERS, jSONObject.toString()); if (networkLayerResp == null) { LogicalEqpFrag logicalEqpFrag = LogicalEqpFrag.this; logicalEqpFrag.alertDialog(logicalEqpFrag.getString(R.string.error), "Invalid data format."); Log.e(CrashlyticsCore.TAG, "networkLayerReq():onResponse(): Parsing error response is:" + jSONObject.toString()); return; } if (networkLayerResp.getResults() != null && networkLayerResp.getResults().getLstNetworkLayers().size() != 0) { AppConstants.netWorkLayersConstant.clear(); AppConstants.netWorkLayersConstant.addAll(networkLayerResp.getResults().getLstNetworkLayers()); LogicalEqpFrag.this.networkLayerList = new ArrayList<>(); NetworkLayer networkLayer = new NetworkLayer(); networkLayer.setLayerTitle("--Select--"); LogicalEqpFrag.this.networkLayerList.add(0, networkLayer); for (int i10 = 0; i10 < networkLayerResp.getResults().getLstNetworkLayers().size(); i10++) { if (networkLayerResp.getResults().getLstNetworkLayers().get(i10).getIsLogicalViewEnabled().equalsIgnoreCase("true")) { LogicalEqpFrag.this.networkLayerList.add(networkLayerResp.getResults().getLstNetworkLayers().get(i10)); } } LogicalEqpFrag.this.barcodeDialog(); return; } Log.e(CrashlyticsCore.TAG, "networkLayerReq():onResponse(): Survey area null or empty"); LogicalEqpFrag logicalEqpFrag2 = LogicalEqpFrag.this; logicalEqpFrag2.alertDialog(logicalEqpFrag2.getString(R.string.error), "Network layer not assigned to you"); return; } } catch (Exception e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "networkLayerReq(): onResponse(): JSONException:" + e10.getMessage()); LogicalEqpFrag logicalEqpFrag3 = LogicalEqpFrag.this; logicalEqpFrag3.alertDialog(logicalEqpFrag3.getString(R.string.error), "Unable parse data. Error is: " + e10.getMessage()); return; } } Log.e(CrashlyticsCore.TAG, "networkLayerReq():onResponse(): Response is null"); LogicalEqpFrag logicalEqpFrag4 = LogicalEqpFrag.this; logicalEqpFrag4.alertDialog(logicalEqpFrag4.getString(R.string.error), "Empty response from server"); } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { if (LogicalEqpFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) LogicalEqpFrag.this.mActivity).progressDialog.dismiss(); } volleyError.printStackTrace(); AppUtil.onVolleyErrorResponseHandling(LogicalEqpFrag.this.getActivity(), LogicalEqpFrag.this.mLepLogger, volleyError, CrashlyticsCore.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(LogicalEqpFrag.this.getContext(), SharePrefConstants.LOGIN_ACCESS_TOKEN)); Log.i(CrashlyticsCore.TAG, "networkLayerReq(): getHeaders():" + hashMap.toString()); return hashMap; } }; Log.i(CrashlyticsCore.TAG, "networkLayerReq(): URL:" + hVar.getUrl()); hVar.setRetryPolicy(new com.android.volley.c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); if (getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) this.mActivity).progressDialog = ProgressDialog.show(getContext(), null, "Fetching network layers...", true); } else { ((EntityDetailActivity) this.mActivity).progressDialog = ProgressDialog.show(getContext(), null, "Fetching network layers...", true); } } catch (JSONException e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "networkLayerReq(): Failed to create Request json:" + e10.getMessage()); } } @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); } @Override public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { this.fragmentLogicalEqpBinding = (FragmentLogicalEqpBinding) f.h(layoutInflater, R.layout.fragment_logical_eqp, viewGroup, false); setListener(); initalize(); return this.fragmentLogicalEqpBinding.getRoot(); } @Override public void onPause() { super.onPause(); } @Override public void onResume() { super.onResume(); } @Override public void onStop() { super.onStop(); f0 f0Var = this.mListSpliterWindow; if (f0Var != null) { f0Var.dismiss(); } } public void refreshAdapter(String str) { this.mPortListAdapter.notifyDataSetChanged(); this.strSelectedPort = str; } public void setBarcodeData(String str, String str2) { new BarcodeAsynk(str, str2).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new String[0]); } public void setData(CustomerInfoResp customerInfoResp, GetStructureDetailsResp.lstElementDetails lstelementdetails) { this.mCustomerInfoResp = customerInfoResp; this.mLstElementDetails = lstelementdetails; } public LogicalEqpFrag() { this.strPortValue = ""; this.strEntityType = ""; this.strSelectedPort = ""; this.lstSpiliterPortElement = new ArrayList<>(); this.fromEntityDetail = false; this.retainState = false; this.mOnClickListener = b.f7371b; } }