示例#1
0
 protected void receiveFromParent() {
   Bundle bundle = getIntent().getExtras();
   if (bundle != null) {
     url = bundle.getString("url");
     canScale = bundle.getBoolean(ContantsUtil.PHOTO_CLIP_SCALE);
     mCaremaPath = bundle.getString(ContantsUtil.PHOTO_CAREMA_PATH);
     mClipImageLayout.init(canScale, url, mCaremaPath);
   }
 }
示例#2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int id = item.getItemId();
   if (id == android.R.id.home) {
     onBackPressed();
     return true;
   } else if (id == R.id.action_save) {
     Bitmap bitmap = mClipImageLayout.clip();
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
     byte[] datas = baos.toByteArray();
     Intent intent = new Intent();
     intent.putExtra(ContantsUtil.PHOTO_RESULT, datas);
     setResult(RESULT_OK, intent);
     finish();
     bitmap.recycle();
     return true;
   } else {
     return super.onOptionsItemSelected(item);
   }
 }