@Override
 public void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   if (mSsoHandler != null) {
     mSsoHandler.authorizeCallBack(requestCode, resultCode, intent);
   }
 }
Esempio n. 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mSsoHandler = new SsoHandler(this, mWeibo);
    mSsoHandler.authorize(new AuthDialogListener());
  }
Esempio n. 3
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (mSsoHandler != null) {
      mSsoHandler.authorizeCallBack(requestCode, resultCode, data);
    }
  }
 private boolean doLogin(CallbackContext callbackContext) {
   mSsoHandler = new SsoHandler(cordova.getActivity(), weibo);
   mSsoHandler.authorize(new AuthDialogListener(callbackContext), null);
   return true;
 }
Esempio n. 5
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    ContentResolver resolver = getContentResolver();
    if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE || requestCode == 300) {
      if (resultCode == RESULT_OK) {
        // Image captured and saved to fileUri specified in the Intent
        BitmapFactory.Options opts = new BitmapFactory.Options();
        opts.inJustDecodeBounds = true;
        BitmapFactory.decodeFile(getFile().getAbsolutePath(), opts);
        opts.inSampleSize = calculateInSampleSize(opts, 250, 250);
        opts.inJustDecodeBounds = false;
        Intent intent = new Intent(MainActivity.this, ImageActivity.class);
        Bitmap bitmap = BitmapFactory.decodeFile(getFile().getAbsolutePath(), opts);
        intent.putExtra("bitmap0", bitmap);
        startActivity(intent);
        overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
        this.finish();
      } else if (resultCode == RESULT_CANCELED) {
        // User cancelled the image capture
      } else {
        // Image capture failed, advise user
      }
    }

    if (requestCode == CAPTURE_GALLERY_ACTIVITY_REQUEST_CODE || requestCode == 400) {
      if (resultCode == RESULT_OK) {
        try {
          Uri originalUri = data.getData();
          byte[] mContext = readStream(resolver.openInputStream(Uri.parse(originalUri.toString())));
          BitmapFactory.Options opts = new BitmapFactory.Options();
          BitmapFactory.Options opts2 = new BitmapFactory.Options();
          opts.inJustDecodeBounds = true;
          opts2.inJustDecodeBounds = true;
          BitmapFactory.decodeByteArray(mContext, 0, mContext.length, opts);
          BitmapFactory.decodeByteArray(mContext, 0, mContext.length, opts2);
          opts.inSampleSize = calculateInSampleSize(opts, 250, 250);
          opts2.inSampleSize = calculateInSampleSize(opts2, 1500, 1500);
          opts2.inJustDecodeBounds = false;
          opts.inJustDecodeBounds = false;
          Bitmap mbitmap = getPicFromBytes(mContext, opts2);
          File file =
              new File(Environment.getExternalStorageDirectory(), "/YlseImgchooseTemp" + ".jpg");
          FileOutputStream outputStream = null;
          try {
            outputStream = new FileOutputStream(file);
            mbitmap.compress(CompressFormat.JPEG, 100, outputStream);
            outputStream.close();
            mbitmap.recycle();
          } catch (IOException e) {
            e.printStackTrace();
          }
          Intent intent = new Intent(MainActivity.this, ImageActivity.class);
          mbitmap = BitmapFactory.decodeFile("/sdcard/YlseImgchooseTemp" + ".jpg", opts);
          intent.putExtra("bitmap1", mbitmap);
          startActivity(intent);
          overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
          this.finish();
        } catch (Exception e) {
          // TODO: handle exception

        }

      } else if (resultCode == RESULT_CANCELED) {
      } else {
      }
    }
    if (mSsoHandler != null) {
      mSsoHandler.authorizeCallBack(requestCode, resultCode, data);
    }
  }