FileDocCategorySizeDatePackage
ManualActivity.javaAPI DocAndroid 5.1 API8105Thu Mar 12 22:22:42 GMT 2015com.android.test.hwuicompare

ManualActivity

public class ManualActivity extends CompareActivity

Fields Summary
private static final String
LOG_TAG
private android.widget.ImageView
mCompareImageView
private android.graphics.Bitmap
mCompareBitmap
private android.widget.TextView
mErrorTextView
private MainView
mSoftwareView
private static final int
COMPARE_VIEW_UNINITIALIZED
private static final int
COMPARE_VIEW_HARDWARE
private static final int
COMPARE_VIEW_SOFTWARE
private static final int
COMPARE_VIEW_HEATMAP
private int
mCompareImageViewState
private int
mLastCompareImageViewState
Runnable
mRunnable
private android.widget.Spinner[]
mSpinners
Constructors Summary
Methods Summary
private voidbuildSpinnerLayout()

        LinearLayout layout = (LinearLayout) findViewById(R.id.spinner_layout);
        String[][] mapsStrings = DisplayModifier.getStrings();
        mSpinners = new Spinner[mapsStrings.length];
        int index = 0;
        for (String[] spinnerValues : mapsStrings) {
            mSpinners[index] = new DisplayModifierSpinner(index);
            mSpinners[index].setAdapter(new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_dropdown_item, spinnerValues));
            layout.addView(mSpinners[index]);
            index++;
        }
        Log.d(LOG_TAG, "created " + index + " spinners");
    
protected booleanforceRecreateBitmaps()

        // continually recreate bitmaps to avoid modifying bitmaps currently being drawn
        return true;
    
protected voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);
        setContentView(R.layout.manual_layout);
        onCreateCommon(mRunnable);

        mSoftwareView = (MainView) findViewById(R.id.software_view);
        mSoftwareView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        mSoftwareView.setBackgroundColor(Color.WHITE);
        mSoftwareView.addDrawCallback(mDrawCallback);

        mCompareImageView = (ImageView) findViewById(R.id.compare_image_view);

        int width = getResources().getDimensionPixelSize(R.dimen.layer_width);
        int height = getResources().getDimensionPixelSize(R.dimen.layer_height);
        mCompareBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

        mErrorTextView = (TextView) findViewById(R.id.current_error);
        ((ImageButton) findViewById(R.id.next)).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                DisplayModifier.step();
                updateSpinners();
                redrawViews();
            }
        });
        ((ImageButton) findViewById(R.id.previous)).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                DisplayModifier.stepBack();
                updateSpinners();
                redrawViews();
            }
        });
        ((Button) findViewById(R.id.show_hardware_version))
                .setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mCompareImageViewState = COMPARE_VIEW_HARDWARE;
                        mHandler.post(mRunnable);
                    }
                });
        ((Button) findViewById(R.id.show_software_version))
                .setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mCompareImageViewState = COMPARE_VIEW_SOFTWARE;
                        mHandler.post(mRunnable);
                    }
                });
        ((Button) findViewById(R.id.show_error_heatmap)).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mCompareImageViewState = COMPARE_VIEW_HEATMAP;
                mHandler.post(mRunnable);
            }
        });

        buildSpinnerLayout();
    
private voidredrawViews()


       
        mHardwareView.invalidate();
        mSoftwareView.invalidate();
    
private voidupdateSpinners()

        int[] indices = DisplayModifier.getIndices();
        for (int i = 0; i < mSpinners.length; i++) {
            mSpinners[i].setSelection(indices[i]);
        }