Android Open Source - min3d Splash Activity






From Project

Back to project page min3d.

License

The source code is released under:

MIT License

If you think the Android project min3d listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.min3d;
//from  w w  w  .j  a va  2 s .c  om
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.util.Linkify;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;


/**
 * Main menu activity
 * 
 * @author Lee
 */
public class SplashActivity extends ListActivity  
{
  private final int CONTEXTID_VIEWFILE = 0;
  private final int CONTEXTID_CANCEL = 1;
  
  private String _baseSourcePath = "http://code.google.com/p/min3d/source/browse/trunk/sampleProjects/min3dSampleProject1/src/min3d/sampleProject1/"; 
  
  class ItemVo
  {
    public String filename;
    public Class<?> cls;
    public String label;

    public ItemVo(String $label, Class<?> $class, String $filename)
    {
      label = $label;
      cls = $class;
      filename = $filename;
    }
  }  
  
  private ItemVo[] _items = {
      new ItemVo("\"Hello, Jupiter\"", ExampleRotatingPlanets.class, "ExampleRotatingPlanets.java"),
      new ItemVo("Minimal example", ExampleMostMinimal.class, "ExampleMostMinimal.java"),
      new ItemVo("Vertex colors", ExampleVertexColors.class, "ExampleVertexColors.java"),
      new ItemVo("Texture", ExampleTextures.class, "ExampleTextures.java"),
      new ItemVo("Usage of Vertices class", ExampleVerticesVariations.class, "ExampleVerticesVariations.java"),
      new ItemVo("Triangles, lines, points", ExampleRenderType.class, "ExampleRenderType.java"),
      new ItemVo("Camera, frustum (trackball)", ExampleCamera.class, "ExampleCamera.java"),
      new ItemVo("Multiple lights", ExampleMultipleLights.class, "ExampleMultipleLights.java"),
      new ItemVo("Animating vertices", ExampleAnimatingVertices.class, "ExampleAnimatingVertices.java"),
      new ItemVo("Rendering subset of faces", ExampleSubsetOfFaces.class, "ExampleSubsetOfFaces.java"),
      new ItemVo("Assigning textures dynamically", ExampleAssigningTexturesDynamically.class, "ExampleAssigningTexturesDynamically.java"),
      new ItemVo("MIP Mapping (on vs. off)", ExampleMipMap.class, "ExampleMipMap.java"),
      new ItemVo("Texture wrapping", ExampleTextureWrap.class, "ExampleTextureWrap.java"),
      new ItemVo("Multiple textures", ExampleMultiTexture.class, "ExampleMultiTexture.java"),
      new ItemVo("Texture offset", ExampleTextureOffset.class, "ExampleTextureOffset.java"),
      new ItemVo("3D inside layout", ExampleInsideLayout.class, "ExampleInsideLayout.java"),
      new ItemVo("Fog Example", ExampleFog.class, "ExampleFog.java"),
      new ItemVo("Transparent GL Surface", ExampleTransparentGlSurface.class, "TransparentActivity.java"),
      new ItemVo("Load model from .obj file", ExampleLoadObjFile.class, "ExampleLoadObjFile.java"),
      new ItemVo("Load multiple models from .obj file", ExampleLoadObjFileMultiple.class, "ExampleLoadObjFileMultiple.java"),
      new ItemVo("Load model from .3ds file", ExampleLoad3DSFile.class, "ExampleLoad3DSFile.java"),
      new ItemVo("Load animated .md2 file", ExampleLoadMD2File.class, "ExampleLoadMD2File.java"),
      new ItemVo("Keyframe animation", ExampleKeyframeAnimation.class, "ExampleKeyframeAnimation.java"),
      new ItemVo("Using the accelerometer", ExampleAccelerometer.class, "ExampleAccelerometer.java")
  };
  
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
      String[] strings = new String[_items.length];
      for (int i = 0; i < _items.length; i++) {
        strings[i] = _items[i].label;
      }
      
      super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_activity);
      setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, strings));
      
      TextView tv = (TextView) this.findViewById(R.id.splashTitle);
      Linkify.addLinks(tv, 0x07);
      
      registerForContextMenu(getListView());      
      
      // TEST ONLY:
      // this.startActivity( new Intent(this, ExampleTransparentGlSurface.class ) );
    }
    
    @Override
    public void onListItemClick(ListView parent, View v, int position, long id)
    {
      this.startActivity( new Intent(this, _items[position].cls ) );
    }
    
    //
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
        super.onCreateOptionsMenu(menu);

        int i = 0;
        menu.add(0, 0, i++, "project home");
        menu.add(0, 1, i++, "author blog");

        return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) 
    {
      Intent i;
      
        switch (item.getItemId()) 
        {
            case 0:
              i = new Intent(Intent.ACTION_VIEW);
              i.setData(Uri.parse( this.getResources().getString(R.string.projectUrl) ));
              startActivity(i);                
              return true;
                
            case 1:
              i = new Intent(Intent.ACTION_VIEW);
              i.setData(Uri.parse( this.getResources().getString(R.string.myBlogUrl) ));
              startActivity(i);                
              return true;
        }
        return false;
    }
    
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) 
    {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(0, CONTEXTID_VIEWFILE, 0, "View source on Google Code");
    menu.add(0, CONTEXTID_CANCEL, 0, "Cancel");
    }

    @Override
  public boolean onContextItemSelected(MenuItem item) 
  {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    
    switch (item.getItemId()) 
    {
      case CONTEXTID_VIEWFILE:
              Intent i = new Intent(Intent.ACTION_VIEW);
              String url = _baseSourcePath + _items[ (int)info.id ].filename;
              i.setData(Uri.parse(url));
              startActivity(i);                
        return true;
      case CONTEXTID_CANCEL:
        // do nothing
        return true;
        
      default:
        return super.onContextItemSelected(item);
    }
  }    
}




Java Source Code List

com.min3d.ApplicationTest.java
com.min3d.ExampleAccelerometer.java
com.min3d.ExampleAnimatedTexture.java
com.min3d.ExampleAnimatingVertices.java
com.min3d.ExampleAssigningTexturesDynamically.java
com.min3d.ExampleCamera.java
com.min3d.ExampleFog.java
com.min3d.ExampleFromScratch.java
com.min3d.ExampleInsideLayout.java
com.min3d.ExampleKeyframeAnimation.java
com.min3d.ExampleLightProperties.java
com.min3d.ExampleLoad3DSFile.java
com.min3d.ExampleLoadMD2File.java
com.min3d.ExampleLoadObjFileMultiple.java
com.min3d.ExampleLoadObjFile.java
com.min3d.ExampleMipMap.java
com.min3d.ExampleMostMinimal.java
com.min3d.ExampleMultiTexture.java
com.min3d.ExampleMultipleLights.java
com.min3d.ExampleRenderType.java
com.min3d.ExampleRotatingPlanets.java
com.min3d.ExampleSubsetOfFaces.java
com.min3d.ExampleTextureOffset.java
com.min3d.ExampleTextureWrap.java
com.min3d.ExampleTextures.java
com.min3d.ExampleTransparentGlSurface.java
com.min3d.ExampleVertexColors.java
com.min3d.ExampleVerticesVariations.java
com.min3d.ScratchActivity.java
com.min3d.SplashActivity.java
com.min3d.lib.AParser.java
com.min3d.lib.ApplicationTest.java
com.min3d.lib.IParser.java
com.min3d.lib.LittleEndianDataInputStream.java
com.min3d.lib.MD2Parser.java
com.min3d.lib.Max3DSParser.java
com.min3d.lib.Min3d.java
com.min3d.lib.ObjParser.java
com.min3d.lib.ParseObjectData.java
com.min3d.lib.ParseObjectFace.java
com.min3d.lib.Parser.java
com.min3d.lib.Shared.java
com.min3d.lib.Utils.java
com.min3d.lib.animation.AnimationObject3d.java
com.min3d.lib.animation.KeyFrame.java
com.min3d.lib.core.Color4BufferList.java
com.min3d.lib.core.FacesBufferedList.java
com.min3d.lib.core.ManagedLightList.java
com.min3d.lib.core.Number3dBufferList.java
com.min3d.lib.core.Object3dContainer.java
com.min3d.lib.core.Object3d.java
com.min3d.lib.core.RenderCaps.java
com.min3d.lib.core.RendererActivity.java
com.min3d.lib.core.Renderer.java
com.min3d.lib.core.Scene.java
com.min3d.lib.core.TextureList.java
com.min3d.lib.core.TextureManager.java
com.min3d.lib.core.UvBufferList.java
com.min3d.lib.core.Vertices.java
com.min3d.lib.interfaces.IDirtyManaged.java
com.min3d.lib.interfaces.IDirtyParent.java
com.min3d.lib.interfaces.IObject3dContainer.java
com.min3d.lib.interfaces.ISceneController.java
com.min3d.lib.objectPrimitives.Box.java
com.min3d.lib.objectPrimitives.HollowCylinder.java
com.min3d.lib.objectPrimitives.Rectangle.java
com.min3d.lib.objectPrimitives.SkyBox.java
com.min3d.lib.objectPrimitives.Sphere.java
com.min3d.lib.objectPrimitives.Torus.java
com.min3d.lib.vos.AbstractDirtyManaged.java
com.min3d.lib.vos.BooleanManaged.java
com.min3d.lib.vos.CameraVo.java
com.min3d.lib.vos.Color4Managed.java
com.min3d.lib.vos.Color4.java
com.min3d.lib.vos.Face.java
com.min3d.lib.vos.FloatManaged.java
com.min3d.lib.vos.FogType.java
com.min3d.lib.vos.FrustumManaged.java
com.min3d.lib.vos.LightType.java
com.min3d.lib.vos.Light.java
com.min3d.lib.vos.Number3dManaged.java
com.min3d.lib.vos.Number3d.java
com.min3d.lib.vos.RenderType.java
com.min3d.lib.vos.ShadeModelManaged.java
com.min3d.lib.vos.ShadeModel.java
com.min3d.lib.vos.TexEnvxVo.java
com.min3d.lib.vos.TextureVo.java
com.min3d.lib.vos.Uv.java
com.min3d.lib.vos.Vertex3d.java