use of android.widget.Button in project platform_frameworks_base by android.
the class AddColumn method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.add_column_in_table);
final Button addRowButton = (Button) findViewById(R.id.add_row_button);
addRowButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final TableLayout table = (TableLayout) findViewById(R.id.table);
final TableRow newRow = new TableRow(AddColumn.this);
for (int i = 0; i < 4; i++) {
final TextView view = new TextView(AddColumn.this);
view.setText("Column " + (i + 1));
view.setPadding(3, 3, 3, 3);
newRow.addView(view, new TableRow.LayoutParams());
}
table.addView(newRow, new TableLayout.LayoutParams());
newRow.requestLayout();
}
});
}
use of android.widget.Button in project platform_frameworks_base by android.
the class PrintErrorFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
CharSequence message = getArguments().getCharSequence(EXTRA_MESSAGE);
if (!TextUtils.isEmpty(message)) {
TextView messageView = (TextView) view.findViewById(R.id.message);
messageView.setText(message);
}
Button actionButton = (Button) view.findViewById(R.id.action_button);
final int action = getArguments().getInt(EXTRA_ACTION);
switch(action) {
case ACTION_RETRY:
{
actionButton.setVisibility(View.VISIBLE);
actionButton.setText(R.string.print_error_retry);
}
break;
case ACTION_NONE:
{
actionButton.setVisibility(View.GONE);
}
break;
}
actionButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Activity activity = getActivity();
if (activity instanceof OnActionListener) {
((OnActionListener) getActivity()).onActionPerformed();
}
}
});
}
use of android.widget.Button in project platform_frameworks_base by android.
the class SegmentedButtons method addButton.
public void addButton(int labelResId, int contentDescriptionResId, Object value) {
final Button b = inflateButton();
b.setTag(LABEL_RES_KEY, labelResId);
b.setText(labelResId);
b.setContentDescription(getResources().getString(contentDescriptionResId));
final LayoutParams lp = (LayoutParams) b.getLayoutParams();
if (getChildCount() == 0) {
// first button has no margin
lp.leftMargin = lp.rightMargin = 0;
}
b.setLayoutParams(lp);
addView(b);
b.setTag(value);
b.setOnClickListener(mClick);
Interaction.register(b, new Interaction.Callback() {
@Override
public void onInteraction() {
fireInteraction();
}
});
mSpTexts.add(b);
}
use of android.widget.Button in project platform_frameworks_base by android.
the class SegmentedButtons method updateLocale.
public void updateLocale() {
for (int i = 0; i < getChildCount(); i++) {
final Button b = (Button) getChildAt(i);
final int labelResId = (Integer) b.getTag(LABEL_RES_KEY);
b.setText(labelResId);
}
}
use of android.widget.Button in project Conversations by siacs.
the class WelcomeActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
if (getResources().getBoolean(R.bool.portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
final ActionBar ab = getActionBar();
if (ab != null) {
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayHomeAsUpEnabled(false);
}
final Button createAccount = (Button) findViewById(R.id.create_account);
createAccount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
}
});
final Button useOwnProvider = (Button) findViewById(R.id.use_own_provider);
useOwnProvider.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Account> accounts = xmppConnectionService.getAccounts();
Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class);
if (accounts.size() == 1) {
intent.putExtra("jid", accounts.get(0).getJid().toBareJid().toString());
intent.putExtra("init", true);
} else if (accounts.size() >= 1) {
intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class);
}
startActivity(intent);
}
});
}
Aggregations