Java 类android.support.v7.widget.AppCompatRadioButton 实例源码

项目:okdownload    文件:QueueActivity.java   
private void initController(final View actionView, final TextView actionTv,
                            final AppCompatRadioButton serialRb,
                            final AppCompatRadioButton parallelRb,
                            final CardView deleteActionView, final View deleteActionTv) {
    final QueueController controller = new QueueController();
    this.controller = controller;
    controller.initTasks(this, new DownloadQueueListener() {
        @Override public void queueEnd() {
            actionView.setTag(null);
            actionTv.setText(R.string.start);
            // to cancel
            controller.stop();

            serialRb.setEnabled(true);
            parallelRb.setEnabled(true);

            deleteActionView.setEnabled(true);
            deleteActionView.setCardElevation((Float) deleteActionView.getTag());
            deleteActionTv.setEnabled(true);

            adapter.notifyDataSetChanged();
        }
    });

}
项目:AssistantBySDK    文件:SingleChooseDialog.java   
private void init() {
    mRgChoice.setVisibility(View.VISIBLE);
    mChoiceBox.setVisibility(View.GONE);
    mScdTitle.setText(title);
    for (int i = 0; i < datas.length; i++) {
        AppCompatRadioButton arb = new AppCompatRadioButton(mContext);
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, ScreenUtil.getInstance().dip2px(48));
        arb.setLayoutParams(layoutParams);
        arb.setGravity(Gravity.CENTER_VERTICAL);
        arb.setId(i);
        arb.setText(datas[i]);
        arb.setTextSize(15);
        arb.setTextColor(mContext.getResources().getColor(R.color.new_text_color_first));
        arb.setPadding(ScreenUtil.getInstance().dip2px(16), 0, 0, 0);
        if (i == 0)
            arb.setChecked(true);
        mRgChoice.addView(arb);
    }
}
项目:LockPattern    文件:DialogLPV.java   
private void setQuestionsGroupView(){
    LinearLayout.LayoutParams rglp = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    LinearLayout.LayoutParams rblp = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    mQuestionsGroup.setLayoutParams(rglp);
    ColorStateList colorStateList = new ColorStateList(
            new int[][]{
                    new int[]{mRadioBtnColor},
                    new int[]{mRadioBtnColor}
            },
            new int[]{mRadioBtnColor, mRadioBtnColor}
    );
    for (int i = 0; i < mQuestionsArray.length; i++) {
        AppCompatRadioButton rb = new AppCompatRadioButton(mContext);

        setQuestionItem(i, rb, rblp, colorStateList);
        mQuestionsGroup.addView(rb);
    }
}
项目:4pdaClient-plus    文件:BasePreferencesActivity.java   
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this,attrs);
            case "Spinner":
                return new AppCompatSpinner(this,attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this,attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this,attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this,attrs);
        }
    }

    return null;
}
项目:collect-mobile    文件:RadioCodeAttributeComponent.java   
private void addRadioButtons(final List<UiCode> codes) {
    uiHandler.post(new Runnable() {
        public void run() {
            Integer selectedViewId = null;
            for (int i = 0; i < codes.size(); i++) {
                UiCode code = codes.get(i);
                if (! enumerator || isAttributeCode(code)) { //if it's enumerator, show only selected code
                    RadioButton radioButton = new AppCompatRadioButton(context);
                    radioButton.setId(i + 1);
                    radioButton.setText(code.toString());
                    radioGroup.addView(radioButton);
                    codeByViewId.put(radioButton.getId(), code);
                    if (isAttributeCode(code)) {
                        selectedViewId = radioButton.getId();
                        radioButton.setSelected(true);
                    }
                }
            }
            if (selectedViewId != null) {
                radioGroup.check(selectedViewId);
            }
        }
    });
}
项目:WeatherDoge    文件:OptionsActivity.java   
@Nullable
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    // Provide colorized/tinted widgets on non-Material devices
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
        }
    }

    return null;
}
项目:okdownload    文件:QueueActivity.java   
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_queue);

    initQueueActivity(findViewById(R.id.actionView), (TextView) findViewById(R.id.actionTv),
            (AppCompatRadioButton) findViewById(R.id.serialRb),
            (AppCompatRadioButton) findViewById(R.id.parallelRb),
            (RecyclerView) findViewById(R.id.recyclerView),
            (CardView) findViewById(R.id.deleteActionView), findViewById(R.id.deleteActionTv));
}
项目:okdownload    文件:QueueActivity.java   
private void initQueueActivity(final View actionView, final TextView actionTv,
                               final AppCompatRadioButton serialRb,
                               final AppCompatRadioButton parallelRb,
                               RecyclerView recyclerView,
                               final CardView deleteActionView, final View deleteActionTv) {
    initController(actionView, actionTv, serialRb, parallelRb,
            deleteActionView, deleteActionTv);
    initRecyclerView(recyclerView);
    initAction(actionView, actionTv, serialRb, parallelRb, deleteActionView, deleteActionTv);
}
项目:AssistantBySDK    文件:ItemExpenseDialog.java   
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.account_sub_item, null);
    }
    TextView tv = (TextView) convertView.findViewById(R.id.account_sub_item_text);
    tv.setText(showSubItems.get(position).getName());
    AppCompatRadioButton acrb = (AppCompatRadioButton) convertView.findViewById(R.id.aitt_button);

    convertView.findViewById(R.id.account_sub_item).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            selectedSubItemId = showSubItems.get(position).getId();
            Log.i(TAG, "selectedSubItemId:>>>>>>" + selectedSubItemId);
            Log.i(TAG, "seletectedItemPosition:" + seletectedItemPosition);
            subAdapter.notifyDataSetChanged();
            String item = items.get(seletectedItemPosition).getItem() + (getSubItemById(selectedSubItemId) != null ? "," + getSubItemById(selectedSubItemId).getName() : "");
            if (mItemListener != null) {
                mItemListener.onItemSelected(item);
                 }
            cancel();
        }
    });
   // ((TextView) ((LinearLayout) convertView).getChildAt(0)).setText(showSubItems.get(position).getName());
    Log.i(TAG, "selectedSubItemId:" + selectedSubItemId);
    Log.i(TAG, "showSubItems.get(position).getId():" + showSubItems.get(position).getId());
    if (showSubItems.get(position).getId() == selectedSubItemId) {
        acrb.setVisibility(View.VISIBLE);
    } else {
        acrb.setVisibility(View.GONE);
    }
    return convertView;
}
项目:Sanxing    文件:SettingsActivity.java   
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        // If we're running pre-L, we need to 'inject' our tint aware Views in place of the
        // standard framework versions
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
        }
    }

    return null;
}
项目:spruce-android    文件:RadioGroupGridLayout.java   
public void onResume() {
    // reset to default
    AppCompatRadioButton activeRadioButton = this.activeRadioButton;
    clearCheckedChildren();
    this.activeRadioButton = activeRadioButton;
    this.activeRadioButton.setChecked(true);
}
项目:spruce-android    文件:RadioGroupGridLayout.java   
private void setChildrenOnClickListener(AppCompatRadioButton child) {
    GridLayout parent = (GridLayout) child.getParent();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View v = parent.getChildAt(i);
        if (v instanceof AppCompatRadioButton) {
            if (((RadioButton) v).isChecked()) {
                activeRadioButton = (AppCompatRadioButton) v;
            }
            v.setOnClickListener(this);
        }
    }
}
项目:spruce-android    文件:RadioGroupGridLayout.java   
private void clearCheckedChildren() {
    for (int i = 0; i < getChildCount(); i++) {
        if (getChildAt(i) instanceof AppCompatRadioButton) {
            ((AppCompatRadioButton) getChildAt(i)).setChecked(false);
        }
    }
}
项目:Watermark    文件:BucketAdapter.java   
BucketViewHolder(ViewGroup parent, View itemView) {
    super(itemView);
    this.mParentView = parent;
    mTvBucketName = (TextView) itemView.findViewById(R.id.tv_bucket_name);
    mIvBucketCover = (SquareImageView) itemView.findViewById(R.id.iv_bucket_cover);
    mRbSelected = (AppCompatRadioButton) itemView.findViewById(R.id.rb_selected);

    itemView.setOnClickListener(this);

    int checkTint = ThemeUtils.resolveColor(itemView.getContext(), R.attr.gallery_checkbox_button_tint_color, R.color.gallery_default_checkbox_button_tint_color);
    CompoundButtonCompat.setButtonTintList(mRbSelected, ColorStateList.valueOf(checkTint));
}
项目:QuestionnaireView    文件:RadioListAdapter.java   
public View getView(final int position, View convertView, ViewGroup parent) {
    Answer item = (Answer) getItem(position);
    if (convertView == null) {
        radioListItemView = (RadioListItemView)View.inflate(context, R.layout.radio_list_item, null);
    } else{
        radioListItemView = (RadioListItemView)convertView;
    }
    final AppCompatRadioButton radio = (AppCompatRadioButton)radioListItemView.findViewById(R.id.radio);
    radio.setChecked(item.isChecked());
    final TextView textView = (TextView)radioListItemView.findViewById(R.id.tv1);
    final RadioListItemView finalRadioListItemView = radioListItemView;
    textView.setText(item.getAnswer());

    radioListItemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setAnswer(position, finalRadioListItemView);
        }
    });
    radio.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setAnswer(position, finalRadioListItemView);
        }
    });

    return radioListItemView;
}
项目:QuestionnaireView    文件:RadioListItemView.java   
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    radioButton = (AppCompatRadioButton) findViewById(R.id.radio);
    textView = (AppCompatTextView)findViewById(R.id.tv1);

}
项目:Recognize-it    文件:AlbumFolderAdapter.java   
private FolderViewHolder(View itemView, int imageSize, ColorStateList selector, OnItemClickListener itemClickListener) {
    super(itemView);

    this.mImageSize = imageSize;
    this.mItemClickListener = itemClickListener;

    mIvImage = (ImageView) itemView.findViewById(R.id.iv_gallery_preview_image);
    mTvTitle = (TextView) itemView.findViewById(R.id.tv_gallery_preview_title);
    mCheckBox = (AppCompatRadioButton) itemView.findViewById(R.id.rb_gallery_preview_check);

    itemView.setOnClickListener(this);

    mCheckBox.setSupportButtonTintList(selector);
}
项目:FamilyBond    文件:RegisterActivity.java   
void initView() {
    mRegisterUsernameEditText = (EditText) findViewById(R.id.register_username_edit_text);
    mRegisterPasswordEditText = (EditText) findViewById(R.id.register_password_edit_text);
    mRegisterRepeatPasswordEditText = (EditText) findViewById(R.id.register_repeat_password_edit_text);
    mNextButton = (Button) findViewById(R.id.next_button);
    mRegisterCardView = (CardView) findViewById(R.id.register_card_view);
    mSwitchFab = (FloatingActionButton) findViewById(R.id.switch_fab);
    mRegisterProgressBar = (ProgressBar) findViewById(R.id.register_progress_bar);
    mChildrenClientRadioButton = (AppCompatRadioButton) findViewById(R.id.children_client_radio_button);
    mParentsClientRadioButton = (AppCompatRadioButton) findViewById(R.id.parents_client_radio_button);

    mNextButton.setOnClickListener(this);
    mSwitchFab.setOnClickListener(this);
}
项目:Liapp    文件:SettingsActivity.java   
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        // If we're running pre-L, we need to 'inject' our tint aware Views in place of the
        // standard framework versions
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
        }
    }

    return null;
}
项目:Status    文件:IconStyleAdapter.java   
public ViewHolder(View v) {
    super(v);
    this.v = v;
    edit = v.findViewById(R.id.edit);
    button = (AppCompatRadioButton) v.findViewById(R.id.radio);
    layout = (LinearLayout) v.findViewById(R.id.icons);
}
项目:radiocom-android    文件:CreateReport.java   
private void addRadioButton(RadioGroup group) {
    for (int i = 1; i < 6; i++) {
        AppCompatRadioButton radio = new AppCompatRadioButton(this);
        radio.setText(String.valueOf(i));
        radio.setTextColor(Color.WHITE);
        radio.setSupportButtonTintList(ColorStateList.valueOf(Color.WHITE));
        group.addView(radio);
    }
}
项目:LockPattern    文件:DialogLPV.java   
private void setQuestionItem(int pos, AppCompatRadioButton rb, ViewGroup.LayoutParams lp,
                             ColorStateList csl){
    rb.setLayoutParams(lp);
    rb.setTag(pos);
    rb.setTextColor(mTextColor);
    rb.setTextSize(mTextSize);
    rb.setText(mQuestionsArray[pos]);
    rb.setOnClickListener(onQuestionItemListener);
    rb.setSupportButtonTintList(csl);

    mQuestionRBtnsList.add(rb);
}
项目:Snapmatic-Life    文件:SettingsActivity.java   
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        // If we're running pre-L, we need to 'inject' our tint aware Views in place of the
        // standard framework versions
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
        }
    }

    return null;
}
项目:mage-android    文件:MageRadioGroup.java   
@Override
public String getPropertyValue() {
    String value = null;
    AppCompatRadioButton radioButton = (AppCompatRadioButton) findViewById(radioGroup.getCheckedRadioButtonId());
    if (radioButton != null) {
        value = (String) radioButton.getText();
    }
    return value;
}
项目:Android-Carbon-Forum    文件:AppCompatPreferenceActivity.java   
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        // If we're running pre-L, we need to 'inject' our tint aware Views in place of the
        // standard framework versions
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
        }
    }

    return null;
}
项目:CodeColors    文件:AppCompatDefStyleHandler.java   
@SuppressLint({"PrivateResource", "InlinedApi"})
@Override
protected int getDefaultViewDefStyleAttr(View view) {
    if (view instanceof AppCompatRadioButton) {
        return R.attr.radioButtonStyle;
    } else if (view instanceof AppCompatCheckBox) {
        return R.attr.checkboxStyle;
    } else if (view instanceof AppCompatButton) {
        return R.attr.buttonStyle;
    } else if (view instanceof AppCompatMultiAutoCompleteTextView) {
        return R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof AppCompatAutoCompleteTextView) {
        return R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof AppCompatEditText) {
        return R.attr.editTextStyle;
    } else if (view instanceof AppCompatCheckedTextView) {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ?
                android.R.attr.checkedTextViewStyle : 0;
    } else if (view instanceof AppCompatTextView) {
        return android.R.attr.textViewStyle;
    } else if (view instanceof AppCompatSpinner) {
        return R.attr.spinnerStyle;
    } else if (view instanceof AppCompatImageButton) {
        return R.attr.imageButtonStyle;
    } else if (view instanceof AppCompatRatingBar) {
        return R.attr.ratingBarStyle;
    } else if (view instanceof AppCompatSeekBar) {
        return R.attr.seekBarStyle;
    } else {
        return super.getDefaultViewDefStyleAttr(view);
    }
}
项目:Hentoid    文件:PrefsActivity.java   
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        // If we're running pre-L, we need to 'inject' our tint aware Views in place of the
        // standard framework versions
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
            default: // do nothing
                break;
        }
    }

    return null;
}
项目:AnimatedPieView    文件:PopupSetting.java   
private void findView() {
    switchDonuts = (SwitchCompat) findViewById(R.id.switch_donuts);
    switchText = (SwitchCompat) findViewById(R.id.switch_text);
    switchTouchAnimation = (SwitchCompat) findViewById(R.id.switch_touch_animation);
    switchDirectText = (SwitchCompat) findViewById(R.id.switch_direct_text);
    switchCanTouch = (SwitchCompat) findViewById(R.id.switch_can_touch);
    inputDuration = (TextInputLayout) findViewById(R.id.input_duration);
    inputStartAngle = (TextInputLayout) findViewById(R.id.input_start_angle);
    inputTouchScaleSize = (TextInputLayout) findViewById(R.id.input_touch_scale_size);
    inputTouchScaleUpDuration = (TextInputLayout) findViewById(R.id.input_touch_scale_up_duration);
    inputTouchScaleDownDuration = (TextInputLayout) findViewById(R.id.input_touch_scale_down_duration);
    inputTouchShadowRadius = (TextInputLayout) findViewById(R.id.input_touch_shadow_radius);
    inputTouchExpandAngle = (TextInputLayout) findViewById(R.id.input_touch_expand_angle);
    inputPieRadiusScale = (TextInputLayout) findViewById(R.id.input_pie_radius_scale);
    inputTextMarginLine = (TextInputLayout) findViewById(R.id.input_text_margin_line);
    inputTextSize = (TextInputLayout) findViewById(R.id.input_text_size);
    inputTextPointRadius = (TextInputLayout) findViewById(R.id.input_text_point_radius);
    inputTextLineStrokeWidth = (TextInputLayout) findViewById(R.id.input_text_line_stroke_width);
    inputTextLineTransitionLength = (TextInputLayout) findViewById(R.id.input_text_line_transition_length);
    inputTextLineStartMargin = (TextInputLayout) findViewById(R.id.input_text_line_start_margin);
    inputSplitAngle = (TextInputLayout) findViewById(R.id.input_split_angle);
    inputFocusAlphaType = (TextInputLayout) findViewById(R.id.input_focus_alpha_type);
    radioFocusWithAlpha = (AppCompatRadioButton) findViewById(R.id.radio_focus_with_alpha);
    radioFocusWithAlphaRev = (AppCompatRadioButton) findViewById(R.id.radio_focus_with_alpha_rev);
    radioFocusWithoutAlpha = (AppCompatRadioButton) findViewById(R.id.radio_focus_without_alpha);
    radioCapButt = (AppCompatRadioButton) findViewById(R.id.radio_paint_cap_butt);
    radioCapRound = (AppCompatRadioButton) findViewById(R.id.radio_paint_cap_round);
    radioCapSquare = (AppCompatRadioButton) findViewById(R.id.radio_paint_cap_square);

    btnOk = (Button) findViewById(R.id.btn_ok);

    switchDonuts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            switchDonuts.setText(isChecked ? "饼图(pie-chat)" : "甜甜圈(ring-chat)");
        }
    });

    btnOk.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (viewConfig != null) {
                dismiss(viewConfig);
                if (mOnClickListener != null) {
                    mOnClickListener.onClick(v);
                }
            }
        }
    });
}
项目:AssistantBySDK    文件:RingListDialog.java   
public RingHolder(View itemView) {
    super(itemView);
    tvRingName = (TextView) itemView.findViewById(R.id.list_speaker_text);
    btnFavor = (AppCompatRadioButton) itemView.findViewById(R.id.list_favorite_bt);
}
项目:AssistantBySDK    文件:ItemIncomeDialog.java   
@Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = inflater.inflate(R.layout.account_sub_item, null);
            }
            TextView tv = (TextView) convertView.findViewById(R.id.account_sub_item_text);
            tv.setTextColor(mContext.getResources().getColor(R.color.new_text_color_first));
            tv.setText(items.get(position).getItem());
            AppCompatRadioButton acrb = (AppCompatRadioButton) convertView.findViewById(R.id.aitt_button);

            convertView.findViewById(R.id.account_sub_item).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    seletectedItemPosition = position;
                    itemAdapter.notifyDataSetChanged();
                    if (seletectedItemPosition > -1) {
                        if (mItemListener != null) {
                            mItemListener.onIncomeSelected(items.get(seletectedItemPosition).getItem());
                        }
                    }
                    cancel();
                }
            });
            // ((TextView) ((LinearLayout) convertView).getChildAt(0)).setText(showSubItems.get(position).getName());
            if (position == seletectedItemPosition) {
                acrb.setVisibility(View.VISIBLE);
            } else {
                acrb.setVisibility(View.GONE);
            }
            return convertView;
//            if (convertView == null) {
//                convertView = new LinearLayout(mContext);
//
//                AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, dp2px(64));
//                convertView.setLayoutParams(lp);
//                ((LinearLayout) convertView).setOrientation(LinearLayout.HORIZONTAL);
//                TextView tv = new TextView(mContext);
//                tv.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
//                tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
//                tv.setTextColor(mContext.getResources().getColorStateList(R.color.new_text_color_first));
//                LinearLayout.LayoutParams llpt = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT);
//                llpt.weight = 1.0f;
//
//                LinearLayout.LayoutParams llpi = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
//                ImageView iv = new ImageView(mContext);
//                iv.setBackgroundResource(R.drawable.ic_green_checkbox);
//                iv.setVisibility(View.GONE);
//                llpi.gravity = Gravity.CENTER_VERTICAL;
//
//                ((LinearLayout) convertView).addView(tv, 0, llpt);
//                ((LinearLayout) convertView).addView(iv, 1, llpi);
//            }
//            ((TextView) ((LinearLayout) convertView).getChildAt(0)).setText(items.get(position).getItem());
//            if (position == seletectedItemPosition) {
//                ((LinearLayout) convertView).getChildAt(1).setVisibility(View.VISIBLE);
//            } else {
//                ((LinearLayout) convertView).getChildAt(1).setVisibility(View.GONE);
//            }
//            return convertView;
        }
项目:edslider    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    manager = new EdSliderManager(new SelectedListener());
    list = new ArrayList<String>();

    for (int i = 0; i < 6; i ++)
    {
        list.add("Button " + i);
    }

    recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(
            new LinearLayoutManager(MainActivity.this, LinearLayoutManager.VERTICAL, false));
    recyclerView.setAdapter(
            new MyAdapter(MainActivity.this, manager, list));

    layoutTest = (LinearLayout) findViewById(R.id.layoutTest);
    radioLeft = (AppCompatRadioButton) findViewById(R.id.radioLeft);
    radioRight = (AppCompatRadioButton) findViewById(R.id.radioRight);
    radioCenter = (AppCompatRadioButton) findViewById(R.id.radioCenter);
    radioTop = (AppCompatRadioButton) findViewById(R.id.radioTop);
    radioBottom = (AppCompatRadioButton) findViewById(R.id.radioBottom);
    button = (Button) findViewById(R.id.button);

    CheckChangedListener radioChangedListener = new CheckChangedListener();
    radioLeft.setOnCheckedChangeListener(radioChangedListener);
    radioRight.setOnCheckedChangeListener(radioChangedListener);
    radioCenter.setOnCheckedChangeListener(radioChangedListener);
    radioTop.setOnCheckedChangeListener(radioChangedListener);
    radioBottom.setOnCheckedChangeListener(radioChangedListener);

    button.setOnLongClickListener(new LongClickListener());
    alignHorizontal = Align.LEFT;
    alignVertical = Align.TOP;
}
项目:ScanLinks    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setElevation(0.0f);
    }

    new Prefs.Builder()
            .setContext(this)
            .setMode(ContextWrapper.MODE_PRIVATE)
            .setPrefsName(getPackageName())
            .setUseDefaultSharedPreference(true)
            .build();

    if (Prefs.getBoolean("firstRun", true)) {
        showFirstRunDialog();
    }

    if (!Prefs.getBoolean("firstRun", true)) {
        if (!checkIfDefault()) {
            showNotDefaultBrowserDialog();
        }
    }

    spinner = (AppCompatSpinner) findViewById(R.id.spinner1);
    radioButton1 = (AppCompatRadioButton) findViewById(R.id.radioButton1);
    radioButton2 = (AppCompatRadioButton) findViewById(R.id.radioButton2);
    radioButton3 = (AppCompatRadioButton) findViewById(R.id.radioButton3);
    checkBox1 = (AppCompatCheckBox)findViewById(R.id.checkBox1);
    button = (AppCompatButton)findViewById(R.id.button2);
    spinnerArray =  new ArrayList<>();

    loadPreferences();

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            savePreferences();
        }
    });


}
项目:spruce-android    文件:RadioGroupGridLayout.java   
@Override
public void onClick(View view) {
    final AppCompatRadioButton rb = (AppCompatRadioButton) view;
    if ( activeRadioButton != null ) {
        activeRadioButton.setChecked(false);
    }
    rb.setChecked(true);
    activeRadioButton = rb;

    switch (getCheckedRadioButtonId())
    {
        case R.id.top_left:
            position = RadialSort.Position.TOP_LEFT;
            break;
        case R.id.top_middle:
            position = RadialSort.Position.TOP_MIDDLE;
            break;
        case R.id.top_right:
            position = RadialSort.Position.TOP_RIGHT;
            break;
        case R.id.right:
            position = RadialSort.Position.RIGHT;
            break;
        case R.id.middle:
            position = RadialSort.Position.MIDDLE;
            break;
        case R.id.left:
            position = RadialSort.Position.LEFT;
            break;
        case R.id.bottom_left:
            position = RadialSort.Position.BOTTOM_LEFT;
            break;
        case R.id.bottom_middle:
            position = RadialSort.Position.BOTTOM_MIDDLE;
            break;
        case R.id.bottom_right:
            position = RadialSort.Position.BOTTOM_RIGHT;
            break;
    }
    listener.onRadioGroupChildChanged();
}
项目:spruce-android    文件:RadioGroupGridLayout.java   
@Override
public void addView(View child, ViewGroup.LayoutParams params) {
    super.addView(child, params);
    setChildrenOnClickListener((AppCompatRadioButton) child);
}
项目:Pocket-Plays-for-Twitch    文件:LayoutSelector.java   
private void init() {
    layoutSelectorView = activity.getLayoutInflater().inflate(R.layout.stream_layout_preview, null);
    final RadioGroup rg = (RadioGroup) layoutSelectorView.findViewById(R.id.layouts_radiogroup);
    final FrameLayout previewWrapper = (FrameLayout) layoutSelectorView.findViewById(R.id.preview_wrapper);

    if (previewMaxHeightRes != -1) {
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                (int) activity.getResources().getDimension(previewMaxHeightRes)
        );
        previewWrapper.setLayoutParams(lp);
        //previewWrapper.setMinimumHeight((int) activity.getResources().getDimension(previewMaxHeightRes));
    }

    ViewStub preview = (ViewStub) layoutSelectorView.findViewById(R.id.layout_stub);
    preview.setLayoutResource(previewLayout);
    final View inflated = preview.inflate();

    for (int i = 0; i < layoutTitles.length; i++) {
        final String layoutTitle = layoutTitles[i];

        final AppCompatRadioButton radioButton = new AppCompatRadioButton(activity);
        radioButton.setText(layoutTitle);

        final int finalI = i;
        radioButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectCallback.onSelected(layoutTitle, finalI, inflated);
            }
        });

        if (textColor != -1) {
            radioButton.setTextColor(Service.getColorAttribute(textColor, R.color.black_text, activity));

            ColorStateList colorStateList = new ColorStateList(
                    new int[][]{
                            new int[]{-android.R.attr.state_checked},
                            new int[]{android.R.attr.state_checked}
                    },
                    new int[]{

                            Color.GRAY, //Disabled
                            Service.getColorAttribute(R.attr.colorAccent, R.color.accent, activity), //Enabled
                    }
            );
            radioButton.setSupportButtonTintList(colorStateList);
        }


        radioButton.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, // Width
                (int) activity.getResources().getDimension(R.dimen.layout_selector_height) // Height
        ));


        rg.addView(radioButton, i);


        if ((selectedLayoutIndex != -1 && selectedLayoutIndex == i) || (selectedLayoutTitle != null && selectedLayoutTitle.equals(layoutTitle))) {
            radioButton.performClick();
        }
    }
}
项目:AC2RD    文件:Home.java   
private void onRefreshRecordServiceState()
 {
    boolean recordServiceState = monitoringManager.getRecordServiceState(getApplicationContext());

    TextView homeTelephoneCallRecorderStateTextView = (TextView) findViewById(R.id.home_telephone_call_recorder_state);
    AppCompatRadioButton homeTelephoneCallRecorderStateRadioButton = (AppCompatRadioButton) findViewById(R.id.home_telephone_call_recorder_state_value);
    TextView homeTelephoneCallRecorderActionValue = (TextView) findViewById(R.id.home_telephone_call_recorder_action_value);

    String stateValueDetail = getApplicationContext().getString(R.string.home_telephone_call_recorder_action_unknown);

    if(recordServiceState == true)
    {
        int recordType = monitoringManager.getRecordType(getApplicationContext());

        switch(recordType)
{
    case 0:
        stateValueDetail = getApplicationContext().getString(R.string.home_telephone_call_recorder_action_incoming_call);
        break;

    case 1:
        stateValueDetail = getApplicationContext().getString(R.string.home_telephone_call_recorder_action_outgoing_call);
        break;

    case 2:
        stateValueDetail = getApplicationContext().getString(R.string.home_telephone_call_recorder_action_microphone);
        break;
}

        microphoneStart.setEnabled(false);

        if(recordType == 2)
        {
            microphoneStop.setEnabled(true);
        }
        else
        {
            microphoneStop.setEnabled(false);
        }

        homeTelephoneCallRecorderStateTextView.setText(getApplicationContext().getString(R.string.home_telephone_call_recorder_state));
        homeTelephoneCallRecorderStateRadioButton.setChecked(true);
        homeTelephoneCallRecorderStateRadioButton.setText(getApplicationContext().getString(R.string.home_telephone_call_recorder_state_on));
        homeTelephoneCallRecorderActionValue.setText(stateValueDetail);
    }
    else
    {
        microphoneStart.setEnabled(true);
        microphoneStop.setEnabled(false);

        homeTelephoneCallRecorderStateTextView.setText(getApplicationContext().getString(R.string.home_telephone_call_recorder_state));
        homeTelephoneCallRecorderStateRadioButton.setChecked(false);
        homeTelephoneCallRecorderStateRadioButton.setText(getApplicationContext().getString(R.string.home_telephone_call_recorder_state_off));
        homeTelephoneCallRecorderActionValue.setText(stateValueDetail);
    }
 }
项目:TaskApp    文件:PriorityControlSet.java   
private void tintRadioButton(AppCompatRadioButton radioButton, int priority) {
    int color = checkBoxes.getPriorityColors().get(priority);
    radioButton.setSupportButtonTintList(new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_checked}, new int[]{android.R.attr.state_checked}},
            new int[]{color, color}));
}
项目:ResearchStack    文件:ConsentQuizQuestionStepLayout.java   
public void initializeStep() {
    setOrientation(VERTICAL);

    ConsentQuizModel.QuizQuestion question = step.getQuestion();
    LayoutInflater inflater = LayoutInflater.from(getContext());
    inflater.inflate(R.layout.rss_layout_quiz_question, this, true);

    ((TextView) findViewById(R.id.title)).setText(step.getTitle());

    radioGroup = (RadioGroup) findViewById(R.id.radio_group);

    submitBar = (SubmitBar) findViewById(R.id.submit_bar);
    submitBar.getNegativeActionView().setVisibility(GONE);

    resultTitle = (TextView) findViewById(R.id.quiz_result_title);
    resultSummary = (TextView) findViewById(R.id.quiz_result_summary);

    radioItemBackground = findViewById(R.id.quiz_result_item_background);

    if (question.getType().equals("instruction")) {
        TextView instructionText = (TextView) findViewById(R.id.instruction_text);
        instructionText.setText(question.getText());
        instructionText.setVisibility(VISIBLE);

        // instruction steps don't need submit, also always count as correct answer
        submitBar.setPositiveTitle(R.string.rsb_next);
        submitBar.setPositiveAction(v -> onNext(true));
    } else {
        submitBar.setPositiveTitle(R.string.rsb_submit);
        submitBar.setPositiveAction(v -> onSubmit());

        for (Choice<String> choice : getChoices(question)) {
            AppCompatRadioButton button = (AppCompatRadioButton) inflater.inflate(R.layout.rss_item_radio_quiz,
                    radioGroup,
                    false);
            button.setText(choice.getText());
            button.setTag(choice);
            radioGroup.addView(button);

            if (question.getExpectedAnswer().equals(choice.getValue())) {
                expectedChoice = choice;
            }
        }
    }
}
项目:mage-android    文件:MageRadioGroup.java   
public void addRadioButton(AppCompatRadioButton radioButton) {
    radioGroup.addView(radioButton);
}
项目:android_maplibui    文件:RadioGroup.java   
@Override
public void init(JSONObject element,
                 List<Field> fields,
                 Bundle savedState,
                 Cursor featureCursor,
                 SharedPreferences preferences) throws JSONException{

    JSONObject attributes = element.getJSONObject(JSON_ATTRIBUTES_KEY);
    mFieldName = attributes.getString(JSON_FIELD_NAME_KEY);
    mIsShowLast = ControlHelper.isSaveLastValue(attributes);
    boolean isEnabled = ControlHelper.isEnabled(fields, mFieldName);
    setEnabled(isEnabled);

    String lastValue = null;
    if (ControlHelper.hasKey(savedState, mFieldName))
        lastValue = savedState.getString(ControlHelper.getSavedStateKey(mFieldName));
    else if (null != featureCursor) { // feature exists
        int column = featureCursor.getColumnIndex(mFieldName);
        if (column >= 0)
            lastValue = featureCursor.getString(column);
    } else if (mIsShowLast)
        lastValue = preferences.getString(mFieldName, null);

    JSONArray values = attributes.getJSONArray(JSON_VALUES_KEY);
    int position = Constants.NOT_FOUND;
    mAliasValueMap = new HashMap<>();

    for (int j = 0; j < values.length(); j++) {
        JSONObject keyValue = values.getJSONObject(j);
        String value = keyValue.getString(JSON_VALUE_NAME_KEY);
        String value_alias = keyValue.getString(JSON_VALUE_ALIAS_KEY);

        if (lastValue == null && keyValue.has(JSON_DEFAULT_KEY) && keyValue.getBoolean(JSON_DEFAULT_KEY)) {
            position = j;
        }

        if (lastValue != null && lastValue.equals(value)) { // if modify data
            position = j;
        }

        mAliasValueMap.put(value_alias, value);
        AppCompatRadioButton radioButton = new AppCompatRadioButton(getContext());
        radioButton.setText(value_alias);
        radioButton.setEnabled(isEnabled);
        addView(radioButton);
    }

    check(getChildAt(position).getId());
    setOrientation(RadioGroup.VERTICAL);
}