Search in sources :

Example 41 with Button

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();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Example 42 with Button

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();
            }
        }
    });
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) Activity(android.app.Activity) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 43 with Button

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);
}
Also used : Button(android.widget.Button)

Example 44 with Button

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);
    }
}
Also used : Button(android.widget.Button)

Example 45 with Button

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);
        }
    });
}
Also used : Button(android.widget.Button) Intent(android.content.Intent) List(java.util.List) View(android.view.View) ActionBar(android.app.ActionBar)

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