当前位置: 首页>>代码示例>>Java>>正文


Java CompoundButton.setChecked方法代码示例

本文整理汇总了Java中android.widget.CompoundButton.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundButton.setChecked方法的具体用法?Java CompoundButton.setChecked怎么用?Java CompoundButton.setChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.CompoundButton的用法示例。


在下文中一共展示了CompoundButton.setChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClick

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    CompoundButton cb = (CompoundButton) v;
    NewConditionItem item = (NewConditionItem) cb.getTag();
    boolean refresh = item.parent.processSubItems(item, cb.isChecked());
    cb.setChecked(item.selected);
    if (refresh) {
        setConditionItem(mRoot);
        this.postDelayed(new Runnable() {

            @Override
            public void run() {
                mController.confirm(SorterContainer.this);
            }
        }, 20);
    }
}
 
开发者ID:Tamicer,项目名称:FilterBar,代码行数:18,代码来源:SorterContainer.java

示例2: checkedButton

import android.widget.CompoundButton; //导入方法依赖的package包/类
public static void checkedButton(CompoundButton compoundButton, boolean checked) {
    if (compoundButton == null) {
        return;
    }
    if (compoundButton.isChecked() == checked) {
        return;
    }
    CompoundButton.OnCheckedChangeListener onCheckedChangeListener =
            (CompoundButton.OnCheckedChangeListener) Reflect.getMember(CompoundButton.class,
                    compoundButton, "mOnCheckedChangeListener");
    compoundButton.setOnCheckedChangeListener(null);
    compoundButton.setChecked(checked);
    compoundButton.setOnCheckedChangeListener(onCheckedChangeListener);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:15,代码来源:RModelAdapter.java

示例3: onCheckedChanged

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(android.widget.CompoundButton v, boolean isChecked) {
    int position = (Integer)v.getTag();
    if(mSelected[position] != isChecked) {
        mSelected[position] = isChecked;

        if(mOnSelectionChangedListener != null)
            mOnSelectionChangedListener.onSelectionChanged(position, mSelected[position]);
    }

    if(mMode == MODE_ITEMS && isChecked && mLastSelectedIndex != position){
        mSelected[mLastSelectedIndex] = false;

        if(mOnSelectionChangedListener != null)
            mOnSelectionChangedListener.onSelectionChanged(mLastSelectedIndex, false);

        CompoundButton child = (CompoundButton) mListView.getChildAt(mLastSelectedIndex - mListView.getFirstVisiblePosition());
        if(child != null)
            child.setChecked(false);

        mLastSelectedIndex = position;
    }
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:24,代码来源:SimpleDialog.java

示例4: onCheckedChanged

import android.widget.CompoundButton; //导入方法依赖的package包/类
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    WeightPhoto photo = (WeightPhoto) buttonView.getTag();
    if (!isChecked || !this.mSelect.contains(photo)) {
        if (isChecked) {
            int size = this.mSelect.size();
            WeightPhotosActivity weightPhotosActivity = this.mActivity;
            if (size >= 2) {
                Helper.showToast((CharSequence) "最多选择两张图片");
                buttonView.setChecked(false);
                return;
            }
        }
        if (isChecked) {
            this.mSelect.add(photo);
        } else {
            this.mSelect.remove(photo);
        }
        this.mActivity.setSelectText();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:WeightPhotosActivity.java

示例5: setConditionItem

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void setConditionItem(NewConditionItem item) {
    mRoot = item;
    mTvTitle.setText(item.name);
    mGrid.removeAllViews();
    for (NewConditionItem subItem : mRoot.subItems) {
        if (subItem.type != NewConditionItem.TYPE_LIST) {
            if (subItem.type == NewConditionItem.TYPE_DATA) {
                this.item = (DateSelectConditionItem) subItem;
                DataSelectContainer container2 = new DataSelectContainer(getContext());
                LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(
                        ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT
                );
                container2.setLayoutParams(lp2);
                container2.setTag(subItem);
                container2.setConditionItem(subItem);
                addFooterView(container2);
            }
            continue;

        }
        btn = (CompoundButton) LayoutInflater.from(getContext())
                .inflate(R.layout.item_condition_grid, mGrid, false);
        btn.setTag(subItem);
        btn.setText(subItem.name);
        btn.setChecked(subItem.selected);
        btn.setOnCheckedChangeListener(this);
        addToGrid(btn);
    }
}
 
开发者ID:Tamicer,项目名称:FilterBar,代码行数:32,代码来源:GridContainer.java

示例6: onCheckedChanged

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

    NewConditionItem item = (NewConditionItem) buttonView.getTag();
    boolean refresh = item.parent.processSubItems(item, buttonView.isChecked());
    buttonView.setChecked(item.selected);
    if (refresh) {
        setConditionItem(item.parent);
    }

}
 
开发者ID:Tamicer,项目名称:FilterBar,代码行数:12,代码来源:GridContainer.java

示例7: onClick

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    CompoundButton cb = (CompoundButton) v;
    NewConditionItem item = (NewConditionItem) cb.getTag();
    boolean refresh = item.parent.processSubItems(item, cb.isChecked());
    cb.setChecked(item.selected);
    if (refresh) {
        setLv0Item(item.parent);
    }
}
 
开发者ID:Tamicer,项目名称:FilterBar,代码行数:11,代码来源:RegionContainer.java

示例8: onCheckedChanged

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.v0:
            if (isChecked) {
                tempModel.selection = p;
                adapter.notifyDataSetChanged();
            }
            break;

        case R.id.v14:
            if (isChecked) {
                // 去除对应的临时要货勾选
                if (tempModel.skus[p].checkTemp) {
                    tempModel.skus[p].checkTemp = false;
                    adapter.notifyDataSetChanged();
                }
            }
            tempModel.skus[p].checkFormal = isChecked;
            break;

        case R.id.v15:
            if (isChecked) {
                if (mustTempReason(binding.getModel(), binding.v16.getText().toString())) {
                    buttonView.setChecked(false);
                    activity.showToast("必须填写临时要货原因");
                    return;
                }

                // 去除对应的正式要货勾选
                if (tempModel.skus[p].checkFormal) {
                    tempModel.skus[p].checkFormal = false;
                    adapter.notifyDataSetChanged();
                }
            }
            tempModel.skus[p].checkTemp = isChecked;
            break;
    }
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:40,代码来源:SelectPkgFragment.java

示例9: onBindViewHolder

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RegionContainer.VH holder, final int position) {
    final NewConditionItem item = mList.get(position);
    if (holder.getItemViewType() == TYPE_EDIT) {
        CompoundButton btnEdit = holder.tb;
                btnEdit.setText(item.name);
        btnEdit.setChecked(item.selected);
        btnEdit.setTag(item);
        btnEdit.setId(holder.getItemViewType());
        btnEdit.setOnClickListener(mOnClickListener);
        final View finalView = btnEdit;
        final NewConditionItem finalitem =item;
        btnEdit.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mOnItemClickListener!= null) {
                   mOnItemClickListener.onEditClick(finalView, item.id);
                }
            }
        });

    } else {
        CompoundButton btn = holder.tb;
        btn.setText(item.name);
        btn.setChecked(item.selected);
        btn.setTag(item);
        btn.setId(holder.getItemViewType());
        btn.setOnClickListener(mOnClickListener);
    }

}
 
开发者ID:Tamicer,项目名称:FilterBar,代码行数:32,代码来源:RegionContainer.java

示例10: setupView

import android.widget.CompoundButton; //导入方法依赖的package包/类
private void setupView(Cursor cursor, View view, CompoundButton switchView) {
    final Repo repo = new Repo(cursor);

    switchView.setChecked(repo.inuse);

    // Add this listener *after* setting the checked status, so we don't
    // invoke the listener while setting up the view...
    switchView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (enabledListener != null) {
                enabledListener.onSetEnabled(repo, isChecked);
            }
        }
    });

    TextView nameView = (TextView) view.findViewById(R.id.repo_name);
    nameView.setText(repo.getName());

    View unsignedView = view.findViewById(R.id.repo_unsigned);
    View unverifiedView = view.findViewById(R.id.repo_unverified);
    if (repo.isSigned()) {
        unsignedView.setVisibility(View.GONE);
        unverifiedView.setVisibility(View.GONE);
    } else if (repo.isSignedButUnverified()) {
        unsignedView.setVisibility(View.GONE);
        unverifiedView.setVisibility(View.VISIBLE);
    } else {
        unsignedView.setVisibility(View.VISIBLE);
        unverifiedView.setVisibility(View.GONE);
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:33,代码来源:RepoAdapter.java

示例11: setChecked

import android.widget.CompoundButton; //导入方法依赖的package包/类
public void setChecked(boolean checked) {
    CompoundButton compoundButton;
    if (this.mItemData.isExclusiveCheckable()) {
        if (this.mRadioButton == null) {
            insertRadioButton();
        }
        compoundButton = this.mRadioButton;
    } else {
        if (this.mCheckBox == null) {
            insertCheckBox();
        }
        compoundButton = this.mCheckBox;
    }
    compoundButton.setChecked(checked);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:ListMenuItemView.java

示例12: mapReflectedData

import android.widget.CompoundButton; //导入方法依赖的package包/类
private void mapReflectedData(String key, T item, DataMapping<T> mapping, AttributeMapping<T> viewMapping, View targetView)
{
    targetView.setVisibility(View.VISIBLE);

    Object result = null;
    
    if (key == null) {
        result = item; //Item is itself's value.
    }
    else {
        result = ReflectionHelper.getAttribute(item, mapping.realClass,  key);
    }
    
    if (result == null) {
        result = viewMapping.fallback;
    }
    
    if (result == null || (result != null && result.equals(viewMapping.invalid))) {
        //Item and it's fallback are null or the item is invalid.
        targetView.setVisibility(viewMapping.visibilityIfNoData);
    }
    else if (targetView instanceof CompoundButton) {
        CompoundButton checkable = (CompoundButton)targetView;
        checkable.setChecked((Boolean)result);
    }
    else if (targetView instanceof TextView) {
        ((TextView)targetView).setText(result.toString());
    }
    else if (targetView instanceof ImageView) {
        if (result instanceof CharSequence) {
            ((ImageView)targetView).setImageURI(Uri.parse(result.toString()));
        }
        else {
            ((ImageView)targetView).setImageResource((Integer)result);
        }
    }
    else {
        throw new RuntimeException("Unknown view type for key: " + key);
    }
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:41,代码来源:AttributeAdapter.java

示例13: onCheckedChanged

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    setChecking();
    compoundButton.setChecked(true);

    switch (compoundButton.getId()){
        case R.id.radioButton1:
            builder.setType(TextCounter.BYTE);
            seekBar1.setEnabled(false);
            type = TextCounter.BYTE;
            break;
        case R.id.radioButton2:
            builder.setType(TextCounter.SHORT);
            seekBar1.setEnabled(false);
            type = TextCounter.SHORT;
            break;
        case R.id.radioButton3:
            builder.setType(TextCounter.INT);
            seekBar1.setEnabled(false);
            type = TextCounter.INT;
            break;
        case R.id.radioButton4:
            builder.setType(TextCounter.FLOAT);
            seekBar1.setEnabled(true);
            type = TextCounter.FLOAT;
            break;
        case R.id.radioButton5:
            builder.setType(TextCounter.LONG);
            seekBar1.setEnabled(false);
            type = TextCounter.LONG;
            break;
        case R.id.radioButton6:
            builder.setType(TextCounter.DOUBLE);
            seekBar1.setEnabled(true);
            type = TextCounter.DOUBLE;
            break;
        default:
            return;
    }
}
 
开发者ID:BullyBoo,项目名称:TextCounter,代码行数:41,代码来源:MainActivity.java

示例14: doOnlyCheckedOne

import android.widget.CompoundButton; //导入方法依赖的package包/类
public void doOnlyCheckedOne(String item) {
    for (int i = 0; i < getChildCount(); i++) {
        CompoundButton button = (CompoundButton) getChildAt(i);
        if (button.getText().toString().equals(item)) {
            button.setChecked(true);
            button.setTextColor(config.buttonSelectedTextColor);
        } else {
            button.setChecked(false);
            button.setTextColor(config.buttonTextColor);
        }
    }
}
 
开发者ID:gzu-liyujiang,项目名称:GoodsSpec,代码行数:13,代码来源:TagViewGroup.java

示例15: doNotCheckedOne

import android.widget.CompoundButton; //导入方法依赖的package包/类
public void doNotCheckedOne(String item) {
    for (int i = 0; i < getChildCount(); i++) {
        CompoundButton button = (CompoundButton) getChildAt(i);
        if (button.getText().toString().equals(item)) {
            button.setChecked(false);
            button.setTextColor(config.buttonTextColor);
        }
    }
}
 
开发者ID:gzu-liyujiang,项目名称:GoodsSpec,代码行数:10,代码来源:TagViewGroup.java


注:本文中的android.widget.CompoundButton.setChecked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。