1
0
Fork 0
mirror of https://github.com/vanitasvitae/Spherical synced 2025-09-10 10:49:42 +02:00

Add PhotoSphereMetadata and parser

This commit is contained in:
vanitasvitae 2017-09-13 01:10:29 +02:00
parent c74c40dc7c
commit 55fda0364a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 322 additions and 11 deletions

View file

@ -12,6 +12,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import de.trac.spherical.parser.PhotoSphereMetadata;
import de.trac.spherical.parser.SphereParser;
public class MainActivity extends AppCompatActivity {
@ -82,14 +83,14 @@ public class MainActivity extends AppCompatActivity {
try {
InputStream inputStream = getContentResolver().openInputStream(uri);
String xml = SphereParser.getXMLContent(inputStream);
PhotoSphereMetadata metadata = SphereParser.parse(xml);
boolean sphere = true; //TODO: parser.
if (sphere) {
if (metadata.isUsePanoramaViewer()) {
displayPhotoSphere(uri);
} else {
displayFlatImage(uri);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
@ -105,12 +106,9 @@ public class MainActivity extends AppCompatActivity {
try {
InputStream inputStream = getContentResolver().openInputStream(uri);
String xml = SphereParser.getXMLContent(inputStream);
PhotoSphereMetadata metadata = SphereParser.parse(xml);
if (xml != null) {
text.setText(xml);
} else {
text.setText("null");
}
displayPhotoSphere(getContentResolver().openInputStream(uri), metadata);
} catch (FileNotFoundException e) {
Log.e(TAG, "File not found.", e);
@ -121,6 +119,10 @@ public class MainActivity extends AppCompatActivity {
}
}
private void displayPhotoSphere(InputStream inputStream, PhotoSphereMetadata metadata) {
//Please fill me!
}
/**
* Display a flat image.
* @param uri