Search in sources :

Example 21 with RadioButton

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]);
}
Also used : SurfaceHolder(android.view.SurfaceHolder) RadioButton(android.widget.RadioButton) SurfaceView(android.view.SurfaceView)

Example 22 with RadioButton

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

Example 23 with RadioButton

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();
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Context(android.content.Context) LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) SharedPreferenceUtil(com.xiecc.seeWeather.common.utils.SharedPreferenceUtil) RadioButton(android.widget.RadioButton) R(com.xiecc.seeWeather.R) BaseApplication(com.xiecc.seeWeather.base.BaseApplication) Intent(android.content.Intent) CheckBoxPreference(android.preference.CheckBoxPreference) Observable(rx.Observable) SeekBar(android.widget.SeekBar) Func1(rx.functions.Func1) ImageLoader(com.xiecc.seeWeather.component.ImageLoader) View(android.view.View) RxUtils(com.xiecc.seeWeather.common.utils.RxUtils) RxBus(com.xiecc.seeWeather.component.RxBus) AutoUpdateService(com.xiecc.seeWeather.modules.service.AutoUpdateService) LayoutInflater(android.view.LayoutInflater) ChangeCityEvent(com.xiecc.seeWeather.modules.main.domain.ChangeCityEvent) MainActivity(com.xiecc.seeWeather.modules.main.ui.MainActivity) ViewGroup(android.view.ViewGroup) File(java.io.File) AlertDialog(android.support.v7.app.AlertDialog) TextView(android.widget.TextView) FileUtil(com.xiecc.seeWeather.common.utils.FileUtil) Preference(android.preference.Preference) PreferenceFragment(android.preference.PreferenceFragment) Notification(android.app.Notification) SimpleSubscriber(com.xiecc.seeWeather.common.utils.SimpleSubscriber) Snackbar(android.support.design.widget.Snackbar) FileSizeUtil(com.xiecc.seeWeather.common.utils.FileSizeUtil) Intent(android.content.Intent) RadioButton(android.widget.RadioButton) MainActivity(com.xiecc.seeWeather.modules.main.ui.MainActivity) ChangeCityEvent(com.xiecc.seeWeather.modules.main.domain.ChangeCityEvent) View(android.view.View) TextView(android.widget.TextView) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 24 with RadioButton

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

Example 25 with RadioButton

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...");
            }
        }
    });
}
Also used : EditText(android.widget.EditText) RadioButton(android.widget.RadioButton) Button(android.widget.Button) CheckBox(android.widget.CheckBox) Intent(android.content.Intent) RadioButton(android.widget.RadioButton) RemoteException(android.os.RemoteException) View(android.view.View)

Aggregations

RadioButton (android.widget.RadioButton)82 View (android.view.View)43 TextView (android.widget.TextView)30 Button (android.widget.Button)16 CheckBox (android.widget.CheckBox)15 RadioGroup (android.widget.RadioGroup)14 Intent (android.content.Intent)11 EditText (android.widget.EditText)11 Bundle (android.os.Bundle)10 ViewGroup (android.view.ViewGroup)8 CompoundButton (android.widget.CompoundButton)8 ImageView (android.widget.ImageView)7 ScrollView (android.widget.ScrollView)7 RemoteException (android.os.RemoteException)6 AdapterView (android.widget.AdapterView)6 Test (org.junit.Test)6 LayoutInflater (android.view.LayoutInflater)5 SeekBar (android.widget.SeekBar)5 OnClickListener (android.view.View.OnClickListener)4 OnCheckedChangeListener (android.widget.RadioGroup.OnCheckedChangeListener)4