app/src/main/java/com/geekyouup/android/ustopwatch/SettingsActivity.java
/**
     * Called when the activity is first created.
     */
Called when the activity is first created.
Called when the activity is first created .
@SuppressLint("NewApi")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings);
        CompoundButton mSwitchLaptimer = (CompoundButton) findViewById(R.id.settings_seconds_laptimer);
        mSwitchLaptimer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                isLaptimerEnabled = b;
            }
        });
        /*CompoundButton mSwitchSoundTicking = (CompoundButton) findViewById(R.id.settings_seconds_sound);
        mSwitchSoundTicking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                isTicking = b;
            }
        });*/
        CompoundButton mSwitchAnimating = (CompoundButton) findViewById(R.id.settings_animations);
        mSwitchAnimating.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                isAnimating = b;
            }
        });
        CompoundButton mSwitchEndlessAlarm = (CompoundButton) findViewById(R.id.settings_endless_alert);
        mSwitchEndlessAlarm.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                isEndlessAlarm = b;
            }
        });
        CompoundButton mSwitchVibrate = (CompoundButton) findViewById(R.id.settings_vibrate);
        mSwitchVibrate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                isVibrate = b;
            }
        });
        mSwitchLaptimer.setChecked(isLaptimerEnabled);
        mSwitchEndlessAlarm.setChecked(isEndlessAlarm);
        mSwitchVibrate.setChecked(isVibrate);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB
                && !((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
            mSwitchVibrate.setChecked(false);
            mSwitchVibrate.setEnabled(false);
        }
        mSwitchAnimating.setChecked(isAnimating);
    }
@ SuppressLint ( "NewApi" ) @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . settings ) ; CompoundButton mSwitchLaptimer = ( CompoundButton ) findViewById ( R . id . settings_seconds_laptimer ) ; mSwitchLaptimer . setOnCheckedChangeListener ( new CompoundButton . OnCheckedChangeListener ( ) { @ Override public void onCheckedChanged ( CompoundButton compoundButton , boolean b ) { isLaptimerEnabled = b ; } } ) ; /*CompoundButton mSwitchSoundTicking = (CompoundButton) findViewById(R.id.settings_seconds_sound);
        mSwitchSoundTicking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                isTicking = b;
            }
        });*/ CompoundButton mSwitchAnimating = ( CompoundButton ) findViewById ( R . id . settings_animations ) ; mSwitchAnimating . setOnCheckedChangeListener ( new CompoundButton . OnCheckedChangeListener ( ) { @ Override public void onCheckedChanged ( CompoundButton compoundButton , boolean b ) { isAnimating = b ; } } ) ; CompoundButton mSwitchEndlessAlarm = ( CompoundButton ) findViewById ( R . id . settings_endless_alert ) ; mSwitchEndlessAlarm . setOnCheckedChangeListener ( new CompoundButton . OnCheckedChangeListener ( ) { @ Override public void onCheckedChanged ( CompoundButton compoundButton , boolean b ) { isEndlessAlarm = b ; } } ) ; CompoundButton mSwitchVibrate = ( CompoundButton ) findViewById ( R . id . settings_vibrate ) ; mSwitchVibrate . setOnCheckedChangeListener ( new CompoundButton . OnCheckedChangeListener ( ) { @ Override public void onCheckedChanged ( CompoundButton compoundButton , boolean b ) { isVibrate = b ; } } ) ; mSwitchLaptimer . setChecked ( isLaptimerEnabled ) ; mSwitchEndlessAlarm . setChecked ( isEndlessAlarm ) ; mSwitchVibrate . setChecked ( isVibrate ) ; if ( android . os . Build . VERSION . SDK_INT >= android . os . Build . VERSION_CODES . HONEYCOMB && ! ( ( Vibrator ) getSystemService ( Context . VIBRATOR_SERVICE ) ) . hasVibrator ( ) ) { mSwitchVibrate . setChecked ( false ) ; mSwitchVibrate . setEnabled ( false ) ; } mSwitchAnimating . setChecked ( isAnimating ) ; }
Called when the activity is first created.
Called when the activity is first created .
//mSwitchSoundTicking.setChecked(isTicking);