get rid of zoom controller. Will be replaced by toolbar button.

This commit is contained in:
Andy2 2010-06-28 06:29:27 -07:00
parent 85679dcb2a
commit 29aa4627e9
3 changed files with 4 additions and 65 deletions

View file

@ -196,8 +196,7 @@
<string name="summary_sort_tiles">Sort trays whenever new tiles
are added</string>
<string name="ringer_zoom">Volume keys zoom</string>
<string name="ringer_zoom_summary">Zoom board using volume keys
rather than an on-screen widget</string>
<string name="ringer_zoom_summary">Zoom board using volume keys</string>
<string name="role_standalone">Standalone</string>
<string name="role_host">Host</string>

View file

@ -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 );
}
}

View file

@ -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