@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;
}
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);
}
}
}
@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,L10NString.getString("umgr_whether_forget_password"),this);
beautyColorTextView(this.mSwitchAccount,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,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 Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_apply_on_boot,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",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();
}
});
}
@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,false);
}
break;
case R.id.sw_discu_notfaction:
if (isChecked) {
OperationRong.setConverstionNotif(mContext,true);
} else {
OperationRong.setConverstionNotif(mContext,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,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;
}
}
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,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,action);
}
}
});
}
}
public void onCheckedChanged(CompoundButton buttonView,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();
}
@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);
}
});
}
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;
}
}
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();
}
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,isChecked);
}
if (buttonView == mToggleFooter) {
adjustPageHeaderAndFooter(mPageScrollView.getorientation() == PageScrollView.VERTICAL,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();
}
}
});
}