Example usage for android.net Uri EMPTY

List of usage examples for android.net Uri EMPTY

Introduction

In this page you can find the example usage for android.net Uri EMPTY.

Prototype

Uri EMPTY

To view the source code for android.net Uri EMPTY.

Click Source Link

Document

The empty URI, equivalent to "".

Usage

From source file:de.grobox.liberario.utils.TransportrUtils.java

public static Intent getShortcutIntent(Context context) {
    Intent shortcutIntent = new Intent(DirectionsFragment.TAG, Uri.EMPTY, context, MainActivity.class);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    shortcutIntent.putExtra("special", DirectionsFragment.TASK_BRING_ME_HOME);
    return shortcutIntent;
}

From source file:com.maskyn.fileeditorpro.activity.MainActivity.java

private void saveTheFile(boolean saveAs) {
    if (!saveAs && greatUri != null && greatUri.getUri() != null && greatUri.getUri() != Uri.EMPTY)
        new SaveFileTask(this, greatUri, pageSystem.getAllText(mEditor.getText().toString()), currentEncoding,
                new SaveFileTask.SaveFileInterface() {
                    @Override//  w ww.ja v a 2 s. com
                    public void fileSaved(Boolean success) {
                        savedAFile(greatUri, true);
                    }
                }).execute();
    else {
        if (Device.hasKitKatApi() && PreferenceHelper.getUseStorageAccessFramework(this)) {
            Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
            intent.setType("*/*");
            intent.putExtra(Intent.EXTRA_TITLE, greatUri.getFileName());
            startActivityForResult(intent, SAVE_AS_REQUEST_CODE);
        } else {
            new NewFileDetailsDialog(greatUri, pageSystem.getAllText(mEditor.getText().toString()),
                    currentEncoding).show(getFragmentManager().beginTransaction(), "dialog");
        }

    }
}

From source file:com.custom.music.MusicBrowserActivity.java

/**
 * get current view/*from w  w w . ja v a2  s .com*/
 * 
 * @param index
 * @return View
 */
private View getView(int index) {
    Log.i(TAG, ">>> getView index = " + index, Log.APP);
    View view = null;
    Intent intent = new Intent(Intent.ACTION_PICK);
    //update by zjw
    //Uri.EMPTY --> custom
    switch (index) {
    case ARTIST_INDEX:
        intent.setClass(this, ArtistAlbumBrowserActivity.class);
        intent.setDataAndType(Uri.EMPTY, Constants.ARTIST_MIME_TYPE);
        break;
    case ALBUM_INDEX:
        intent.setClass(this, AlbumBrowserActivity.class);
        intent.setDataAndType(Uri.EMPTY, Constants.ALBUM_MIME_TYPE);
        break;
    case SONG_INDEX:
        intent.setClass(this, TrackBrowserActivity.class);
        intent.setDataAndType(Uri.EMPTY, Constants.TRACK_MIME_TYPE);
        break;
    case PLAYLIST_INDEX:
        intent.setClass(this, PlaylistBrowserActivity.class);
        intent.setDataAndType(Uri.EMPTY, Constants.PLAYLIST_MIME_TYPE);
        break;
    default:
        return null;
    }
    intent.putExtra("withtabs", true);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    view = mActivityManager.startActivity(getStringId(index), intent).getDecorView();
    Log.i(TAG, "getView >>>", Log.APP);
    return view;
}

From source file:org.secu3.android.ParamActivity.java

@Override
protected void onResume() {
    super.onResume();
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.starter_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.angles_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.idling_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.functions_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.temperature_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.carburetor_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.adc_errors_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.ckps_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.miscellaneous_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.choke_control_title));

    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.op_comp_nc_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.choke_control_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class)
                    .putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                            R.string.secur_par_title)
                    .putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_DIR,
                            Secu3Packet.OUTPUT_TYPE));
    dialog = (CustomNumberPickerDialog) getLastCustomNonConfigurationInstance();
    if (dialog != null) {
        dialog.setOnCustomNumberPickerAcceptListener(this);
    }//  w  ww .  j  a  va2 s . c  om
    registerReceiver(receiver, receiver.intentFilter);
}

From source file:com.android.music.MusicBrowserActivity.java

/**
 * get current view/*  w  ww .ja  v  a 2  s.c om*/
 *
 * @param index
 * @return View
 */
private View getView(int index) {
    MusicLogUtils.d(TAG, "getView>>>index = " + index);
    View view = null;
    Intent intent = new Intent(Intent.ACTION_PICK);
    switch (index) {
    case ARTIST_INDEX:
        intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/artistalbum");
        break;
    case ALBUM_INDEX:
        intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/album");
        break;
    case SONG_INDEX:
        intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
        break;
    case PLAYLIST_INDEX:
        intent.setDataAndType(Uri.EMPTY, MediaStore.Audio.Playlists.CONTENT_TYPE);
        break;
    default:
        MusicLogUtils.d(TAG, "default");
        return null;
    }
    intent.putExtra("withtabs", true);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    view = mActivityManager.startActivity(getStringId(index), intent).getDecorView();
    MusicLogUtils.d(TAG, "getView<<<");
    return view;
}

From source file:com.maskyn.fileeditorpro.activity.MainActivity.java

/**
 * Parses the intent//from w  ww.  ja  v  a 2  s . c  om
 */
private void parseIntent(Intent intent) {
    final String action = intent.getAction();
    final String type = intent.getType();

    if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action)
            || Intent.ACTION_PICK.equals(action) && type != null) {
        // Post event
        //newFileToOpen(new File(intent
        //        .getData().getPath()), "");
        Uri uri = intent.getData();
        GreatUri newUri = new GreatUri(uri, AccessStorageApi.getPath(this, uri),
                AccessStorageApi.getName(this, uri));
        newFileToOpen(newUri, "");
    } else if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            newFileToOpen(new GreatUri(Uri.EMPTY, "", ""), intent.getStringExtra(Intent.EXTRA_TEXT));
        }
    }
}

From source file:uk.org.ngo.squeezer.service.SqueezeService.java

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private void downloadSong(@NonNull Uri url, String title, @NonNull Uri serverUrl) {
    if (url.equals(Uri.EMPTY)) {
        return;/*  ww w.jav  a2  s .com*/
    }

    // If running on Gingerbread or greater use the Download Manager
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
        DownloadDatabase downloadDatabase = new DownloadDatabase(this);
        String localPath = getLocalFile(serverUrl);
        String tempFile = UUID.randomUUID().toString();
        String credentials = mUsername + ":" + mPassword;
        String base64EncodedCredentials = Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
        DownloadManager.Request request = new DownloadManager.Request(url).setTitle(title)
                .setDestinationInExternalFilesDir(this, Environment.DIRECTORY_MUSIC, tempFile)
                .setVisibleInDownloadsUi(false)
                .addRequestHeader("Authorization", "Basic " + base64EncodedCredentials);
        long downloadId = downloadManager.enqueue(request);

        Crashlytics.log("Registering new download");
        Crashlytics.log("downloadId: " + downloadId);
        Crashlytics.log("tempFile: " + tempFile);
        Crashlytics.log("localPath: " + localPath);

        if (!downloadDatabase.registerDownload(downloadId, tempFile, localPath)) {
            Crashlytics.log(Log.WARN, TAG, "Could not register download entry for: " + downloadId);
            downloadManager.remove(downloadId);
        }
    }
}

From source file:com.musenkishi.wally.activities.ImageDetailsActivity.java

@Override
public boolean handleMessage(Message msg) {
    switch (msg.what) {

    case MSG_GET_PAGE:
        String url = (String) msg.obj;
        if (url != null) {
            WallyApplication.getDataProviderInstance().getPageData(url,
                    new DataProvider.OnPageReceivedListener() {
                        @Override
                        public void onPageReceived(ImagePage imagePage) {
                            Message msgObj = uiHandler.obtainMessage();
                            msgObj.what = MSG_PAGE_FETCHED;
                            msgObj.obj = imagePage;
                            uiHandler.sendMessage(msgObj);
                        }/* ww w.ja v a2 s  . c o m*/

                        @Override
                        public void onError(DataProviderError error) {
                            Message msgObj = uiHandler.obtainMessage();
                            msgObj.what = MSG_PAGE_ERROR;
                            msgObj.obj = error;
                            uiHandler.sendMessage(msgObj);
                        }
                    });
        }
        break;

    case MSG_SAVE_TO_FILE:
        int what = msg.arg1;
        saveToFile(what);
        break;

    case MSG_PAGE_FETCHED:
        imagePage = (ImagePage) msg.obj;
        if (imagePage != null) {
            textViewUploader.setText(imagePage.uploader());
            textViewUploadDate.setText(imagePage.uploadDate());
            textViewSource.setText(imagePage.author().name());
            if (imagePage.author().page() != Uri.EMPTY) {
                textViewSource.setTextColor(getResources().getColor(R.color.Holo_Blue_Dark));
                textViewSource.setTag(imagePage.author());
                textViewSource.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Author author = (Author) v.getTag();
                        if (author.page() != Uri.EMPTY) {
                            Intent browserIntent = new Intent(Intent.ACTION_VIEW, author.page());
                            startActivity(browserIntent);
                        }
                    }
                });
            }
            textViewResolution.setText(imagePage.resolution());
            textViewCategory.setText(imagePage.category());
            textViewRating.setText(imagePage.rating());
            final String imageUrl = imagePage.imagePath().toString();

            Glide.with(getApplicationContext()).load(imageUrl)
                    .placeholder(photoViewAttacher.getImageView().getDrawable()).fitCenter()
                    .listener(new RequestListener<String, GlideDrawable>() {
                        @Override
                        public boolean onException(Exception e, String model, Target<GlideDrawable> target,
                                boolean isFirstResource) {
                            hideLoader();
                            //TODO: maybe show a retry button?
                            return false;
                        }

                        @Override
                        public boolean onResourceReady(GlideDrawable resource, String model,
                                Target<GlideDrawable> target, boolean isFromMemoryCache,
                                boolean isFirstResource) {

                            photoView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                            photoViewAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);

                            renderColors(((GlideBitmapDrawable) resource.getCurrent()).getBitmap());
                            photoView.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View view) {
                                    toggleZoomImage();
                                }
                            });
                            hideLoader();

                            Size size = fitToWidthAndKeepRatio(imagePage.getImageWidth(),
                                    imagePage.getImageHeight());

                            imageSize = size;

                            setupPaddings(size, true);

                            enableParallaxEffect(scrollView, photoLayoutHolder);

                            scrollUpToolbarIfNeeded();

                            return false;
                        }
                    }).into(photoView);

            specsLayout.setAlpha(1.0f);
            specsLayout.scheduleLayoutAnimation();

        }
        break;

    case MSG_PAGE_ERROR:
        DataProviderError dataProviderError = (DataProviderError) msg.obj;
        if (dataProviderError != null) {
            Toast.makeText(ImageDetailsActivity.this,
                    dataProviderError.getHttpStatusCode() + ": " + dataProviderError.getMessage(),
                    Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(ImageDetailsActivity.this, getString(R.string.toast_error_default),
                    Toast.LENGTH_SHORT).show();
        }
        break;

    case MSG_IMAGE_REQUEST_READY_FOR_SETTING:
        Uri savedImageDataForWallpaper = (Uri) msg.obj;
        if (savedImageDataForWallpaper != null) {
            setImageAsWallpaperPicker(savedImageDataForWallpaper);
        }
        break;

    case MSG_IMAGE_REQUEST_SAVED:
        updateSaveButton();
        break;

    case MSG_IMAGE_REQUEST_SAVING:
        if (buttonSave != null) {
            buttonSave.setText(getString(R.string.saving));
            buttonSave.setAlpha(0.50f);
        }
        break;

    case MSG_RENDER_PALETTE:

        Bitmap bitmap1 = (Bitmap) msg.obj;
        Palette colorScheme = Palette.generate(bitmap1);

        Message msgObj = uiHandler.obtainMessage();
        msgObj.what = MSG_SET_IMAGE_AND_PALETTE;
        msgObj.obj = colorScheme;
        uiHandler.sendMessage(msgObj);

        break;

    case MSG_SET_IMAGE_AND_PALETTE:
        Palette renderedPalette = (Palette) msg.obj;
        setColors(renderedPalette);
        break;

    case MSG_SCROLL_UP_SCROLLVIEW:
        int targetScroll = msg.arg1;
        scrollView.smoothScrollTo(0, targetScroll);
        break;

    }
    return false;
}

From source file:com.maskyn.fileeditorpro.activity.MainActivity.java

private void refreshList(@Nullable GreatUri thisUri, boolean add, boolean delete) {
    int max_recent_files = 15;
    if (add)//from   ww w .  j  av  a2  s . c o m
        max_recent_files--;

    // File paths saved in preferences
    String[] savedPaths = PreferenceHelper.getSavedPaths(this);
    int first_index_of_array = savedPaths.length > max_recent_files ? savedPaths.length - max_recent_files : 0;
    savedPaths = ArrayUtils.subarray(savedPaths, first_index_of_array, savedPaths.length);
    // File names for the list
    greatUris.clear();
    // StringBuilder that will contain the file paths
    StringBuilder sb = new StringBuilder();

    // for cycle to convert paths to names
    for (int i = 0; i < savedPaths.length; i++) {
        Uri particularUri = Uri.parse(savedPaths[i]);
        String name = AccessStorageApi.getName(this, particularUri);
        // Check that the file exist
        // if is null or empty the particular url we dont use it
        if (particularUri != null && !particularUri.equals(Uri.EMPTY) && !TextUtils.isEmpty(name)) {
            // if the particular uri is good
            boolean good = false;
            if (thisUri == null || thisUri.getUri() == null || thisUri.getUri() == Uri.EMPTY)
                good = true;
            else {
                if (delete == false)
                    good = true;
                else if (!thisUri.getUri().equals(particularUri))
                    good = true;
                else
                    good = false;
            }
            if (good) {
                greatUris.addFirst(
                        new GreatUri(particularUri, AccessStorageApi.getPath(this, particularUri), name));
                sb.append(savedPaths[i]).append(",");
            }
        }
        //}
    }
    // if is not null, empty, we have to add something and we dont already have this uri
    if (thisUri != null && !thisUri.getUri().equals(Uri.EMPTY) && add
            && !ArrayUtils.contains(savedPaths, thisUri.getUri().toString())) {
        sb.append(thisUri.getUri().toString()).append(",");
        greatUris.addFirst(thisUri);
    }
    // save list without empty or non existed files
    PreferenceHelper.setSavedPaths(this, sb);
    // Set adapter
    arrayAdapter.notifyDataSetChanged();
}

From source file:com.bitants.wally.activities.ImageDetailsActivity.java

@Override
public boolean handleMessage(Message msg) {
    switch (msg.what) {

    case MSG_GET_PAGE:
        String url = (String) msg.obj;
        if (url != null) {
            WallyApplication.getDataProviderInstance().getPageData(url,
                    new DataProvider.OnPageReceivedListener() {
                        @Override
                        public void onPageReceived(ImagePage imagePage) {
                            Message msgObj = uiHandler.obtainMessage();
                            msgObj.what = MSG_PAGE_FETCHED;
                            msgObj.obj = imagePage;
                            uiHandler.sendMessage(msgObj);
                        }/*from  w w  w.ja  v  a  2 s  . c  om*/

                        @Override
                        public void onError(DataProviderError error) {
                            Message msgObj = uiHandler.obtainMessage();
                            msgObj.what = MSG_PAGE_ERROR;
                            msgObj.obj = error;
                            uiHandler.sendMessage(msgObj);
                        }
                    });
        }
        break;

    case MSG_SAVE_TO_FILE:
        int what = msg.arg1;
        saveToFile(what);
        break;

    case MSG_PAGE_FETCHED:
        imagePage = (ImagePage) msg.obj;
        if (imagePage != null) {
            textViewUploader.setText(imagePage.uploader());
            textViewUploadDate.setText(imagePage.uploadDate());
            textViewSource.setText(imagePage.author().name());
            if (imagePage.author().page() != Uri.EMPTY) {
                textViewSource.setTextColor(getResources().getColor(R.color.Holo_Blue_Dark));
                textViewSource.setTag(imagePage.author());
                textViewSource.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Author author = (Author) v.getTag();
                        if (author.page() != Uri.EMPTY) {
                            Intent browserIntent = new Intent(Intent.ACTION_VIEW, author.page());
                            startActivity(browserIntent);
                        }
                    }
                });
            }
            textViewResolution.setText(imagePage.resolution());
            textViewCategory.setText(imagePage.category());
            textViewRating.setText(imagePage.rating());
            final String imageUrl = imagePage.imagePath().toString();

            if (imagePage.tags().size() > 0) {
                flowLayoutTags.removeAllViews();
                for (final Tag tag : imagePage.tags()) {
                    View tagView = getLayoutInflater().inflate(R.layout.view_tag_item, flowLayoutTags, false);
                    TextView tagTextView = (TextView) tagView.findViewById(R.id.tag_item_text);
                    tagTextView.setText(tag.name());

                    flowLayoutTags.addView(tagView);

                    tagTextView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            WallyApplication.getSearchFragmentMessages().put(SearchFragment.EXTRA_MESSAGE_TAG,
                                    tag.name());
                            Intent intent = new Intent();
                            setResult(RESULT_OK, intent);
                            ImageDetailsActivity.this.finish();
                        }
                    });
                }
            } else {
                findViewById(R.id.image_details_tags_title).setVisibility(View.GONE);
                flowLayoutTags.setVisibility(View.GONE);
            }

            Glide.with(getApplicationContext()).load(imageUrl).placeholder(photoView.getDrawable()).fitCenter()
                    .listener(new RequestListener<String, GlideDrawable>() {
                        @Override
                        public boolean onException(Exception e, String model, Target<GlideDrawable> target,
                                boolean isFirstResource) {
                            hideLoader();
                            //TODO: maybe show a retry button?
                            return false;
                        }

                        @Override
                        public boolean onResourceReady(GlideDrawable resource, String model,
                                Target<GlideDrawable> target, boolean isFromMemoryCache,
                                boolean isFirstResource) {

                            photoView.setScaleType(ImageView.ScaleType.CENTER_CROP);

                            renderTags(((GlideBitmapDrawable) resource.getCurrent()).getBitmap());
                            renderColors(((GlideBitmapDrawable) resource.getCurrent()).getBitmap());
                            photoView.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View view) {
                                    toggleZoomImage();
                                }
                            });
                            hideLoader();

                            Size size = fitToWidthAndKeepRatio(imagePage.getImageWidth(),
                                    imagePage.getImageHeight());

                            imageSize = size;

                            setupPaddings(size, true);

                            scrollUpToolbarIfNeeded();

                            return false;
                        }
                    }).into(photoView);

            specsLayout.setAlpha(1.0f);
            specsLayout.scheduleLayoutAnimation();

            enableParallaxEffect(scrollView, photoLayoutHolder);
        }
        break;

    case MSG_PAGE_ERROR:
        DataProviderError dataProviderError = (DataProviderError) msg.obj;
        if (dataProviderError != null) {
            Toast.makeText(ImageDetailsActivity.this,
                    dataProviderError.getHttpStatusCode() + ": " + dataProviderError.getMessage(),
                    Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(ImageDetailsActivity.this, getString(R.string.toast_error_default),
                    Toast.LENGTH_SHORT).show();
        }
        break;

    case MSG_IMAGE_REQUEST_READY_FOR_SETTING:
        Uri savedImageDataForWallpaper = (Uri) msg.obj;
        if (savedImageDataForWallpaper != null) {
            setImageAsWallpaperPicker(savedImageDataForWallpaper);
        }
        break;

    case MSG_IMAGE_REQUEST_SAVED:
        updateSaveButton();
        break;

    case MSG_IMAGE_REQUEST_SAVING:
        if (buttonSave != null) {
            buttonSave.setText(getString(R.string.saving));
            buttonSave.setAlpha(0.50f);
        }
        break;

    case MSG_RENDER_PALETTE:

        Bitmap bitmap1 = (Bitmap) msg.obj;
        Palette palette = Palette.generate(bitmap1);

        Message msgObj = uiHandler.obtainMessage();
        msgObj.what = MSG_SET_IMAGE_AND_PALETTE;
        msgObj.obj = palette;
        uiHandler.sendMessage(msgObj);

        break;

    case MSG_SET_IMAGE_AND_PALETTE:
        Palette renderedPalette = (Palette) msg.obj;
        setColors(renderedPalette);
        break;

    case MSG_SCROLL_UP_SCROLLVIEW:
        int targetScroll = msg.arg1;
        scrollView.smoothScrollTo(0, targetScroll);
        break;

    }
    return false;
}