Skip to content

Commit

Permalink
Capable of detecting and labeling panoramas
Browse files Browse the repository at this point in the history
also found where and what needs to be changed to be able to open them!
  • Loading branch information
ferminho committed Feb 1, 2015
1 parent b3f88d4 commit c8f4029
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ android {
dependencies {
compile "com.android.support:support-v13:21.0.+"
compile "com.android.support:support-v4:21.0.+"
compile 'com.google.android.gms:play-services-panorama:6.5.87'
compile "com.googlecode.mp4parser:isoparser:1.0-RC-15"
compile "com.adobe.xmp:xmpcore:5.1.2"
compile fileTree(dir: 'libs', include: ['*.jar'])
Expand Down
4 changes: 4 additions & 0 deletions src/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
android:largeHeap="true"
android:restoreAnyVersion="true"
android:supportsRtl="true">

<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<uses-library android:name="com.google.android.media.effects" android:required="false" />
<activity android:name="com.unifstudios.gallerylollipop.app.MovieActivity"
android:label="@string/movie_view_label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public PanoSupportListener (AlbumEntry entry) {
@Override
public void panoramaInfoAvailable(MediaObject mediaObject, boolean isPanorama,
boolean isPanorama360) {
if (mEntry != null) mEntry.isPanorama = isPanorama;
if (mEntry != null) {
mEntry.isPanorama = isPanorama;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.ExifInterface;
import android.net.Uri;
import android.provider.MediaStore;

import java.io.FileNotFoundException;
import java.io.IOException;

public class LightCycleHelper {
public static class PanoramaMetadata {
Expand All @@ -35,8 +43,28 @@ public PanoramaMetadata(boolean usePanoramaViewer, boolean isPanorama360) {

public static final PanoramaMetadata NOT_PANORAMA = new PanoramaMetadata(false, false);

private static final String PanoramaAttribute = "MeteringMode";
private static final int PanoramaAttributeValue = 65535;

public static PanoramaMetadata getPanoramaMetadata(Context context, Uri uri) {
return NOT_PANORAMA;
PanoramaMetadata metadata = NOT_PANORAMA;
try {
Cursor cursor = context.getContentResolver().query(
uri, new String[]{ MediaStore.Images.Media.DATA }, null, null, null);
int colIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String path = cursor.getString(colIndex);
cursor.close();

ExifInterface exifInterface = new ExifInterface(path);
int value = exifInterface.getAttributeInt(PanoramaAttribute, -1);
if (value == PanoramaAttributeValue) {
metadata = new PanoramaMetadata(true, true);
}
} catch (IOException e) {
}

return metadata;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public void onStop() {
}

public void showPanorama(Uri uri) {
/* Do nothing */
// FIXME : launch the pano viewer!
}
}

0 comments on commit c8f4029

Please sign in to comment.