Java tutorial
package com.hxqc.mall.auto.fragment; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.hxqc.mall.auto.config.AutoInfoContants; import com.hxqc.mall.auto.controler.AutoHelper; import com.hxqc.mall.auto.controler.AutoTypeControl; import com.hxqc.mall.auto.inter.CallBackControl; import com.hxqc.mall.auto.model.BrandGroup; import com.hxqc.mall.auto.model.MyAuto; import com.hxqc.mall.auto.util.ActivitySwitchAutoInfo; import com.hxqc.mall.auto.util.CompleteAutoDialogUtils; import com.hxqc.mall.auto.view.CommonEditInfoItemView; import com.hxqc.mall.core.R; import com.hxqc.mall.core.controler.UserInfoHelper; import com.hxqc.mall.core.util.ActivitySwitchBase; import com.hxqc.mall.core.util.ToastHelper; import com.hxqc.mall.core.views.vedit.EditTextValidatorView; import com.hxqc.mall.core.views.vedit.manager.VWholeEditManager; import com.hxqc.mall.core.views.vedit.tech.VMallDivNotNull; import com.hxqc.util.DebugLog; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.util.ArrayList; import java.util.Calendar; import static android.R.attr.name; import static com.hxqc.mall.core.R.id.phone; /** * Author: * Date: 2016 - 11 - 01 * Des: ???? * FIXME * Todo */ public class MaintainEditAutoFragment extends Fragment implements View.OnClickListener { private static final String TAG = AutoInfoContants.LOG_J; private View rootView; // private PlateNumberTextView mLicenseCityView; // private PlateNumberTextView mLicenseNumView; // private EditText mVINView; private EditTextValidatorView mAutoTypeView; private EditTextValidatorView mMileageView; private Button mFinishView; public OnFinishClickListener mOnFinishClickListener; public OnAutoTyperClickListener mOnAutoTyperClickListener; private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == AutoInfoContants.AUTO_TYPE_BACK_DATA) { // mAutoTypeView.setText(mMyAuto.brand + "," + mMyAuto.series + "," + mMyAuto.autoModel); mAutoTypeView.setText(mMyAuto.autoModel); } } }; public MyAuto mMyAuto; private boolean isAdd = false; // private CommenAutoInfoHeaderView mAutoInfoHeaderView; // private CommonEditInfoItemView mEditNameView; // private CommonEditInfoItemView mEditPhoneView; private CommonEditInfoItemView mRegisterDateView; private TextView mMaintainView; private TextView mQualityDateView; private LinearLayout mMaintainInfoView; private String shopID; // private PlateNumberEditText mPlateNumberView; private int flagActivity; private int flagAuto; private VWholeEditManager vWholeEditManager; private TextView mExplainContentView; public interface OnAutoTyperClickListener { void onAutoTyperClick(View v); } public interface OnFinishClickListener { void onFinishClick(View v, MyAuto myAuto, boolean isAdd, int flag); } public void setmOnAutoTyperClickListener(OnAutoTyperClickListener l) { this.mOnAutoTyperClickListener = l; } public void setOnFinishClickListener(OnFinishClickListener l) { this.mOnFinishClickListener = l; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (rootView == null) { rootView = inflater.inflate(R.layout.fragment_maintain_add_auto_info, container, false); } ViewGroup parent = (ViewGroup) rootView.getParent(); if (parent != null) { parent.removeView(rootView); } return rootView; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); vWholeEditManager = new VWholeEditManager(getActivity()); initView(); initData(); initEvent(); } private ArrayList<MyAuto> autoLocal = null; /** * ?? */ private void initData() { ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); if (getActivity().getIntent() != null) { Bundle bundleExtra = getActivity().getIntent().getBundleExtra(ActivitySwitchBase.KEY_DATA); if (bundleExtra != null) { int flagPage = bundleExtra.getInt("flagPage"); if (flagPage == AutoInfoContants.ADD_PAGE) { actionBar.setTitle("?"); } else if (flagPage == AutoInfoContants.EDIT_PAGE) { actionBar.setTitle("?"); } } mExplainContentView.setVisibility(View.VISIBLE); isAdd = true; if (bundleExtra.getParcelable("myAuto") != null) { mMyAuto = bundleExtra.getParcelable("myAuto"); shopID = bundleExtra.getString("shopID"); flagActivity = bundleExtra.getInt("flagActivity", -1); DebugLog.i(TAG, mMyAuto.toString()); DebugLog.i(TAG, "EDIT shopID:" + shopID); DebugLog.i(TAG, "EDIT flagActivity:" + flagActivity); mAutoTypeView.setText(mMyAuto.autoModel); mMileageView.setText(mMyAuto.drivingDistance); } else { shopID = bundleExtra.getString("shopID"); flagActivity = bundleExtra.getInt("flagActivity", -1); DebugLog.i(TAG, "EDIT shopID:" + shopID); DebugLog.i(TAG, "EDIT flagActivity:" + flagActivity); mMyAuto = new MyAuto(); } } } /** * */ private void checkDetailAutoInfo() { DebugLog.i(TAG, "?"); autoLocal = AutoHelper.getInstance().getAutoLocal(getActivity(), AutoHelper.AUTO_DETAIL_INFO); if (autoLocal != null && !autoLocal.isEmpty()) { DebugLog.i(TAG, "?"); for (int i = 0; i < autoLocal.size(); i++) { if (!TextUtils.isEmpty(autoLocal.get(i).autoModel)) { flagID = i; break; } } DebugLog.i(TAG, "flagID " + flagID); if (flagID == -1) { DebugLog.i(TAG, ""); CompleteAutoDialogUtils.dialogAutoInfoComplete(getActivity(), autoLocal.get(0), -1); // dialogAutoInfoComplete(autoLocal.get(0)); } else { DebugLog.i(TAG, ""); Bundle bundle = new Bundle(); bundle.putParcelable("myAuto", autoLocal.get(flagID)); ActivitySwitchBase.toWhere(getActivity(), "com.hxqc.mall.thirdshop.maintenance.activity.ShopQuoteActivity", bundle); getActivity().finish(); } } } /** * */ private boolean checkLocalAutoInfo() { DebugLog.i(TAG, "?"); autoLocal = AutoHelper.getInstance().getAutoLocal(getActivity(), AutoHelper.AUTO_LOCAL_INFO); if (autoLocal != null && !autoLocal.isEmpty()) { DebugLog.i(TAG, "?"); for (int i = 0; i < autoLocal.size(); i++) { if (!TextUtils.isEmpty(autoLocal.get(i).autoModel)) { flagID = i; break; } } DebugLog.i(TAG, "flagID " + flagID); if (flagID == -1) { DebugLog.i(TAG, ""); CompleteAutoDialogUtils.dialogAutoInfoComplete(getActivity(), autoLocal.get(0), -1); // dialogAutoInfoComplete(autoLocal.get(0)); } else { DebugLog.i(TAG, ""); Bundle bundle = new Bundle(); bundle.putParcelable("myAuto", autoLocal.get(flagID)); ActivitySwitchBase.toWhere(getActivity(), "com.hxqc.mall.thirdshop.maintenance.activity.ShopQuoteActivity", bundle); getActivity().finish(); } return false; } else { return true; } } /** * ? */ private void initEvent() { mFinishView.setOnClickListener(this); if (isAdd) { // mPlateNumberView.setCheckListener(checkListener); mAutoTypeView.setOnClickListener(this); } // mMileageView.setOnFocusChangeListener(mileageFocusChangeListener); /*if (TextUtils.isEmpty(mPlateNumberView.getPlateNumber())) { mPlateNumberView.setCheckListener(checkListener); }*/ // mLicenseNumView.addTextChangedListener(licenseNumberChangeListener); // mRegisterDateView.setOnContentClickListener(registerDateListener); } /** * ? */ private void initView() { // mAutoInfoHeaderView = (CommenAutoInfoHeaderView) rootView.findViewById(R.id.add_auto_info_header); // mLicenseCityView = mAutoInfoHeaderView.getmLicenseCityView(); // mLicenseCityView.setMode(PlateNumberTextView.MODE_CITY); // mLicenseNumView = mAutoInfoHeaderView.getmLicenseNumView(); // mLicenseNumView.setMode(PlateNumberTextView.MODE_WORD); // mPlateNumberView = mAutoInfoHeaderView.getmPlateNumView(); // LinearLayout mPlateNumberParentView = mAutoInfoHeaderView.getmPlateNumberParentView(); // mVINView = mAutoInfoHeaderView.getmVINView(); // mAutoTypeView = mAutoInfoHeaderView.getmAutoTypeView(); // mMileageView = mAutoInfoHeaderView.getmMileageView(); // mMaintainInfoView = mAutoInfoHeaderView.getmMaintainInfoView(); // LinearLayout mMileageInfoView = mAutoInfoHeaderView.getmMileageInfoView(); // mMaintainView = mAutoInfoHeaderView.getmMaintainView(); // mQualityDateView = mAutoInfoHeaderView.getmQualityDateView(); mExplainContentView = (TextView) rootView.findViewById(R.id.add_auto_info_explain_content); mAutoTypeView = (EditTextValidatorView) rootView.findViewById(R.id.add_auto_info_type); mMileageView = (EditTextValidatorView) rootView.findViewById(R.id.add_auto_info_mileage); mMaintainInfoView = (LinearLayout) rootView.findViewById(R.id.add_auto_info_maintain_info); mMaintainView = (TextView) rootView.findViewById(R.id.add_auto_info_maintain); mQualityDateView = (TextView) rootView.findViewById(R.id.add_auto_info_date); // mEditNameView = (CommonEditInfoItemView) rootView.findViewById(R.id.add_auto_info_name); // mEditPhoneView = (CommonEditInfoItemView) rootView.findViewById(R.id.add_auto_info_phone); // mRegisterDateView = (CommonEditInfoItemView) rootView.findViewById(R.id.add_auto_info_register_date); mFinishView = (Button) rootView.findViewById(R.id.add_auto_info_btn); mAutoTypeView.setHint("?()"); mAutoTypeView.addValidator(new VMallDivNotNull("?", "")); mMileageView.setHint("()"); mMileageView.addValidator(new VMallDivNotNull("", "")); vWholeEditManager.addEditView(mAutoTypeView); vWholeEditManager.addEditView(mMileageView); // mRegisterDateView.setVisibility(View.GONE); // mPlateNumberParentView.setVisibility(View.GONE); mMaintainInfoView.setVisibility(View.GONE); // mMileageInfoView.setVisibility(View.VISIBLE); } /** * ? * * @param brand * @param brandID * @param brandThumb * @param series * @param seriesID * @param model * @param modelID */ public void setAutoType(String brand, String brandID, String brandThumb, String seriesBrandName, String series, String seriesID, String model, String modelID) { Message msg = Message.obtain(); msg.what = AutoInfoContants.AUTO_TYPE_BACK_DATA; mMyAuto.brand = brand; mMyAuto.brandID = brandID; mMyAuto.brandThumb = brandThumb; mMyAuto.series = series; mMyAuto.seriesID = seriesID; mMyAuto.autoModel = model; mMyAuto.autoModelID = modelID; mMyAuto.brandName = seriesBrandName; msg.obj = mMyAuto; mHandler.sendMessage(msg); } /* private TextWatcher licenseNumberChangeListener = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { DebugLog.i(TAG, "beforeTextChanged:" + s.toString()); } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { DebugLog.i(TAG, "onTextChanged:" + s.toString()); } @Override public void afterTextChanged(Editable s) { DebugLog.i(TAG, "afterTextChanged:" + s.toString()); if (s.toString().length() == 6) { String plateNumber = mLicenseCityView.getText() + s.toString(); AutoInfoControl.getInstance().checkAutoInfo(getActivity(), "", plateNumber, checkAutoHandler); } } };*/ /** * ? */ /*private AutoInfoControl.CheckAutoHandler checkAutoHandler = new AutoInfoControl.CheckAutoHandler() { @Override public void onCheckSucceed(MyAuto myAuto) { if (TextUtils.isEmpty(mEditNameView.getContentText())) { mEditNameView.setContentText(myAuto.ownName); } if (TextUtils.isEmpty(mEditPhoneView.getContentText())) { mEditPhoneView.setContentText(myAuto.ownPhone); } if (TextUtils.isEmpty(myAuto.lastMaintenancDate) && TextUtils.isEmpty(myAuto.drivingDistance) && TextUtils.isEmpty(myAuto.guaranteePeriod)) { // mMaintainView.setVisibility(View.GONE); // mQualityDateView.setVisibility(View.GONE); mMaintainInfoView.setVisibility(View.GONE); } else if (!TextUtils.isEmpty(myAuto.lastMaintenancDate) && !TextUtils.isEmpty(myAuto.drivingDistance) && !TextUtils.isEmpty(myAuto.guaranteePeriod)) { // mMaintainView.setVisibility(View.VISIBLE); // mQualityDateView.setVisibility(View.VISIBLE); mMaintainInfoView.setVisibility(View.VISIBLE); } if (TextUtils.isEmpty(mMileageView.getText())) { if (!TextUtils.isEmpty(myAuto.drivingDistance)) { // mMaintainView.setText("" + myAuto.getDrivingDistance() + ""); mMileageView.setText(myAuto.drivingDistance); // mMileageView.setSelection(myAuto.getDrivingDistance().length()); } } if (TextUtils.isEmpty(myAuto.lastMaintenancDate)) { mMaintainView.setVisibility(View.GONE); } else { mMaintainView.setVisibility(View.VISIBLE); mMaintainView.setText("?" + myAuto.lastMaintenancDate); } if (TextUtils.isEmpty(myAuto.guaranteePeriod)) { ToastHelper.showYellowToast(getActivity(), "?"); mQualityDateView.setVisibility(View.GONE); } else { mQualityDateView.setVisibility(View.VISIBLE); mQualityDateView.setText("?" + myAuto.guaranteePeriod); } if (!TextUtils.isEmpty(myAuto.autoModel)) { mAutoTypeView.setText(myAuto.autoModel); } mMyAuto.brand = myAuto.brand; mMyAuto.brandID = myAuto.brandID; mMyAuto.series = myAuto.series; mMyAuto.seriesID = myAuto.seriesID; mMyAuto.autoModel = myAuto.autoModel; mMyAuto.autoModelID = myAuto.autoModelID; } @Override public void onCheckFailed(boolean offLine) { // ToastHelper.showYellowToast(getActivity(), "?"); } };*/ //? private CallBackControl.CallBack<MyAuto> checkAutoCallBack = new CallBackControl.CallBack<MyAuto>() { @Override public void onSuccess(MyAuto response) { if (response != null) { // if (TextUtils.isEmpty(mEditNameView.getContentText())) { // mEditNameView.setContentText(response.ownName); // } // if (TextUtils.isEmpty(mEditPhoneView.getContentText())) { // mEditPhoneView.setContentText(response.ownPhone); // } if (TextUtils.isEmpty(mMileageView.getText())) { if (!TextUtils.isEmpty(response.drivingDistance)) { // mMaintainView.setText("" + myAuto.getDrivingDistance() + ""); mMileageView.setText(response.drivingDistance); // mMileageView.setSelection(myAuto.getDrivingDistance().length()); } } // showOtherInfo(response); if (!TextUtils.isEmpty(response.autoModel)) { mAutoTypeView.setText(response.autoModel); } /*if (!TextUtils.isEmpty(response.registerTime)) { mRegisterDateView.setContentText(response.registerTime); }*/ mMyAuto.brand = response.brand; mMyAuto.brandID = response.brandID; mMyAuto.series = response.series; mMyAuto.seriesID = response.seriesID; mMyAuto.autoModel = response.autoModel; mMyAuto.autoModelID = response.autoModelID; } } @Override public void onFailed(boolean offLine) { // ToastHelper.showYellowToast(getActivity(), "?"); } }; /** * ? * * @param response */ private void showOtherInfo(MyAuto response) { if (TextUtils.isEmpty(response.lastMaintenanceDate) && TextUtils.isEmpty(response.drivingDistance) && TextUtils.isEmpty(response.guaranteePeriod)) { // mMaintainView.setVisibility(View.GONE); // mQualityDateView.setVisibility(View.GONE); mMaintainInfoView.setVisibility(View.GONE); } else if (!TextUtils.isEmpty(response.lastMaintenanceDate) || !TextUtils.isEmpty(response.drivingDistance) || !TextUtils.isEmpty(response.guaranteePeriod)) { // mMaintainView.setVisibility(View.VISIBLE); // mQualityDateView.setVisibility(View.VISIBLE); mMaintainInfoView.setVisibility(View.VISIBLE); } if (TextUtils.isEmpty(response.lastMaintenanceDate) && TextUtils.isEmpty(response.drivingDistance)) { mMaintainView.setVisibility(View.GONE); } else if (!TextUtils.isEmpty(response.lastMaintenanceDate) && !TextUtils.isEmpty(response.drivingDistance)) { mMaintainView.setVisibility(View.VISIBLE); mMaintainView.setText(getString(R.string.maintenance_time) + response.lastMaintenanceDate + getString(R.string.mileage) + response.drivingDistance + getString(R.string.kilometre)); } else if (!TextUtils.isEmpty(response.lastMaintenanceDate) && TextUtils.isEmpty(response.drivingDistance)) { mMaintainView.setVisibility(View.VISIBLE); mMaintainView.setText(getString(R.string.maintenance_time) + response.lastMaintenanceDate); } else if (TextUtils.isEmpty(response.lastMaintenanceDate) && !TextUtils.isEmpty(response.drivingDistance)) { mMaintainView.setVisibility(View.VISIBLE); mMaintainView.setText( getString(R.string.mileage) + response.drivingDistance + getString(R.string.kilometre)); } if (TextUtils.isEmpty(response.guaranteePeriod)) { // ToastHelper.showYellowToast(getActivity(), "?"); mQualityDateView.setVisibility(View.GONE); } else { mQualityDateView.setVisibility(View.VISIBLE); mQualityDateView.setText(getString(R.string.warranty) + response.guaranteePeriod); } } @Override public void onClick(View v) { if (v.getId() == R.id.add_auto_info_type) { mOnAutoTyperClickListener.onAutoTyperClick(v); } else if (v.getId() == R.id.add_auto_info_btn) { // String plateNum = mPlateNumberView.getPlateNumber(); // String vin = mVINView.getText().toString(); String autoType = mAutoTypeView.getText().toString(); String mileage = mMileageView.getText().toString(); // String name = mEditNameView.getContentText().toString(); // String phone = mEditPhoneView.getContentText().toString(); DebugLog.i(TAG, "1-----" + "1-----" + autoType + "1-----" + mileage + "1-----" + name + "1-----" + phone); /* if (TextUtils.isEmpty(plateNum)) { ToastHelper.showYellowToast(getActivity(), "?"); return; } else if (plateNum.length() < 7) { ToastHelper.showYellowToast(getActivity(), "???"); return; }*/ /*if (!TextUtils.isEmpty(plateNum)) { if (plateNum.length() < 7) { ToastHelper.showYellowToast(getActivity(), "???"); return; } }*/ if (TextUtils.isEmpty(autoType)) { // mAutoTypeView.setError(""); ToastHelper.showYellowToast(getActivity(), ""); vWholeEditManager.validate(); return; } if (isAdd) { if (TextUtils.isEmpty(mileage)) { // mMileageView.setError("?"); ToastHelper.showYellowToast(getActivity(), ""); vWholeEditManager.validate(); return; } } /* if (!TextUtils.isEmpty(name)) { if (name.length() < 2 || name.length() > 30) { ToastHelper.showYellowToast(getActivity(), "????"); return; } } if (!TextUtils.isEmpty(phone)) { if (!FormatCheck.isPhoneNumber(phone)) { ToastHelper.showYellowToast(getActivity(), R.string.me_phone_number_format_error); return; } }*/ if (vWholeEditManager.validate()) { // mMyAuto.plateNumber = plateNum; // myAuto.VIN = vin; mMyAuto.autoModel = autoType; mMyAuto.drivingDistance = mileage; // mMyAuto.ownName = name; // mMyAuto.ownPhone = phone; // mMyAuto.registerTime = mRegisterDateView.getContentText(); if (flagActivity == AutoInfoContants.AUTO_DETAIL) { loadShopBrands(v, mMyAuto, isAdd); } else { vWholeEditManager.autoAddVViews(); if (vWholeEditManager.validate()) { mOnFinishClickListener.onFinishClick(v, mMyAuto, isAdd, flagActivity); } } } } } private int imYear = -1, imMonthOfYear = -1, imDayOfMonth = -1; private Calendar now = null; private DatePickerDialog dpd = null; private CommonEditInfoItemView.onContentClickListener registerDateListener = new CommonEditInfoItemView.onContentClickListener() { @Override public void onContentClick(View v) { now = Calendar.getInstance(); dpd = DatePickerDialog.newInstance(dateSetListener, imYear != -1 ? imYear : now.get(Calendar.YEAR), imMonthOfYear != -1 ? imMonthOfYear : now.get(Calendar.MONTH), imDayOfMonth != -1 ? imDayOfMonth : now.get(Calendar.DAY_OF_MONTH)); dpd.setThemeDark(true); dpd.vibrate(true); dpd.dismissOnPause(false); dpd.showYearPickerFirst(false); dpd.setAccentColor(ContextCompat.getColor(getActivity(), R.color.cursor_orange)); dpd.show(getActivity().getFragmentManager(), "DatePickerDialog"); } }; private DatePickerDialog.OnDateSetListener dateSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) { imYear = year; imMonthOfYear = monthOfYear; imDayOfMonth = dayOfMonth; if (monthOfYear < 9) { mRegisterDateView.setContentText(year + "-0" + (monthOfYear + 1) + "-" + dayOfMonth); } else { mRegisterDateView.setContentText(year + "-" + (monthOfYear + 1) + "-" + dayOfMonth); } } }; private boolean isCheck = false; /** * ?? */ private void loadShopBrands(final View view, final MyAuto mMyAuto, final boolean isAdd) { AutoTypeControl.getInstance().requestBrand(getActivity(), shopID, new CallBackControl.CallBack<ArrayList<BrandGroup>>() { @Override public void onSuccess(ArrayList<BrandGroup> myAutoGroups) { for (int i = 0; i < myAutoGroups.size(); i++) { for (int j = 0; j < myAutoGroups.get(i).group.size(); j++) { if (myAutoGroups.get(i).group.get(j).brandName.equals(mMyAuto.brand)) { isCheck = true; // ToastHelper.showRedToast(getActivity(), "?"); // return; } /* else { mOnFinishClickListener.onFinishClick(view, mMyAuto, isAdd); return; }*/ } } if (isCheck) { mOnFinishClickListener.onFinishClick(view, mMyAuto, isAdd, flagActivity); } else { ToastHelper.showRedToast(getActivity(), "?"); return; } } @Override public void onFailed(boolean offLine) { DebugLog.i(TAG, "??"); } }); } private int flagID = -1; //? /*private CallBack<ArrayList<MyAuto>> arrayListCallBack = new CallBack<ArrayList<MyAuto>>() { @Override public void onSuccess(ArrayList<MyAuto> response) { if (response != null) { DebugLog.i(TAG, "???"); if (!response.isEmpty()) { for (int i = 0; i < response.size(); i++) { if (!TextUtils.isEmpty(response.get(i).autoModel)) { flagID = i; break; } } AutoHelper.getInstance().createAutoLocal(getActivity(), response, AutoHelper.AUTO_LOCAL_INFO); if (flagID == -1) { CompleteAutoDialogUtils.dialogAutoInfoComplete(getActivity(), autoLocal.get(0)); // dialogAutoInfoComplete(response.get(0)); } else { // AutoHelper.getInstance().createAutoLocal(getActivity(), response,UserInfoHelper.getInstance().getPhoneNumber(getActivity())); Bundle bundle = new Bundle(); bundle.putParcelable("myAuto", response.get(flagID)); ActivitySwitchBase.toWhere(getActivity(), "com.hxqc.mall.thirdshop.maintenance.activity.ShopQuoteActivity", bundle); getActivity().finish(); } } } } @Override public void onFailed(boolean offLine) { } };*/ /** * ? */ private void dialogAutoInfoComplete(final MyAuto myAuto) { View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_auto_info_complete, null); final AlertDialog imAlertDialog = new AlertDialog.Builder(getActivity()).setView(view).create(); imAlertDialog.setCanceledOnTouchOutside(false); imAlertDialog.show(); ImageView cancelView = (ImageView) view.findViewById(R.id.dialog_cancel); Button completeView = (Button) view.findViewById(R.id.dialog_complete); cancelView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imAlertDialog.dismiss(); } }); completeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (UserInfoHelper.getInstance().isLogin(getActivity())) { // ActivitySwitchAutoInfo.toAutoInfo(getActivity()); // ActivitySwitchBase.toAutoInfo(getActivity(), "", AutoInfoContants.AUTO_DETAIL); ActivitySwitchAutoInfo.toChooseBrandActivity(getActivity(), myAuto, AutoInfoContants.AUTO_DETAIL, false); imAlertDialog.dismiss(); getActivity().finish(); } } }); } private View.OnFocusChangeListener mileageFocusChangeListener = new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { DebugLog.i(TAG, "hasFocus:" + hasFocus); if (!hasFocus) { if (TextUtils.isEmpty(mMileageView.getText())) { ToastHelper.showRedToast(getActivity(), ""); } } } }; @Override public void onDestroy() { if (dpd != null) { dpd.dismiss(); } if (now != null) { now.clear(); now = null; } super.onDestroy(); } }