本文整理汇总了Java中android.support.v7.widget.AppCompatCheckBox类的典型用法代码示例。如果您正苦于以下问题:Java AppCompatCheckBox类的具体用法?Java AppCompatCheckBox怎么用?Java AppCompatCheckBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppCompatCheckBox类属于android.support.v7.widget包,在下文中一共展示了AppCompatCheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCheckedChanged
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Log.i("AlarmFrcheckListener", "buttonView=" + buttonView);
if (isChecked) {
confirmable = true;
if (buttonView.getId() == map[0]) {
checkedOnce(true);
} else {
checkedOnce(false);
}
} else {
for (int id : map) {
if (((AppCompatCheckBox) findViewById(id)).isChecked()) {
confirmable = true;
break;
}
confirmable = false;
}
}
mTvConfirm.setTextColor(confirmable ? context.getResources().getColor(R.color.base_blue)
: context.getResources().getColor(R.color.forbid_click_color));
}
示例2: onClick
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.afd_confirm) {
if (!((AppCompatCheckBox) findViewById(map[0])).isChecked()) {
fr = 0;
for (int i = 1; i < map.length; i++) {
if (((AppCompatCheckBox) findViewById(map[i])).isChecked()) {
fr <<= 3;
fr += i;
}
}
if (fr == 0) {
return;
}
repeat = true;
} else {
int week = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
fr = week - 1 > 0 ? week - 1 : 7;
repeat = false;
}
if (onResultListener != null) {
onResultListener.onResult(fr, repeat);
}
}
cancel();
}
示例3: init
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
private void init() {
mRgChoice.setVisibility(View.GONE);
mChoiceBox.setVisibility(View.VISIBLE);
mCdTitle.setText(title);
for (int i = 0; i < datas.length; i++) {
AppCompatCheckBox cb = new AppCompatCheckBox(mContext);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, ScreenUtil.getInstance().dip2px(48));
cb.setLayoutParams(layoutParams);
cb.setGravity(Gravity.CENTER_VERTICAL);
cb.setId(i);
cb.setText(datas[i]);
cb.setTextSize(15);
cb.setTextColor(mContext.getResources().getColor(R.color.new_text_color_first));
cb.setPadding(ScreenUtil.getInstance().dip2px(16), 0, 0, 0);
if (i == 0)
cb.setChecked(true);
mChoiceBox.addView(cb);
}
}
示例4: onViewCreatedOk
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Override
public void onViewCreatedOk(View view, @Nullable Bundle savedInstanceState) {
mCbCheck = (AppCompatCheckBox) view.findViewById(R.id.cb_page_check);
mViewPager = (ViewPager) view.findViewById(R.id.view_pager_page);
mRlRootView = (RelativeLayout) view.findViewById(R.id.rl_page_root_view);
mScreenSize = DeviceUtils.getScreenSize(getContext());
mMediaBeanList = new ArrayList<>();
if (savedInstanceState != null) {
List<MediaBean> mediaList = savedInstanceState.getParcelableArrayList(EXTRA_MEDIA_LIST);
mItemClickPosition = savedInstanceState.getInt(EXTRA_ITEM_CLICK_POSITION);
if (mediaList != null) {
mMediaBeanList.addAll(mediaList);
}
}
mMediaPreviewAdapter = new MediaPreviewAdapter(mMediaBeanList,
mScreenSize.widthPixels, mScreenSize.heightPixels, mConfiguration
, ThemeUtils.resolveColor(getActivity(), R.attr.gallery_page_bg, R.color.gallery_default_page_bg),
ContextCompat.getDrawable(getActivity(), ThemeUtils.resolveDrawableRes(getActivity(), R.attr.gallery_default_image, R.drawable.gallery_default_image)));
mViewPager.setAdapter(mMediaPreviewAdapter);
mCbCheck.setOnClickListener(this);
mViewPager.setCurrentItem(mItemClickPosition);
mViewPager.addOnPageChangeListener(this);
}
示例5: onViewCreatedOk
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Override
public void onViewCreatedOk(View view, @Nullable Bundle savedInstanceState) {
mCbCheck = (AppCompatCheckBox) view.findViewById(R.id.cb_check);
mViewPager = (ViewPager) view.findViewById(R.id.view_pager);
mRlRootView = (RelativeLayout) view.findViewById(R.id.rl_root_view);
mScreenSize = DeviceUtils.getScreenSize(getContext());
mMediaBeanList = new ArrayList<>();
if (mMediaActivity.getCheckedList() != null) {
mMediaBeanList.addAll(mMediaActivity.getCheckedList());
}
MediaPreviewAdapter mMediaPreviewAdapter = new MediaPreviewAdapter(mMediaBeanList,
mScreenSize.widthPixels, mScreenSize.heightPixels, mConfiguration,
ThemeUtils.resolveColor(getActivity(), R.attr.gallery_page_bg, R.color.gallery_default_page_bg),
ContextCompat.getDrawable(getActivity(), ThemeUtils.resolveDrawableRes(getActivity(), R.attr.gallery_default_image, R.drawable.gallery_default_image)));
mViewPager.setAdapter(mMediaPreviewAdapter);
mCbCheck.setOnClickListener(this);
if (savedInstanceState != null) {
mPagerPosition = savedInstanceState.getInt(EXTRA_PAGE_INDEX);
}
}
示例6: onCheckedChanged
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mConfiguration.getMaxSize() == mMediaActivity.getCheckedList().size() &&
!mMediaActivity.getCheckedList().contains(mediaBean)) {
AppCompatCheckBox checkBox = (AppCompatCheckBox) buttonView;
checkBox.setChecked(false);
Logger.i("选中:" + mMediaActivity.getResources().getString(R.string.gallery_image_max_size_tip, mConfiguration.getMaxSize()));
if (iMultiImageCheckedListener != null) {
iMultiImageCheckedListener.selectedImgMax(buttonView, isChecked, mConfiguration.getMaxSize());
}
} else {
if (iMultiImageCheckedListener != null)
iMultiImageCheckedListener.selectedImg(buttonView, isChecked);
}
}
示例7: convertCommon
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Override
public void convertCommon(ViewHolder viewHolder, final List<AppInfo> appInfo, final int position) {
super.convertCommon(viewHolder, appInfo, position);
final AppInfo info = appInfo.get(position);
viewHolder.setText(R.id.tv_app_package_name, info.getAppPackageName());
((TextView) viewHolder.getView(R.id.tv_app_name)).setTextColor(info.isEnable() == 1
? mResources.getColor(R.color.textPrimary)
: mResources.getColor(R.color.translucentBg));
((ImageView) viewHolder.getView(R.id.iv_app_icon)).getDrawable().setColorFilter(info.isEnable() == 1
? mColorFilterNormal : mColorFilterGrey);
((TextView) viewHolder.getView(R.id.tv_app_package_name)).setTextColor(info.isEnable() == 1
? mResources.getColor(R.color.textSecondary)
: mResources.getColor(R.color.translucentBg));
AppCompatCheckBox cb = viewHolder.getView(R.id.cb_select_apps);
cb.setOnCheckedChangeListener(null); // CheckBox在执行setChecked时会触发setOnCheckedChangeListener
cb.setChecked(mDisablePackages.contains(info.getAppPackageName()));
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mCheckedChangeListener != null) {
mCheckedChangeListener.onCheckedChanged(info, position, isChecked);
}
}
});
}
示例8: ifHuaweiAlert
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
private void ifHuaweiAlert() {
final SharedPreferences settings = getSharedPreferences("ProtectedApps", MODE_PRIVATE);
final String saveIfSkip = "skipProtectedAppsMessage";
boolean skipMessage = settings.getBoolean(saveIfSkip, false);
if (!skipMessage) {
final SharedPreferences.Editor editor = settings.edit();
Intent intent = new Intent();
intent.setClassName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity");
if (isCallable(intent)) {
final AppCompatCheckBox dontShowAgain = new AppCompatCheckBox(this);
dontShowAgain.setText(R.string.Do_not_show_again);
dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
editor.putBoolean(saveIfSkip, isChecked);
editor.apply();
}
});
new AlertDialog.Builder(this)
.setTitle("Huawei Protected Apps")
.setMessage(String.format("%s requires to be enabled in 'Protected Apps' to send notifications.%n", getString(R.string.app_name)))
.setView(dontShowAgain)
.setPositiveButton("Protected Apps", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
huaweiProtectedApps();
}
})
.setNegativeButton("Cancel", null)
.show();
} else {
editor.putBoolean(saveIfSkip, true);
editor.apply();
}
}
}
示例9: uncheckRemindersDisablesReminderTime
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Test
public void uncheckRemindersDisablesReminderTime() {
// Click on settings
onView(withId(R.id.settings)).perform(click());
// Enable the diary alert
onData(PreferenceMatchers.withKey("pref_diary_alert")).perform(click());
// Verify the diary alert is enabled
onData(PreferenceMatchers.withKey("pref_diary_alert"))
.onChildView(withClassName(is(AppCompatCheckBox.class.getName())))
.check(matches(isChecked()));
// Disable the diary alert and verify
onData(PreferenceMatchers.withKey("pref_diary_alert")).perform(click());
onData(PreferenceMatchers.withKey("pref_diary_alert"))
.onChildView(withClassName(is(AppCompatCheckBox.class.getName())))
.check(matches(not(isChecked())));
// Verify diary alert time is disabled
onData(PreferenceMatchers.withKey("pref_diary_alert_time")).check(matches(not(isEnabled())));
}
示例10: UserHolder
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
public UserHolder(View itemView) {
super(itemView);
photo = (CircleImageView) itemView.findViewById(R.id.new_chat_member_image);
name = (TextView) itemView.findViewById(R.id.new_chat_member_name);
userCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.new_chat_member_checkbox);
userCheckBox.setOnCheckedChangeListener(
(buttonView, isChecked) -> {
long userId = users.get(getAdapterPosition()).getUserId();
if (isChecked) {
checkedUsers.add(userId);
name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name_checked));
listener.onCheckBoxClickPush(userId);
} else {
checkedUsers.remove(userId);
name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name));
listener.onCheckBoxClickPull(userId);
}
});
}
示例11: UserHolder
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
public UserHolder(View itemView) {
super(itemView);
photo = (CircleImageView) itemView.findViewById(R.id.new_chat_member_image);
name = (TextView) itemView.findViewById(R.id.new_chat_member_name);
userCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.new_chat_member_checkbox);
userCheckBox.setOnCheckedChangeListener(
(buttonView, isChecked) -> {
if (isChecked) {
checkedUsers.add(users.get(getAdapterPosition()).getUserId());
name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name_checked));
} else {
checkedUsers.remove(users.get(getAdapterPosition()).getUserId());
name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name));
}
listener.onCheckBoxClick();
});
}
示例12: ImageHolder
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
ImageHolder(View itemView, int itemSize, boolean hasCamera, @Album.ChoiceMode int choiceMode, ColorStateList selector,
OnItemClickListener itemClickListener, OnItemCheckedListener itemCheckedListener) {
super(itemView);
itemView.getLayoutParams().height = itemSize;
this.itemSize = itemSize;
this.hasCamera = hasCamera;
this.mChoiceMode = choiceMode;
this.mItemClickListener = itemClickListener;
this.mItemCheckedListener = itemCheckedListener;
mIvImage = (ImageView) itemView.findViewById(R.id.iv_album_content_image);
mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.cb_album_check);
mLayoutLayer = (FrameLayout) itemView.findViewById(R.id.layout_layer);
itemView.setOnClickListener(this);
mCheckBox.setOnClickListener(this);
mLayoutLayer.setOnClickListener(this);
if (mChoiceMode == Album.MODE_MULTIPLE) {
mCheckBox.setVisibility(View.VISIBLE);
mCheckBox.setSupportButtonTintList(selector);
} else {
mCheckBox.setVisibility(View.GONE);
}
}
示例13: VideoHolder
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
VideoHolder(View itemView, int itemSize, boolean hasCamera, @Album.ChoiceMode int choiceMode, ColorStateList selector,
OnItemClickListener itemClickListener, OnItemCheckedListener itemCheckedListener) {
super(itemView);
itemView.getLayoutParams().height = itemSize;
this.itemSize = itemSize;
this.hasCamera = hasCamera;
this.mChoiceMode = choiceMode;
this.mItemClickListener = itemClickListener;
this.mItemCheckedListener = itemCheckedListener;
mIvImage = (ImageView) itemView.findViewById(R.id.iv_album_content_image);
mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.cb_album_check);
mTvDuration = (TextView) itemView.findViewById(R.id.tv_duration);
mLayoutLayer = (FrameLayout) itemView.findViewById(R.id.layout_layer);
itemView.setOnClickListener(this);
mCheckBox.setOnClickListener(this);
mLayoutLayer.setOnClickListener(this);
if (mChoiceMode == Album.MODE_MULTIPLE) {
mCheckBox.setVisibility(View.VISIBLE);
mCheckBox.setSupportButtonTintList(selector);
} else {
mCheckBox.setVisibility(View.GONE);
}
}
示例14: newView
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
final View itemLayout =
mInflater.inflate(R.layout.contact_select_list_item, parent, false);
final ContactViewHolder holder = new ContactViewHolder();
holder.textView1 = (TextView) itemLayout.findViewById(R.id.applozic_group_member_info);
holder.textView2 = (TextView) itemLayout.findViewById(R.id.displayName);
holder.contactNumberTextView = (TextView) itemLayout.findViewById(R.id.contactNumberTextView);
holder.checkBox = (AppCompatCheckBox) itemLayout.findViewById(R.id.checkbox);
holder.checkBox.setVisibility(View.VISIBLE);
holder.alphabeticImage = (TextView) itemLayout.findViewById(R.id.alphabeticImage);
holder.circleImageView = (CircleImageView) itemLayout.findViewById(R.id.contactImage);
itemLayout.setTag(holder);
return itemLayout;
}
示例15: ViewHolder
import android.support.v7.widget.AppCompatCheckBox; //导入依赖的package包/类
public ViewHolder(View itemLayoutView, Activity activity) {
super(itemLayoutView);
this.activity = activity;
dateTime = (TextView) itemLayoutView.findViewById(R.id.date_time_layout_textview);
cityNameText = (TextView) itemLayoutView.findViewById(R.id.spot_city_name_layout_textview);
notesText = (TextView) itemLayoutView.findViewById(R.id.spot_notes_layout_textview);
waitingTimeText = (TextView) itemLayoutView.findViewById(R.id.waiting_time_layout_textview);
waitingIcon = (ImageView) itemLayoutView.findViewById(R.id.waiting_icon_layout_imageview);
destinationIcon = (ImageView) itemLayoutView.findViewById(R.id.arrival_icon_layout_imageview);
singleSpotIcon = (ImageView) itemLayoutView.findViewById(R.id.single_icon_layout_imageview);
breakIcon = (ImageView) itemLayoutView.findViewById(R.id.break_icon_layout_imageview);
viewParent = itemLayoutView.findViewById(R.id.spot_list_item_parent);
viewParent.setOnClickListener(this);
cbx = (AppCompatCheckBox) itemLayoutView.findViewById(R.id.spot_delete_checkbox);
}