forked from upstream-mirrors/OpenTracks
Bugfixes: TrackStoppedActivity on smaller devices. Fixes #1257.
This commit is contained in:
committed by
Román Martínez
parent
281cd8a861
commit
c5d7ea4245
@@ -44,26 +44,26 @@ public class TrackStoppedActivity extends AbstractActivity implements ChooseActi
|
|||||||
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(this);
|
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(this);
|
||||||
Track track = contentProviderUtils.getTrack(trackId);
|
Track track = contentProviderUtils.getTrack(trackId);
|
||||||
|
|
||||||
viewBinding.fields.trackEditName.setText(track.getName());
|
viewBinding.trackEditName.setText(track.getName());
|
||||||
|
|
||||||
viewBinding.fields.trackEditActivityType.setText(track.getCategory());
|
viewBinding.trackEditActivityType.setText(track.getCategory());
|
||||||
|
|
||||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.activity_types, android.R.layout.simple_dropdown_item_1line);
|
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.activity_types, android.R.layout.simple_dropdown_item_1line);
|
||||||
viewBinding.fields.trackEditActivityType.setAdapter(adapter);
|
viewBinding.trackEditActivityType.setAdapter(adapter);
|
||||||
viewBinding.fields.trackEditActivityType.setOnItemClickListener((parent, view, position, id) -> setActivityTypeIcon(TrackIconUtils.getIconValue(this, (String) viewBinding.fields.trackEditActivityType.getAdapter().getItem(position))));
|
viewBinding.trackEditActivityType.setOnItemClickListener((parent, view, position, id) -> setActivityTypeIcon(TrackIconUtils.getIconValue(this, (String) viewBinding.trackEditActivityType.getAdapter().getItem(position))));
|
||||||
viewBinding.fields.trackEditActivityType.setOnFocusChangeListener((v, hasFocus) -> {
|
viewBinding.trackEditActivityType.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
setActivityTypeIcon(TrackIconUtils.getIconValue(
|
setActivityTypeIcon(TrackIconUtils.getIconValue(
|
||||||
TrackStoppedActivity.this, viewBinding.fields.trackEditActivityType.getText().toString()));
|
TrackStoppedActivity.this, viewBinding.trackEditActivityType.getText().toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
String iconValue = track.getIcon();
|
String iconValue = track.getIcon();
|
||||||
|
|
||||||
setActivityTypeIcon(iconValue);
|
setActivityTypeIcon(iconValue);
|
||||||
viewBinding.fields.trackEditActivityTypeIcon.setOnClickListener(v -> ChooseActivityTypeDialogFragment.showDialog(getSupportFragmentManager(), viewBinding.fields.trackEditActivityType.getText().toString()));
|
viewBinding.trackEditActivityTypeIcon.setOnClickListener(v -> ChooseActivityTypeDialogFragment.showDialog(getSupportFragmentManager(), viewBinding.trackEditActivityType.getText().toString()));
|
||||||
|
|
||||||
viewBinding.fields.trackEditDescription.setText(track.getDescription());
|
viewBinding.trackEditDescription.setText(track.getDescription());
|
||||||
|
|
||||||
viewBinding.time.setText(StringUtils.formatElapsedTime(track.getTrackStatistics().getMovingTime()));
|
viewBinding.time.setText(StringUtils.formatElapsedTime(track.getTrackStatistics().getMovingTime()));
|
||||||
|
|
||||||
@@ -87,8 +87,8 @@ public class TrackStoppedActivity extends AbstractActivity implements ChooseActi
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewBinding.finishButton.setOnClickListener(v -> {
|
viewBinding.finishButton.setOnClickListener(v -> {
|
||||||
TrackUtils.updateTrack(TrackStoppedActivity.this, track, viewBinding.fields.trackEditName.getText().toString(),
|
TrackUtils.updateTrack(TrackStoppedActivity.this, track, viewBinding.trackEditName.getText().toString(),
|
||||||
viewBinding.fields.trackEditActivityType.getText().toString(), viewBinding.fields.trackEditDescription.getText().toString(),
|
viewBinding.trackEditActivityType.getText().toString(), viewBinding.trackEditDescription.getText().toString(),
|
||||||
contentProviderUtils);
|
contentProviderUtils);
|
||||||
ExportUtils.postWorkoutExport(this, trackId);
|
ExportUtils.postWorkoutExport(this, trackId);
|
||||||
finish();
|
finish();
|
||||||
@@ -112,13 +112,13 @@ public class TrackStoppedActivity extends AbstractActivity implements ChooseActi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setActivityTypeIcon(String iconValue) {
|
private void setActivityTypeIcon(String iconValue) {
|
||||||
viewBinding.fields.trackEditActivityTypeIcon.setImageResource(TrackIconUtils.getIconDrawable(iconValue));
|
viewBinding.trackEditActivityTypeIcon.setImageResource(TrackIconUtils.getIconDrawable(iconValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChooseActivityTypeDone(String iconValue) {
|
public void onChooseActivityTypeDone(String iconValue) {
|
||||||
setActivityTypeIcon(iconValue);
|
setActivityTypeIcon(iconValue);
|
||||||
viewBinding.fields.trackEditActivityType.setText(getString(TrackIconUtils.getIconActivityType(iconValue)));
|
viewBinding.trackEditActivityType.setText(getString(TrackIconUtils.getIconActivityType(iconValue)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resumeTrackAndFinish() {
|
private void resumeTrackAndFinish() {
|
||||||
|
|||||||
@@ -7,97 +7,173 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include
|
<ScrollView style="@style/ScrollView.WithBottomButtons">
|
||||||
android:id="@+id/fields"
|
|
||||||
layout="@layout/track_edit_fields" />
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?attr/textInputOutlinedStyle"
|
||||||
|
android:hint="@string/generic_name"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:layout_marginBottom="16dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/track_edit_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
|
android:selectAllOnFocus="true" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?attr/textInputOutlinedExposedDropdownMenuStyle"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:layout_marginBottom="16dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||||
|
android:id="@+id/track_edit_activity_type"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:hint="@string/track_edit_activity_type_hint"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:selectAllOnFocus="true" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/track_edit_activity_type_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
tools:src="@drawable/ic_activity_bike_24dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?attr/textInputOutlinedStyle"
|
||||||
|
android:hint="@string/generic_description"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:layout_marginBottom="16dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/track_edit_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
|
android:selectAllOnFocus="true" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/guideline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.5" />
|
||||||
|
|
||||||
|
<!-- Time -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time"
|
||||||
|
style="?attr/textAppearanceHeadline2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="04:54:36" />
|
||||||
|
|
||||||
|
<!-- Distance -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/distance"
|
||||||
|
style="?attr/textAppearanceHeadline3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/distance_unit"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/time"
|
||||||
|
tools:layout_editor_absoluteX="52dp"
|
||||||
|
tools:text="130" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/distance_unit"
|
||||||
|
style="@style/TextAppearance.OpenTracks.PrimaryUnit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/distance"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/guideline"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/distance"
|
||||||
|
tools:text="km" />
|
||||||
|
|
||||||
|
<!-- Average moving speed -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/speed"
|
||||||
|
style="?attr/textAppearanceHeadline3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/speed_unit"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/time"
|
||||||
|
tools:text="26,5" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/speed_unit"
|
||||||
|
style="@style/TextAppearance.OpenTracks.PrimaryUnit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/speed"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/speed"
|
||||||
|
tools:text="km/h" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
<LinearLayout style="@style/BottomButtonBar">
|
<LinearLayout style="@style/BottomButtonBar">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="16dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
|
||||||
android:id="@+id/guideline"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintGuide_percent="0.5" />
|
|
||||||
|
|
||||||
<!-- Time -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/time"
|
|
||||||
style="?attr/textAppearanceHeadline2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:text="04:54:36" />
|
|
||||||
|
|
||||||
<!-- Distance -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/distance"
|
|
||||||
style="?attr/textAppearanceHeadline3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/distance_unit"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/time"
|
|
||||||
tools:layout_editor_absoluteX="52dp"
|
|
||||||
tools:text="130" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/distance_unit"
|
|
||||||
style="@style/TextAppearance.OpenTracks.PrimaryUnit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/distance"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/guideline"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/distance"
|
|
||||||
tools:text="km" />
|
|
||||||
|
|
||||||
<!-- Average moving speed -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/speed"
|
|
||||||
style="?attr/textAppearanceHeadline3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/speed_unit"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/time"
|
|
||||||
tools:text="26,5" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/speed_unit"
|
|
||||||
style="@style/TextAppearance.OpenTracks.PrimaryUnit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/speed"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/speed"
|
|
||||||
tools:text="km/h" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Barrier
|
|
||||||
android:id="@+id/stats_summary_barrier"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:barrierDirection="bottom"
|
|
||||||
app:constraint_referenced_ids="time,distance,speed" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/resume_button"
|
android:id="@+id/resume_button"
|
||||||
android:layout_width="64dp"
|
android:layout_width="64dp"
|
||||||
android:layout_height="64dp"
|
android:layout_height="64dp"
|
||||||
android:layout_marginTop="48dp"
|
|
||||||
android:contentDescription="@string/image_record"
|
android:contentDescription="@string/image_record"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/finish_button"
|
app:layout_constraintEnd_toStartOf="@id/finish_button"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/stats_summary_barrier"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/ic_button_resume" />
|
app:srcCompat="@drawable/ic_button_resume" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|||||||
Reference in New Issue
Block a user