diff options
author | Chih-Chung Chang <chihchung@google.com> | 2010-03-04 22:15:45 -0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2010-03-04 22:17:08 -0800 |
commit | e8697d7437c343e31e815fd4714238afafc7b1ac (patch) | |
tree | 9a6e849a010a897780b0748f19cd6c74d5536da9 /src/com/android/camera/MenuHelper.java | |
parent | e0f06cec51540a6b7d656fc540ba7f20f31d3e33 (diff) | |
download | LegacyCamera-e8697d7437c343e31e815fd4714238afafc7b1ac.zip LegacyCamera-e8697d7437c343e31e815fd4714238afafc7b1ac.tar.gz LegacyCamera-e8697d7437c343e31e815fd4714238afafc7b1ac.tar.bz2 |
Remove unused code.
This is for unbundling, will clean more later.
Diffstat (limited to 'src/com/android/camera/MenuHelper.java')
-rw-r--r-- | src/com/android/camera/MenuHelper.java | 204 |
1 files changed, 0 insertions, 204 deletions
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java index 4cdc912..822df8c 100644 --- a/src/com/android/camera/MenuHelper.java +++ b/src/com/android/camera/MenuHelper.java @@ -25,7 +25,6 @@ import android.content.Intent; import android.content.DialogInterface.OnClickListener; import android.location.Geocoder; import android.media.ExifInterface; -import android.media.MediaMetadataRetriever; import android.net.Uri; import android.os.Environment; import android.os.Handler; @@ -370,209 +369,6 @@ public class MenuHelper { private static boolean onDetailsClicked(MenuInvoker onInvoke, final Handler handler, final Activity activity) { - onInvoke.run(new MenuCallback() { - public void run(Uri u, IImage image) { - if (image == null) { - return; - } - - final AlertDialog.Builder builder = - new AlertDialog.Builder(activity); - - final View d = View.inflate(activity, R.layout.detailsview, - null); - - ImageView imageView = (ImageView) d.findViewById( - R.id.details_thumbnail_image); - imageView.setImageBitmap(image.miniThumbBitmap()); - - TextView textView = (TextView) d.findViewById( - R.id.details_image_title); - textView.setText(image.getTitle()); - - long length = getImageFileSize(image); - String lengthString = length < 0 - ? EMPTY_STRING - : Formatter.formatFileSize(activity, length); - ((TextView) d - .findViewById(R.id.details_file_size_value)) - .setText(lengthString); - - int dimensionWidth = 0; - int dimensionHeight = 0; - if (ImageManager.isImage(image)) { - // getWidth is much slower than reading from EXIF - dimensionWidth = image.getWidth(); - dimensionHeight = image.getHeight(); - d.findViewById(R.id.details_duration_row) - .setVisibility(View.GONE); - d.findViewById(R.id.details_frame_rate_row) - .setVisibility(View.GONE); - d.findViewById(R.id.details_bit_rate_row) - .setVisibility(View.GONE); - d.findViewById(R.id.details_format_row) - .setVisibility(View.GONE); - d.findViewById(R.id.details_codec_row) - .setVisibility(View.GONE); - } else { - MediaMetadataRetriever retriever - = new MediaMetadataRetriever(); - try { - retriever.setMode(MediaMetadataRetriever - .MODE_GET_METADATA_ONLY); - retriever.setDataSource(image.getDataPath()); - try { - dimensionWidth = Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_VIDEO_WIDTH)); - dimensionHeight = Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_VIDEO_HEIGHT)); - } catch (NumberFormatException e) { - dimensionWidth = 0; - dimensionHeight = 0; - } - - try { - int durationMs = Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_DURATION)); - String durationValue = formatDuration( - activity, durationMs); - ((TextView) d.findViewById( - R.id.details_duration_value)) - .setText(durationValue); - } catch (NumberFormatException e) { - d.findViewById( - R.id.details_frame_rate_row) - .setVisibility(View.GONE); - } - - try { - String frameRate = String.format( - activity.getString(R.string.details_fps), - Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_FRAME_RATE))); - ((TextView) d.findViewById( - R.id.details_frame_rate_value)) - .setText(frameRate); - } catch (NumberFormatException e) { - d.findViewById( - R.id.details_frame_rate_row) - .setVisibility(View.GONE); - } - - try { - long bitRate = Long.parseLong( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_BIT_RATE)); - String bps; - if (bitRate < 1000000) { - bps = String.format( - activity.getString( - R.string.details_kbps), - bitRate / 1000); - } else { - bps = String.format( - activity.getString( - R.string.details_mbps), - (bitRate) / 1000000.0); - } - ((TextView) d.findViewById( - R.id.details_bit_rate_value)) - .setText(bps); - } catch (NumberFormatException e) { - d.findViewById(R.id.details_bit_rate_row) - .setVisibility(View.GONE); - } - - String format = retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_VIDEO_FORMAT); - ((TextView) d.findViewById( - R.id.details_format_value)) - .setText(format); - - String codec = retriever.extractMetadata( - MediaMetadataRetriever.METADATA_KEY_CODEC); - if (codec != null) { - setDetailsValue(d, codec, R.id.details_codec_value); - } else { - hideDetailsRow(d, R.id.details_codec_row); - } - - } catch (RuntimeException ex) { - // Assume this is a corrupt video file. - } finally { - try { - retriever.release(); - } catch (RuntimeException ex) { - // Ignore failures while cleaning up. - } - } - } - - String value = null; - if (dimensionWidth > 0 && dimensionHeight > 0) { - value = String.format( - activity.getString(R.string.details_dimension_x), - dimensionWidth, dimensionHeight); - } - - if (value != null) { - setDetailsValue(d, value, R.id.details_resolution_value); - } else { - hideDetailsRow(d, R.id.details_resolution_row); - } - - value = EMPTY_STRING; - long dateTaken = image.getDateTaken(); - if (dateTaken != 0) { - Date date = new Date(image.getDateTaken()); - // Date/Time preferences are stored differently so we query them separately. - DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(activity); - DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(activity); - value = dateFormat.format(date) + ' ' + timeFormat.format(date); - } - if (value != EMPTY_STRING) { - setDetailsValue(d, value, R.id.details_date_taken_value); - } else { - hideDetailsRow(d, R.id.details_date_taken_row); - } - - // Show more EXIF header details for JPEG images. - if (JPEG_MIME_TYPE.equals(image.getMimeType())) { - showExifInformation(image, d, activity); - } else { - hideExifInformation(d); - } - - builder.setNeutralButton(R.string.details_ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, - int which) { - dialog.dismiss(); - } - }); - - handler.post( - new Runnable() { - public void run() { - builder.setIcon( - android.R.drawable.ic_dialog_info) - .setTitle(R.string.details_panel_title) - .setView(d) - .show(); - } - }); - } - }); return true; } |