use of android.widget.RadioButton in project grafika by google.
the class HardwareScalerActivity method onRadioButtonClicked.
/**
* onClick handler for radio buttons.
*/
public void onRadioButtonClicked(View view) {
int newSize;
RadioButton rb = (RadioButton) view;
if (!rb.isChecked()) {
Log.d(TAG, "Got click on non-checked radio button");
return;
}
switch(rb.getId()) {
case R.id.surfaceSizeTiny_radio:
newSize = SURFACE_SIZE_TINY;
break;
case R.id.surfaceSizeSmall_radio:
newSize = SURFACE_SIZE_SMALL;
break;
case R.id.surfaceSizeMedium_radio:
newSize = SURFACE_SIZE_MEDIUM;
break;
case R.id.surfaceSizeFull_radio:
newSize = SURFACE_SIZE_FULL;
break;
default:
throw new RuntimeException("Click from unknown id " + rb.getId());
}
mSelectedSize = newSize;
int[] wh = mWindowWidthHeight[newSize];
// Update the Surface size. This causes a "surface changed" event, but does not
// destroy and re-create the Surface.
SurfaceView sv = (SurfaceView) findViewById(R.id.hardwareScaler_surfaceView);
SurfaceHolder sh = sv.getHolder();
Log.d(TAG, "setting size to " + wh[0] + "x" + wh[1]);
sh.setFixedSize(wh[0], wh[1]);
}
use of android.widget.RadioButton in project grafika by google.
the class RecordFBOActivity method updateControls.
/**
* Updates the on-screen controls to reflect the current state of the app.
*/
private void updateControls() {
Button toggleRelease = (Button) findViewById(R.id.fboRecord_button);
int id = mRecordingEnabled ? R.string.toggleRecordingOff : R.string.toggleRecordingOn;
toggleRelease.setText(id);
RadioButton rb;
rb = (RadioButton) findViewById(R.id.recDrawTwice_radio);
rb.setChecked(mSelectedRecordMethod == RECMETHOD_DRAW_TWICE);
rb = (RadioButton) findViewById(R.id.recFbo_radio);
rb.setChecked(mSelectedRecordMethod == RECMETHOD_FBO);
rb = (RadioButton) findViewById(R.id.recFramebuffer_radio);
rb.setChecked(mSelectedRecordMethod == RECMETHOD_BLIT_FRAMEBUFFER);
rb.setEnabled(mBlitFramebufferAllowed);
TextView tv = (TextView) findViewById(R.id.nowRecording_text);
if (mRecordingEnabled) {
tv.setText(getString(R.string.nowRecording));
} else {
tv.setText("");
}
}
use of android.widget.RadioButton in project SeeWeather by xcc3641.
the class SettingFragment method showIconDialog.
private void showIconDialog() {
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View dialogLayout = inflater.inflate(R.layout.icon_dialog, (ViewGroup) getActivity().findViewById(R.id.dialog_root));
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setView(dialogLayout);
final AlertDialog alertDialog = builder.create();
LinearLayout layoutTypeOne = (LinearLayout) dialogLayout.findViewById(R.id.layout_one);
layoutTypeOne.setClickable(true);
RadioButton radioTypeOne = (RadioButton) dialogLayout.findViewById(R.id.radio_one);
LinearLayout layoutTypeTwo = (LinearLayout) dialogLayout.findViewById(R.id.layout_two);
layoutTypeTwo.setClickable(true);
RadioButton radioTypeTwo = (RadioButton) dialogLayout.findViewById(R.id.radio_two);
TextView done = (TextView) dialogLayout.findViewById(R.id.done);
radioTypeOne.setClickable(false);
radioTypeTwo.setClickable(false);
alertDialog.show();
switch(mSharedPreferenceUtil.getIconType()) {
case 0:
radioTypeOne.setChecked(true);
radioTypeTwo.setChecked(false);
break;
case 1:
radioTypeOne.setChecked(false);
radioTypeTwo.setChecked(true);
break;
}
layoutTypeOne.setOnClickListener(v -> {
radioTypeOne.setChecked(true);
radioTypeTwo.setChecked(false);
});
layoutTypeTwo.setOnClickListener(v -> {
radioTypeOne.setChecked(false);
radioTypeTwo.setChecked(true);
});
done.setOnClickListener(v -> {
mSharedPreferenceUtil.setIconType(radioTypeOne.isChecked() ? 0 : 1);
String[] iconsText = getResources().getStringArray(R.array.icons);
mChangeIcons.setSummary(radioTypeOne.isChecked() ? iconsText[0] : iconsText[1]);
alertDialog.dismiss();
Snackbar.make(getView(), "切换成功,重启应用生效", Snackbar.LENGTH_INDEFINITE).setAction("重启", v1 -> {
Intent intent = new Intent(getActivity(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getActivity().startActivity(intent);
getActivity().finish();
RxBus.getDefault().post(new ChangeCityEvent());
}).show();
});
}
use of android.widget.RadioButton in project android_frameworks_base by DirtyUnicorns.
the class ElementLayoutActivity method createRadioButton.
private void createRadioButton() {
RadioButton button = new RadioButton(this);
button.setText("RadioButton:" + mRandom.nextInt());
mLayout.addView(button);
}
use of android.widget.RadioButton in project android_frameworks_base by AOSPA.
the class ClientTest method onCreate.
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button addpbtn = (Button) findViewById(R.id.addpkg);
Button procbtn = (Button) findViewById(R.id.procmsg);
Button delbtn = (Button) findViewById(R.id.delpkg);
Log.v(LOG_TAG, "activity created!!");
addpbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText app_id = (EditText) findViewById(R.id.app_id);
EditText cont = (EditText) findViewById(R.id.cont);
EditText pkg = (EditText) findViewById(R.id.pkg);
EditText cls = (EditText) findViewById(R.id.cls);
RadioButton act = (RadioButton) findViewById(R.id.act);
CheckBox sig = (CheckBox) findViewById(R.id.sig);
CheckBox ftr = (CheckBox) findViewById(R.id.ftr);
try {
if (!mWapPushMan.addPackage(app_id.getText().toString(), cont.getText().toString(), pkg.getText().toString(), cls.getText().toString(), act.isChecked() ? WapPushManagerParams.APP_TYPE_ACTIVITY : WapPushManagerParams.APP_TYPE_SERVICE, sig.isChecked(), ftr.isChecked())) {
Log.w(LOG_TAG, "remote add pkg failed...");
mWapPushMan.updatePackage(app_id.getText().toString(), cont.getText().toString(), pkg.getText().toString(), cls.getText().toString(), act.isChecked() ? WapPushManagerParams.APP_TYPE_ACTIVITY : WapPushManagerParams.APP_TYPE_SERVICE, sig.isChecked(), ftr.isChecked());
}
} catch (RemoteException e) {
Log.w(LOG_TAG, "remote func failed...");
}
}
});
delbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText app_id = (EditText) findViewById(R.id.app_id);
EditText cont = (EditText) findViewById(R.id.cont);
EditText pkg = (EditText) findViewById(R.id.pkg);
EditText cls = (EditText) findViewById(R.id.cls);
try {
mWapPushMan.deletePackage(app_id.getText().toString(), cont.getText().toString(), pkg.getText().toString(), cls.getText().toString());
// delall.isChecked());
} catch (RemoteException e) {
Log.w(LOG_TAG, "remote func failed...");
}
}
});
procbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText pdu = (EditText) findViewById(R.id.pdu);
EditText app_id = (EditText) findViewById(R.id.app_id);
EditText cont = (EditText) findViewById(R.id.cont);
// wap.dispatchWapPdu(strToHex(pdu.getText().toString()));
try {
Intent intent = new Intent();
intent.putExtra("transactionId", 0);
intent.putExtra("pduType", 6);
intent.putExtra("header", HexDump.hexStringToByteArray(pdu.getText().toString()));
intent.putExtra("data", HexDump.hexStringToByteArray(pdu.getText().toString()));
mWapPushMan.processMessage(app_id.getText().toString(), cont.getText().toString(), intent);
//HexDump.hexStringToByteArray(pdu.getText().toString()), 0, 6, 5, 5);
} catch (RemoteException e) {
Log.w(LOG_TAG, "remote func failed...");
}
}
});
}
Aggregations