PageRenderTime 27ms CodeModel.GetById 20ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/magnify/src/com/google/marvin/magnify/ZoomActivity.java

http://eyes-free.googlecode.com/
Java | 50 lines | 40 code | 10 blank | 0 comment | 0 complexity | 95a22aff8bb17d58b685cf26dfdffc7a MD5 | raw file
 1package com.google.marvin.magnify;
 2
 3import android.app.Activity;
 4import android.os.Bundle;
 5import android.util.Log;
 6import android.view.View;
 7import android.view.View.OnClickListener;
 8import android.widget.ZoomButton;
 9
10public class ZoomActivity extends Activity {
11  private static final String TAG = "ZoomActivity";
12
13  private ContrastView mContrast;
14  private ZoomButton mZoomIn;
15  private ZoomButton mZoomOut;
16  
17  @Override
18  public void onCreate(Bundle savedInstanceState) {
19    super.onCreate(savedInstanceState);
20    
21    Log.i(TAG, "Started " + TAG);
22
23    setContentView(R.layout.zoom);
24
25    mContrast = (ContrastView) findViewById(R.id.contrast);
26    mContrast.setContrast(2.0f);
27    mContrast.setBitmap(CaptureActivity.mBitmap); // HACKHACKHACK
28    
29    mZoomIn = (ZoomButton) findViewById(R.id.btn_zoom_up);
30    mZoomOut = (ZoomButton) findViewById(R.id.btn_zoom_down);
31    
32    mZoomIn.setOnClickListener(new OnClickListener() {
33      @Override
34      public void onClick(View v) {
35        int x = mContrast.getWidth() / 2;
36        int y = mContrast.getHeight() / 2;
37        mContrast.performZoom(x, y, 2.0f);
38      }
39    });
40    
41    mZoomOut.setOnClickListener(new OnClickListener() {
42      @Override
43      public void onClick(View v) {
44        int x = mContrast.getWidth() / 2;
45        int y = mContrast.getHeight() / 2;
46        mContrast.performZoom(x, y, 0.5f);
47      }
48    });
49  }
50}