Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'group6_C2' of https://github.com/rilling/OpenTracksConc…
Browse files Browse the repository at this point in the history
…ordia into group6_C2
  • Loading branch information
pranjalesh committed Nov 20, 2023
2 parents dac7dab + ff587cd commit 0e79d43
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 32 deletions.
24 changes: 12 additions & 12 deletions src/main/java/de/dennisguse/opentracks/TrackListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void onPrepare(Menu menu, int[] positions, long[] trackIds, boolean showS
boolean isSingleSelection = trackIds.length == 1;

viewBinding.bottomAppBar.performHide(true);
viewBinding.trackListFabAction.setVisibility(View.INVISIBLE);
viewBinding.button.setVisibility(View.INVISIBLE);

menu.findItem(R.id.list_context_menu_edit).setVisible(isSingleSelection);
menu.findItem(R.id.list_context_menu_select_all).setVisible(showSelectAll);
Expand All @@ -120,7 +120,7 @@ public boolean onClick(int itemId, int[] positions, long[] trackIds) {

@Override
public void onDestroy() {
viewBinding.trackListFabAction.setVisibility(View.VISIBLE);
viewBinding.button.setVisibility(View.VISIBLE);
viewBinding.bottomAppBar.performShow(true);
}
};
Expand Down Expand Up @@ -238,7 +238,7 @@ public void bindView(View view, Context context, Cursor cursor) {
viewBinding.trackList.setAdapter(resourceCursorAdapter);
ActivityUtils.configureListViewContextualMenu(viewBinding.trackList, contextualActionModeCallback);

viewBinding.trackListFabAction.setOnClickListener((view) -> {
viewBinding.button.setOnClickListener((view) -> {
if (recordingStatus.isRecording()) {
Toast.makeText(TrackListActivity.this, getString(R.string.hold_to_stop), Toast.LENGTH_LONG).show();
return;
Expand All @@ -256,7 +256,7 @@ public void bindView(View view, Context context, Cursor cursor) {
connection.unbind(this);
}).startAndBind(this, true);
});
viewBinding.trackListFabAction.setOnLongClickListener((view) -> {
viewBinding.button.setOnLongClickListener((view) -> {
if (!recordingStatus.isRecording()) {
return false;
}
Expand All @@ -265,8 +265,8 @@ public void bindView(View view, Context context, Cursor cursor) {
ActivityUtils.vibrate(this, 1000);
updateGpsMenuItem(false, false);
trackRecordingServiceConnection.stopRecording(TrackListActivity.this);
viewBinding.trackListFabAction.setImageResource(R.drawable.ic_baseline_record_24);
viewBinding.trackListFabAction.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.red_dark));
// viewBinding.button.setImageResource(R.drawable.ic_baseline_record_24);
viewBinding.button.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.red_dark));
return true;
});

Expand Down Expand Up @@ -553,13 +553,13 @@ public void onGpsStatusChanged(GpsStatusValue newStatus) {
updateGpsMenuItem(true, recordingStatus.isRecording());
}

private void setFloatButton() {
viewBinding.trackListFabAction.setImageResource(recordingStatus.isRecording() ? R.drawable.ic_baseline_stop_24 : R.drawable.ic_baseline_record_24);
viewBinding.trackListFabAction.setBackgroundTintList(ContextCompat.getColorStateList(this, recordingStatus.isRecording() ? R.color.opentracks : R.color.red_dark));
}
// private void setFloatButton() {
// viewBinding.button.setImageResource(recordingStatus.isRecording() ? R.drawable.ic_baseline_stop_24 : R.drawable.ic_baseline_record_24);
// viewBinding.button.setBackgroundTintList(ContextCompat.getColorStateList(this, recordingStatus.isRecording() ? R.color.opentracks : R.color.red_dark));
// }

private void onRecordingStatusChanged(RecordingStatus status) {
recordingStatus = status;
setFloatButton();
// setFloatButton();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ protected void onCreate(Bundle savedInstanceState) {
viewBinding.trackDetailActivityViewPager.setCurrentItem(savedInstanceState.getInt(CURRENT_TAB_TAG_KEY));
}

viewBinding.trackRecordingFabAction.setImageResource(R.drawable.ic_baseline_stop_24);
viewBinding.trackRecordingFabAction.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.opentracks));
viewBinding.trackRecordingFabAction.setBackgroundColor(ContextCompat.getColor(this, R.color.opentracks));
viewBinding.trackRecordingFabAction.setOnLongClickListener((view) -> {
// viewBinding.holdToStopButton.setImageResource(R.drawable.ic_baseline_stop_24);
// viewBinding.holdToStopButton.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.opentracks));
// viewBinding.holdToStopButton.setBackgroundColor(ContextCompat.getColor(this, R.color.opentracks));
viewBinding.holdToStopButton.setOnLongClickListener((view) -> {
ActivityUtils.vibrate(this, 1000);
trackRecordingServiceConnection.stopRecording(TrackRecordingActivity.this);
Intent newIntent = IntentUtils.newIntent(TrackRecordingActivity.this, TrackStoppedActivity.class)
Expand All @@ -145,7 +145,7 @@ protected void onCreate(Bundle savedInstanceState) {
finish();
return true;
});
viewBinding.trackRecordingFabAction.setOnClickListener((view) -> Toast.makeText(TrackRecordingActivity.this, getString(R.string.hold_to_stop), Toast.LENGTH_LONG).show());
viewBinding.holdToStopButton.setOnClickListener((view) -> Toast.makeText(TrackRecordingActivity.this, getString(R.string.hold_to_pause), Toast.LENGTH_LONG).show());

viewBinding.bottomAppBar.setNavigationIcon(R.drawable.ic_baseline_arrow_back_24);
setSupportActionBar(viewBinding.bottomAppBar);
Expand Down
20 changes: 12 additions & 8 deletions src/main/res/layout/track_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ limitations under the License.
</com.google.android.material.appbar.AppBarLayout>

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
Expand Down Expand Up @@ -126,13 +127,16 @@ limitations under the License.

</com.google.android.material.bottomappbar.BottomAppBar>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/track_list_fab_action"
android:tint="@android:color/white"
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/image_record"
android:src="@drawable/ic_baseline_record_24"
app:layout_anchor="@id/bottom_app_bar" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
android:layout_weight="1"
android:backgroundTint="#0B0A0A"
android:fontFamily="monospace"
android:text="START WORKOUT"
android:textStyle="bold"
app:layout_anchor="@+id/bottom_app_bar"
app:layout_anchorGravity="center" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
19 changes: 12 additions & 7 deletions src/main/res/layout/track_recording.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">

<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
Expand Down Expand Up @@ -40,12 +41,16 @@
app:navigationIcon="@drawable/ic_logo_color_24dp"
app:menu="@menu/track_record" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/track_recording_fab_action"
<Button
android:id="@+id/hold_to_stop_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_record_24"
android:contentDescription="@string/image_stop"
app:layout_anchor="@id/bottom_app_bar" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
android:backgroundTint="#020202"
android:fontFamily="monospace"
android:text="HOLD TO PAUSE"
android:textStyle="bold"
android:translationX="-20dp"
app:layout_anchor="@+id/bottom_app_bar"
app:layout_anchorGravity="end|center" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
2 changes: 2 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,8 @@ limitations under the License.
<string name="share_image_body">I think you might be interested in this image.</string>

<string name="hold_to_stop">Hold to stop</string>
<string name="hold_to_pause">Hold to Pause</string>


<string name="instant_export_enabled_summary">Export track to storage after recording is finished</string>
<string name="instant_export_enabled_title">Instant post-workout export</string>
Expand Down

0 comments on commit 0e79d43

Please sign in to comment.