Java 类android.widget.CompoundButton 实例源码

项目:quire    文件:SelectDistinctFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_select_distinct, container, false);

    ((CreateGroupChannelActivity) getActivity()).setState(CreateGroupChannelActivity.STATE_SELECT_DISTINCT);

    mListener = (CreateGroupChannelActivity) getActivity();

    mCheckBox = (CheckBox) rootView.findViewById(R.id.checkbox_select_distinct);
    mCheckBox.setChecked(true);
    mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mListener.onDistinctSelected(isChecked);
        }
    });

    return rootView;
}
项目:RelativeRadioGroup    文件:RelativeRadioGroup.java   
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    // prevents from infinite recursion
    if (mProtectFromCheckedChange) {
        return;
    }

    mProtectFromCheckedChange = true;
    if (mCheckedId != -1) {
        setCheckedStateForView(mCheckedId, false);
    }
    mProtectFromCheckedChange = false;

    int id = buttonView.getId();
    setCheckedId(id);
}
项目:thesis-project    文件:StudentViewActivity.java   
public void init() {
    recyclerView = (RecyclerView) findViewById(R.id.student_recyclerview);
    btnSearch = (ToggleButton)findViewById(R.id.btn_search_student);
    btnSearchOk = (Button)findViewById(R.id.btn_search_ok_student);
    btnBack = (Button) findViewById(R.id.btn_back_student);
    editTextSearch =(EditText)findViewById(R.id.etxt_search_student);
    frameLayoutSearch = (FrameLayout)findViewById(R.id.frame_search_student);
    txtMsgContent = (TextView) findViewById(R.id.message_label_stud);

    frameLayoutSearch.setVisibility(View.GONE);
    txtMsgContent.setVisibility(View.INVISIBLE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                frameLayoutSearch.setVisibility(View.VISIBLE);
            else
                frameLayoutSearch.setVisibility(View.GONE);
        }
    });
}
项目:RLibrary    文件:ImagePreviewActivity.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    int id = buttonView.getId();
    if (id == R.id.cb_origin) {
        if (isChecked) {
            long size = 0;
            for (ImageItem item : selectedImages)
                size += item.size;
            String fileSize = Formatter.formatFileSize(this, size);
            isOrigin = true;
            mCbOrigin.setText(getString(R.string.origin_size, fileSize));
        } else {
            isOrigin = false;
            mCbOrigin.setText(getString(R.string.origin));
        }
    }
}
项目:android-robocar    文件:TiltControllerActivity.java   
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

        if(buttonView==mToggleButton) {
            if(isChecked){
                mLastLeftSpeed=0;
                mLastRightSpeed = 0;

                mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_UI);
                mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_UI);
            }
            else{
                mSensorManager.unregisterListener(this);
                setSpeed(0,0);
            }

        }
    }
项目:MovieGuide    文件:DiscoverFragment.java   
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    mType = b ? MOVIES : TV_SHOWS;
    int textColorLight = ContextCompat.getColor(getActivity(), R.color.colorPrimary);
    int textColorDark = ContextCompat.getColor(getActivity(), R.color.colorGray);
    moviesRadioButton.setTextColor(b ? textColorLight : textColorDark);
    tvRadioButton.setTextColor(!b ? textColorLight : textColorDark);
}
项目:RLibrary    文件:RModelAdapter.java   
public void unSelector(int position, @NonNull RRecyclerView recyclerView, @NonNull String viewTag) {
    boolean notify = false;
    removeSelectorPosition(position);
    RBaseViewHolder vh = (RBaseViewHolder) recyclerView.findViewHolderForAdapterPosition(position);
    if (vh != null) {
        final View view = vh.tag(viewTag);
        if (view != null) {
            if (view instanceof CompoundButton) {
                checkedButton((CompoundButton) view, false);
            } else if (view instanceof RCheckGroup.ICheckView) {
                ((RCheckGroup.ICheckView) view).setChecked(false);
            }
            notify = true;
        }
    } else {
        notifyItemChanged(position);
    }

    if (notify) {
        //防止在视图还没有加载的时候,通知事件
        notifySelectorChange();
    }
}
项目:UIWidget    文件:RadiusViewDelegate.java   
public RadiusViewDelegate(View view, Context context, AttributeSet attrs) {
    this.view = view;
    this.mContext = context;
    obtainAttributes(context, attrs);
    view.setSelected(selected);
    if (!(view instanceof CompoundButton) && !view.isClickable()) {
        view.setClickable(isRippleEnable);
    }
}
项目:Sunstrike    文件:CustomSwitch.java   
private void init() {
    sunStrikeResources = new SunStrikeResources(getContext());

    setBackgroundColor(sunStrikeResources.getColorTransparent());
    setCustomColor(sunStrikeResources.getColorBackground(),
            sunStrikeResources.getColorProgress(),
            sunStrikeResources.getColorChecked());


    this.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
            if (callbackList.size() != 0) {
                for (Callback callback : callbackList) {
                    if (isChecked) {
                        callback.onChecked();
                    } else {
                        callback.onUnchecked();
                    }
                }
            }
        }
    });
}
项目:letv    文件:LoginActivity.java   
private void beautyView() {
    beautyEditText(this.mInputAccount, L10NString.getString("umgr_please_input_username"), this.mAccountTextWatcher);
    beautyCleanButton(this.mClearInputAccount, this);
    this.mInputAccountLayout.setOnClickListener(this);
    beautyCleanButton(this.mClearInputPassword, this);
    this.mInputPassword.setOnClickListener(this);
    beautyEditText(this.mInputPassword, L10NString.getString("umgr_please_input_password"), this.mPasswordTextWatcher);
    beautyColorTextView(this.mRegister, "#007dc4", false, L10NString.getString("umgr_whether_register_ornot"), this);
    beautyColorTextView(this.mFindpwd, "#007dc4", false, L10NString.getString("umgr_whether_forget_password"), this);
    beautyColorTextView(this.mSwitchAccount, "#007dc4", false, L10NString.getString("umgr_third_login_qihoo_tip"), this);
    beautyButtonGreen(this.mLogin, L10NString.getString("umgr_login"), this);
    beautyTextView(this.mAgreeClause1, L10NString.getString("umgr_login_agree_clause_1"));
    beautyTextView(this.mAgreeClauseUser, L10NString.getString("umgr_agree_clause_2_user"));
    beautyColorTextView(this.mAgreement, "#0099e5", true, L10NString.getString("umgr_agree_clause_2_agreement"), this);
    beautyTextView(this.mAnd, L10NString.getString("umgr_agree_clause_2_and"));
    beautyColorTextView(this.mPrivacy, "#0099e5", true, L10NString.getString("umgr_agree_clause_2_privacy"), this);
    beautyCheckButton(this.mShowPwd, new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            LoginActivity.this.mInputPassword.setTransformationMethod(LoginActivity.this.mShowPwd.isChecked() ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance());
        }
    });
    loadPrivateConfig();
}
项目:RLibrary    文件:RModelAdapter.java   
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);
}
项目:KernelAdiutor-Mod    文件:ProfileFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_apply_on_boot, container, false);

    ((TextView) rootView.findViewById(R.id.title)).setText(getString(R.string.profile_tasker_toast));
    SwitchCompat switchCompat = (SwitchCompat) rootView.findViewById(R.id.switcher);
    switchCompat.setChecked(Prefs.getBoolean("showtaskertoast", true, getActivity()));
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            Prefs.saveBoolean("showtaskertoast", b, getActivity());
        }
    });

    return rootView;
}
项目:DMS    文件:DMSToggleButton.java   
/**
 * 속성 초기화, 클릭 이벤트 설정
 */
private void init(Context context, int textSize) {
    setBackground(ContextCompat.getDrawable(context, R.drawable.dmstb));
    mNormalTextColor = ContextCompat.getColor(context, R.color.colorPrimary);
    mCheckedTextColor = ContextCompat.getColor(context, android.R.color.white);

    setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked()) {
                setTextColor(mCheckedTextColor);
            } else {
                setTextColor(mNormalTextColor);
            }
        }
    });

    setTextSize(TypedValue.COMPLEX_UNIT_SP, DensityConverter.pxTodp(context, textSize));
    setTextColor(mNormalTextColor);
    setMinWidth(0);
    setMinimumWidth(0);
    setMinHeight(0);
    setMinimumHeight(0);
}
项目:IT405    文件:MainActivity.java   
/**
 * Checkbox - Used to customize checkbox properties
 * For additional information please see:
 * https://developer.android.com/guide/topics/ui/controls/checkbox.html
 */
private void customizeCheckbox() {
    //Set the checkbox to a specific checked state
    checkBox.setChecked(true);

    //Set the label for the checkbox
    checkBox.setText("My Checkbox");

    //Set a checked state change listener
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            Toast.makeText(getApplicationContext(),
                    "Checkbox state changed!", Toast.LENGTH_SHORT).show();
        }
    });
}
项目:rongyunDemo    文件:DiscussionDetailActivity.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.sw_discu_top:
            if (isChecked) {
                OperationRong.setConversationTop(mContext, Conversation.ConversationType.DISCUSSION, targetId, true);
            } else {
                OperationRong.setConversationTop(mContext, Conversation.ConversationType.DISCUSSION, targetId, false);
            }
            break;
        case R.id.sw_discu_notfaction:
            if (isChecked) {
                OperationRong.setConverstionNotif(mContext, Conversation.ConversationType.DISCUSSION, targetId, true);
            } else {
                OperationRong.setConverstionNotif(mContext, Conversation.ConversationType.DISCUSSION, targetId, false);
            }
            break;
    }
}
项目:RantApp    文件:RantActivity.java   
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    switch(compoundButton.getId()){
        case R.id.activity_rant_checkbox_up:
            mDownCheckbox.setClickable(false);
            mUpCheckbox.setClickable(true);
            postThumb(1, mDetailItem.getRantId());
            break;
        case R.id.activity_rant_checkbox_down:
            mDownCheckbox.setClickable(true);
            mUpCheckbox.setClickable(false);
            postThumb(-1, mDetailItem.getRantId());
            break;
    }

}
项目:Android-Code-Demos    文件:MainActivity.java   
private void setBezier3View() {
    setContentView(R.layout.view_bezier_3);
    final Bezier3View bezier3View = (Bezier3View) findViewById(R.id.bezier_3_view);
    ((RadioButton) findViewById(R.id.control_1)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            bezier3View.setMode(isChecked);
        }
    });
   /* ((RadioButton) findViewById(R.id.control_2)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            bezier3View.setMode(false);
        }
    });*/
}
项目:mobile-store    文件:StartSwapView.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (isChecked) {
        Utils.debugLog(TAG, "Received onCheckChanged(true) for Bluetooth swap, prompting user as to whether they want to enable Bluetooth.");
        getActivity().startBluetoothSwap();
        textBluetoothVisible.setText(R.string.swap_visible_bluetooth);
        viewBluetoothId.setVisibility(View.VISIBLE);
        Utils.debugLog(TAG, "Received onCheckChanged(true) for Bluetooth swap (prompting user or setup Bluetooth complete)");
        // TODO: When they deny the request for enabling bluetooth, we need to disable this switch...
    } else {
        Utils.debugLog(TAG, "Received onCheckChanged(false) for Bluetooth swap, disabling Bluetooth swap.");
        getManager().getBluetoothSwap().stop();
        textBluetoothVisible.setText(R.string.swap_not_visible_bluetooth);
        viewBluetoothId.setVisibility(View.GONE);
        Utils.debugLog(TAG, "Received onCheckChanged(false) for Bluetooth swap, Bluetooth swap disabled successfully.");
    }
}
项目:Bigbang    文件:SimpleDialog.java   
@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;
    }
}
项目:boohee_v5.6    文件:CompoundButtonCompatDonut.java   
static Drawable getButtonDrawable(CompoundButton button) {
    if (!sButtonDrawableFieldFetched) {
        try {
            sButtonDrawableField = CompoundButton.class.getDeclaredField("mButtonDrawable");
            sButtonDrawableField.setAccessible(true);
        } catch (NoSuchFieldException e) {
            Log.i(TAG, "Failed to retrieve mButtonDrawable field", e);
        }
        sButtonDrawableFieldFetched = true;
    }
    if (sButtonDrawableField != null) {
        try {
            return (Drawable) sButtonDrawableField.get(button);
        } catch (IllegalAccessException e2) {
            Log.i(TAG, "Failed to get button drawable via reflection", e2);
            sButtonDrawableField = null;
        }
    }
    return null;
}
项目:treetracker-android    文件:UpdateTreeDetailsFragment.java   
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
    case R.id.fragment_update_tree_details_missing_tree:
        mTreeIsMissing = isChecked;
        EditText noteTxt = (EditText) getActivity().findViewById(R.id.fragment_update_tree_details_note);

        if (isChecked) {
            noteTxt.setHint(getActivity().getResources().getString(R.string.cause_of_death));
        } else {
            noteTxt.setHint(getActivity().getResources().getString(R.string.your_note));
        }
        break;

    default:
        break;
    }

}
项目:BookReader-master    文件:SettingActivity.java   
@Override
public void configViews() {
    noneCoverCompat.setChecked(SettingManager.getInstance().isNoneCover());
    noneCoverCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SettingManager.getInstance().saveNoneCover(isChecked);
        }
    });
}
项目:home-automation    文件:DeviceActivity.java   
private void populate(final boolean enabled, List<DeviceActionDAO> defaultActions, List<StoryDeviceActionDAO> existingActions) {
    LinearLayout layout;
    if (enabled) {
        layout = findViewById(R.id.storyEnabledLinearLayout);
    } else {
        layout = findViewById(R.id.storyDisabledLinearLayout);
    }
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lp.setMargins(0, 8, 0, 8);
    for (final DeviceActionDAO action : defaultActions) {
        Switch s = new Switch(this);
        s.setText(action.getName());
        s.setLayoutParams(lp);
        // Check the matching switch for every list
        for (StoryDeviceActionDAO existingAction : existingActions) {
            if (enabled && existingAction.isEnabled() && existingAction.getActionId() == action.getId()) {
                s.setChecked(true);
                break;
            } else if (!enabled && !existingAction.isEnabled() && existingAction.getActionId() == action.getId()) {
                s.setChecked(true);
                break;
            }
        }
        layout.addView(s);
        s.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
                if (checked) {
                    db.createActionForStoryAndDevice(storyId, enabled, action);
                } else {
                    db.deleteActionForStoryAndDevice(storyId, enabled, action);
                }
            }
        });
    }
}
项目:NestRadioGroup    文件:NestRadioGroup.java   
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    // prevents from infinite recursion
    if (mProtectFromCheckedChange) {
        return;
    }

    mProtectFromCheckedChange = true;
    if (mCheckedId != -1) {
        setCheckedStateForView(mCheckedId, false);
    }
    mProtectFromCheckedChange = false;

    int id = buttonView.getId();
    setCheckedId(id);
}
项目:Nird2    文件:DevReportActivity.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    ReportField field = (ReportField) buttonView.getTag();
    if (field != null) {
        if (isChecked) excludedFields.remove(field);
        else excludedFields.add(field);
    }
}
项目:Bigbang    文件:MonitorSettingCard.java   
private void initView(Context context) {
    mContext = context;


    LayoutInflater.from(context).inflate(R.layout.card_monitor_setting, this);

    onlyTextRL = (RelativeLayout) findViewById(R.id.text_only_rl);
    onlyTextSwitch = (SwitchCompat) findViewById(R.id.text_only_switch);

    whiteList = (TextView) findViewById(R.id.white_list);

    doubleClickIntervalRl = (RelativeLayout) findViewById(R.id.double_click_interval_rl);
    mDoubleClick = (TextView) findViewById(R.id.double_click_setting);
    doubleClickEditText = (EditText) findViewById(R.id.double_click_interval_edit);
    doubleClickInputLayout = (TextInputLayout) findViewById(R.id.double_click_interval);
    doubleClickConfirm = (Button) findViewById(R.id.double_click_confirm);

    onlyTextSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton aSwitch, boolean isChecked) {
            //这里由于文案从“只监控文本”改成了“增强型监控”,所以意思完全相反了,为了防止改动太多,就在这里做一个反置
            onlyText = !isChecked;
            UrlCountUtil.onEvent(UrlCountUtil.STATUS_ONLY_TEXT_MONITOR, !isChecked);
            SPHelper.save(ConstantUtil.TEXT_ONLY, onlyText);
            mContext.sendBroadcast(new Intent(BROADCAST_BIGBANG_MONITOR_SERVICE_MODIFIED));
        }
    });

    onlyTextRL.setOnClickListener(myOnClickListerner);
    whiteList.setOnClickListener(myOnClickListerner);
    mDoubleClick.setOnClickListener(myOnClickListerner);
    doubleClickConfirm.setOnClickListener(myOnClickListerner);

    refresh();
}
项目:lineagex86    文件:ZenModeConditionSelection.java   
private RadioButton newRadioButton(Condition condition) {
    final RadioButton button = new RadioButton(mContext);
    button.setTag(condition);
    button.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                setCondition((Condition) button.getTag());
            }
        }
    });
    addView(button);
    return button;
}
项目:q-mail    文件:AccountSetupBasics.java   
/**
 * Called when checking the client certificate CheckBox
 */
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    updateViewVisibility(isChecked);
    validateFields();

    // Have the user select (or confirm) the client certificate
    if (isChecked) {
        mClientCertificateSpinner.chooseCertificate();
    }
}
项目:ToggleButtons    文件:ToggleGroup.java   
/**
 * Determines where to position dividers between children. Note: this is an 'illegal' override
 * of a hidden method.
 *
 * @param childIndex Index of child to check for preceding divider
 * @return true if there should be a divider before the child at childIndex
 */
protected boolean hasDividerBeforeChildAt(int childIndex) {
    final CompoundButton child = (CompoundButton) getChildAt(childIndex);
    if (child == null)
        return false;
    if (child.getVisibility() == GONE)
        return false;
    final CompoundButton previous = getVisibleViewBeforeChildAt(childIndex);
    if (previous == null)
        return false;

    // If both are checked, add a divider
    return child.isChecked() && previous.isChecked();
}
项目:android-radiobutton-extended    文件:ExampleViewHolder.java   
@Override
public void setCheckedChangeListener(final IOnCheckedChangeListener<ExampleViewHolder, Long> listener) {
    mRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            listener.onCheckedChange(ExampleViewHolder.this, buttonView, isChecked);
        }

    });
}
项目:YKCenterSDKExample_for_AS    文件:YKWifiConfigActivity.java   
private void setListener() {
    cbLaws.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView,
                boolean isChecked) {
            if (isChecked) {
                etPsw.setInputType(InputType.TYPE_CLASS_TEXT| InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            } else {
                etPsw.setInputType(InputType.TYPE_CLASS_TEXT| InputType.TYPE_TEXT_VARIATION_PASSWORD);
            }
        }
    });
}
项目:MyFlightbookAndroid    文件:ActFlightMap.java   
public void onCheckedChanged(CompoundButton v, boolean isChecked) {
    switch (v.getId()) {
        case R.id.ckShowAllAirports:
            setShowAllAirports(v.isChecked());
            break;
        default:
            break;
    }
}
项目:SystemUITuner2    文件:Demo.java   
private void setShowNotifs(Switch toggle) {
    toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                activity.setThings.editor.putBoolean("showNotifs", true);
                showNotifs = "true";
            } else {
                activity.setThings.editor.putBoolean("showNotifs", false);
                showNotifs = "false";
            }
            activity.setThings.editor.apply();
        }
    });
}
项目:GitHub    文件:BarStatusDrawerActivity.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (isChecked) {
        btnRandomColor.setVisibility(View.GONE);
        flActivityContainer.setBackgroundResource(R.drawable.bg_bar);
    } else {
        btnRandomColor.setVisibility(View.VISIBLE);
        flActivityContainer.setBackgroundColor(Color.WHITE);
    }
    updateStatusBar();
}
项目:Plamber-Android    文件:CategoryActivity.java   
private void iniOfflineSwitch() {
    getOfflineSwitcher().setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            preferenceUtils.writeLogic(PreferenceUtils.OFFLINE_MODE, b);
            finish();
        }
    });
}
项目:GlossikaSchedule    文件:DayAdapter.java   
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
    realm.executeTransaction(r -> {
                studyItem.setCompleted(isChecked);
                day.updateDateCompleted();
            }
    );
    listener.onItemChecked();
}
项目:Cable-Android    文件:WebRtcCallControls.java   
public void setAudioMuteButtonListener(final MuteButtonListener listener) {
  audioMuteButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
      listener.onToggle(b);
    }
  });
}
项目:GitHub    文件:AnimationControlsManager.java   
private void setupPlayPauseToggleButton() {
  if (mPlayPauseToggleButton == null) {
    return;
  }
  mPlayPauseToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      if (isChecked) {
        mAnimatedDrawable.start();
      } else {
        mAnimatedDrawable.stop();
      }
    }
  });
}
项目:PageScrollView    文件:ExampleViewPagerFragment.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    super.onCheckedChanged(buttonView, isChecked);
    if (buttonView == mToggleHeader) {
        adjustPageHeaderAndFooter(mPageScrollView.getOrientation() == PageScrollView.VERTICAL, true, isChecked);
    }
    if (buttonView == mToggleFooter) {
        adjustPageHeaderAndFooter(mPageScrollView.getOrientation() == PageScrollView.VERTICAL, false, isChecked);
    }
}
项目:ReadMark    文件:MainActivity.java   
private void initNavView(){
    MenuItem item = mNavigationView.getMenu().findItem(R.id.nav_theme);
    mNavigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
    mThemeSwitch = (SwitchCompat) MenuItemCompat
            .getActionView(item)
            .findViewById(R.id.theme_switch);
    //
    mThemeSwitch.setChecked(!SkinPreUtils.getInstance(this).getSkinPath().equals(""));


    mThemeSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if(isChecked){
                /*
                * 这里有待改进,是读取apk包的地方
                * */
                String skinPath = Environment.getExternalStorageDirectory().getAbsolutePath()
                        + File.separator
                        + "skin_night.apk";
                mSkinManager.loadSkin(skinPath);
            }else{
                mSkinManager.restoreDefault();
            }

        }
    });

}