Java Code Examples for android.widget.CheckBox#getParent()
The following examples show how to use
android.widget.CheckBox#getParent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsActivity.java From matrix-android-console with Apache License 2.0 | 5 votes |
private void refreshGCMEntries() { GcmRegistrationManager gcmRegistrationManager = Matrix.getInstance(this).getSharedGcmRegistrationManager(); final CheckBox gcmBox = (CheckBox) findViewById(R.id.checkbox_useGcm); gcmBox.setChecked(gcmRegistrationManager.useGCM() && gcmRegistrationManager.is3rdPartyServerRegistred()); // check if the GCM registration has not been rejected. boolean gcmButEnabled = gcmRegistrationManager.useGCM() || gcmRegistrationManager.isGCMRegistred(); View parentView = (View)gcmBox.getParent(); parentView.setEnabled(gcmButEnabled); gcmBox.setEnabled(gcmButEnabled); parentView.setAlpha(gcmButEnabled ? 1.0f : 0.5f); }
Example 2
Source File: NotificationSettingsActivity.java From matrix-android-console with Apache License 2.0 | 4 votes |
private void refreshUI() { mPerWordAdapter.clear(); mPerRoomAdapter.clear(); mPerSenderAdapter.clear(); if (null != mBingRuleSet) { BingRule disableAll = mBingRuleSet.findDefaultRule(BingRule.RULE_ID_DISABLE_ALL); if ((null != disableAll) && disableAll.isEnabled) { mDisableAllButton.setText(getString(R.string.notification_settings_enable_notifications)); mDisableAllTextView.setVisibility(View.VISIBLE); mAllSettingsLayout.setVisibility(View.INVISIBLE); mEnableLayout.setBackgroundColor(Color.RED); } else { mDisableAllButton.setText(getString(R.string.notification_settings_disable_all)); mDisableAllTextView.setVisibility(View.INVISIBLE); mAllSettingsLayout.setVisibility(View.VISIBLE); mEnableLayout.setBackgroundColor(Color.TRANSPARENT); } // per word if (null != mBingRuleSet.content) { mPerWordAdapter.addAll(mBingRuleSet.getContentRules()); } // dummy bing rule to add a new one mPerWordAdapter.addAll(new BingRule(false)); mPerWordAdapter.setListener(mOnRulesClicklistener); // per room if (null != mBingRuleSet.content) { mPerRoomAdapter.addAll(mBingRuleSet.getRoomRules()); mPerRoomAdapter.setRooms(mxSession.getDataHandler().getStore().getRooms(), mxSession.getMyUserId()); } // dummy bing rule to add a new one mPerRoomAdapter.addAll(new BingRule(false)); mPerRoomAdapter.setListener(mOnRulesClicklistener); // per sender if (null != mBingRuleSet.content) { mPerSenderAdapter.addAll(mBingRuleSet.getSenderRules()); } // dummy bing rule to add a new one mPerSenderAdapter.addAll(new BingRule(false)); mPerSenderAdapter.setListener(mOnRulesClicklistener); for(String ruleId : mRuleCheckBoxByRuleId.keySet()) { BingRule rule = mBingRuleSet.findDefaultRule(ruleId); CheckBox checkBox = mRuleCheckBoxByRuleId.get(ruleId); if ((null == rule) && (null != checkBox)) { View parentView = (View)checkBox.getParent(); parentView.setVisibility(View.GONE); } // sanity check else if (null != checkBox) { checkBox.setChecked((null == rule) || (rule.isEnabled)); } } } mPerWordAdapter.notifyDataSetChanged(); refreshListViewHeight(mPerWordList); mPerRoomAdapter.notifyDataSetChanged(); refreshListViewHeight(mPerRoomList); mPerSenderAdapter.notifyDataSetChanged(); refreshListViewHeight(mPerSenderList); }
Example 3
Source File: DoctorPlanAdapter.java From android-apps with MIT License | 4 votes |
@Override public void onClick(View view) { CheckBox cbF = (CheckBox) view; Doctor doctorF =(Doctor)cbF.getTag(); // LinearLayout llLayoutP = (LinearLayout) cbF.getParent(); // get Check box parent layout // LinearLayout llLayoutPL = (LinearLayout) llLayoutP.getParent(); // get xml file parent layout // LinearLayout llLayoutF = (LinearLayout) llLayoutPL.getChildAt(0); // get first linear layout of xml file // // TextView tvDoctorId = (TextView) llLayoutF.getChildAt(1); String doctorId = doctorF.getCode(), freq = doctorF.getFrequency(); //Toast.makeText(context, doctorId + "", 500).show(); //if( DoctorCallPlanCheck.isDoctorAvailable(doctorId,freq) ) { if(view instanceof CheckBox ){ CheckBox cb = (CheckBox) view; Doctor doctor =(Doctor)cb.getTag(); if(cb.isChecked()){ if(cb.getId()==R.id.cbEvning){ doctor.setShift("1"); }else if(cb.getId()==R.id.cbMorning) { doctor.setShift("0"); } //Toast.makeText(context, doctor.getName() + "", 500).show(); doctor.setSelected(true); LinearLayout llLayout = (LinearLayout) cb.getParent(); for(int i=0; i<((ViewGroup)llLayout).getChildCount(); ++i) { View nextChild = ((ViewGroup)llLayout).getChildAt(i); if(nextChild instanceof CheckBox && nextChild.getId()==cb.getId() ){ }else if (nextChild instanceof CheckBox && nextChild.getId()!=cb.getId() ){ CheckBox cb2=(CheckBox) nextChild; cb2.setChecked(false); } } }else{ doctor.setShift("EVENING"); doctor.setSelected(false); } } } // else // { // CheckBox cb = (CheckBox) view; // Doctor doctor =(Doctor)cb.getTag(); // doctor.setSelected(false); // // LinearLayout llLayout = (LinearLayout) cb.getParent(); // // for(int i=0; i<((ViewGroup)llLayout).getChildCount(); ++i) { // View nextChild = ((ViewGroup)llLayout).getChildAt(i); // if(nextChild instanceof CheckBox && nextChild.getId()==cb.getId() ){ // CheckBox cb2=(CheckBox) nextChild; // cb2.setChecked(false); // }else if (nextChild instanceof CheckBox && nextChild.getId()!=cb.getId() ){ // CheckBox cb2=(CheckBox) nextChild; // cb2.setChecked(false); // // } // } // // Toast.makeText(context, "You have already cross max plan/call limit", 700).show(); // } }