2023-04-03 15:39:44 +02:00
|
|
|
package com.example.mastermind;
|
|
|
|
|
2023-04-09 19:15:36 +02:00
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Intent;
|
2023-04-03 15:39:44 +02:00
|
|
|
import android.os.Bundle;
|
2023-04-09 19:15:36 +02:00
|
|
|
import android.view.View;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
import android.widget.Switch;
|
2023-04-03 15:39:44 +02:00
|
|
|
|
2023-04-09 19:15:36 +02:00
|
|
|
public class SettingsActivity extends Activity {
|
|
|
|
private Button mButton;
|
|
|
|
private Switch mSwitch;
|
|
|
|
private boolean pionV;
|
2023-04-03 15:39:44 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.settings_activity);
|
|
|
|
|
2023-04-09 19:15:36 +02:00
|
|
|
mButton = findViewById(R.id.backButton);
|
|
|
|
mSwitch = findViewById(R.id.switchPion);
|
|
|
|
|
|
|
|
mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
if(isChecked) {
|
|
|
|
pionV = true;
|
|
|
|
} else {
|
|
|
|
pionV = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
mButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.putExtra("pionV", pionV);
|
|
|
|
setResult(1, intent);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
});
|
2023-04-03 15:39:44 +02:00
|
|
|
}
|
|
|
|
}
|