Example usage for android.graphics Bitmap hashCode

List of usage examples for android.graphics Bitmap hashCode

Introduction

In this page you can find the example usage for android.graphics Bitmap hashCode.

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:com.carlrice.reader.utils.UiUtils.java

static public void getFaviconPalette(final Bitmap bitmap, final PaletteAsyncListener listener) {
    if (bitmap != null) {
        Palette palette = UiUtils.PALETTE_CACHE.get(bitmap.hashCode());
        if (palette != null) {
            if (listener != null) {
                listener.onGenerated(palette);
            }/*  w w  w  . j a  v a  2s  .  c o m*/
        } else {
            Palette.generateAsync(bitmap, new PaletteAsyncListener() {
                @Override
                public void onGenerated(Palette palette) {
                    UiUtils.PALETTE_CACHE.put(bitmap.hashCode(), palette);
                    if (listener != null) {
                        listener.onGenerated(palette);
                    }
                }
            });
        }
    }
}

From source file:com.pizidea.imagepicker.ui.demo.ImagesGridActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {

        if (requestCode == AndroidImagePicker.REQ_CAMERA) {
            Bitmap bmp = (Bitmap) data.getExtras().get("bitmap");
            Log.i(TAG, "=====get Bitmap:" + bmp.hashCode());
        } else if (requestCode == AndroidImagePicker.REQ_PREVIEW) {
            setResult(RESULT_OK);// w  w w .ja v  a 2s  .  c  om
            finish();
        }
    }
}

From source file:com.engine.privatefood.activity.ImagesGridActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {

        if (requestCode == AndroidImagePicker.REQ_CAMERA) {
            Bitmap bmp = (Bitmap) data.getExtras().get("bitmap");
            Log.i(TAG, "=====get Bitmap:" + bmp.hashCode());
        } else if (requestCode == AndroidImagePicker.REQ_PREVIEW) {
            setResult(RESULT_OK);/*from ww w  . ja v a2 s.co  m*/
            finish();
        }

    }

}

From source file:com.pizidea.imagepicker.activity.ImagesGridActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == AndroidImagePicker.REQ_CAMERA) {
            Bitmap bmp = (Bitmap) data.getExtras().get("bitmap");
            Log.i(TAG, "=====get Bitmap:" + bmp.hashCode());
        } else if (requestCode == AndroidImagePicker.REQ_PREVIEW) {
            androidImagePicker.notifyOnImagePickComplete(androidImagePicker.getSelectedImages());
            setResult(RESULT_OK);//from   w  w w  .  j  a  v a2s . com
            finish();
        }
    }
}

From source file:com.pizidea.imagepicker.ui.ImagesGridActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {

        if (requestCode == AndroidImagePicker.REQ_CAMERA) {
            Bitmap bmp = (Bitmap) data.getExtras().get("bitmap");
            Log.i(TAG, "=====get Bitmap:" + bmp.hashCode());
        } else if (requestCode == AndroidImagePicker.REQ_PREVIEW) {
            setResult(RESULT_OK);/*from   w  w  w  .  j ava  2  s.c  om*/
            finish();

        } else if (requestCode == UCrop.REQUEST_CROP) { // ?
            handleCropResult(data);
        } else if (requestCode == UCrop.RESULT_ERROR) {// ?
            handleCropError(data);
        }

    }

}

From source file:com.cleveroad.audiowidget.AudioWidget.java

@NonNull
private Controller newController() {
    return new Controller() {

        @Override//from   ww  w.j  a v a 2s.c o m
        public void start() {
            playbackState.start(this);
        }

        @Override
        public void pause() {
            playbackState.pause(this);
        }

        @Override
        public void stop() {
            playbackState.stop(this);
        }

        @Override
        public int duration() {
            return playbackState.duration();
        }

        @Override
        public void duration(int duration) {
            playbackState.duration(duration);
        }

        @Override
        public int position() {
            return playbackState.position();
        }

        @Override
        public void position(int position) {
            playbackState.position(position);
        }

        @Override
        public void onControlsClickListener(@Nullable OnControlsClickListener onControlsClickListener) {
            AudioWidget.this.onControlsClickListener.onControlsClickListener(onControlsClickListener);
        }

        @Override
        public void onWidgetStateChangedListener(
                @Nullable OnWidgetStateChangedListener onWidgetStateChangedListener) {
            AudioWidget.this.onWidgetStateChangedListener = onWidgetStateChangedListener;
        }

        @Override
        public void albumCover(@Nullable Drawable albumCover) {
            expandCollapseWidget.albumCover(albumCover);
            playPauseButton.albumCover(albumCover);
        }

        @Override
        public void albumCoverBitmap(@Nullable Bitmap bitmap) {
            if (bitmap == null) {
                return;
            }
            WeakReference<Drawable> wrDrawable = albumCoverCache.get(bitmap.hashCode());
            if (wrDrawable != null) {
                Drawable drawable = wrDrawable.get();
                if (drawable != null) {
                    expandCollapseWidget.albumCover(drawable);
                    playPauseButton.albumCover(drawable);
                    return;
                }
            }
            Drawable albumCover = new BitmapDrawable(context.getResources(), bitmap);
            expandCollapseWidget.albumCover(albumCover);
            playPauseButton.albumCover(albumCover);
            albumCoverCache.put(bitmap.hashCode(), new WeakReference<>(albumCover));
        }
    };
}

From source file:com.stanleyidesis.quotograph.api.controller.LWQNotificationControllerImpl.java

@Override
public void postSavedWallpaperReadyNotification(Uri filePath, Uri imageUri) {
    final Bitmap savedImage = BitmapFactory.decodeFile(filePath.getPath());
    final Bitmap notificationBitmap = chopToCenterSquare(savedImage);
    savedImage.recycle();//from   w w w . j  a v a2s .  c o m

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(LWQApplication.get());
    notificationBuilder.setAutoCancel(true);
    notificationBuilder.setCategory(Notification.CATEGORY_SERVICE);
    notificationBuilder.setContentTitle(LWQApplication.get().getString(R.string.notification_title_save_image));
    notificationBuilder
            .setContentText(LWQApplication.get().getString(R.string.notification_content_save_image));
    notificationBuilder.setLights(LWQApplication.get().getResources().getColor(R.color.palette_A100), 500, 500);
    notificationBuilder.setLargeIcon(notificationBitmap);
    notificationBuilder.setOngoing(false);
    notificationBuilder.setShowWhen(false);
    notificationBuilder.setSmallIcon(R.mipmap.ic_stat);
    notificationBuilder.setTicker(LWQApplication.get().getString(R.string.notification_title_save_image));
    notificationBuilder.setWhen(System.currentTimeMillis());
    notificationBuilder.setColor(LWQApplication.get().getResources().getColor(R.color.palette_A100));

    NotificationCompat.BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle();
    bigPictureStyle.bigPicture(notificationBitmap);
    bigPictureStyle.bigLargeIcon(notificationBitmap);

    notificationBuilder.setStyle(bigPictureStyle);

    // Set content Intent
    final Intent viewIntent = new Intent(Intent.ACTION_VIEW);
    viewIntent.setDataAndType(imageUri, "image/*");
    final Intent viewChooser = Intent.createChooser(viewIntent,
            LWQApplication.get().getString(R.string.view_using));
    final PendingIntent viewActivity = PendingIntent.getActivity(LWQApplication.get(), uniqueRequestCode++,
            viewChooser, PendingIntent.FLAG_UPDATE_CURRENT);
    notificationBuilder.setContentIntent(viewActivity);

    // Add Share Action
    final Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("image/*");
    shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(filePath.getPath())));
    final Intent shareChooser = Intent.createChooser(shareIntent,
            LWQApplication.get().getString(R.string.share_using));
    final PendingIntent shareActivity = PendingIntent.getActivity(LWQApplication.get(), uniqueRequestCode++,
            shareChooser, PendingIntent.FLAG_UPDATE_CURRENT);
    final NotificationCompat.Action shareAction = new NotificationCompat.Action.Builder(R.mipmap.ic_share_white,
            LWQApplication.get().getString(R.string.share), shareActivity).build();
    notificationBuilder.addAction(shareAction);

    NotificationManager notificationManager = (NotificationManager) LWQApplication.get()
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(savedImage.hashCode(), notificationBuilder.build());
    notificationBitmap.recycle();
}