@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { if (requestCode == 1000) { Uri uri = data.getData(); ContentResolver cr = getActivity().getContentResolver(); try { Bitmap bitmap = BitmapFactory.decodeStream(cr.openInputStream(uri)); ImageView ivHead = new ImageView(getActivity()); ivHead.setImageBitmap(ImageViewUtil.centerSquareScaleBitmap(bitmap, 60)); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( (int) getResources().getDimension(R.dimen.refresh_header_height), (int) getResources().getDimension(R.dimen.refresh_header_height)); lp.setMargins(5, 0, 5, 0); vContainer.addView(ivHead, lp); // TODO 命名规则?? new GetAndUploadFile(getActivity()).resumableUpload(uri.getPath(), "user/head.jpg"); } catch (FileNotFoundException e) { } } } super.onActivityResult(requestCode, resultCode, data); }
@Override public void doHandlerView(View handler) { super.doHandlerView(handler); TextView tv = ((TextView) handler); int left, right; left = right = getResources().getDimensionPixelSize(R.dimen.custom_actionbar_handler_padding); tv.setPadding(left, 0, right, 0); setOnClickListener( new OnHandlerClickListener() { @Override public void onClick(View handlerView) { Editable options = etOptions.getText(), contacts = etContacts.getText(); if (TextUtils.isEmpty(options)) { ToastHelper.show(getActivity(), getResources().getString(R.string.input_your_option)); return; } if (TextUtils.isEmpty(contacts)) { ToastHelper.show( getActivity(), getResources().getString(R.string.input_your_contacts)); return; } if (!RegexValidateUtil.checkCellphone(contacts.toString()) && !RegexValidateUtil.checkQQ(contacts.toString())) { ToastHelper.show(getActivity(), "请按要求输入联系方式."); return; } // TODO 发送反馈信息 } }); tv.setText("发送"); }