|
@@ -1,41 +1,104 @@
|
|
package app.brest.testmin3d;
|
|
package app.brest.testmin3d;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
|
|
+import android.content.Intent;
|
|
|
|
+import android.provider.ContactsContract;
|
|
import android.support.v7.app.ActionBar;
|
|
import android.support.v7.app.ActionBar;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
import android.view.MotionEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.view.WindowManager;
|
|
|
|
+import android.widget.Button;
|
|
|
|
+import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
+import android.widget.TextView;
|
|
|
|
+
|
|
|
|
+import java.io.InputStream;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+
|
|
|
|
+import app.brest.utils.app.brest.game.Resource;
|
|
|
|
+import min3d.core.Object3d;
|
|
|
|
+import min3d.core.Object3dContainer;
|
|
|
|
+import min3d.core.RendererActivity;
|
|
|
|
+import min3d.parser.IParser;
|
|
|
|
+import min3d.parser.Parser;
|
|
|
|
+import min3d.vos.Light;
|
|
|
|
|
|
/**
|
|
/**
|
|
* An example full-screen activity that shows and hides the system UI (i.e.
|
|
* An example full-screen activity that shows and hides the system UI (i.e.
|
|
* status bar and navigation/system bar) with user interaction.
|
|
* status bar and navigation/system bar) with user interaction.
|
|
*/
|
|
*/
|
|
-public class ViewerActivity extends AppCompatActivity {
|
|
|
|
|
|
+public class ViewerActivity extends RendererActivity {
|
|
|
|
|
|
|
|
|
|
|
|
+ private Resource mResource;
|
|
|
|
+ private FrameLayout mFrameLayout;
|
|
|
|
+ private ImageView mImageView;
|
|
|
|
+ private Button mButton;
|
|
|
|
+ private TextView mText;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_viewer);
|
|
setContentView(R.layout.activity_viewer);
|
|
|
|
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
|
|
+ mFrameLayout = (FrameLayout) findViewById(R.id.frame_viewer);
|
|
|
|
+ mImageView = (ImageView) findViewById(R.id.imageView);
|
|
|
|
+ mButton = (Button) findViewById(R.id.button_info);
|
|
|
|
+ mText = (TextView) findViewById(R.id.tv_comment);
|
|
|
|
|
|
- //mControlsView = findViewById(R.id.fullscreen_content_controls);
|
|
|
|
- //mContentView = findViewById(R.id.fullscreen_content);
|
|
|
|
-
|
|
|
|
|
|
+ if(getIntent().hasExtra("resource"))
|
|
|
|
+ {
|
|
|
|
+ mResource = (Resource) getIntent().getSerializableExtra("resource");
|
|
|
|
+ setTitle(mResource.getTitle());
|
|
|
|
+ }
|
|
|
|
|
|
- // Set up the user interaction to manually show or hide the system UI.
|
|
|
|
|
|
+ if(mResource != null && !getIntent().hasExtra("information"))
|
|
|
|
+ {
|
|
|
|
+ if(mResource.getType().compareTo("Image")==0)
|
|
|
|
+ {
|
|
|
|
+ int id = getResources().getIdentifier(mResource.getName()+"_res","drawable", getPackageName());
|
|
|
|
+ mImageView.setImageResource(id);
|
|
|
|
+ }
|
|
|
|
+ else if(mResource.getType().compareTo("3D")==0)
|
|
|
|
+ {
|
|
|
|
+ mFrameLayout.addView(_glSurfaceView);
|
|
|
|
+ }
|
|
|
|
+ }else if(mResource != null)
|
|
|
|
+ {
|
|
|
|
+ mButton.setVisibility(View.INVISIBLE);
|
|
|
|
+ mText.setVisibility(View.VISIBLE);
|
|
|
|
+ mText.setText(mResource.getComment());
|
|
|
|
+ }
|
|
|
|
|
|
- // Upon interacting with UI controls, delay any scheduled hide()
|
|
|
|
- // operations to prevent the jarring behavior of controls going away
|
|
|
|
- // while interacting with the UI.
|
|
|
|
- //findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void onClickInfo(View v)
|
|
public void onClickInfo(View v)
|
|
{
|
|
{
|
|
- ImageView iv = (ImageView) findViewById(R.id.imageView);
|
|
|
|
|
|
+ Intent intent = new Intent(this, ViewerActivity.class);
|
|
|
|
+ intent.putExtra("resource", mResource);
|
|
|
|
+ intent.putExtra("information", true);
|
|
|
|
+ startActivity(intent);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void initScene()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ scene.backgroundColor().setAll(0x00000000);
|
|
|
|
+ scene.lights().add(new Light());
|
|
|
|
+ scene.lights().add(new Light());
|
|
|
|
+
|
|
|
|
+ Light myLight = new Light();
|
|
|
|
+ myLight.position.setZ(150);
|
|
|
|
+ scene.lights().add(myLight);
|
|
|
|
+ scene.addChild(mResource.get3DModel(this));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void updateScene() {
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|