mirror of
https://github.com/russok/FitoTrack.git
synced 2025-10-29 00:32:11 -07:00
Correctly display workout comment
This commit is contained in:
parent
16c42ec350
commit
4a89e95b41
@ -67,12 +67,9 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
|
|
||||||
initAfterContent();
|
initAfterContent();
|
||||||
|
|
||||||
String commentStr = getString(R.string.comment) + ": " + workout.comment;
|
commentView = addText("", true);
|
||||||
if (workout.edited) {
|
|
||||||
commentStr = getString(R.string.workoutEdited) + "\n" + commentStr;
|
|
||||||
}
|
|
||||||
commentView = addText(commentStr, true);
|
|
||||||
commentView.setOnClickListener(v -> openEditCommentDialog());
|
commentView.setOnClickListener(v -> openEditCommentDialog());
|
||||||
|
updateCommentText();
|
||||||
|
|
||||||
addTitle(getString(R.string.workoutTime));
|
addTitle(getString(R.string.workoutTime));
|
||||||
addKeyValue(getString(R.string.workoutDate), getDate());
|
addKeyValue(getString(R.string.workoutDate), getDate());
|
||||||
@ -136,14 +133,22 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
editText.setSingleLine(true);
|
editText.setSingleLine(true);
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle(R.string.enterComment)
|
.setTitle(R.string.enterComment)
|
||||||
.setPositiveButton(R.string.okay, (dialog, which) -> changeComment(editText.getText().toString(), commentView))
|
.setPositiveButton(R.string.okay, (dialog, which) -> changeComment(editText.getText().toString()))
|
||||||
.setView(editText).create().show();
|
.setView(editText).create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeComment(String comment, TextView onChange) {
|
private void changeComment(String comment) {
|
||||||
workout.comment= comment;
|
workout.comment= comment;
|
||||||
Instance.getInstance(this).db.workoutDao().updateWorkout(workout);
|
Instance.getInstance(this).db.workoutDao().updateWorkout(workout);
|
||||||
onChange.setText(getString(R.string.comment) + ": " + workout.comment);
|
updateCommentText();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCommentText() {
|
||||||
|
String commentStr = getString(R.string.comment) + ": " + workout.comment;
|
||||||
|
if (workout.edited) {
|
||||||
|
commentStr = getString(R.string.workoutEdited) + "\n" + commentStr;
|
||||||
|
}
|
||||||
|
commentView.setText(commentStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDate() {
|
private String getDate() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user