Search in sources :

Example 71 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 72 with RadioButton

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

Example 73 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 74 with RadioButton

use of android.widget.RadioButton in project bdcodehelper by boredream.

the class IndicatorRadioGroup method setViewPager.

public void setViewPager(ViewPager vp, final int count) {
    if (vp == null || vp.getAdapter() == null) {
        return;
    }
    if (count <= 1) {
        setVisibility(View.GONE);
        return;
    }
    setVisibility(View.VISIBLE);
    vp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            if (getChildCount() > 1) {
                View child = getChildAt(position % count);
                if (child != null && child instanceof RadioButton) {
                    ((RadioButton) child).setChecked(true);
                }
            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    removeAllViews();
    for (int i = 0; i < count; i++) {
        RadioButton rb = new RadioButton(getContext());
        LayoutParams params = new LayoutParams(DisplayUtils.dp2px(getContext(), 6), DisplayUtils.dp2px(getContext(), 6));
        if (i > 0) {
            params.setMargins(DisplayUtils.dp2px(getContext(), 10), 0, 0, 0);
        }
        rb.setLayoutParams(params);
        rb.setButtonDrawable(new ColorDrawable());
        rb.setBackgroundResource(indicatorRes);
        rb.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                // do nothing
                return true;
            }
        });
        addView(rb);
    }
    ((RadioButton) getChildAt(0)).setChecked(true);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) RadioButton(android.widget.RadioButton) ViewPager(android.support.v4.view.ViewPager) View(android.view.View) MotionEvent(android.view.MotionEvent)

Example 75 with RadioButton

use of android.widget.RadioButton in project StatusBarCompat by niorgai.

the class MainActivity method changeButtonStatus.

private void changeButtonStatus(int index, boolean check) {
    RadioButton button;
    switch(index) {
        case PAGE_COMMON:
            button = mCommon;
            break;
        case PAGE_TRANSLUCENT:
            button = mTranslucent;
            break;
        case PAGE_COORDINATOR:
            button = mCoordinator;
            break;
        case PAGE_COLLAPSING_TOOLBAR:
            button = mCollapsingToolbar;
            break;
        default:
            button = mCommon;
    }
    button.setOnCheckedChangeListener(null);
    button.setChecked(check);
    button.setOnCheckedChangeListener(this);
    if (check) {
        button.setTextColor(ContextCompat.getColor(this, R.color.colorAccent));
    } else {
        button.setTextColor(ContextCompat.getColor(this, R.color.colorBlack));
    }
}
Also used : RadioButton(android.widget.RadioButton)

Aggregations

RadioButton (android.widget.RadioButton)198 View (android.view.View)100 TextView (android.widget.TextView)69 RadioGroup (android.widget.RadioGroup)43 Button (android.widget.Button)38 Intent (android.content.Intent)36 CheckBox (android.widget.CheckBox)28 EditText (android.widget.EditText)26 ImageView (android.widget.ImageView)21 CompoundButton (android.widget.CompoundButton)19 LayoutInflater (android.view.LayoutInflater)18 ViewGroup (android.view.ViewGroup)18 LinearLayout (android.widget.LinearLayout)17 Bundle (android.os.Bundle)16 AdapterView (android.widget.AdapterView)15 DialogInterface (android.content.DialogInterface)14 Context (android.content.Context)10 ScrollView (android.widget.ScrollView)10 ArrayList (java.util.ArrayList)10 SharedPreferences (android.content.SharedPreferences)9