@Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.service_settings, menu);
   boolean enabled = isEnabled();
   getPreferenceScreen().setEnabled(enabled);
   Switch enableSwitch =
       ButterKnife.findById(
           menu.findItem(R.id.menu_enable_switch).getActionView(), R.id.action_widget_switch);
   enableSwitch.setChecked(enabled);
   enableSwitch.setOnCheckedChangeListener(
       new CompoundButton.OnCheckedChangeListener() {
         @Override
         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
           setEnabled(isChecked);
           getPreferenceScreen().setEnabled(isChecked);
         }
       });
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.menu_pref_notifications, menu);
   super.onCreateOptionsMenu(menu, inflater);
 }
Beispiel #3
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.preferences_search_menu, menu);
 }