private void updateServiceState(ServiceState serviceState) { int state = serviceState.getState(); String display = mRes.getString(R.string.radioInfo_unknown); switch (state) { case ServiceState.STATE_IN_SERVICE: display = mRes.getString(R.string.radioInfo_service_in); break; case ServiceState.STATE_OUT_OF_SERVICE: case ServiceState.STATE_EMERGENCY_ONLY: display = mRes.getString(R.string.radioInfo_service_out); break; case ServiceState.STATE_POWER_OFF: display = mRes.getString(R.string.radioInfo_service_off); break; } setSummaryText(KEY_SERVICE_STATE, display); if (serviceState.getRoaming()) { setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in)); } else { setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not)); } Preference p = findPreference(KEY_OPERATOR_NAME); String op = serviceState.getOperatorAlphaLong(); if (TextUtils.isEmpty(op)) { op = this.getResources().getString(R.string.device_info_default); } if (p != null) { mExt.updateServiceState(p, serviceState.getOperatorAlphaLong()); } }
private void updateServiceState(ServiceState serviceState) { int state = serviceState.getState(); String display = mRes.getString(R.string.radioInfo_unknown); switch (state) { case ServiceState.STATE_IN_SERVICE: display = mRes.getString(R.string.radioInfo_service_in); break; case ServiceState.STATE_OUT_OF_SERVICE: case ServiceState.STATE_EMERGENCY_ONLY: display = mRes.getString(R.string.radioInfo_service_out); break; case ServiceState.STATE_POWER_OFF: display = mRes.getString(R.string.radioInfo_service_off); break; } setSummaryText(KEY_SERVICE_STATE, display); if (serviceState.getRoaming()) { setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in)); } else { setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not)); } setSummaryText(KEY_OPERATOR_NAME, serviceState.getOperatorAlphaLong()); }
public String getOperatorState() { if (mTelephonyManager == null) { return null; } if (mServiceState == null || mServiceState.getState() == ServiceState.STATE_OUT_OF_SERVICE) { return mContext.getString(R.string.pie_phone_status_no_service); } if (mServiceState.getState() == ServiceState.STATE_POWER_OFF) { return mContext.getString(R.string.pie_phone_status_airplane_mode); } if (mServiceState.isEmergencyOnly()) { return mContext.getString(R.string.pie_phone_status_emergency_only); } return mServiceState.getOperatorAlphaLong(); }