com.google.android.gms.common.images.ImageManager Java Examples

The following examples show how to use com.google.android.gms.common.images.ImageManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Request.java    From play_games with MIT License 6 votes vote down vote up
private void readImage(final Uri uri) {
    final Map<String, Object> data = new HashMap<>();
    if (uri == null) {
        data.put("bytes", null);
        result(data);
    }
    ImageManager manager = ImageManager.create(registrar.context());
    manager.loadImage(new ImageManager.OnImageLoadedListener() {
        @Override
        public void onImageLoaded(Uri uri1, Drawable drawable, boolean isRequestedDrawable) {
            Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
            byte[] bytes = stream.toByteArray();
            data.put("bytes", bytes);
            result(data);
        }
    }, uri);
}
 
Example #2
Source File: MainMenuActivity.java    From tedroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onSignInSucceeded() {
    super.onSignInSucceeded();
    signInLayout.setVisibility(View.GONE);
    achievementsButton.setVisibility(View.VISIBLE);
    leaderboardsButton.setVisibility(View.VISIBLE);
    signedUserLayout.setVisibility(View.VISIBLE);
    Player currentPlayer = Games.Players.getCurrentPlayer(getApiClient());
    signOutAlertDialog.setMessage(getString(R.string.sign_out_message, currentPlayer.getDisplayName()));
    signedUserTextView.setText(currentPlayer.getDisplayName());
    if (!isUserPhoto(signedUserImageView.getDrawable())) ImageManager.create(this).loadImage(signedUserImageView, currentPlayer.getIconImageUri());
}