Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SedentaryBehaviourApplication
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Joseph De Jonckheere CESM2014
SedentaryBehaviourApplication
Commits
1cb496be
Commit
1cb496be
authored
7 years ago
by
Peter Joseph De Jonckheere CESM2014
Browse files
Options
Downloads
Patches
Plain Diff
fixed radio buttons
parent
6c7b7964
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/example/pharmacy/frontEnd/Settings.java
+8
-7
8 additions, 7 deletions
src/main/java/com/example/pharmacy/frontEnd/Settings.java
src/main/res/layout/settings.xml
+33
-34
33 additions, 34 deletions
src/main/res/layout/settings.xml
with
41 additions
and
41 deletions
src/main/java/com/example/pharmacy/frontEnd/Settings.java
+
8
−
7
View file @
1cb496be
...
...
@@ -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
).
set
Activat
ed
(
shared
.
getBoolean
(
getString
(
R
.
string
.
audio
),
false
));
findViewById
(
R
.
id
.
Vibration
).
set
Activat
ed
(
shared
.
getBoolean
(
getString
(
R
.
string
.
vibration
),
false
));
findViewById
(
R
.
id
.
LEDFlash
).
set
Activat
ed
(
shared
.
getBoolean
(
getString
(
R
.
string
.
led
),
false
));
((
CheckBox
)
findViewById
(
R
.
id
.
Audio
)
)
.
set
Check
ed
(
shared
.
getBoolean
(
getString
(
R
.
string
.
audio
),
false
));
((
CheckBox
)
findViewById
(
R
.
id
.
Vibration
)
)
.
set
Check
ed
(
shared
.
getBoolean
(
getString
(
R
.
string
.
vibration
),
false
));
((
CheckBox
)
findViewById
(
R
.
id
.
LEDFlash
)
)
.
set
Check
ed
(
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
).
is
Activat
ed
();
boolean
vibration
=
findViewById
(
R
.
id
.
Vibration
).
is
Activat
ed
();
boolean
led
=
findViewById
(
R
.
id
.
LEDFlash
).
is
Activat
ed
();
boolean
audio
=
((
CheckBox
)
findViewById
(
R
.
id
.
Audio
)
)
.
is
Check
ed
();
boolean
vibration
=
((
CheckBox
)
findViewById
(
R
.
id
.
Vibration
)
)
.
is
Check
ed
();
boolean
led
=
((
CheckBox
)
findViewById
(
R
.
id
.
LEDFlash
)
)
.
is
Check
ed
();
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
);
...
...
This diff is collapsed.
Click to expand it.
src/main/res/layout/settings.xml
+
33
−
34
View file @
1cb496be
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment