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();
}
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;
}
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);
}
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);
}
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);
}
Aggregations