コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    // set up Button listeners
    Button religious = (Button) findViewById(R.id.religiousCommunities);
    religious.setOnClickListener(this);
    Button israel = (Button) findViewById(R.id.israel);
    israel.setOnClickListener(this);
    Button socialJustice = (Button) findViewById(R.id.socialJustice);
    socialJustice.setOnClickListener(this);
    Button education = (Button) findViewById(R.id.education);
    education.setOnClickListener(this);
    Button jewishCulture = (Button) findViewById(R.id.jewishCulture);
    jewishCulture.setOnClickListener(this);

    // Set up Switch Listeners
    Switch religiousS = (Switch) findViewById(R.id.religiousCommunitiesSwitch);
    religiousS.setChecked(NotificationSignup.signedUpForAllRC(getApplicationContext()));
    religiousS.setOnCheckedChangeListener(this);
    Switch israelS = (Switch) findViewById(R.id.israelSwitch);
    israelS.setChecked(NotificationSignup.signedUpForAllIO(getApplicationContext()));
    israelS.setOnCheckedChangeListener(this);
    Switch socialJusticeS = (Switch) findViewById(R.id.socialJusticeSwitch);
    socialJusticeS.setOnCheckedChangeListener(this);
    socialJusticeS.setChecked(NotificationSignup.signedUpForAllSJ(getApplicationContext()));
    Switch educationS = (Switch) findViewById(R.id.educationSwitch);
    educationS.setChecked(NotificationSignup.signedUpForAllED(getApplicationContext()));
    educationS.setOnCheckedChangeListener(this);
    Switch jewishCultureS = (Switch) findViewById(R.id.jewishCultureSwitch);
    jewishCultureS.setChecked(NotificationSignup.signedUpForAllJC(getApplicationContext()));
    jewishCultureS.setOnCheckedChangeListener(this);
  }
コード例 #2
0
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   if (buttonView.getId() == R.id.religiousCommunitiesSwitch) {
     if (isChecked) NotificationSignup.signupAllRC(getApplicationContext());
   }
   if (buttonView.getId() == R.id.israelSwitch) {
     if (isChecked) NotificationSignup.signupAllIO(getApplicationContext());
   }
   if (buttonView.getId() == R.id.socialJusticeSwitch) {
     if (isChecked) NotificationSignup.signupAllSJ(getApplicationContext());
   }
   if (buttonView.getId() == R.id.educationSwitch) {
     if (isChecked) NotificationSignup.signupAllED(getApplicationContext());
   }
   if (buttonView.getId() == R.id.jewishCultureSwitch) {
     if (isChecked) NotificationSignup.signupAllJC(getApplicationContext());
   }
 }