@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_my_profile, container, false); ivAvatar = (ImageView) rootView.findViewById(R.id.avatar); imageFrag = (ImageView) rootView.findViewById(R.id.img_flag); lblName = (TextView) rootView.findViewById(R.id.lbl_name); lblAge = (TextView) rootView.findViewById(R.id.lbl_age); lblNation = (TextView) rootView.findViewById(R.id.lbl_nation); lblDescription = (TextView) rootView.findViewById(R.id.lbl_description); tvTitlebar = (TextView) rootView.findViewById(R.id.tv_title_bar); rootView.findViewById(R.id.btnShowDrawer).setOnClickListener(this); rootView.findViewById(R.id.button_edit).setOnClickListener(this); ivAvatar.setOnClickListener(this); userID = mPrefs.getString(Prefs.ID, null); if (UIUtils.ensureNetworkInternet(context, false)) { showLoading(); requestGetUserInfo(); } else { setInfo(null); } return rootView; }
@Override public void onClick(View v) { switch (v.getId()) { // case R.id.tvChangeNumber: // finish(); // break; case R.id.button_back: finish(); break; case R.id.button_verify: if (UIUtils.ensureNetworkInternet(this, false)) { showLoading(); UIUtils.hideSoftInput(v); String verifyCode = etVerifyCode.getText().toString(); if (verifyCode.length() != 6) { UIUtils.alert(this, R.string.invalid_verify_code_length); hideLoading(); return; } if (TextUtil.isEmpty(verifyCode)) { UIUtils.alert(this, R.string.please_enter_your_verify_code_sent_to_phone_number); hideLoading(); return; } requestVerifyCode(verifyCode); } break; default: UIUtils.alert(this, "Still builiding.. !"); break; } }
private void onPhoto(Uri imgUri) { filePath = AndroidUtils.getPath(mActivity, imgUri); if (UIUtils.ensureNetworkInternet(context, false)) { if (filePath != null) { showLoading(); requestUpdateAvatar(); } else { hideLoading(); UIUtils.alert(context, R.string.cannot_get_file_path_image_picture); } } }