diff options
author | Chih-Chung Chang <> | 2009-04-01 00:40:11 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-01 00:40:11 -0700 |
commit | 5ceee696eb926984228b1c44ff613f64f28b7aaf (patch) | |
tree | 186f48ae38ae9f9456777c08448fe8adb980675f | |
parent | 0435bac841f165b3bda6e8ef38ce6b5ac6f0f2a5 (diff) | |
download | LegacyCamera-5ceee696eb926984228b1c44ff613f64f28b7aaf.zip LegacyCamera-5ceee696eb926984228b1c44ff613f64f28b7aaf.tar.gz LegacyCamera-5ceee696eb926984228b1c44ff613f64f28b7aaf.tar.bz2 |
AI 143958: Style fix.
Automated import of CL 143958
-rw-r--r-- | src/com/android/camera/ActionMenuButton.java | 16 | ||||
-rw-r--r-- | src/com/android/camera/ErrorScreen.java | 10 | ||||
-rw-r--r-- | src/com/android/camera/PhotoAppWidgetBind.java | 21 | ||||
-rw-r--r-- | src/com/android/camera/PhotoAppWidgetProvider.java | 70 | ||||
-rw-r--r-- | src/com/android/camera/PickWallpaper.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/VideoPreview.java | 17 |
6 files changed, 69 insertions, 68 deletions
diff --git a/src/com/android/camera/ActionMenuButton.java b/src/com/android/camera/ActionMenuButton.java index d6d355a..6dce3dd 100644 --- a/src/com/android/camera/ActionMenuButton.java +++ b/src/com/android/camera/ActionMenuButton.java @@ -25,9 +25,9 @@ import android.util.AttributeSet; import android.widget.TextView; /** - * TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan - * because we want to make the bubble taller than the text and TextView's clip is - * too aggressive. + * TextView that draws a bubble behind the text. We cannot use a + * LineBackgroundSpan because we want to make the bubble taller than the text + * and TextView's clip is too aggressive. */ public class ActionMenuButton extends TextView { private static final float CORNER_RADIUS = 8.0f; @@ -61,7 +61,8 @@ public class ActionMenuButton extends TextView { setFocusable(true); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - mPaint.setColor(getContext().getResources().getColor(R.color.bubble_dark_background)); + mPaint.setColor(getContext().getResources() + .getColor(R.color.bubble_dark_background)); } public void setRestricted(boolean restricted) { @@ -98,9 +99,10 @@ public class ActionMenuButton extends TextView { final int top = getExtendedPaddingTop(); rect.set(left + layout.getLineLeft(0) - PADDING_H, - top + layout.getLineTop(0) - PADDING_V, - Math.min(left + layout.getLineRight(0) + PADDING_H, mScrollX + mRight - mLeft), - top + layout.getLineBottom(0) + PADDING_V); + top + layout.getLineTop(0) - PADDING_V, + Math.min(left + layout.getLineRight(0) + PADDING_H, + mScrollX + mRight - mLeft), + top + layout.getLineBottom(0) + PADDING_V); canvas.drawRoundRect(rect, CORNER_RADIUS, CORNER_RADIUS, mPaint); super.draw(canvas); diff --git a/src/com/android/camera/ErrorScreen.java b/src/com/android/camera/ErrorScreen.java index 1018eb7..0ee286f 100644 --- a/src/com/android/camera/ErrorScreen.java +++ b/src/com/android/camera/ErrorScreen.java @@ -16,19 +16,18 @@ package com.android.camera; -import android.content.Intent; import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; -import android.os.Bundle; import android.widget.TextView; /** * */ -public class ErrorScreen extends Activity -{ +public class ErrorScreen extends Activity { int mError; boolean mLogoutOnExit; boolean mReconnectOnExit; @@ -79,7 +78,8 @@ public class ErrorScreen extends Activity mError = intent.getIntExtra("error", mError); mLogoutOnExit = intent.getBooleanExtra("logout", mLogoutOnExit); - mReconnectOnExit = intent.getBooleanExtra("reconnect", mReconnectOnExit); + mReconnectOnExit = intent.getBooleanExtra("reconnect", + mReconnectOnExit); } // void startNextActivity() { diff --git a/src/com/android/camera/PhotoAppWidgetBind.java b/src/com/android/camera/PhotoAppWidgetBind.java index 5e71a54..06d7a94 100644 --- a/src/com/android/camera/PhotoAppWidgetBind.java +++ b/src/com/android/camera/PhotoAppWidgetBind.java @@ -31,7 +31,8 @@ import java.util.ArrayList; public class PhotoAppWidgetBind extends Activity { static final String TAG = "PhotoAppWidgetBind"; - static final String EXTRA_APPWIDGET_BITMAPS = "com.android.camera.appwidgetbitmaps"; + static final String EXTRA_APPWIDGET_BITMAPS = + "com.android.camera.appwidgetbitmaps"; @Override protected void onCreate(Bundle icicle) { @@ -39,16 +40,18 @@ public class PhotoAppWidgetBind extends Activity { finish(); // The caller has requested that we bind a given bitmap to a specific - // appWidgetId, which probably is happening during a Launcher upgrade. This - // is dangerous because the caller could set bitmaps on appWidgetIds they - // don't own, so we guard this call at the manifest level by requiring - // the BIND_APPWIDGET permission. + // appWidgetId, which probably is happening during a Launcher upgrade. + // This is dangerous because the caller could set bitmaps on + // appWidgetIds they don't own, so we guard this call at the manifest + // level by requiring the BIND_APPWIDGET permission. final Intent intent = getIntent(); final Bundle extras = intent.getExtras(); - final int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - final ArrayList<Bitmap> bitmaps = extras.getParcelableArrayList(EXTRA_APPWIDGET_BITMAPS); + final int[] appWidgetIds = + extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); + final ArrayList<Bitmap> bitmaps = + extras.getParcelableArrayList(EXTRA_APPWIDGET_BITMAPS); if (appWidgetIds == null || bitmaps == null || appWidgetIds.length != bitmaps.size()) { @@ -64,7 +67,9 @@ public class PhotoAppWidgetBind extends Activity { helper.setPhoto(appWidgetId, bitmaps.get(i)); // Push newly updated widget to surface - RemoteViews views = PhotoAppWidgetProvider.buildUpdate(this, appWidgetId, helper); + RemoteViews views = + PhotoAppWidgetProvider.buildUpdate(this, appWidgetId, + helper); appWidgetManager.updateAppWidget(new int[] { appWidgetId }, views); } helper.close(); diff --git a/src/com/android/camera/PhotoAppWidgetProvider.java b/src/com/android/camera/PhotoAppWidgetProvider.java index e87c1bd..6229638 100644 --- a/src/com/android/camera/PhotoAppWidgetProvider.java +++ b/src/com/android/camera/PhotoAppWidgetProvider.java @@ -16,48 +16,21 @@ package com.android.camera; -import com.android.internal.util.XmlUtils; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import android.app.Activity; -import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; -import android.content.BroadcastReceiver; -import android.content.ComponentName; -import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.PackageManager; import android.database.Cursor; -import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.net.Uri; -import android.os.Environment; -import android.provider.Settings; -import android.provider.Calendar.Attendees; -import android.provider.Calendar.Calendars; -import android.provider.Calendar.Instances; -import android.text.format.DateFormat; -import android.text.format.DateUtils; import android.util.Config; import android.util.Log; -import android.util.Xml; -import android.view.View; import android.widget.RemoteViews; import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; /** @@ -68,13 +41,17 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { static final boolean LOGD = Config.LOGD || true; @Override - public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { + public void onUpdate(Context context, AppWidgetManager appWidgetManager, + int[] appWidgetIds) { // Update each requested appWidgetId with its unique photo PhotoDatabaseHelper helper = new PhotoDatabaseHelper(context); for (int appWidgetId : appWidgetIds) { int[] specificAppWidget = new int[] { appWidgetId }; RemoteViews views = buildUpdate(context, appWidgetId, helper); - if (LOGD) Log.d(TAG, "sending out views="+views+" for id="+appWidgetId); + if (LOGD) { + Log.d(TAG, "sending out views=" + views + + " for id=" + appWidgetId); + } appWidgetManager.updateAppWidget(specificAppWidget, views); } helper.close(); @@ -93,11 +70,13 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { /** * Load photo for given widget and build {@link RemoteViews} for it. */ - static RemoteViews buildUpdate(Context context, int appWidgetId, PhotoDatabaseHelper helper) { + static RemoteViews buildUpdate(Context context, int appWidgetId, + PhotoDatabaseHelper helper) { RemoteViews views = null; Bitmap bitmap = helper.getPhoto(appWidgetId); if (bitmap != null) { - views = new RemoteViews(context.getPackageName(), R.layout.photo_frame); + views = new RemoteViews(context.getPackageName(), + R.layout.photo_frame); views.setImageViewBitmap(R.id.photo, bitmap); } return views; @@ -128,7 +107,8 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { } @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + public void onUpgrade(SQLiteDatabase db, int oldVersion, + int newVersion) { int version = oldVersion; if (version != DATABASE_VERSION) { @@ -144,8 +124,9 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { public boolean setPhoto(int appWidgetId, Bitmap bitmap) { boolean success = false; try { - // Try go guesstimate how much space the icon will take when serialized - // to avoid unnecessary allocations/copies during the write. + // Try go guesstimate how much space the icon will take when + // serialized to avoid unnecessary allocations/copies during + // the write. int size = bitmap.getWidth() * bitmap.getHeight() * 4; ByteArrayOutputStream out = new ByteArrayOutputStream(size); bitmap.compress(Bitmap.CompressFormat.PNG, 100, out); @@ -154,10 +135,12 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { ContentValues values = new ContentValues(); values.put(PhotoDatabaseHelper.FIELD_APPWIDGET_ID, appWidgetId); - values.put(PhotoDatabaseHelper.FIELD_PHOTO_BLOB, out.toByteArray()); + values.put(PhotoDatabaseHelper.FIELD_PHOTO_BLOB, + out.toByteArray()); SQLiteDatabase db = getWritableDatabase(); - db.insertOrThrow(PhotoDatabaseHelper.TABLE_PHOTOS, null, values); + db.insertOrThrow(PhotoDatabaseHelper.TABLE_PHOTOS, null, + values); success = true; } catch (SQLiteException e) { @@ -165,7 +148,7 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { } catch (IOException e) { Log.e(TAG, "Could not serialize photo", e); } - if (LOGD) Log.d(TAG, "setPhoto success="+success); + if (LOGD) Log.d(TAG, "setPhoto success=" + success); return success; } @@ -183,16 +166,20 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { Bitmap bitmap = null; try { SQLiteDatabase db = getReadableDatabase(); - String selection = String.format("%s=%d", FIELD_APPWIDGET_ID, appWidgetId); + String selection = String.format("%s=%d", FIELD_APPWIDGET_ID, + appWidgetId); c = db.query(TABLE_PHOTOS, PHOTOS_PROJECTION, selection, null, null, null, null, null); - if (c != null && LOGD) Log.d(TAG, "getPhoto query count="+c.getCount()); + if (c != null && LOGD) { + Log.d(TAG, "getPhoto query count=" + c.getCount()); + } if (c != null && c.moveToFirst()) { byte[] data = c.getBlob(INDEX_PHOTO_BLOB); if (data != null) { - bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); + bitmap = BitmapFactory.decodeByteArray(data, 0, + data.length); } } } catch (SQLiteException e) { @@ -211,7 +198,8 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider { public void deletePhoto(int appWidgetId) { try { SQLiteDatabase db = getWritableDatabase(); - String whereClause = String.format("%s=%d", FIELD_APPWIDGET_ID, appWidgetId); + String whereClause = String.format("%s=%d", FIELD_APPWIDGET_ID, + appWidgetId); db.delete(TABLE_PHOTOS, whereClause, null); } catch (SQLiteException e) { Log.e(TAG, "Could not delete photo from database", e); diff --git a/src/com/android/camera/PickWallpaper.java b/src/com/android/camera/PickWallpaper.java index e1fe784..b9bff5a 100644 --- a/src/com/android/camera/PickWallpaper.java +++ b/src/com/android/camera/PickWallpaper.java @@ -17,7 +17,8 @@ package com.android.camera; /** - * 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 PickWallpaper extends Wallpaper { } diff --git a/src/com/android/camera/VideoPreview.java b/src/com/android/camera/VideoPreview.java index aed1e89..fdcf9ad 100644 --- a/src/com/android/camera/VideoPreview.java +++ b/src/com/android/camera/VideoPreview.java @@ -28,9 +28,10 @@ class VideoPreview extends SurfaceView { private int mVerticalTileSize = 1; /** - * Setting the aspect ratio to this value means to not enforce an aspect ratio. + * Setting the aspect ratio to this value means to not enforce an aspect + * ratio. */ - public static float DONT_CARE = 0.0f; + public static final float DONT_CARE = 0.0f; public VideoPreview(Context context) { super(context); @@ -83,9 +84,12 @@ class VideoPreview extends SurfaceView { } else if (defaultRatio > mAspectRatio) { width = (int) (height * mAspectRatio); } - width = roundUpToTile(width, mHorizontalTileSize, widthSpecSize); - height = roundUpToTile(height, mVerticalTileSize, heightSpecSize); - Log.i("VideoPreview", "ar " + mAspectRatio + " setting size: " + width + 'x' + height); + width = roundUpToTile(width, mHorizontalTileSize, + widthSpecSize); + height = roundUpToTile(height, mVerticalTileSize, + heightSpecSize); + Log.i("VideoPreview", "ar " + mAspectRatio + + " setting size: " + width + 'x' + height); setMeasuredDimension(width, height); return; } @@ -94,6 +98,7 @@ class VideoPreview extends SurfaceView { } private int roundUpToTile(int dimension, int tileSize, int maxDimension) { - return Math.min(((dimension + tileSize - 1) / tileSize) * tileSize, maxDimension); + return Math.min(((dimension + tileSize - 1) / tileSize) + * tileSize, maxDimension); } } |