Java 类android.support.v7.widget.AppCompatCheckBox 实例源码
项目:AssistantBySDK
文件:AlarmFrDialog.java
@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));
}
项目:AssistantBySDK
文件:AlarmFrDialog.java
@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();
}
项目:AssistantBySDK
文件:MultiChoiceDialog.java
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);
}
}
项目:Watermark
文件:MediaPageFragment.java
@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);
}
项目:Watermark
文件:MediaPreviewFragment.java
@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);
}
}
项目:Watermark
文件:MediaGridAdapter.java
@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);
}
}
项目:StopApp
文件:AppListAdapter.java
@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);
}
}
});
}
项目:Say_it
文件:MainActivity.java
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();
}
}
}
项目:TherapyGuide
文件:SettingsScreenTest.java
@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())));
}
项目:BizareChat
文件:EditChatRecyclerViewAdapter.java
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);
}
});
}
项目:BizareChat
文件:NewChatUsersRecyclerAdapter.java
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();
});
}
项目:Recognize-it
文件:AlbumFileAdapter.java
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);
}
}
项目:Recognize-it
文件:AlbumFileAdapter.java
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);
}
}
项目:Applozic-Android-Chat-Sample
文件:ContactSelectionFragment.java
@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;
}
项目:Applozic-Android-Chat-Sample
文件:ContactSelectionFragment.java
@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;
}
项目:MyHitchhikingSpots-for-Android
文件:SpotListAdapter.java
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);
}
项目:amixer-webui-android
文件:EqualizerActivity.java
/**
* Setups checkbox in menu.
* @param menu menu
*/
private void setupCheckbox(Menu menu)
{
AppCompatCheckBox checkBox = (AppCompatCheckBox) menu.findItem(R.id.equalizer_lock).getActionView();
ColorStateList colorStateList = new ColorStateList(new int[][]{
new int[]{-android.R.attr.state_enabled}, // disabled
new int[]{android.R.attr.state_enabled}, // enabled
},
new int[]{
Color.WHITE, // disabled
Color.WHITE // enabled
});
checkBox.setSupportButtonTintList(colorStateList);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b)
{
lockedSliders = b;
}
});
checkBox.setText(getString(R.string.lock_sliders));
checkBox.setChecked(true);
checkBox.setPadding(0,0,Math.round(getResources().getDimension(R.dimen.activity_horizontal_margin)),0);
}
项目:nono-android
文件:TodoLayout.java
@Override
protected void initUI() {
LinearLayout linearLayout=new LinearLayout(getContext());
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
checkBox=new AppCompatCheckBox(getContext());
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
TodoLayout.this.isChecked=isChecked;
}
});
editText=new BaseRichEditText(getContext());
editText.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT,1.0f));
linearLayout.addView(checkBox);
linearLayout.addView(editText);
this.addView(linearLayout);
}
项目:GittyReporter
文件:GittyReporter.java
public void reportIssue (View v) {
if (enableGitHubLogin) {
final AppCompatCheckBox githubCheckbox = (AppCompatCheckBox) findViewById(R.id.gittyreporter_github_checkbox);
EditText userName = (EditText) findViewById(R.id.gittyreporter_login_username);
EditText userPassword = (EditText) findViewById(R.id.gittyreporter_login_password);
if (!githubCheckbox.isChecked()){
if (validateGitHubLogin()){
this.gitUser = userName.getText().toString();
this.gitPassword = userPassword.getText().toString();
sendBugReport();
}
} else {
this.gitUser = "";
this.gitPassword = "";
sendBugReport();
}
} else {
if (validateBugReport()) {
this.gitUser = "";
this.gitPassword = "";
sendBugReport();
}
}
}
项目:FRC-Krawler
文件:CheckBoxMetricWidget.java
public CheckBoxMetricWidget(Context context, MetricValue m) {
super(context, m);
final Optional<List<String>> optionalValues = MetricHelper.getListItemIndexRange(m.getMetric());
if (!optionalValues.isPresent())
throw new IllegalStateException("Couldn't parse range values, cannot proceed");
final List<String> rangeValues = optionalValues.get();
for (int i = 0; i < rangeValues.size(); i++) {
String value = rangeValues.get(i);
AppCompatCheckBox checkbox = new AppCompatCheckBox(getContext());
checkbox.setText(value);
values.addView(checkbox);
}
setMetricValue(m);
}
项目:Applozic-Android-SDK
文件:ContactSelectionFragment.java
@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;
}
项目:SearchBar-SearchView
文件:SearchView.java
public void setFilters(@Nullable List<SearchFilter> filters) {
mSearchFilters = filters;
mFlexboxLayout.removeAllViews();
if (filters == null) {
mSearchFiltersStates = null;
mFlexboxLayout.setVisibility(View.GONE);
} else {
mSearchFiltersStates = new ArrayList<>();
for (SearchFilter filter : filters) {
AppCompatCheckBox checkBox = new AppCompatCheckBox(mContext);
checkBox.setText(filter.getTitle());
checkBox.setTextSize(12);
checkBox.setTextColor(mTextColor);
checkBox.setChecked(filter.isChecked());
FlexboxLayout.LayoutParams lp = new FlexboxLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(getResources().getDimensionPixelSize(R.dimen.search_filter_margin_start), getResources().getDimensionPixelSize(R.dimen.search_filter_margin_top), getResources().getDimensionPixelSize(R.dimen.search_filter_margin_top), getResources().getDimensionPixelSize(R.dimen.search_filter_margin_top));
checkBox.setLayoutParams(lp);
checkBox.setTag(filter.getTagId());
mFlexboxLayout.addView(checkBox);
mSearchFiltersStates.add(filter.isChecked());
}
}
}
项目:box-android-browse-sdk
文件:BoxItemAdapter.java
/**
* Instantiates a new Box item view holder.
*
* @param itemView the item view
*/
public BoxItemViewHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
if (mListener.getMultiSelectHandler() != null) {
itemView.setOnLongClickListener(this);
}
mView = itemView;
mThumbView = (ImageView) itemView.findViewById(R.id.box_browsesdk_thumb_image);
mNameView = (TextView) itemView.findViewById(R.id.box_browsesdk_name_text);
mMetaDescription = (TextView) itemView.findViewById(R.id.metaline_description);
mProgressBar = (ProgressBar) itemView.findViewById((R.id.spinner));
mSecondaryAction = (ImageButton) itemView.findViewById(R.id.secondaryAction);
mItemCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.boxItemCheckBox);
mSecondaryClickListener = new BoxItemClickListener();
if (mSecondaryAction != null) {
mSecondaryAction.setOnClickListener(mSecondaryClickListener);
}
}
项目: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;
}
项目: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;
}
项目:yjPlay
文件:VideoPlayerView.java
/***
* 显示隐藏全屏按钮
*
* @param visibility 状态
*/
public void showFullscreenTempView(int visibility) {
AppCompatCheckBox compatCheckBox = (AppCompatCheckBox) playerView.findViewById(R.id.sexo_video_fullscreen);
compatCheckBox.setVisibility(visibility);
compatCheckBox.setButtonDrawable(playerView.getControllerView().getIcFullscreenSelector());
compatCheckBox.setOnClickListener(onClickListener);
}
项目:AssistantBySDK
文件:AlarmFrDialog.java
/**
* 仅一次与其他周期互斥
**/
private void checkedOnce(boolean flag) {
if (flag) {
for (int i = 1; i < map.length; i++) {
((AppCompatCheckBox) findViewById(map[i])).setChecked(false);
}
} else {
((AppCompatCheckBox) findViewById(map[0])).setChecked(false);
}
}
项目: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;
}
项目:RxJavaDownLoadMultipleFile
文件:DownLoadItem.java
@Override public void bindViews(View view) {
btn_status = (Button) view.findViewById(R.id.btn_status);
tv_key = (TextView) view.findViewById(R.id.tv_key);
progress = (ContentLoadingProgressBar) view.findViewById(R.id.progress);
checkBox = (AppCompatCheckBox) view.findViewById(R.id.checkbox);
rootView = view;
}
项目:Sega
文件:SearchView.java
public void setTextColor(@ColorInt int color) {
mTextColor = color;
mEditText.setTextColor(mTextColor);
for (int i = 0, n = mFiltersContainer.getChildCount(); i < n; i++) {
View child = mFiltersContainer.getChildAt(i);
if (child instanceof AppCompatCheckBox)
((AppCompatCheckBox) child).setTextColor(mTextColor);
}
}
项目:Sega
文件:SearchView.java
private void restoreFiltersState(List<Boolean> states) {
mSearchFiltersStates = states;
for (int i = 0, j = 0, n = mFiltersContainer.getChildCount(); i < n; i++) {
View view = mFiltersContainer.getChildAt(i);
if (view instanceof AppCompatCheckBox) {
((AppCompatCheckBox) view).setChecked(mSearchFiltersStates.get(j++));
}
}
}
项目:Sega
文件:SearchView.java
private void dispatchFilters() {
if (mSearchFiltersStates != null) {
for (int i = 0, j = 0, n = mFiltersContainer.getChildCount(); i < n; i++) {
View view = mFiltersContainer.getChildAt(i);
if (view instanceof AppCompatCheckBox)
mSearchFiltersStates.set(j++, ((AppCompatCheckBox) view).isChecked());
}
}
}
项目:Watermark
文件:MediaGridAdapter.java
GridViewHolder(View itemView) {
super(itemView);
mIvMediaImage = itemView.findViewById(R.id.iv_media_image);
mCbCheck = (AppCompatCheckBox) itemView.findViewById(R.id.cb_check);
relativeLayout = (SquareRelativeLayout) itemView.findViewById(R.id.rootView);
mLlCamera = (LinearLayout) itemView.findViewById(R.id.ll_camera);
mTvCameraTxt = (TextView) itemView.findViewById(R.id.tv_camera_txt);
mIvCameraImage = (ImageView) itemView.findViewById(R.id.iv_camera_image);
int checkTint = ThemeUtils.resolveColor(itemView.getContext(), R.attr.gallery_checkbox_button_tint_color, R.color.gallery_default_checkbox_button_tint_color);
CompoundButtonCompat.setButtonTintList(mCbCheck, ColorStateList.valueOf(checkTint));
}
项目:Watermark
文件:MediaGridAdapter.java
@Override
public void onClick(View view) {
if (mConfiguration.getMaxSize() == mMediaActivity.getCheckedList().size() &&
!mMediaActivity.getCheckedList().contains(mediaBean)) {
AppCompatCheckBox checkBox = (AppCompatCheckBox) view;
checkBox.setChecked(false);
Logger.i("=>" + mMediaActivity.getResources().getString(R.string.gallery_image_max_size_tip, mConfiguration.getMaxSize()));
} else {
RxBus.getDefault().post(new MediaCheckChangeEvent(mediaBean));
}
}
项目:CXJPadProject
文件:SelectReturnSupplierDialog.java
private void initData() {
checked = new boolean[list.size()];
rv_return_supplier = (RecyclerView) this.findViewById(R.id.rv_return_supplier);
adapter = new BRAdapter<ReturnQuoteInfo.ReturnQuoteDetail>(activity, R.layout.item_select_return_supplier_dialog, list) {
@Override
protected void convert(RvHolder holder, final ReturnQuoteInfo.ReturnQuoteDetail returnQuoteDetail, final int position) {
holder.setText(R.id.tv_supplier, returnQuoteDetail.vendorName);
holder.setText(R.id.tv_status, returnQuoteDetail.statusName);
final String isCanChecked = list.get(position).isCanChecked;
final AppCompatCheckBox ivStatus = holder.getView(R.id.iv_select);
if (!"1".equals(isCanChecked)) {
ivStatus.setVisibility(View.INVISIBLE);
}
ivStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
checked[position] = isChecked;
}
});
// holder.setOnClickListener(R.id.iv_select, new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// ivStatus.setImageResource(R.drawable.duoxuan_01);
// ivStatus.setTag(R.id.tag_first, returnQuoteDetail.vendorId);
//
// }
// });
}
};
rv_return_supplier.setAdapter(adapter);
rv_return_supplier.setLayoutManager(new LinearLayoutManager(activity));
}
项目:oma-riista-android
文件:ChoiceView.java
public ChoiceView(Context context, String titleText) {
super(context);
LayoutInflater.from(context).inflate(R.layout.view_choice, this);
((TextView) findViewById(R.id.txt_choice_title)).setText(titleText);
mSpinner = (AppCompatSpinner) findViewById(R.id.spinner_choice);
mCheckBox = (AppCompatCheckBox) findViewById(R.id.check_choice);
mEditText = (EditText) findViewById(R.id.edit_text_choice);
mCheckBoxes = (LinearLayout) findViewById(R.id.container_check_boxes);
mBottomSeparator = findViewById(R.id.separator_choice_bottom);
}
项目:oma-riista-android
文件:ChoiceView.java
public void addMultipleChoice(String text, boolean checked, final OnCheckListener listener) {
ColorStateList colorStateList = new ColorStateList(
new int[][]{
new int[]{-android.R.attr.state_enabled}, //disabled
new int[]{android.R.attr.state_enabled}, //enabled
new int[]{android.R.attr.state_checked}
},
new int[]{
R.color.checkbox_disabled_color, //disabled
R.color.checkbox_enabled_color, //enabled
R.color.checkbox_checked_color
}
);
AppCompatCheckBox box = new AppCompatCheckBox(getContext());
box.setChecked(checked);
box.setSupportButtonTintList(colorStateList);
box.setText(localize(text));
box.setTextColor(getResources().getColor(R.color.text_dark));
box.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
listener.onCheck(isChecked);
}
});
mCheckBoxes.addView(box);
}
项目:QuestionnaireView
文件:CheckListItemView.java
@Override
protected void onFinishInflate() {
super.onFinishInflate();
checkBox = (AppCompatCheckBox)findViewById(R.id.checkbox);
textView = (AppCompatTextView)findViewById(R.id.tv1);
}
项目:wallpaperboard
文件:Tooltip.java
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
if (view == null) {
view = View.inflate(mContext, R.layout.tooltips_popup, null);
}
TextView content = view.findViewById( R.id.content);
TextView desc = view.findViewById( R.id.desc);
AppCompatCheckBox checkBox = view.findViewById( R.id.checkbox);
TextView button = view.findViewById( R.id.button);
content.setText(mBuilder.mContent);
button.setText(mBuilder.mButton);
if (mBuilder.mDesc != null) {
desc.setVisibility(View.VISIBLE);
desc.setText(mBuilder.mDesc);
if (mBuilder.mDescIcon != 0) {
int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
Drawable drawable = DrawableHelper.getTintedDrawable(mContext, mBuilder.mDescIcon, color);
desc.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
}
}
checkBox.setVisibility(mBuilder.mIsDontShowAgainVisible ? View.VISIBLE : View.GONE);
checkBox.setOnCheckedChangeListener((compoundButton, b) -> mCheckboxState = b);
button.setOnClickListener(v -> {
if (mBuilder.mCallback != null) {
mBuilder.mCallback.onButtonClick(mTooltip);
return;
}
mTooltip.dismiss();
});
return view;
}
项目:BizareChat
文件:LoginFragment.java
private void initView(View view) {
signIn = (Button) view.findViewById(R.id.sign_in);
signUp = (Button) view.findViewById(R.id.sign_up);
emailEditText = (EditText) view.findViewById(R.id.email);
passwordEditText = (EditText) view.findViewById(R.id.password);
forgotPasswordTextView = (TextView) view.findViewById(R.id.forgot_password);
progressBar = (ProgressBar) getActivity().findViewById(R.id.progress_bar);
keepMeSignIn = (AppCompatCheckBox) view.findViewById(R.id.keep_me_check);
notificationManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
TextView txtView = (TextView) getActivity().findViewById(R.id.toolbar_title);
txtView.setText(R.string.sign_in);
}