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


Java ToggleButton.setChecked方法代码示例

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


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

示例1: initializeViews

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void initializeViews(Dialog dialog) {
    major = (ToggleButton) dialog.findViewById(R.id.major);
    minor = (ToggleButton) dialog.findViewById(R.id.minor);
    dialog.findViewById(R.id.major_parent).setOnClickListener(__ -> onMajorClicked());
    dialog.findViewById(R.id.minor_parent).setOnClickListener(__ -> onMinorClicked());

    keySigImage = (ImageView) dialog.findViewById(R.id.key_sig_image);

    key = (NumberPicker) dialog.findViewById(R.id.key);
    key.setWrapSelectorWheel(false);
    key.setMinValue(0);
    key.setMaxValue(KeySigHandler.FIFTHS.length - 1);

    major.setChecked(false);
    onMajorClicked();
    key.setOnValueChangedListener(this);
    key.setValue(6);
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:19,代码来源:KeySigDialogFragment.java

示例2: onClick

import android.widget.ToggleButton; //导入方法依赖的package包/类
@OnClick({2131427582, 2131427584})
public void onClick(View v) {
    boolean z = false;
    switch (v.getId()) {
        case R.id.ll_check_all:
            ToggleButton toggleButton = this.tb_check_all;
            if (!this.tb_check_all.isChecked()) {
                z = true;
            }
            toggleButton.setChecked(z);
            checkAll(this.tb_check_all.isChecked());
            return;
        case R.id.rl_copy:
            if (this.copyCount == 0) {
                Helper.showToast((CharSequence) "请选择复制内容");
                return;
            }
            this.copyFlag = 0;
            copyEating();
            copyActivity();
            return;
        default:
            return;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:CopyRecordActivity.java

示例3: initNotice

import android.widget.ToggleButton; //导入方法依赖的package包/类
void initNotice(int type, ToggleButton toggleButton, TextView textView) {
    ArrayList<Alarm> alarms = this.alarm_dao.getAlarmsByNoticeType(type);
    if (alarms != null && alarms.size() != 0) {
        String timeString = "";
        for (int i = 0; i < alarms.size(); i++) {
            Alarm alarm = (Alarm) alarms.get(i);
            if (alarm.is_open()) {
                timeString = timeString + " " + ((Alarm) alarms.get(i)).formatTime();
                this.alarm_dao.update(alarm);
                RemindService.start(alarm, this.ctx);
            }
        }
        if (TextUtils.isEmpty(timeString)) {
            toggleButton.setChecked(false);
            textView.setText(R.string.ft);
            return;
        }
        toggleButton.setChecked(true);
        textView.setText("每天 " + timeString);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:BooheeNoticeActivity.java

示例4: initializeViews

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void initializeViews(Dialog dialog) {
    simple = (ToggleButton) dialog.findViewById(R.id.simple);
    compound = (ToggleButton) dialog.findViewById(R.id.compound);
    beats = (TextView) dialog.findViewById(R.id.beats);
    beatValue = (TextView) dialog.findViewById(R.id.beat_value);
    decrementBeats = (Button) dialog.findViewById(R.id.decrement_beats);
    incrementBeats = (Button) dialog.findViewById(R.id.increment_beats);
    decrementBeatValue = (Button) dialog.findViewById(R.id.decrement_beat_value);
    incrementBeatValue = (Button) dialog.findViewById(R.id.increment_beat_value);

    dialog.findViewById(R.id.simple_parent).setOnClickListener(__ -> onSimpleClicked());
    dialog.findViewById(R.id.compound_parent).setOnClickListener(__ -> onCompoundClicked());

    decrementBeats.setOnClickListener(__ -> onDecrementBeatsClicked());
    incrementBeats.setOnClickListener(__ -> onIncrementBeatsClicked());
    decrementBeatValue.setOnClickListener(__ -> onDecrementBeatValueClicked());
    incrementBeatValue.setOnClickListener(__ -> onIncrementBeatValueClicked());

    tempoNote = (ImageView) dialog.findViewById(R.id.tempo_note);
    tempo = (NumberPicker) dialog.findViewById(R.id.tempo);
    tempo.setMinValue(getResources().getInteger(R.integer.min_tempo));
    tempo.setMaxValue(getResources().getInteger(R.integer.max_tempo));
    tempo.setValue(getResources().getInteger(R.integer.default_tempo));
    tempo.setWrapSelectorWheel(false);

    simple.setChecked(false);
    onSimpleClicked();
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:29,代码来源:TimeDialogFragment.java

示例5: onCreateDialog

import android.widget.ToggleButton; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    mFilterSelected = getArguments().getInt(STATUS);
    mCategoriesSelected = getArguments().getStringArrayList(CATEGORIES);
    mRiskSelected = getArguments().getInt(RISK);
    initAllCategories();
    mIntent = new Intent();



    ConfirmDialog dialog = new ConfirmDialog(getContext());

    dialog.setTitle(R.string.filter_dialog_title);
    LayoutInflater inflater = getActivity().getLayoutInflater();

    mView = inflater.inflate(R.layout.dialog_filter_issues, null);
    setRadioButtonSelected(mView);
    mToggleButton = (ToggleButton) mView.findViewById(R.id.toggle_select_all_categories);
    if (mCategoriesSelected.size() == mAllCategories.size()) {
        mCategoriesChecked = true;
        mToggleButton.setChecked(true);
    } else {
        mCategoriesChecked = false;
        mToggleButton.setChecked(false);
    }
    setupView(mView);

    dialog.setView(mView);
    dialog.setPositiveButton(null, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface d, int w) {
            setupIntent();
            getTargetFragment().onActivityResult(getTargetRequestCode(),
                    Activity.RESULT_OK, mIntent);
        }
    });
    return dialog;
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:40,代码来源:FilterDialogFragment.java

示例6: onCreate

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mWifiAPMgr = new WifiAPMgr(this, apName, apPwd);
    tb_wifi_switch = (ToggleButton) findViewById(R.id.tb_wifi_switch);
    tv_ap_info = (TextView) findViewById(R.id.tv_ap_info);

    tb_wifi_switch.setChecked(mWifiAPMgr.isApOn());

    mToast = Toast.makeText(this, "", Toast.LENGTH_SHORT);

}
 
开发者ID:jingle1267,项目名称:OneKeyShareWifi,代码行数:15,代码来源:MainActivity.java

示例7: updateView

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void updateView() {
	Setting setting = mSetting;
	mTitle.setText(setting.titleId);
	mDescr.setText(setting.descr);
	mIcon.setImageResource(setting.iconId);
	
	ToggleButton toggle = mToggle;
	toggle.setChecked(setting.checked);
	toggle.setEnabled(setting.enabled);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:11,代码来源:ToggleSettingRenderer.java

示例8: initCoupon

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void initCoupon() {
    if (this.ll_coupon_child != null) {
        this.ll_coupon_child.removeAllViews();
        if (this.mCoupons != null && this.mCoupons.size() > 0) {
            String couponFormat = getString(R.string.h7);
            for (final Coupon coupon : this.mCoupons) {
                String couponInfo = String.format(couponFormat, new Object[]{coupon.amount,
                        coupon.title});
                View view_coupon_child = LayoutInflater.from(this.ctx).inflate(R.layout.ol,
                        null);
                if (coupon.isChecked.booleanValue()) {
                    this.mCoupon = coupon;
                    refreshPayTotal();
                    this.tv_use_coupon_type.setText(couponInfo);
                }
                ToggleButton tb_coupon = (ToggleButton) view_coupon_child.findViewById(R.id
                        .tb_coupon);
                TextView tv_coupon_type = (TextView) view_coupon_child.findViewById(R.id
                        .tv_coupon_type);
                tb_coupon.setChecked(coupon.isChecked.booleanValue());
                tb_coupon.setClickable(false);
                tv_coupon_type.setText(couponInfo);
                view_coupon_child.setOnClickListener(new OnClickListener() {
                    public void onClick(View v) {
                        OrderEditActivity.this.tb_use_coupon.setChecked(true);
                        for (Coupon cp : OrderEditActivity.this.mCoupons) {
                            if (coupon == cp) {
                                cp.isChecked = Boolean.valueOf(true);
                            } else {
                                cp.isChecked = Boolean.valueOf(false);
                            }
                        }
                        OrderEditActivity.this.initCoupon();
                    }
                });
                this.ll_coupon_child.addView(view_coupon_child);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:41,代码来源:OrderEditActivity.java

示例9: setFields

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void setFields(Activity activity, Property property)
{
    EditText price = (EditText)activity.findViewById(R.id.price);
    EditText afterRepairsValue = (EditText)activity.findViewById(R.id.afterRepairsValue);
    ToggleButton financing = (ToggleButton)activity.findViewById(R.id.financing);
    EditText downPayment = (EditText)activity.findViewById(R.id.downPayment);
    EditText interestRate = (EditText)activity.findViewById(R.id.interestRate);
    EditText loanDuration = (EditText)activity.findViewById(R.id.loanDuration);
    EditText purchaseCost = (EditText)activity.findViewById(R.id.purchaseCost);
    EditText repairCost = (EditText)activity.findViewById(R.id.repairCost);
    EditText rent = (EditText)activity.findViewById(R.id.rent);
    EditText otherIncome = (EditText)activity.findViewById(R.id.otherIncome);
    EditText totalExpenses = (EditText)activity.findViewById(R.id.totalExpenses);
    EditText vacancy = (EditText)activity.findViewById(R.id.vacancy);
    EditText appreciation = (EditText)activity.findViewById(R.id.appreciation);
    EditText incomeIncrease = (EditText)activity.findViewById(R.id.incomeIncrease);
    EditText expensesIncrease = (EditText)activity.findViewById(R.id.expensesIncrease);
    EditText sellingCosts = (EditText)activity.findViewById(R.id.sellingCosts);
    EditText landValue = (EditText)activity.findViewById(R.id.landValue);
    EditText incomeTaxRate = (EditText)activity.findViewById(R.id.incomeTaxRate);

    price.setText(String.format(Locale.US, "%d", property.purchasePrice));
    afterRepairsValue.setText(String.format(Locale.US, "%d", property.afterRepairsValue));
    financing.setChecked(property.useLoan);
    downPayment.setText(String.format(Locale.US, "%d", property.downPayment));
    interestRate.setText(String.format(Locale.US, "%.2f", property.interestRate));
    loanDuration.setText(String.format(Locale.US, "%d", property.loanDuration));
    purchaseCost.setText(String.format(Locale.US, "%d", property.purchaseCosts));
    repairCost.setText(String.format(Locale.US, "%d", property.repairRemodelCosts));
    rent.setText(String.format(Locale.US, "%d", property.grossRent));
    otherIncome.setText(String.format(Locale.US, "%d", property.otherIncome));
    totalExpenses.setText(String.format(Locale.US, "%d", property.expenses));
    vacancy.setText(String.format(Locale.US, "%d", property.vacancy));
    appreciation.setText(String.format(Locale.US, "%d", property.appreciation));
    incomeIncrease.setText(String.format(Locale.US, "%d", property.incomeIncrease));
    expensesIncrease.setText(String.format(Locale.US, "%d", property.expenseIncrease));
    sellingCosts.setText(String.format(Locale.US, "%d", property.sellingCosts));
    landValue.setText(String.format(Locale.US, "%d", property.landValue));
    incomeTaxRate.setText(String.format(Locale.US, "%d", property.incomeTaxRate));
}
 
开发者ID:brarcher,项目名称:rental-calc,代码行数:41,代码来源:PropertyWorksheetActivityTest.java

示例10: getView

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
    LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
    ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
    TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
    TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
    ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
    ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
    Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
    itemActuatorRun.setVisibility(View.GONE);

    final SensorInfo sensorInfo = sensorInfos.get(position);
    itemImageView.setImageResource(sensorInfo.getType().getImage());
    itemNameView.setText(sensorInfo.getType().getNickname());
    itemEnable.setChecked(sensorInfo.isEnable());
    if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
        itemStatus.setVisibility(View.GONE);
        itemActivate.setVisibility(View.GONE);
    }
    else {
        itemActivate.setEnabled(false);
        itemStatus.setText(sensorInfo.toString());
        itemActivate.setChecked(sensorInfo.isActivated());
    }

    // sensor item click
    itemLayout.setTag(sensorInfo);
    itemLayout.setOnClickListener(listItemClickListener);

    // sensor enable button click
    itemEnable.setTag(sensorInfo);
    itemEnable.setOnClickListener(enableClickListener);

    return rowView;
}
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:38,代码来源:SensorListActivity.java

示例11: initDietCardView

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void initDietCardView(int time_type, ArrayList<RecordFood> foodRcordList,
                              LinearLayout ll_card) {
    RelativeLayout rl_meal = (RelativeLayout) ll_card.findViewById(R.id.rl_time_type);
    final ToggleButton tb_time_type = (ToggleButton) ll_card.findViewById(R.id.tb_time_type);
    TextView tv_time_type = (TextView) ll_card.findViewById(R.id.tv_time_type);
    LinearLayout ll_list = (LinearLayout) ll_card.findViewById(R.id.ll_list);
    if (foodRcordList == null || foodRcordList.size() == 0) {
        ll_card.setVisibility(8);
        if (time_type == 1) {
            this.breakfastCount = 0;
        } else if (time_type == 2) {
            this.lunchCount = 0;
        } else if (time_type == 3) {
            this.dinnerCount = 0;
        } else if (time_type == 6) {
            this.snacksBreakfastCount = 0;
        } else if (time_type == 7) {
            this.snacksLunchCount = 0;
        } else if (time_type == 8) {
            this.snacksDinnerCount = 0;
        }
    } else {
        ll_card.setVisibility(0);
        ll_list.removeAllViews();
        tb_time_type.setChecked(isDietChecked(foodRcordList));
        tv_time_type.setText(FoodUtils.getDietName(this, time_type));
        int totalCount = 0;
        for (int i = 0; i < foodRcordList.size(); i++) {
            if (((RecordFood) foodRcordList.get(i)).isChecked) {
                totalCount++;
            }
            View view = getDietItemView(time_type, foodRcordList, ll_card, i);
            if (view != null) {
                ll_list.addView(view);
            }
        }
        if (time_type == 1) {
            this.breakfastCount = totalCount;
        } else if (time_type == 2) {
            this.lunchCount = totalCount;
        } else if (time_type == 3) {
            this.dinnerCount = totalCount;
        } else if (time_type == 6) {
            this.snacksBreakfastCount = totalCount;
        } else if (time_type == 7) {
            this.snacksLunchCount = totalCount;
        } else if (time_type == 8) {
            this.snacksDinnerCount = totalCount;
        }
    }
    refreshCount();
    final ArrayList<RecordFood> arrayList = foodRcordList;
    final int i2 = time_type;
    final LinearLayout linearLayout = ll_card;
    rl_meal.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            tb_time_type.setChecked(!tb_time_type.isChecked());
            CopyRecordActivity.this.setDietAllIsChecked(arrayList, tb_time_type.isChecked());
            CopyRecordActivity.this.initDietCardView(i2, arrayList, linearLayout);
            if (tb_time_type.isChecked()) {
                CopyRecordActivity.this.tb_check_all.setChecked(CopyRecordActivity.this
                        .isAllChecked());
            } else {
                CopyRecordActivity.this.tb_check_all.setChecked(false);
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:69,代码来源:CopyRecordActivity.java

示例12: initSportCardView

import android.widget.ToggleButton; //导入方法依赖的package包/类
private void initSportCardView(final ArrayList<RecordSport> recordSportList, final
LinearLayout ll_card) {
    RelativeLayout rl_time_type = (RelativeLayout) ll_card.findViewById(R.id.rl_time_type);
    TextView tv_time_type = (TextView) ll_card.findViewById(R.id.tv_time_type);
    final ToggleButton tb_time_type = (ToggleButton) ll_card.findViewById(R.id.tb_time_type);
    LinearLayout ll_list = (LinearLayout) ll_card.findViewById(R.id.ll_list);
    if (recordSportList == null || recordSportList.size() == 0) {
        ll_card.setVisibility(8);
        this.sportCount = 0;
    } else {
        ll_card.setVisibility(0);
        ll_list.removeAllViews();
        tb_time_type.setChecked(isSportChecked(recordSportList));
        tv_time_type.setText("运动");
        int totalCount = 0;
        for (int i = 0; i < recordSportList.size(); i++) {
            if (((RecordSport) recordSportList.get(i)).isChecked) {
                totalCount++;
            }
            View view = getSportItemView(recordSportList, ll_card, i);
            if (view != null) {
                ll_list.addView(view);
            }
        }
        this.sportCount = totalCount;
    }
    refreshCount();
    rl_time_type.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            tb_time_type.setChecked(!tb_time_type.isChecked());
            CopyRecordActivity.this.setSportAllIsChecked(recordSportList, tb_time_type
                    .isChecked());
            CopyRecordActivity.this.initSportCardView(recordSportList, ll_card);
            if (tb_time_type.isChecked()) {
                CopyRecordActivity.this.tb_check_all.setChecked(CopyRecordActivity.this
                        .isAllChecked());
            } else {
                CopyRecordActivity.this.tb_check_all.setChecked(false);
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:43,代码来源:CopyRecordActivity.java

示例13: getItemView

import android.widget.ToggleButton; //导入方法依赖的package包/类
public View getItemView(int position, View convertView, ViewHolder holder) {
    Boolean isEdit = CartActivity.isEdit;
    CartGoods goods = (CartGoods) this.goodsList.get(position);
    RelativeLayout rl_title = (RelativeLayout) holder.getView(R.id.rl_title);
    LinearLayout ll_edit = (LinearLayout) holder.getView(R.id.ll_edit);
    TextView tv_goods_state = (TextView) holder.getView(R.id.tv_goods_state);
    ToggleButton checkBox = (ToggleButton) holder.getView(R.id.tb_cart);
    ImageView iv_goods = (ImageView) holder.getView(R.id.iv_goods);
    TextView tv_goods_title = (TextView) holder.getView(R.id.tv_goods_title);
    TextView tv_price_value = (TextView) holder.getView(R.id.tv_price_value);
    Button btn_decrease = (Button) holder.getView(R.id.btn_decrease);
    Button btn_increase = (Button) holder.getView(R.id.btn_increase);
    TextView tv_goods_num = (TextView) holder.getView(R.id.tv_goods_num);
    checkBox.setChecked(goods.isChecked.booleanValue());
    this.loader.displayImage(goods.thumb_photo_url, iv_goods, this.options);
    if (TextUtils.equals(goods_type.SpecGoods.name(), goods.type)) {
        tv_goods_title.setText(goods.title);
    } else {
        tv_goods_title.setText(goods.title + ShopUtils.getFormatInfo(goods.chosen_specs));
    }
    tv_price_value.setText(this.ctx.getString(R.string.a04) + "  " + this.ctx.getString(R
            .string.ae4) + TextUtil.m2(goods.base_price));
    tv_goods_num.setText(String.valueOf(goods.quantity));
    btn_decrease.setOnClickListener(new onCreaseClickListener(tv_goods_num, btn_decrease,
            goods));
    btn_increase.setOnClickListener(new onCreaseClickListener(tv_goods_num, btn_increase,
            goods));
    if (goods.quantity > 1) {
        btn_decrease.setEnabled(true);
        btn_decrease.setBackgroundResource(R.drawable.ij);
    } else {
        btn_decrease.setEnabled(false);
    }
    if (isEdit.booleanValue()) {
        checkBox.setVisibility(0);
        btn_decrease.setVisibility(8);
        btn_increase.setVisibility(8);
    } else {
        checkBox.setVisibility(8);
        btn_decrease.setVisibility(0);
        btn_increase.setVisibility(0);
    }
    if (goods.can_sale) {
        tv_price_value.setVisibility(0);
        tv_goods_state.setVisibility(8);
        ll_edit.setVisibility(0);
        rl_title.setAlpha(1.0f);
    } else {
        if (!TextUtils.isEmpty(goods.msg)) {
            tv_goods_state.setText(goods.msg);
        }
        tv_price_value.setVisibility(8);
        tv_goods_state.setVisibility(0);
        ll_edit.setVisibility(8);
        rl_title.setAlpha(0.5f);
    }
    return convertView;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:59,代码来源:CartListAdapter.java

示例14: getView

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
            LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
            ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
            TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
            TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
            ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
            ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
            Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
            itemEnable.setVisibility(View.GONE);

            SensorInfo sensorInfo = sensorInfos.get(position);
            itemImageView.setImageResource(sensorInfo.getType().getImage());
            itemNameView.setText(sensorInfo.getType().getNickname());
//            itemEnable.setChecked(sensorInfo.isEnable());
            if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
                itemStatus.setVisibility(View.GONE);
                itemActivate.setVisibility(View.GONE);
                itemActuatorRun.setEnabled(sensorInfo.isActivated() && !sensorInfo.isSuspend());
            }
            else {
                itemActuatorRun.setVisibility(View.GONE);
                itemStatus.setText(sensorInfo.toString());
                itemActivate.setChecked(sensorInfo.isActivated());
                itemActivate.setEnabled(!sensorInfo.isSuspend());
            }

            // sensor item click
            itemLayout.setTag(sensorInfo);
            itemLayout.setOnClickListener(listItemClickListener);

            // sensor activation button click
            itemActivate.setTag(sensorInfo);
            itemActivate.setOnClickListener(activateClickListener);

            // actuator run button click
            itemActuatorRun.setTag(sensorInfo);
            itemActuatorRun.setOnClickListener(actuatorRunClickListener);

            return rowView;
        }
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:44,代码来源:SensorListActivity.java

示例15: getView

import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
            LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
            ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
            TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
            TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
            ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
            ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
            Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
            itemEnable.setVisibility(View.GONE);

            SensorInfo sensorInfo = sensorInfos.get(position);
            itemImageView.setImageResource(sensorInfo.getType().getImage());
            itemNameView.setText(sensorInfo.getType().getNickname());
//            itemEnable.setChecked(sensorInfo.isEnable());
            if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
                itemStatus.setVisibility(View.GONE);
                itemActivate.setVisibility(View.GONE);
                itemActuatorRun.setEnabled(!sensorInfo.isControlling()); // && !sensorInfo.isSuspend());
            }
            else {
                itemActuatorRun.setVisibility(View.GONE);
                itemStatus.setText(sensorInfo.toString());
                itemActivate.setChecked(sensorInfo.isActivated());
                itemActivate.setEnabled(!sensorInfo.isControlling()); // !sensorInfo.isSuspend());
            }

            // sensor item click
            itemLayout.setTag(sensorInfo);
            itemLayout.setOnClickListener(listItemClickListener);

            // sensor activation button click
            itemActivate.setTag(sensorInfo);
            itemActivate.setOnClickListener(activateClickListener);

            // actuator run button click
            itemActuatorRun.setTag(sensorInfo);
            itemActuatorRun.setOnClickListener(actuatorRunClickListener);

            return rowView;
        }
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-app-android,代码行数:44,代码来源:SensorListActivity.java


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