diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 27a4bed3e..a9eec9287 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -196,8 +196,7 @@ Sort trays whenever new tiles are added Volume keys zoom - Zoom board using volume keys - rather than an on-screen widget + Zoom board using volume keys Standalone Host diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index e4a1f59da..798dad687 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -251,7 +251,6 @@ public class BoardActivity extends Activity implements UtilCtxt { m_view = (BoardView)findViewById( R.id.board_view ); m_volKeysZoom = CommonPrefs.getVolKeysZoom( this ); - m_view.setUseZoomControl( !m_volKeysZoom ); Intent intent = getIntent(); Uri uri = intent.getData(); @@ -341,7 +340,6 @@ public class BoardActivity extends Activity implements UtilCtxt { m_jniThread.handle( JNIThread.JNICmd.CMD_PREFS_CHANGE ); } } - m_view.setUseZoomControl( !m_volKeysZoom ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java index fe5397e29..8b473415a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java @@ -33,7 +33,6 @@ import android.view.MotionEvent; import android.graphics.drawable.Drawable; import android.content.res.Resources; import android.graphics.Paint.FontMetricsInt; -import android.widget.ZoomButtonsController; import android.os.Handler; import java.nio.IntBuffer; @@ -113,9 +112,6 @@ public class BoardView extends View implements DrawCtx, BoardHandler, private int[] m_bonusColors; private int[] m_playerColors; private int[] m_otherColors; - private ZoomButtonsController m_zoomButtons; - private boolean m_useZoomControl; - private boolean m_canZoom; // called when inflating xml public BoardView( Context context, AttributeSet attrs ) @@ -128,15 +124,13 @@ public class BoardView extends View implements DrawCtx, BoardHandler, { int action = event.getAction(); int xx = (int)event.getX() - m_left; - int yy = (int)event.getY() - getCurTop(); + int yy = (int)event.getY() - m_top; switch ( action ) { case MotionEvent.ACTION_DOWN: - enableZoomControlsIf(); m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy ); break; case MotionEvent.ACTION_MOVE: - enableZoomControlsIf(); m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_MOVE, xx, yy ); break; case MotionEvent.ACTION_UP: @@ -156,18 +150,11 @@ public class BoardView extends View implements DrawCtx, BoardHandler, { synchronized( this ) { if ( layoutBoardOnce() ) { - canvas.drawBitmap( m_bitmap, m_left, getCurTop(), m_drawPaint ); + canvas.drawBitmap( m_bitmap, m_left, m_top, m_drawPaint ); } } } - @Override - protected void onDetachedFromWindow() - { - m_zoomButtons.setVisible( false ); - super.onDetachedFromWindow(); - } - private void init( Context context ) { final float scale = getResources().getDisplayMetrics().density; @@ -201,33 +188,6 @@ public class BoardView extends View implements DrawCtx, BoardHandler, m_otherColors = prefs.otherColors; m_viewHandler = new Handler(); - m_zoomButtons = new ZoomButtonsController( this ); - ZoomButtonsController.OnZoomListener lstnr = - new ZoomButtonsController.OnZoomListener(){ - public void onVisibilityChanged( boolean visible ){} - public void onZoom( boolean zoomIn ) - { - if ( null != m_jniThread ) { - int zoomBy = zoomIn ? 1 : -1; - m_jniThread.handle( JNIThread.JNICmd.CMD_ZOOM, zoomBy ); - } - } - }; - m_zoomButtons.setOnZoomListener( lstnr ); - m_zoomButtons.setZoomSpeed( 100 ); // milliseconds - } - - protected void setUseZoomControl( boolean useZoomControl ) - { - m_useZoomControl = useZoomControl; - if ( !useZoomControl ) { - m_zoomButtons.setVisible( false ); - } - } - - private int getCurTop() - { - return m_useZoomControl ? 0 : m_top; } private BoardDims figureBoardDims( int width, int height, @@ -295,9 +255,6 @@ public class BoardView extends View implements DrawCtx, BoardHandler, m_letterRect = null; m_valRect = null; - // We hide zoom on change in orientation - m_zoomButtons.setVisible( false ); - BoardDims dims = figureBoardDims( width, height, m_gi ); m_left = dims.left; m_top = dims.top; @@ -315,15 +272,6 @@ public class BoardView extends View implements DrawCtx, BoardHandler, return layoutDone; } // layoutBoardOnce - private void enableZoomControlsIf() - { - if ( m_useZoomControl && m_canZoom ) { - if ( m_layoutWidth <= m_layoutHeight ) { - m_zoomButtons.setVisible( true ); - } - } - } - // BoardHandler interface implementation public void startHandling( JNIThread thread, int gamePtr, CurGameInfo gi ) { @@ -361,15 +309,9 @@ public class BoardView extends View implements DrawCtx, BoardHandler, } } + // Get rid of this if not wanted for disabling zoom toolbar button public void zoomChanged( final boolean[] canZoom ) { - m_viewHandler.post( new Runnable() { - public void run() { - m_zoomButtons.setZoomInEnabled( canZoom[0] ); - m_zoomButtons.setZoomOutEnabled( canZoom[1] ); - m_canZoom = canZoom[0] || canZoom[1]; - } - } ); } // DrawCtxt interface implementation