Skip to content
Snippets Groups Projects
Commit 1cb496be authored by Peter Joseph De Jonckheere CESM2014's avatar Peter Joseph De Jonckheere CESM2014
Browse files

fixed radio buttons

parent 6c7b7964
No related branches found
No related tags found
No related merge requests found
......@@ -6,11 +6,12 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.CheckBox;
import android.widget.Spinner;
import android.widget.Toast;
......@@ -30,9 +31,9 @@ public class Settings extends AppCompatActivity{
private void retrieveSettings(){
SharedPreferences shared = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);
findViewById(R.id.Audio).setActivated(shared.getBoolean(getString(R.string.audio), false));
findViewById(R.id.Vibration).setActivated(shared.getBoolean(getString(R.string.vibration), false));
findViewById(R.id.LEDFlash).setActivated(shared.getBoolean(getString(R.string.led), false));
((CheckBox)findViewById(R.id.Audio)).setChecked(shared.getBoolean(getString(R.string.audio), false));
((CheckBox)findViewById(R.id.Vibration)).setChecked(shared.getBoolean(getString(R.string.vibration), false));
((CheckBox)findViewById(R.id.LEDFlash)).setChecked(shared.getBoolean(getString(R.string.led), false));
findViewById(R.id.spinner).setTop(shared.getInt(getString(R.string.daily_goal), R.integer.notify_period_minutes));
((EditText)findViewById(R.id.notificationMessage)).setText(shared.getString(getString(R.string.daily_goal_text), getString(R.string.notf_text)));
}
......@@ -58,9 +59,9 @@ public class Settings extends AppCompatActivity{
}
private void saveSharedPreferenceData(View view){
boolean audio = findViewById(R.id.Audio).isActivated();
boolean vibration = findViewById(R.id.Vibration).isActivated();
boolean led = findViewById(R.id.LEDFlash).isActivated();
boolean audio = ((CheckBox)findViewById(R.id.Audio)).isChecked();
boolean vibration = ((CheckBox)findViewById(R.id.Vibration)).isChecked();
boolean led = ((CheckBox)findViewById(R.id.LEDFlash)).isChecked();
int notifyGap = findViewById(R.id.spinner).getTop();//???
String message = (findViewById(R.id.notificationMessage)).toString();
SharedPreferences sharedPref = view.getContext().getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);
......
......@@ -101,7 +101,35 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
<RadioButton
<EditText
android:id="@+id/notificationMessage"
android:layout_width="346dp"
android:layout_height="44dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:ems="10"
android:inputType="textPersonName"
android:text="@string/notf_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView9"
android:layout_width="277dp"
android:layout_height="44dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/setting_button"
android:textAlignment="textStart"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/back"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/Audio"
android:layout_width="162dp"
android:layout_height="38dp"
......@@ -109,12 +137,11 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/audio"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/spinner" />
<RadioButton
<CheckBox
android:id="@+id/Vibration"
android:layout_width="162dp"
android:layout_height="38dp"
......@@ -126,46 +153,18 @@
app:layout_constraintStart_toEndOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/Audio" />
<RadioButton
<CheckBox
android:id="@+id/LEDFlash"
android:layout_width="162dp"
android:layout_height="38dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/led"
app:layout_constraintBottom_toTopOf="@+id/notificationMessage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/Vibration" />
<EditText
android:id="@+id/notificationMessage"
android:layout_width="346dp"
android:layout_height="44dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:ems="10"
android:inputType="textPersonName"
android:text="@string/notf_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/LEDFlash" />
<TextView
android:id="@+id/textView9"
android:layout_width="277dp"
android:layout_height="44dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/setting_button"
android:textAlignment="textStart"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/back"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment