AndroidResources.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package app.brest.utils;
  2. import android.app.Activity;
  3. import android.graphics.drawable.Drawable;
  4. import android.net.Uri;
  5. import android.view.View;
  6. import android.widget.VideoView;
  7. import java.net.URI;
  8. import app.brest.testmin3d.R;
  9. import min3d.core.Object3d;
  10. import min3d.parser.IParser;
  11. import min3d.parser.Parser;
  12. /**
  13. * Created by ptitcois on 14/03/17.
  14. */
  15. public class AndroidResources {
  16. public static Object3d getModel(Activity context, String name)
  17. {
  18. IParser myParser = Parser.createParser(Parser.Type.OBJ, context.getResources(), "app.brest.testmin3d:raw/"+name+"_obj",true);
  19. myParser.parse();
  20. return myParser.getParsedObject();
  21. }
  22. private static Uri _getAudioVideo(String name, String suffix)
  23. {
  24. String path="android.resource://app.brest.testmin3d/raw/"+name+"_"+suffix;
  25. return Uri.parse(path);
  26. }
  27. public static Uri getVideo(String name)
  28. {
  29. return _getAudioVideo(name, "video");
  30. }
  31. public static Uri getAudio(String name)
  32. {
  33. return _getAudioVideo(name, "audio");
  34. }
  35. public static Drawable getImage()
  36. {
  37. return null;
  38. }
  39. }