use of android.widget.RadioButton in project enroscar by stanfy.
the class RelativeRadioGroup method addView.
@Override
public void addView(final View child, final int index, final ViewGroup.LayoutParams params) {
if (child instanceof RadioButton) {
final RadioButton button = (RadioButton) child;
if (button.isChecked()) {
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
setCheckedId(button.getId());
}
}
super.addView(child, index, params);
}
use of android.widget.RadioButton in project Shuttle by timusus.
the class TracksListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.tracks_row_layout, parent, false);
holder = new Holder((TextView) convertView.findViewById(R.id.text), (RadioButton) convertView.findViewById(R.id.radio));
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.radio.setTag(position);
holder.radio.setChecked(mSelectedPosition == position);
convertView.setOnClickListener(this);
holder.label.setText(mTracks.get(position).getName());
return convertView;
}
use of android.widget.RadioButton in project coursera-android by aporter.
the class SamplerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//
final ImageButton button = (ImageButton) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Show Toast message
Toast.makeText(SamplerActivity.this, "Beep Bop", Toast.LENGTH_SHORT).show();
}
});
final EditText edittext = (EditText) findViewById(R.id.edittext);
edittext.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "Done" button
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
// Show Toast message
Toast.makeText(SamplerActivity.this, edittext.getText(), Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
});
final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
checkbox.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Show Toast message indicating the CheckBox's Checked state
if (((CheckBox) v).isChecked()) {
Toast.makeText(SamplerActivity.this, "CheckBox checked", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(SamplerActivity.this, "CheckBox not checked", Toast.LENGTH_SHORT).show();
}
}
});
final RadioButton radio_red = (RadioButton) findViewById(R.id.radio_red);
final RadioButton radio_blue = (RadioButton) findViewById(R.id.radio_blue);
radio_red.setOnClickListener(radio_listener);
radio_blue.setOnClickListener(radio_listener);
final ToggleButton togglebutton = (ToggleButton) findViewById(R.id.togglebutton);
togglebutton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Perform action on clicks
if (togglebutton.isChecked()) {
Toast.makeText(SamplerActivity.this, "ToggleButton checked", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(SamplerActivity.this, "ToggleButton not checked", Toast.LENGTH_SHORT).show();
}
}
});
final RatingBar ratingbar = (RatingBar) findViewById(R.id.ratingbar);
ratingbar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
Toast.makeText(SamplerActivity.this, "New Rating: " + rating, Toast.LENGTH_SHORT).show();
}
});
}
use of android.widget.RadioButton in project ARChon-Packager by bpear96.
the class activityInstalled method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.installed_list);
g.setstep(0);
//Open either file explorer
if (selection == 1) {
// Open file selector
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(intent, PICKFILE_RESULT_CODE);
}
if (selection == 0) {
AsyncTask<Void, Void, Void> task = new //Start progress dialog and run task in background
AsyncTask<Void, Void, Void>() {
@Override
protected void onPreExecute() {
pd = new ProgressDialog(activityInstalled.this);
pd.setTitle("Processing...");
pd.setMessage("Please wait.");
pd.setCancelable(false);
pd.setIndeterminate(true);
pd.show();
}
@Override
protected Void doInBackground(Void... arg0) {
//or list installed apps
//Create TreeMap to store list of apps.
map = new TreeMap<String, Button>();
// This is the id of the RadioGroup we defined
appButtonLayout = (ViewGroup) findViewById(R.id.installed_radio_group);
//Generate list of apps installed
List<PackageInfo> PackList = getPackageManager().getInstalledPackages(0);
for (int i = 0; i < PackList.size(); i++) {
PackageInfo PackInfo = PackList.get(i);
if ((PackInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
// Do not use system apps. Only user/data apps.
final String AppName = PackInfo.applicationInfo.loadLabel(getPackageManager()).toString();
RadioButton buttonr = new RadioButton(activityInstalled.this);
//Set text of button to applications name
buttonr.setText(AppName);
buttonr.setId(i);
//Put buttons in TreeMap
map.put(AppName, buttonr);
buttonr.setOnClickListener(new //When app radio button is selected
View.OnClickListener() {
@Override
public void onClick(View view) {
((RadioGroup) view.getParent()).check(view.getId());
//store AppID
SelectedAppId = view.getId();
//Store App name
SelectedAppName = AppName;
Toast.makeText(activityInstalled.this, "App selected.", Toast.LENGTH_LONG).show();
//Save variables for next fragment
// Sets global variable
g.setSelectedAppId(SelectedAppId);
g.setSelectedAppName(SelectedAppName);
AsyncTask<Void, Void, Void> task = new //Start progress dialog and run task in background
AsyncTask<Void, Void, Void>() {
@Override
protected void onPreExecute() {
pd = new ProgressDialog(activityInstalled.this);
pd.setTitle("Processing...");
pd.setMessage("Please wait.");
pd.setCancelable(false);
pd.setIndeterminate(true);
pd.show();
}
@Override
protected Void doInBackground(Void... arg0) {
pullAPk();
return null;
}
@Override
protected void onPostExecute(Void result) {
if (pd != null) {
pd.dismiss();
}
}
};
task.execute((Void[]) null);
}
});
}
}
return null;
}
@Override
protected void onPostExecute(Void result) {
if (pd != null) {
for (Button b : map.values()) {
//Add buttons in TreeMap to view.
appButtonLayout.addView(b);
}
pd.dismiss();
}
}
};
task.execute((Void[]) null);
}
}
use of android.widget.RadioButton in project grafika by google.
the class RecordFBOActivity method onRadioButtonClicked.
/**
* onClick handler for radio buttons.
*/
public void onRadioButtonClicked(View view) {
RadioButton rb = (RadioButton) view;
if (!rb.isChecked()) {
Log.d(TAG, "Got click on non-checked radio button");
return;
}
switch(rb.getId()) {
case R.id.recDrawTwice_radio:
mSelectedRecordMethod = RECMETHOD_DRAW_TWICE;
break;
case R.id.recFbo_radio:
mSelectedRecordMethod = RECMETHOD_FBO;
break;
case R.id.recFramebuffer_radio:
mSelectedRecordMethod = RECMETHOD_BLIT_FRAMEBUFFER;
break;
default:
throw new RuntimeException("Click from unknown id " + rb.getId());
}
Log.d(TAG, "Selected rec mode " + mSelectedRecordMethod);
RenderHandler rh = mRenderThread.getHandler();
if (rh != null) {
rh.setRecordMethod(mSelectedRecordMethod);
}
}
Aggregations