1
0
Fork 0
mirror of https://github.com/vanitasvitae/Spherical synced 2024-11-22 04:12:07 +01:00

Refactoring

This commit is contained in:
vanitasvitae 2017-09-13 23:44:58 +02:00
parent 0a87451b6d
commit 92301a92b7
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 7 additions and 11 deletions

View file

@ -1,15 +1,11 @@
package de.trac.spherical; package de.trac.spherical;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.opengl.GLSurfaceView;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -17,7 +13,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import de.trac.spherical.parser.PhotoSphereMetadata; import de.trac.spherical.parser.PhotoSphereMetadata;
import de.trac.spherical.parser.SphereParser; import de.trac.spherical.parser.PhotoSphereParser;
import de.trac.spherical.rendering.Renderer; import de.trac.spherical.rendering.Renderer;
import de.trac.spherical.rendering.SphereSurfaceView; import de.trac.spherical.rendering.SphereSurfaceView;
@ -57,7 +53,7 @@ public class MainActivity extends AppCompatActivity {
/** /**
* Distinguish type of sent image. Images with the MIME type of a photosphere will be directly * Distinguish type of sent image. Images with the MIME type of a photosphere will be directly
* displayed, while images with MIME type image/* are being manually tested using {@link SphereParser}. * displayed, while images with MIME type image/* are being manually tested using {@link PhotoSphereParser}.
* @param intent incoming intent. * @param intent incoming intent.
*/ */
private void handleSentImageIntent(Intent intent) { private void handleSentImageIntent(Intent intent) {
@ -92,8 +88,8 @@ public class MainActivity extends AppCompatActivity {
private void displayMaybePhotoSphere(Uri uri) { private void displayMaybePhotoSphere(Uri uri) {
try { try {
InputStream inputStream = getContentResolver().openInputStream(uri); InputStream inputStream = getContentResolver().openInputStream(uri);
String xml = SphereParser.getXMLContent(inputStream); String xml = PhotoSphereParser.getXMLContent(inputStream);
PhotoSphereMetadata metadata = SphereParser.parse(xml); PhotoSphereMetadata metadata = PhotoSphereParser.parse(xml);
if (metadata == null || !metadata.isUsePanoramaViewer()) { if (metadata == null || !metadata.isUsePanoramaViewer()) {
displayFlatImage(getContentResolver().openInputStream(uri)); displayFlatImage(getContentResolver().openInputStream(uri));
@ -115,8 +111,8 @@ public class MainActivity extends AppCompatActivity {
private void displayPhotoSphere(Uri uri) { private void displayPhotoSphere(Uri uri) {
try { try {
InputStream inputStream = getContentResolver().openInputStream(uri); InputStream inputStream = getContentResolver().openInputStream(uri);
String xml = SphereParser.getXMLContent(inputStream); String xml = PhotoSphereParser.getXMLContent(inputStream);
PhotoSphereMetadata metadata = SphereParser.parse(xml); PhotoSphereMetadata metadata = PhotoSphereParser.parse(xml);
if (metadata == null) { if (metadata == null) {
Log.e(TAG, "Metadata is null. Fall back to flat image."); Log.e(TAG, "Metadata is null. Fall back to flat image.");

View file

@ -39,7 +39,7 @@ import static de.trac.spherical.parser.PhotoSphereMetadata.USE_PANORAMA_VIEWER;
/** /**
* ParserUtil that does stuff. * ParserUtil that does stuff.
*/ */
public class SphereParser { public class PhotoSphereParser {
private static final String TAG = "PhoSphePars"; private static final String TAG = "PhoSphePars";