Search in sources :

Example 31 with RadioGroup

use of android.widget.RadioGroup in project J2ME-Loader by nikita36078.

the class ChoiceGroup method getItemContentView.

@Override
public View getItemContentView() {
    Context context = getOwnerForm().getParentActivity();
    switch(choiceType) {
        case EXCLUSIVE:
            if (buttongroup == null) {
                buttongroup = new RadioGroup(context);
                initButtonGroup();
                ((RadioGroup) buttongroup).setOnCheckedChangeListener(radiolistener);
            }
            return buttongroup;
        case MULTIPLE:
            if (buttongroup == null) {
                buttongroup = new LinearLayout(context);
                initButtonGroup();
            }
            return buttongroup;
        case POPUP:
            if (spinner == null) {
                adapter = new CompoundSpinnerAdapter(context);
                spinner = new Spinner(context);
                spinner.setAdapter(adapter);
                int size = selected.size();
                for (int i = 0; i < size; i++) {
                    adapter.append(strings.get(i), images.get(i));
                }
                if (selectedIndex >= 0 && selectedIndex < selected.size()) {
                    spinner.setSelection(selectedIndex);
                }
                spinner.setOnItemSelectedListener(spinlistener);
            }
            return spinner;
        default:
            throw new InternalError();
    }
}
Also used : Context(android.content.Context) CompoundSpinnerAdapter(javax.microedition.lcdui.list.CompoundSpinnerAdapter) RadioGroup(android.widget.RadioGroup) Spinner(android.widget.Spinner) LinearLayout(android.widget.LinearLayout)

Example 32 with RadioGroup

use of android.widget.RadioGroup in project httpclient by pixmob.

the class CustomNavigation method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Used for theme switching in samples
    setTheme(SampleList.THEME);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text);
    ((TextView) findViewById(R.id.text)).setText(R.string.custom_navigation_content);
    // Inflate the custom view
    View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null);
    // Bind to its state change
    ((RadioGroup) customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show();
        }
    });
    // Attach to the action bar
    getSupportActionBar().setCustomView(customNav);
    getSupportActionBar().setDisplayShowCustomEnabled(true);
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 33 with RadioGroup

use of android.widget.RadioGroup in project cloudrail-si-android-sdk by CloudRail.

the class MainActivity method onClick.

@Override
public void onClick(View view) {
    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
    final Email service;
    switch(radioGroup.getCheckedRadioButtonId()) {
        case R.id.mailJetRadioButton:
            {
                service = mailJet;
                break;
            }
        case R.id.sendGridRadioButton:
            {
                service = sendGrid;
                break;
            }
        default:
            throw new RuntimeException("Unknown Button ID!!");
    }
    final String fromAdr = ((EditText) findViewById(R.id.senderEditText)).getText().toString().trim();
    final String fromName = fromAdr;
    String toAdresses = ((EditText) findViewById(R.id.receiverEditText)).getText().toString();
    final List<String> toAdressesList = Arrays.asList(toAdresses.split(","));
    for (String s : toAdressesList) {
        s = s.trim();
    }
    final String subject = ((EditText) findViewById(R.id.subjectEditText)).getText().toString().trim();
    final String textBody = ((EditText) findViewById(R.id.messageEditText)).getText().toString().trim();
    final String htmlBody = textBody;
    final List<String> ccAdresses = null;
    final List<String> bccAdresses = null;
    String serviceStr = "mailJet";
    if (service == sendGrid)
        serviceStr = "sendGrid";
    System.out.println("from: " + fromAdr + "  to: " + toAdresses + "  with" + serviceStr + "  subject: " + subject);
    new Thread(new Runnable() {

        @Override
        public void run() {
            service.sendEmail(fromAdr, fromName, toAdressesList, subject, textBody, htmlBody, ccAdresses, bccAdresses);
        }
    }).start();
}
Also used : EditText(android.widget.EditText) Email(com.cloudrail.si.interfaces.Email) RadioGroup(android.widget.RadioGroup)

Example 34 with RadioGroup

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

the class HugeBackupActivity method populateUI.

/**
     * Configure the UI based on our persistent data, creating the
     * data file and establishing defaults if necessary.
     */
void populateUI() {
    RandomAccessFile file;
    // Default values in case there's no data file yet
    int whichFilling = R.id.pastrami;
    boolean addMayo = false;
    boolean addTomato = false;
    /** Hold the data-access lock around access to the file */
    synchronized (HugeBackupActivity.sDataLock) {
        boolean exists = mDataFile.exists();
        try {
            file = new RandomAccessFile(mDataFile, "rw");
            if (exists) {
                Log.v(TAG, "datafile exists");
                whichFilling = file.readInt();
                addMayo = file.readBoolean();
                addTomato = file.readBoolean();
                Log.v(TAG, "  mayo=" + addMayo + " tomato=" + addTomato + " filling=" + whichFilling);
            } else {
                // The default values were configured above: write them
                // to the newly-created file.
                Log.v(TAG, "creating default datafile");
                writeDataToFileLocked(file, addMayo, addTomato, whichFilling);
                // We also need to perform an initial backup; ask for one
                mBackupManager.dataChanged();
            }
        } catch (IOException ioe) {
        }
    }
    /** Now that we've processed the file, build the UI outside the lock */
    mFillingGroup.check(whichFilling);
    mAddMayoCheckbox.setChecked(addMayo);
    mAddTomatoCheckbox.setChecked(addTomato);
    /**
         * We also want to record the new state when the user makes changes,
         * so install simple observers that do this
         */
    mFillingGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // As with the checkbox listeners, rewrite the
            // entire state file
            Log.v(TAG, "New radio item selected: " + checkedId);
            recordNewUIState();
        }
    });
    CompoundButton.OnCheckedChangeListener checkListener = new CompoundButton.OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // Whichever one is altered, we rewrite the entire UI state
            Log.v(TAG, "Checkbox toggled: " + buttonView);
            recordNewUIState();
        }
    };
    mAddMayoCheckbox.setOnCheckedChangeListener(checkListener);
    mAddTomatoCheckbox.setOnCheckedChangeListener(checkListener);
}
Also used : RandomAccessFile(java.io.RandomAccessFile) RadioGroup(android.widget.RadioGroup) IOException(java.io.IOException) CompoundButton(android.widget.CompoundButton)

Example 35 with RadioGroup

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

the class NotificationBuilderTest method getRadioTag.

private String getRadioTag(int id) {
    final RadioGroup g = (RadioGroup) findViewById(id);
    final View v = findViewById(g.getCheckedRadioButtonId());
    return (String) v.getTag();
}
Also used : RadioGroup(android.widget.RadioGroup) View(android.view.View)

Aggregations

RadioGroup (android.widget.RadioGroup)70 View (android.view.View)30 TextView (android.widget.TextView)23 RadioButton (android.widget.RadioButton)17 OnCheckedChangeListener (android.widget.RadioGroup.OnCheckedChangeListener)13 Button (android.widget.Button)10 CompoundButton (android.widget.CompoundButton)9 Validator (com.mobsandgeeks.saripaar.Validator)8 DialogInterface (android.content.DialogInterface)7 EditText (android.widget.EditText)7 Intent (android.content.Intent)6 AlertDialog (android.support.v7.app.AlertDialog)6 CheckBox (android.widget.CheckBox)6 LinearLayout (android.widget.LinearLayout)6 ImageView (android.widget.ImageView)5 IOException (java.io.IOException)5 RandomAccessFile (java.io.RandomAccessFile)5 Test (org.junit.Test)5 CardView (android.support.v7.widget.CardView)4 ScrollView (android.widget.ScrollView)4