Search in sources :

Example 71 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class ManualActivity method onCreate.

@Override
protected void onCreate(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();
}
Also used : ImageButton(android.widget.ImageButton) ImageButton(android.widget.ImageButton) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 72 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class AbstractLayoutTest method create.

public View create(Context context, String name, int size) {
    Button result = new Button(context);
    result.setText(name);
    result.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            animate(v);
        }
    });
    return result;
}
Also used : Button(android.widget.Button) View(android.view.View)

Example 73 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class TimeDialogActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout layout = new FrameLayout(this);
    Button b = new Button(this);
    b.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
    b.setText("Show dialog");
    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new TimePickerDialog(TimeDialogActivity.this, null, 12, 12, true).show();
        }
    });
    layout.addView(b);
    setContentView(layout);
}
Also used : Button(android.widget.Button) FrameLayout(android.widget.FrameLayout) TimePickerDialog(android.app.TimePickerDialog) View(android.view.View)

Example 74 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class ViewPropertyAlphaActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_properties);
    getWindow().getDecorView().postDelayed(new Runnable() {

        @Override
        public void run() {
            startAnim(R.id.button);
            startAnim(R.id.textview);
            startAnim(R.id.spantext);
            startAnim(R.id.edittext);
            startAnim(R.id.selectedtext);
            startAnim(R.id.textviewbackground);
            startAnim(R.id.layout);
            startAnim(R.id.imageview);
            startAnim(myViewAlphaDefault);
            startAnim(myViewAlphaHandled);
            EditText selectedText = (EditText) findViewById(R.id.selectedtext);
            selectedText.setSelection(3, 8);
        }
    }, 2000);
    Button invalidator = (Button) findViewById(R.id.invalidateButton);
    invalidator.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            findViewById(R.id.textview).invalidate();
            findViewById(R.id.spantext).invalidate();
        }
    });
    TextView textView = (TextView) findViewById(R.id.spantext);
    if (textView != null) {
        SpannableStringBuilder text = new SpannableStringBuilder("Now this is a short text message with spans");
        text.setSpan(new BackgroundColorSpan(Color.RED), 0, 3, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        text.setSpan(new ForegroundColorSpan(Color.BLUE), 4, 9, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        text.setSpan(new SuggestionSpan(this, new String[] { "longer" }, 3), 11, 16, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        text.setSpan(new UnderlineSpan(), 17, 20, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        text.setSpan(new ImageSpan(this, R.drawable.icon), 21, 22, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        textView.setText(text);
    }
    LinearLayout container = (LinearLayout) findViewById(R.id.container);
    myViewAlphaDefault = new MyView(this, false);
    myViewAlphaDefault.setLayoutParams(new LinearLayout.LayoutParams(75, 75));
    container.addView(myViewAlphaDefault);
    myViewAlphaHandled = new MyView(this, true);
    myViewAlphaHandled.setLayoutParams(new LinearLayout.LayoutParams(75, 75));
    container.addView(myViewAlphaHandled);
}
Also used : EditText(android.widget.EditText) ForegroundColorSpan(android.text.style.ForegroundColorSpan) TextView(android.widget.TextView) View(android.view.View) UnderlineSpan(android.text.style.UnderlineSpan) Button(android.widget.Button) TextView(android.widget.TextView) SuggestionSpan(android.text.style.SuggestionSpan) SpannableStringBuilder(android.text.SpannableStringBuilder) BackgroundColorSpan(android.text.style.BackgroundColorSpan) LinearLayout(android.widget.LinearLayout) ImageSpan(android.text.style.ImageSpan)

Example 75 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class GetBitmapActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout content = new FrameLayout(this);
    mTextureView = new TextureView(this);
    mTextureView.setSurfaceTextureListener(this);
    Button button = new Button(this);
    button.setText("Copy bitmap to /sdcard/textureview.png");
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Bitmap b = mTextureView.getBitmap();
            try {
                FileOutputStream out = new FileOutputStream(Environment.getExternalStorageDirectory() + "/textureview.png");
                try {
                    b.compress(Bitmap.CompressFormat.PNG, 100, out);
                } finally {
                    try {
                        out.close();
                    } catch (IOException e) {
                    // Ignore
                    }
                }
            } catch (FileNotFoundException e) {
            // Ignore
            }
        }
    });
    content.addView(mTextureView, new FrameLayout.LayoutParams(500, 400, Gravity.CENTER));
    content.addView(button, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM));
    setContentView(content);
}
Also used : Bitmap(android.graphics.Bitmap) Button(android.widget.Button) FrameLayout(android.widget.FrameLayout) FileOutputStream(java.io.FileOutputStream) FileNotFoundException(java.io.FileNotFoundException) TextureView(android.view.TextureView) IOException(java.io.IOException) TextureView(android.view.TextureView) View(android.view.View)

Aggregations

Button (android.widget.Button)1477 View (android.view.View)909 TextView (android.widget.TextView)609 OnClickListener (android.view.View.OnClickListener)275 Intent (android.content.Intent)200 LinearLayout (android.widget.LinearLayout)189 ImageView (android.widget.ImageView)146 EditText (android.widget.EditText)126 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)76 ViewGroup (android.view.ViewGroup)65 LayoutInflater (android.view.LayoutInflater)56 CompoundButton (android.widget.CompoundButton)53 ScrollView (android.widget.ScrollView)53 Test (org.junit.Test)51 Bundle (android.os.Bundle)49 CheckBox (android.widget.CheckBox)48 FrameLayout (android.widget.FrameLayout)47 AlertDialog (android.app.AlertDialog)45 ImageButton (android.widget.ImageButton)45