use of android.widget.Button in project platform_frameworks_base by android.
the class BiDiTestGridLayoutCodeLtr method create.
public static View create(Context context) {
GridLayout layout = new GridLayout(context);
layout.setUseDefaultMargins(true);
layout.setAlignmentMode(ALIGN_BOUNDS);
layout.setRowOrderPreserved(false);
layout.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
Spec row1 = spec(0);
Spec row2 = spec(1);
Spec row3 = spec(2, BASELINE);
Spec row4 = spec(3, BASELINE);
// allow the last two rows to overlap the middle two
Spec row5 = spec(2, 3, FILL);
Spec row6 = spec(5);
Spec row7 = spec(6);
Spec col1a = spec(0, 4, CENTER);
Spec col1b = spec(0, 4, LEFT);
Spec col1c = spec(0, RIGHT);
Spec col2 = spec(1, START);
Spec col3 = spec(2, FILL);
Spec col4a = spec(3);
Spec col4b = spec(3, FILL);
{
TextView c = new TextView(context);
c.setTextSize(32);
c.setText("Email setup");
layout.addView(c, new GridLayout.LayoutParams(row1, col1a));
}
{
TextView c = new TextView(context);
c.setTextSize(16);
c.setText("You can configure email in just a few steps:");
layout.addView(c, new GridLayout.LayoutParams(row2, col1b));
}
{
TextView c = new TextView(context);
c.setText("Email address:");
layout.addView(c, new GridLayout.LayoutParams(row3, col1c));
}
{
EditText c = new EditText(context);
c.setEms(10);
c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
layout.addView(c, new GridLayout.LayoutParams(row3, col2));
}
{
TextView c = new TextView(context);
c.setText("Password:");
layout.addView(c, new GridLayout.LayoutParams(row4, col1c));
}
{
TextView c = new EditText(context);
c.setEms(8);
c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
layout.addView(c, new GridLayout.LayoutParams(row4, col2));
}
{
Space c = new Space(context);
layout.addView(c, new GridLayout.LayoutParams(row5, col3));
}
{
Button c = new Button(context);
c.setText("Manual setup");
layout.addView(c, new GridLayout.LayoutParams(row6, col4a));
}
{
Button c = new Button(context);
c.setText("Next");
layout.addView(c, new GridLayout.LayoutParams(row7, col4b));
}
return layout;
}
use of android.widget.Button in project androidannotations by androidannotations.
the class ClicksHandledActivityTest method buttonArgumentIsGiven.
@Test
public void buttonArgumentIsGiven() {
assertThat(activity.viewArgument).isNull();
Button button = (Button) activity.findViewById(R.id.buttonWithButtonArgument);
button.performClick();
assertThat(activity.viewArgument).isSameAs(button);
}
use of android.widget.Button in project MediaRouter-Cast-Button-android by googlecast.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Display buttons to launch other activities for MediaRouter use cases
Button button = (Button) findViewById(R.id.media_router_discovery);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterDiscoveryActivity");
startActivity(MediaRouterDiscoveryActivity.class);
}
});
button = (Button) findViewById(R.id.media_router_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterButtonActivity");
startActivity(MediaRouterButtonActivity.class);
}
});
button = (Button) findViewById(R.id.media_router_action_bar_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterActionBarButtonActivity");
startActivity(MediaRouterActionBarButtonActivity.class);
}
});
button = (Button) findViewById(R.id.media_router_custom_dialog_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterCustomDialogActivity");
startActivity(MediaRouterCustomDialogActivity.class);
}
});
}
use of android.widget.Button in project CastHelloText-android-v2 by googlecast.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
// When the user clicks on the button, use Android voice recognition to
// get text
Button voiceButton = (Button) findViewById(R.id.voiceButton);
voiceButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startVoiceRecognitionActivity();
}
});
// Configure Cast device discovery
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = new MediaRouteSelector.Builder().addControlCategory(CastMediaControlIntent.categoryForCast(getResources().getString(R.string.app_id))).build();
mMediaRouterCallback = new MyMediaRouterCallback();
}
use of android.widget.Button in project android-vision by googlesamples.
the class GooglyEyesActivity method onCreate.
//==============================================================================================
// Activity Methods
//==============================================================================================
/**
* Initializes the UI and initiates the creation of a face detector.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mPreview = (CameraSourcePreview) findViewById(R.id.preview);
mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);
final Button button = (Button) findViewById(R.id.flipButton);
button.setOnClickListener(mFlipButtonListener);
if (savedInstanceState != null) {
mIsFrontFacing = savedInstanceState.getBoolean("IsFrontFacing");
}
// Check for the camera permission before accessing the camera. If the
// permission is not granted yet, request permission.
int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
if (rc == PackageManager.PERMISSION_GRANTED) {
createCameraSource();
} else {
requestCameraPermission();
}
}
Aggregations