diff options
author | Chih-Chung Chang <> | 2009-04-01 00:11:56 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-01 00:11:56 -0700 |
commit | 0435bac841f165b3bda6e8ef38ce6b5ac6f0f2a5 (patch) | |
tree | 4f3225804c733f0f8f93454d56706f1ab8d36f82 /src/com/android/camera/Wallpaper.java | |
parent | c16bd98ec8e4c3ed591251ecfb0c5abebba45b8a (diff) | |
download | LegacyCamera-0435bac841f165b3bda6e8ef38ce6b5ac6f0f2a5.zip LegacyCamera-0435bac841f165b3bda6e8ef38ce6b5ac6f0f2a5.tar.gz LegacyCamera-0435bac841f165b3bda6e8ef38ce6b5ac6f0f2a5.tar.bz2 |
AI 143951: Style fix.
Automated import of CL 143951
Diffstat (limited to 'src/com/android/camera/Wallpaper.java')
-rw-r--r-- | src/com/android/camera/Wallpaper.java | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/src/com/android/camera/Wallpaper.java b/src/com/android/camera/Wallpaper.java index 5c7d0e5..cf29064 100644 --- a/src/com/android/camera/Wallpaper.java +++ b/src/com/android/camera/Wallpaper.java @@ -16,7 +16,6 @@ package com.android.camera; - import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; @@ -30,14 +29,15 @@ import android.os.Message; import android.provider.MediaStore; import android.util.Log; -import java.io.IOException; -import java.io.InputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; /** - * Wallpaper picker for the camera application. This just redirects to the standard pick action. + * Wallpaper picker for the camera application. This just redirects to the + * standard pick action. */ public class Wallpaper extends Activity { private static final String LOG_TAG = "Camera"; @@ -47,8 +47,8 @@ public class Wallpaper extends Activity { static final int SHOW_PROGRESS = 0; static final int FINISH = 1; - static final String sDoLaunchIcicle = "do_launch"; - static final String sTempFilePathIcicle = "temp_file_path"; + static final String DO_LAUNCH_ICICLE = "do_launch"; + static final String TEMP_FILE_PATH_ICICLE = "temp_file_path"; private ProgressDialog mProgressDialog = null; private boolean mDoLaunch = true; @@ -60,7 +60,8 @@ public class Wallpaper extends Activity { switch (msg.what) { case SHOW_PROGRESS: { CharSequence c = getText(R.string.wallpaper); - mProgressDialog = ProgressDialog.show(Wallpaper.this, "", c, true, false); + mProgressDialog = ProgressDialog.show(Wallpaper.this, + "", c, true, false); break; } @@ -80,7 +81,8 @@ public class Wallpaper extends Activity { private final Context mContext; private final File mFile; - public SetWallpaperThread(Bitmap bitmap, Handler handler, Context context, File file) { + public SetWallpaperThread(Bitmap bitmap, Handler handler, + Context context, File file) { mBitmap = bitmap; mHandler = handler; mContext = context; @@ -111,15 +113,15 @@ public class Wallpaper extends Activity { protected void onCreate(Bundle icicle) { super.onCreate(icicle); if (icicle != null) { - mDoLaunch = icicle.getBoolean(sDoLaunchIcicle); - mTempFilePath = icicle.getString(sTempFilePathIcicle); + mDoLaunch = icicle.getBoolean(DO_LAUNCH_ICICLE); + mTempFilePath = icicle.getString(TEMP_FILE_PATH_ICICLE); } } @Override protected void onSaveInstanceState(Bundle icicle) { - icicle.putBoolean(sDoLaunchIcicle, mDoLaunch); - icicle.putString(sTempFilePathIcicle, mTempFilePath); + icicle.putBoolean(DO_LAUNCH_ICICLE, mDoLaunch); + icicle.putString(TEMP_FILE_PATH_ICICLE, mTempFilePath); } @Override @@ -138,7 +140,8 @@ public class Wallpaper extends Activity { Uri imageToUse = getIntent().getData(); if (imageToUse != null) { Intent intent = new Intent(); - intent.setClassName("com.android.camera", "com.android.camera.CropImage"); + intent.setClassName("com.android.camera", + "com.android.camera.CropImage"); intent.setData(imageToUse); formatIntent(intent); startActivityForResult(intent, CROP_DONE); @@ -169,34 +172,43 @@ public class Wallpaper extends Activity { intent.putExtra("aspectY", height); intent.putExtra("scale", true); intent.putExtra("noFaceDetection", true); - intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse("file:/" + mTempFilePath)); - intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.name()); - // TODO: we should have an extra called "setWallpaper" to ask CropImage to - // set the cropped image as a wallpaper directly - // This means the SetWallpaperThread should be moved out of this class to CropImage + intent.putExtra(MediaStore.EXTRA_OUTPUT, + Uri.parse("file:/" + mTempFilePath)); + intent.putExtra("outputFormat", + Bitmap.CompressFormat.PNG.name()); + // TODO: we should have an extra called "setWallpaper" to ask CropImage + // to set the cropped image as a wallpaper directly. This means the + // SetWallpaperThread should be moved out of this class to CropImage } @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if ((requestCode == PHOTO_PICKED || requestCode == CROP_DONE) && (resultCode == RESULT_OK) - && (data != null)) { + protected void onActivityResult(int requestCode, int resultCode, + Intent data) { + if ((requestCode == PHOTO_PICKED || requestCode == CROP_DONE) + && (resultCode == RESULT_OK) && (data != null)) { try { File tempFile = new File(mTempFilePath); InputStream s = new FileInputStream(tempFile); Bitmap bitmap = BitmapFactory.decodeStream(s); if (bitmap == null) { - Log.e(LOG_TAG, "Failed to set wallpaper. Couldn't get bitmap for path " + mTempFilePath); + Log.e(LOG_TAG, "Failed to set wallpaper. " + + "Couldn't get bitmap for path " + + mTempFilePath); } else { - if (android.util.Config.LOGV) - Log.v(LOG_TAG, "bitmap size is " + bitmap.getWidth() + " / " + bitmap.getHeight()); + if (android.util.Config.LOGV) { + Log.v(LOG_TAG, "bitmap size is " + + bitmap.getWidth() + + " / " + bitmap.getHeight()); + } mHandler.sendEmptyMessage(SHOW_PROGRESS); - new SetWallpaperThread(bitmap, mHandler, this, tempFile).start(); + new SetWallpaperThread(bitmap, mHandler, + this, tempFile).start(); } mDoLaunch = false; } catch (FileNotFoundException ex) { - + // ignore } catch (IOException ex) { - + // ignore } } else { setResult(RESULT_CANCELED); |