|
@@ -2,6 +2,7 @@ package app.brest.testmin3d;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
|
+import android.graphics.Bitmap;
|
|
import android.net.Uri;
|
|
import android.net.Uri;
|
|
import android.provider.ContactsContract;
|
|
import android.provider.ContactsContract;
|
|
import android.support.v4.view.MotionEventCompat;
|
|
import android.support.v4.view.MotionEventCompat;
|
|
@@ -24,7 +25,9 @@ import android.widget.VideoView;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
+import app.brest.app.brest.ui.MediaView;
|
|
import app.brest.utils.app.brest.game.Resource;
|
|
import app.brest.utils.app.brest.game.Resource;
|
|
|
|
+import app.brest.utils.files.FileManager;
|
|
import app.brest.utils.geometry.Point;
|
|
import app.brest.utils.geometry.Point;
|
|
import min3d.core.Object3d;
|
|
import min3d.core.Object3d;
|
|
import min3d.core.Object3dContainer;
|
|
import min3d.core.Object3dContainer;
|
|
@@ -50,6 +53,8 @@ public class ViewerActivity extends RendererActivity implements View.OnTouchList
|
|
private Button mButton;
|
|
private Button mButton;
|
|
private TextView mText;
|
|
private TextView mText;
|
|
private PhotoViewAttacher mAttacher;
|
|
private PhotoViewAttacher mAttacher;
|
|
|
|
+ private MediaView mMediaView;
|
|
|
|
+
|
|
protected float mPreviousX;
|
|
protected float mPreviousX;
|
|
protected float mPreviousY;
|
|
protected float mPreviousY;
|
|
protected float mPreviousDist=0;
|
|
protected float mPreviousDist=0;
|
|
@@ -65,7 +70,8 @@ public class ViewerActivity extends RendererActivity implements View.OnTouchList
|
|
mImageView = (ImageView) findViewById(R.id.imageView);
|
|
mImageView = (ImageView) findViewById(R.id.imageView);
|
|
mButton = (Button) findViewById(R.id.button_info);
|
|
mButton = (Button) findViewById(R.id.button_info);
|
|
mText = (TextView) findViewById(R.id.tv_comment);
|
|
mText = (TextView) findViewById(R.id.tv_comment);
|
|
-
|
|
|
|
|
|
+ mMediaView = new MediaView(this);
|
|
|
|
+ mFrameLayout.addView(mMediaView);
|
|
if(getIntent().hasExtra("resource"))
|
|
if(getIntent().hasExtra("resource"))
|
|
{
|
|
{
|
|
mResource = (Resource) getIntent().getSerializableExtra("resource");
|
|
mResource = (Resource) getIntent().getSerializableExtra("resource");
|
|
@@ -75,15 +81,21 @@ public class ViewerActivity extends RendererActivity implements View.OnTouchList
|
|
VideoView m_c = (VideoView)findViewById(R.id.vv_media);
|
|
VideoView m_c = (VideoView)findViewById(R.id.vv_media);
|
|
Button title = (Button)findViewById(R.id.b_title);
|
|
Button title = (Button)findViewById(R.id.b_title);
|
|
m_c.setVisibility(View.INVISIBLE);
|
|
m_c.setVisibility(View.INVISIBLE);
|
|
|
|
+ mMediaView.setVisibility(View.INVISIBLE);
|
|
if(mResource != null && !getIntent().hasExtra("information") && !getIntent().hasExtra("map"))
|
|
if(mResource != null && !getIntent().hasExtra("information") && !getIntent().hasExtra("map"))
|
|
{
|
|
{
|
|
Log.e("______", "Type="+mResource.getType());
|
|
Log.e("______", "Type="+mResource.getType());
|
|
title.setText(mResource.getTitle());
|
|
title.setText(mResource.getTitle());
|
|
if(mResource.getType().compareTo("Image")==0)
|
|
if(mResource.getType().compareTo("Image")==0)
|
|
{
|
|
{
|
|
- int id = getResources().getIdentifier(mResource.getName(),"drawable", getPackageName());
|
|
|
|
|
|
+ Bitmap bmp=null;
|
|
|
|
+ try {
|
|
|
|
+ bmp = FileManager.openImage(mResource.getName());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
|
|
- mImageView.setImageResource(id);
|
|
|
|
|
|
+ mImageView.setImageBitmap(bmp);
|
|
mAttacher = new PhotoViewAttacher(mImageView);
|
|
mAttacher = new PhotoViewAttacher(mImageView);
|
|
mAttacher.setMaximumScale(20);
|
|
mAttacher.setMaximumScale(20);
|
|
}
|
|
}
|
|
@@ -94,24 +106,38 @@ public class ViewerActivity extends RendererActivity implements View.OnTouchList
|
|
mc.setVisibility(View.INVISIBLE);
|
|
mc.setVisibility(View.INVISIBLE);
|
|
}else
|
|
}else
|
|
{
|
|
{
|
|
- String path="android.resource://app.brest.testmin3d/raw/"+mResource.getName();
|
|
|
|
|
|
+ String path=mResource.getName();
|
|
if(mResource.getType().compareTo("Audio")==0) path+="_audio";
|
|
if(mResource.getType().compareTo("Audio")==0) path+="_audio";
|
|
else path+="_video";
|
|
else path+="_video";
|
|
mImageView.setVisibility(View.INVISIBLE);
|
|
mImageView.setVisibility(View.INVISIBLE);
|
|
_glSurfaceView.setVisibility(View.INVISIBLE);
|
|
_glSurfaceView.setVisibility(View.INVISIBLE);
|
|
_glSurfaceView.setOnTouchListener(this);
|
|
_glSurfaceView.setOnTouchListener(this);
|
|
- VideoView mc = (VideoView)findViewById(R.id.vv_media);
|
|
|
|
|
|
+ mMediaView.setVisibility(View.VISIBLE);
|
|
|
|
+ /*VideoView mc = (VideoView)findViewById(R.id.vv_media);
|
|
|
|
+
|
|
mc.setVisibility(View.VISIBLE);
|
|
mc.setVisibility(View.VISIBLE);
|
|
- Uri video = Uri.parse(path);
|
|
|
|
- mc.setVideoURI(video);
|
|
|
|
- mc.start();
|
|
|
|
|
|
+ Uri video = null;
|
|
|
|
+ try {
|
|
|
|
+ video = FileManager.getUri(path);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //mc.setVideoURI(video);
|
|
|
|
+ mc.start();*/
|
|
|
|
+ mMediaView.play(path);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
} else if(getIntent().hasExtra("map") )
|
|
} else if(getIntent().hasExtra("map") )
|
|
{
|
|
{
|
|
- int id = getResources().getIdentifier(getIntent().getStringExtra("map"),"drawable", getPackageName());
|
|
|
|
|
|
+ Bitmap bmp=null;
|
|
|
|
+ try {
|
|
|
|
+ bmp = FileManager.openImage(mResource.getName());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
title.setText("Carte");
|
|
title.setText("Carte");
|
|
- mImageView.setImageResource(id);
|
|
|
|
|
|
+ mImageView.setImageBitmap(bmp);
|
|
mAttacher = new PhotoViewAttacher(mImageView);
|
|
mAttacher = new PhotoViewAttacher(mImageView);
|
|
mAttacher.setMaximumScale(20);
|
|
mAttacher.setMaximumScale(20);
|
|
mButton.setVisibility(View.INVISIBLE);
|
|
mButton.setVisibility(View.INVISIBLE);
|
|
@@ -134,6 +160,26 @@ public class ViewerActivity extends RendererActivity implements View.OnTouchList
|
|
startActivity(intent);
|
|
startActivity(intent);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ protected void onPause()
|
|
|
|
+ {
|
|
|
|
+ mMediaView.stop();
|
|
|
|
+ super.onPause();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void finish()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ mMediaView.stop();
|
|
|
|
+ super.finish();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void onDestroy()
|
|
|
|
+ {
|
|
|
|
+ mMediaView.stop();
|
|
|
|
+ super.onDestroy();
|
|
|
|
+ }
|
|
|
|
+
|
|
public void initScene()
|
|
public void initScene()
|
|
{
|
|
{
|
|
|
|
|