Skip to content
Snippets Groups Projects
Commit e4371fac authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Android: replace calls to the support.v4 library

parent 439c095d
No related branches found
No related tags found
No related merge requests found
...@@ -70,7 +70,6 @@ public class ModelFragment extends Fragment{ ...@@ -70,7 +70,6 @@ public class ModelFragment extends Fragment{
_glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); _glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
_glView.requestRender(); _glView.requestRender();
_hideDelay = new Handler(); _hideDelay = new Handler();
this.postDelay();
_gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() { _gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() {
public boolean onSingleTapUp(MotionEvent e) { return false; } // UNUSED Auto-generated method stub public boolean onSingleTapUp(MotionEvent e) { return false; } // UNUSED Auto-generated method stub
public void onShowPress(MotionEvent e) {} // UNUSED Auto-generated method stub public void onShowPress(MotionEvent e) {} // UNUSED Auto-generated method stub
...@@ -138,7 +137,7 @@ public class ModelFragment extends Fragment{ ...@@ -138,7 +137,7 @@ public class ModelFragment extends Fragment{
if(((ImageButton)v).getContentDescription().equals("play")) { if(((ImageButton)v).getContentDescription().equals("play")) {
((ImageButton)v).setContentDescription("pause"); ((ImageButton)v).setContentDescription("pause");
((ImageButton)v).setImageResource(android.R.drawable.ic_media_pause); ((ImageButton)v).setImageResource(android.R.drawable.ic_media_pause);
_animationStepper.setMax(_gmsh.numberOfAnimation()); _animationStepper.setMax(_gmsh.numberOfAnimation()-1);
_animation = new Timer(); _animation = new Timer();
_animation.schedule(new TimerTask() { _animation.schedule(new TimerTask() {
public void run() { public void run() {
...@@ -176,6 +175,7 @@ public class ModelFragment extends Fragment{ ...@@ -176,6 +175,7 @@ public class ModelFragment extends Fragment{
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
glViewLayout.addView(_controlBarLayout, layoutParams); glViewLayout.addView(_controlBarLayout, layoutParams);
this._controlBarLayout.setVisibility(View.INVISIBLE);
return rootView; return rootView;
} }
public void postDelay(int delay) { public void postDelay(int delay) {
...@@ -195,7 +195,7 @@ public class ModelFragment extends Fragment{ ...@@ -195,7 +195,7 @@ public class ModelFragment extends Fragment{
_controlBarLayout.startAnimation(bottomUp); _controlBarLayout.startAnimation(bottomUp);
} }
public void hideControlBar() { public void hideControlBar() {
if(getActivity() == null) return; if(getActivity() == null || View.INVISIBLE == _controlBarLayout.getVisibility()) return;
_hideDelay.removeCallbacks(hideControlsRunnable); _hideDelay.removeCallbacks(hideControlsRunnable);
Animation bottomDown = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out); Animation bottomDown = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
_controlBarLayout.startAnimation(bottomDown); _controlBarLayout.startAnimation(bottomDown);
......
...@@ -3,7 +3,6 @@ package org.geuz.onelab; ...@@ -3,7 +3,6 @@ package org.geuz.onelab;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.support.v4.view.MotionEventCompat;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector;
...@@ -47,10 +46,10 @@ class mGLSurfaceView extends GLSurfaceView { ...@@ -47,10 +46,10 @@ class mGLSurfaceView extends GLSurfaceView {
if(event.getPointerCount() >= 3){ if(event.getPointerCount() >= 3){
scaleGesture.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0,0, 0)); scaleGesture.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0,0, 0));
final float x = MotionEventCompat.getX(event, 1); final float x = event.getX(1);
final float y = MotionEventCompat.getY(event, 1); final float y = event.getY(1);
int action = MotionEventCompat.getActionMasked(event); int action = event.getActionMasked();
if(action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_1_DOWN){ if(action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_1_DOWN){
_renderer.startInteraction(x,y); _renderer.startInteraction(x,y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment