MD5 校验值:7cd346351ab05a28e42aff65173e0141
ConnectionFinderFrag.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.leptonsoftware.fibernet.fragments.cpf; import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; 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.c; 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.cpf.EntityEqpBaseAdapter; import com.leptonsoftware.fibernet.adapters.cpf.EntityEqpIdAdapter; import com.leptonsoftware.fibernet.adapters.cpf.EntityPortListAdapter; import com.leptonsoftware.fibernet.constants; import com.leptonsoftware.fibernet.databinding.FragmentConnectionFinderBinding; import com.leptonsoftware.fibernet.datamodel.NetworkLayer; import com.leptonsoftware.fibernet.fragments.BaseFragment; 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.GetSplitterPortReq; import com.leptonsoftware.fibernet.requests.NetworkLayerReq; import com.leptonsoftware.fibernet.requests.SearchEntityReq; import com.leptonsoftware.fibernet.responses.ConnectionEntityResp; 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.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 io.fabric.sdk.android.services.common.i; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; public class ConnectionFinderFrag extends BaseFragment { EntityEqpIdAdapter adapter; private ConnectionInfoResp connectionDetailsResp; EntitiesResp.Entity curEntity; private Dialog dialog; EntityEqpBaseAdapter entityEqpBaseAdapter; private ArrayList<ConnectionEntityResp.EquipementSearchDataModel> entitySearchList; private FragmentConnectionFinderBinding fragmentConnectionFinderBinding; SearchEntityResp.EntityResult mBarcodeEntity; private ConnectionPortResp mConnectionPortResp; private CustomerInfoResp mCustomerInfoResp; private LegendListAdapter mLegendListAdapter; private f0 mListEntityWindow; private f0 mListSpliterWindow; private GetStructureDetailsResp.lstElementDetails mLstElementDetails; private ConnectionFinedListAdapter mPortListAdapter; private ArrayList<NetworkLayer> networkLayerList; ConnectionEntityResp.EquipementSearchDataModel selectedObj; private String str_PortText = ""; private String strPortValue = ""; private String strEntityType = ""; private ArrayList<ConnectionPortResp.EquipementPortDataModel> lstSpiliterPortElement = new ArrayList<>(); private boolean fromEntityDetail = false; private boolean retainState = false; private boolean preventEntityApi = false; View.OnClickListener mOnClickListener = new View.OnClickListener() { @Override public final void onClick(View view) { view.getId(); } }; 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() { ConnectionFinderFrag.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 = ConnectionFinderFrag.this.getContext(); if (context == null) { ConnectionFinderFrag.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) { ConnectionFinderFrag.this.mBarcodeEntity = searchEntityResp.getResults().get(0); } return ConnectionFinderFrag.this.mBarcodeEntity; } @Override public void onPostExecute(SearchEntityResp.EntityResult entityResult) { if (entityResult != null) { ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etCableEqp.setText(ConnectionFinderFrag.this.mBarcodeEntity.getValue()); if (ConnectionFinderFrag.this.dialog != null) { ConnectionFinderFrag.this.dialog.dismiss(); ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.selectedObj = new ConnectionEntityResp.EquipementSearchDataModel(String.valueOf(connectionFinderFrag.mBarcodeEntity.getSystemId()), ConnectionFinderFrag.this.mBarcodeEntity.getEntityName(), ConnectionFinderFrag.this.mBarcodeEntity.getEntityName(), ConnectionFinderFrag.this.mBarcodeEntity.getGeomType()); ConnectionFinderFrag connectionFinderFrag2 = ConnectionFinderFrag.this; connectionFinderFrag2.getSplliterPortApi(String.valueOf(connectionFinderFrag2.mBarcodeEntity.getSystemId()), ConnectionFinderFrag.this.mBarcodeEntity.getEntityName()); return; } return; } if (ConnectionFinderFrag.this.getContext() != null) { ConnectionFinderFrag connectionFinderFrag3 = ConnectionFinderFrag.this; connectionFinderFrag3.alertDialog(connectionFinderFrag3.getString(R.string.info), "No Entity Found for\nBarcode: " + this.networkId); } } } 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) { ConnectionFinderFrag.this.dialog.dismiss(); if (ConnectionFinderFrag.this.getActivity() instanceof ManageEntitiesActivity) { ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; Activity activity = connectionFinderFrag.mActivity; ((ManageEntitiesActivity) activity).BarcodeAction = "connection"; connectionFinderFrag.mBarcodeEntity = null; AppUtil.showBarcode(activity); return; } return; } ConnectionFinderFrag connectionFinderFrag2 = ConnectionFinderFrag.this; connectionFinderFrag2.alertDialog(connectionFinderFrag2.getString(R.string.info), "Please select entity type"); } }); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ConnectionFinderFrag.this.dialog.dismiss(); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ConnectionFinderFrag.this.dialog.dismiss(); } }); this.dialog.show(); } public void closeSuggestionList() { this.fragmentConnectionFinderBinding.lvSuggestion.setVisibility(8); this.fragmentConnectionFinderBinding.tiPort.setVisibility(0); } 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.Get_Equipment_Search_Result), new JSONObject(convertBeanToJson2), new k.b<JSONObject>() { @Override public void onResponse(JSONObject jSONObject) { ConnectionFinderFrag.this.fragmentConnectionFinderBinding.ivLoader.setVisibility(8); if (ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etCableEqp.getText().toString().length() > 0) { ConnectionFinderFrag.this.fragmentConnectionFinderBinding.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; } ConnectionEntityResp connectionEntityResp = (ConnectionEntityResp) JsonParser.convertJsonToBean(ApiType.Get_Equipment_Search_Result, jSONObject.toString()); if (connectionEntityResp == null) { Log.i(CrashlyticsCore.TAG, "getEntitiesApiReq():onResponse(): Parsing error response is:" + jSONObject.toString()); return; } if (connectionEntityResp.getStatus().equalsIgnoreCase(NetworkRespCodes.OK)) { if (connectionEntityResp.getResults() != null && connectionEntityResp.getResults().getLstEquipementSearchResult() != null) { ConnectionFinderFrag.this.entitySearchList = connectionEntityResp.getResults().getLstEquipementSearchResult(); } else { ConnectionFinderFrag.this.entitySearchList = new ArrayList(); ConnectionFinderFrag.this.entitySearchList.add(new ConnectionEntityResp.EquipementSearchDataModel(" No Match Found", "0")); } if (ConnectionFinderFrag.this.entitySearchList.size() == 0) { ConnectionFinderFrag.this.entitySearchList.add(new ConnectionEntityResp.EquipementSearchDataModel(" No Match Found", "0")); } ConnectionFinderFrag.this.setEqpAdapter(); ConnectionFinderFrag.this.fragmentConnectionFinderBinding.acCableEqp.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i10, long j10) { ConnectionFinderFrag.this.selectedObj = (ConnectionEntityResp.EquipementSearchDataModel) adapterView.getAdapter().getItem(i10); if (ConnectionFinderFrag.this.selectedObj.getSystem_id() != null) { ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.getSplliterPortApi(connectionFinderFrag.selectedObj.getSystem_id(), ConnectionFinderFrag.this.selectedObj.getEntity_type()); } } }); 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()); ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.alertDialog(connectionFinderFrag.getString(R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { if (ConnectionFinderFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } volleyError.printStackTrace(); AppUtil.onVolleyErrorResponseHandling(ConnectionFinderFrag.this.getActivity(), ConnectionFinderFrag.this.mLepLogger, volleyError, CrashlyticsCore.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(ConnectionFinderFrag.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 c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f)); a10.a(hVar); this.fragmentConnectionFinderBinding.ivLoader.setVisibility(0); this.fragmentConnectionFinderBinding.ivCross.setVisibility(8); } catch (JSONException e10) { e10.printStackTrace(); Log.e(CrashlyticsCore.TAG, "getLegendseApiReq(): 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 (ConnectionFinderFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) ConnectionFinderFrag.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"); return; } ConnectionFinderFrag.this.mConnectionPortResp = (ConnectionPortResp) JsonParser.convertJsonToBean(ApiType.Get_Equipment_Port_Info, jSONObject.toString()); if (ConnectionFinderFrag.this.mConnectionPortResp != null) { if (ConnectionFinderFrag.this.mConnectionPortResp.getStatus().equalsIgnoreCase(NetworkRespCodes.OK)) { if (ConnectionFinderFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } ConnectionFinderFrag.this.setSpliterData(); return; } ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.alertDialog(connectionFinderFrag.getString(R.string.error), ConnectionFinderFrag.this.mConnectionPortResp.getError_message()); Log.e(CrashlyticsCore.TAG, "getSplliterPortReq():onResponse(): Error while checking nearby building."); return; } 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()); ConnectionFinderFrag connectionFinderFrag2 = ConnectionFinderFrag.this; connectionFinderFrag2.alertDialog(connectionFinderFrag2.getString(R.string.error), "Unable parse data. Error is: " + e10.getMessage()); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { ((ManageEntitiesActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); volleyError.printStackTrace(); AppUtil.onVolleyErrorResponseHandling(ConnectionFinderFrag.this.getActivity(), ConnectionFinderFrag.this.mLepLogger, volleyError, CrashlyticsCore.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(ConnectionFinderFrag.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 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.mListSpliterWindow = new f0(getContext()); this.mListEntityWindow = new f0(getContext()); this.fragmentConnectionFinderBinding.header.tvToolbarTitle.setText("Connection Path Finder"); this.fragmentConnectionFinderBinding.header.ivBack.setTypeface(AppUtil.getStaticIcomoonTypeface(getContext())); this.fragmentConnectionFinderBinding.header.ivBack.setText(getString(R.string.icon_back)); this.fragmentConnectionFinderBinding.header.ivBack.setVisibility(0); this.fragmentConnectionFinderBinding.header.ivBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ConnectionFinderFrag.this.getActivity().onBackPressed(); } }); this.fragmentConnectionFinderBinding.etSplitterPort.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!BaseFragment.isNotNull(ConnectionFinderFrag.this.lstSpiliterPortElement) || ConnectionFinderFrag.this.lstSpiliterPortElement.size() <= 0) { ConnectionFinderFrag.this.showToastWarn("No connected core/port found!"); } else { ConnectionFinderFrag.this.setAdapter(); ConnectionFinderFrag.this.mListSpliterWindow.a(); } } }); this.fragmentConnectionFinderBinding.rlParent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ConnectionFinderFrag.this.closeSuggestionList(); } }); this.fragmentConnectionFinderBinding.ivCross.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etCableEqp.getText().clear(); } }); this.fragmentConnectionFinderBinding.etCableEqp.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable editable) { if (editable == null || editable.length() <= 0) { if (ConnectionFinderFrag.this.mListEntityWindow != null) { ConnectionFinderFrag.this.mListEntityWindow.dismiss(); } ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.selectedObj = null; connectionFinderFrag.fragmentConnectionFinderBinding.ivCross.setVisibility(8); ConnectionFinderFrag.this.lstSpiliterPortElement = new ArrayList(); ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etSplitterPort.setText(""); ConnectionFinderFrag.this.setAdapter(); ConnectionFinderFrag.this.entitySearchList = new ArrayList(); ConnectionFinderFrag.this.setEqpAdapter(); ConnectionFinderFrag.this.closeSuggestionList(); return; } ConnectionFinderFrag.this.fragmentConnectionFinderBinding.ivCross.setVisibility(0); if (ConnectionFinderFrag.this.preventEntityApi) { ConnectionFinderFrag.this.preventEntityApi = false; return; } if (ConnectionFinderFrag.this.retainState) { ConnectionFinderFrag.this.retainState = false; return; } ConnectionFinderFrag connectionFinderFrag2 = ConnectionFinderFrag.this; connectionFinderFrag2.selectedObj = null; connectionFinderFrag2.lstSpiliterPortElement = new ArrayList(); ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etSplitterPort.setText(""); ConnectionFinderFrag.this.setAdapter(); ConnectionFinderFrag.this.mListEntityWindow.dismiss(); ConnectionFinderFrag.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.fragmentConnectionFinderBinding.ivBarcode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (AppUtil.isNetworkConnected(ConnectionFinderFrag.this.getContext())) { if (ConnectionFinderFrag.this.networkLayerList != null) { ConnectionFinderFrag.this.barcodeDialog(); return; } else { ConnectionFinderFrag.this.networkLayerReq(false); return; } } ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.alertDialog(connectionFinderFrag.getString(R.string.alert), ConnectionFinderFrag.this.getString(R.string.message_noInternet)); } }); this.entitySearchList = new ArrayList<>(); if (this.adapter != null) { this.retainState = true; ConnectionEntityResp.EquipementSearchDataModel equipementSearchDataModel = this.selectedObj; if (equipementSearchDataModel != null) { getSplliterPortApi(equipementSearchDataModel.getSystem_id(), this.selectedObj.getEntity_type()); } } if (this.adapter == null) { this.adapter = new EntityEqpIdAdapter(getContext(), android.R.layout.simple_dropdown_item_1line, android.R.id.text1, this.entitySearchList, getActivity()); } this.fragmentConnectionFinderBinding.acCableEqp.setThreshold(0); this.fragmentConnectionFinderBinding.acCableEqp.setAdapter(this.adapter); this.fragmentConnectionFinderBinding.acCableEqp.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i10, long j10) { ConnectionFinderFrag.this.selectedObj = (ConnectionEntityResp.EquipementSearchDataModel) adapterView.getAdapter().getItem(i10); i.D(ConnectionFinderFrag.this.getContext(), ConnectionFinderFrag.this.fragmentConnectionFinderBinding.acCableEqp); if (ConnectionFinderFrag.this.selectedObj.getSystem_id() != null) { ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.getSplliterPortApi(connectionFinderFrag.selectedObj.getSystem_id(), ConnectionFinderFrag.this.selectedObj.getEntity_type()); } } }); this.fragmentConnectionFinderBinding.btnShowRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; if (connectionFinderFrag.selectedObj == null) { connectionFinderFrag.showToastWarn("Please select valid equipment id"); return; } if (connectionFinderFrag.fragmentConnectionFinderBinding.etSplitterPort.getText().toString().contains("Core") || ConnectionFinderFrag.this.strPortValue.isEmpty()) { ConnectionFinderFrag.this.showToastWarn("Please select a port!"); return; } ConnectionFinderTabularFrag connectionFinderTabularFrag = new ConnectionFinderTabularFrag(ConnectionFinderFrag.this.selectedObj); Bundle bundle = new Bundle(); bundle.putString("EqpId", ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etCableEqp.getText().toString()); bundle.putString("CorePort", ConnectionFinderFrag.this.strPortValue); bundle.putString("PortText", ConnectionFinderFrag.this.str_PortText); bundle.putString("EnityType", ConnectionFinderFrag.this.selectedObj.getEntity_type()); bundle.putString("EntitySystemID", ConnectionFinderFrag.this.selectedObj.getSystem_id()); bundle.putBoolean("fromEntityDetail", ConnectionFinderFrag.this.fromEntityDetail); connectionFinderTabularFrag.setArguments(bundle); ConnectionFinderFrag.this.retainState = true; if (ConnectionFinderFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) ConnectionFinderFrag.this.mActivity).replaceFragment(connectionFinderTabularFrag); } else { ((EntityDetailActivity) ConnectionFinderFrag.this.mActivity).replaceFragment(connectionFinderTabularFrag); } } }); } public void setAdapter() { this.mListSpliterWindow.r(new EntityPortListAdapter(getActivity(), this.lstSpiliterPortElement)); this.mListSpliterWindow.s(this.fragmentConnectionFinderBinding.etSplitterPort); this.mListSpliterWindow.I(600); this.mListSpliterWindow.C(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i10, long j10) { ConnectionPortResp.EquipementPortDataModel equipementPortDataModel = (ConnectionPortResp.EquipementPortDataModel) view.getTag(R.integer.data); if (equipementPortDataModel.getPort_value().equalsIgnoreCase("0")) { ConnectionFinderFrag.this.strPortValue = ""; ConnectionFinderFrag.this.str_PortText = ""; ConnectionFinderFrag.this.strEntityType = ""; ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etSplitterPort.setText(""); ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etSplitterPort.setTextColor(p.b.c(ConnectionFinderFrag.this.getActivity(), R.color.gray)); } else { if (!ConnectionFinderFrag.this.strPortValue.equalsIgnoreCase(equipementPortDataModel.getPort_text())) { ConnectionFinderFrag.this.strPortValue = equipementPortDataModel.getPort_value(); ConnectionFinderFrag.this.str_PortText = equipementPortDataModel.getPort_text(); ConnectionFinderFrag.this.strEntityType = equipementPortDataModel.getPort_text(); } ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etSplitterPort.setText(equipementPortDataModel.getPort_text()); ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etSplitterPort.setTextColor(p.b.c(ConnectionFinderFrag.this.getActivity(), R.color.black)); } ConnectionFinderFrag.this.mListSpliterWindow.dismiss(); } }); } public void setEqpAdapter() { this.entityEqpBaseAdapter = new EntityEqpBaseAdapter(getActivity(), this.entitySearchList); if (BaseFragment.isNotNull(this.entitySearchList) && this.entitySearchList.size() > 0 && this.fragmentConnectionFinderBinding.etCableEqp.getText().toString().length() > 0) { showList(); } else { closeSuggestionList(); } this.fragmentConnectionFinderBinding.lvSuggestion.setAdapter((ListAdapter) this.entityEqpBaseAdapter); this.fragmentConnectionFinderBinding.lvSuggestion.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i10, long j10) { ConnectionEntityResp.EquipementSearchDataModel equipementSearchDataModel = (ConnectionEntityResp.EquipementSearchDataModel) view.getTag(R.integer.data); if (equipementSearchDataModel.getSystem_id().equalsIgnoreCase("0")) { return; } ConnectionFinderFrag.this.preventEntityApi = true; ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etCableEqp.setText(equipementSearchDataModel.getDisplay_name()); ConnectionFinderFrag.this.fragmentConnectionFinderBinding.etCableEqp.setTextColor(p.b.c(ConnectionFinderFrag.this.getActivity(), R.color.black)); ConnectionFinderFrag.this.closeSuggestionList(); ConnectionFinderFrag.this.selectedObj = equipementSearchDataModel; if (equipementSearchDataModel.getSystem_id() != null) { ConnectionFinderFrag.this.str_PortText = ""; ConnectionFinderFrag.this.strPortValue = ""; ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.getSplliterPortApi(connectionFinderFrag.selectedObj.getSystem_id(), ConnectionFinderFrag.this.selectedObj.getEntity_type()); } } }); } private void setListener() { } public void setSpliterData() { if (!this.str_PortText.isEmpty()) { this.fragmentConnectionFinderBinding.etSplitterPort.setText(this.str_PortText); } else { this.fragmentConnectionFinderBinding.etSplitterPort.setText("Core/Port"); } this.lstSpiliterPortElement = this.mConnectionPortResp.getResults().getLstEquipementPort(); ConnectionPortResp.EquipementPortDataModel equipementPortDataModel = new ConnectionPortResp.EquipementPortDataModel(); equipementPortDataModel.setPort_text("Select Port"); equipementPortDataModel.setPort_value("0"); if (this.lstSpiliterPortElement == null) { this.lstSpiliterPortElement = new ArrayList<>(); } this.lstSpiliterPortElement.add(0, equipementPortDataModel); setAdapter(); } private void showList() { this.fragmentConnectionFinderBinding.lvSuggestion.setVisibility(0); this.fragmentConnectionFinderBinding.tiPort.setVisibility(8); } 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 (ConnectionFinderFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) ConnectionFinderFrag.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) { ConnectionFinderFrag connectionFinderFrag = ConnectionFinderFrag.this; connectionFinderFrag.alertDialog(connectionFinderFrag.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()); ConnectionFinderFrag.this.networkLayerList = new ArrayList(); NetworkLayer networkLayer = new NetworkLayer(); networkLayer.setLayerTitle("--Select--"); ConnectionFinderFrag.this.networkLayerList.add(0, networkLayer); for (int i10 = 0; i10 < networkLayerResp.getResults().getLstNetworkLayers().size(); i10++) { if (networkLayerResp.getResults().getLstNetworkLayers().get(i10).getIsVirtualPortAllowed().equalsIgnoreCase("false")) { ConnectionFinderFrag.this.networkLayerList.add(networkLayerResp.getResults().getLstNetworkLayers().get(i10)); } } ConnectionFinderFrag.this.barcodeDialog(); return; } Log.e(CrashlyticsCore.TAG, "networkLayerReq():onResponse(): Survey area null or empty"); ConnectionFinderFrag connectionFinderFrag2 = ConnectionFinderFrag.this; connectionFinderFrag2.alertDialog(connectionFinderFrag2.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()); ConnectionFinderFrag connectionFinderFrag3 = ConnectionFinderFrag.this; connectionFinderFrag3.alertDialog(connectionFinderFrag3.getString(R.string.error), "Unable parse data. Error is: " + e10.getMessage()); return; } } Log.e(CrashlyticsCore.TAG, "networkLayerReq():onResponse(): Response is null"); ConnectionFinderFrag connectionFinderFrag4 = ConnectionFinderFrag.this; connectionFinderFrag4.alertDialog(connectionFinderFrag4.getString(R.string.error), "Empty response from server"); } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { if (ConnectionFinderFrag.this.getActivity() instanceof ManageEntitiesActivity) { ((ManageEntitiesActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } else { ((EntityDetailActivity) ConnectionFinderFrag.this.mActivity).progressDialog.dismiss(); } volleyError.printStackTrace(); AppUtil.onVolleyErrorResponseHandling(ConnectionFinderFrag.this.getActivity(), ConnectionFinderFrag.this.mLepLogger, volleyError, CrashlyticsCore.TAG); a10.e(); } }) { @Override public Map<String, String> getHeaders() { HashMap hashMap = new HashMap(); hashMap.put("Authorization", "bearer " + SharePrefFactory.getStringPref(ConnectionFinderFrag.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 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 onActivityResult(int i10, int i11, Intent intent) { super.onActivityResult(i10, i11, intent); Log.e("Reached", "Here1"); } @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); } @Override public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { this.fragmentConnectionFinderBinding = (FragmentConnectionFinderBinding) f.h(layoutInflater, R.layout.fragment_connection_finder, viewGroup, false); setListener(); initalize(); return this.fragmentConnectionFinderBinding.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(); } f0 f0Var2 = this.mListEntityWindow; if (f0Var2 != null) { f0Var2.dismiss(); } } 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; } }