forked from upstream-mirrors/OpenTracks
UI refactoring with a Bottom App Bar.
Only one button to play/stop. Stop Activity to edit track just recorded, resuming or finishing. Logo color to FF6D00. Fixes #1078 #437 #575 #1094.
This commit is contained in:
committed by
Román Martínez
parent
a350077e5c
commit
da62d26409
+3
@@ -60,6 +60,9 @@ public class AggregatedStatisticsActivity extends AbstractActivity implements Fi
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
});
|
||||
|
||||
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
|
||||
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.menu_aggregated_statistics));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -105,7 +105,7 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
setTitle(markerAdapter.getPageTitle(position));
|
||||
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(markerAdapter.getPageTitle(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,6 +113,8 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
|
||||
}
|
||||
});
|
||||
viewBinding.makerDetailActivityViewPager.setCurrentItem(markerIndex == -1 ? 0 : markerIndex);
|
||||
|
||||
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -101,7 +101,7 @@ public class MarkerEditActivity extends AbstractActivity {
|
||||
});
|
||||
|
||||
boolean isNewMarker = markerId == null;
|
||||
setTitle(isNewMarker ? R.string.menu_insert_marker : R.string.menu_edit);
|
||||
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(isNewMarker ? R.string.menu_insert_marker : R.string.menu_edit));
|
||||
viewBinding.markerEditDone.setText(isNewMarker ? R.string.generic_add : R.string.generic_save);
|
||||
viewBinding.markerEditDone.setOnClickListener(v -> {
|
||||
viewModel.onDone(viewBinding.markerEditName.getText().toString(),
|
||||
@@ -150,6 +150,8 @@ public class MarkerEditActivity extends AbstractActivity {
|
||||
viewBinding.markerEditDescription.getText().toString());
|
||||
}
|
||||
});
|
||||
|
||||
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -80,6 +80,8 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
|
||||
public void onPrepare(Menu menu, int[] positions, long[] ids, boolean showSelectAll) {
|
||||
boolean isSingleSelection = ids.length == 1;
|
||||
|
||||
viewBinding.bottomAppBarLayout.bottomAppBar.performHide(true);
|
||||
|
||||
menu.findItem(R.id.list_context_menu_show_on_map).setVisible(isSingleSelection);
|
||||
menu.findItem(R.id.list_context_menu_edit).setVisible(isSingleSelection);
|
||||
menu.findItem(R.id.list_context_menu_delete).setVisible(true);
|
||||
@@ -92,6 +94,11 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
|
||||
public boolean onClick(int itemId, int[] positions, long[] ids) {
|
||||
return handleContextItem(itemId, ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
viewBinding.bottomAppBarLayout.bottomAppBar.performShow(true);
|
||||
}
|
||||
};
|
||||
private MenuItem insertMarkerMenuItem;
|
||||
private MenuItem searchMenuItem;
|
||||
@@ -121,6 +128,8 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
|
||||
ActivityUtils.configureListViewContextualMenu(viewBinding.markerList, contextualActionModeCallback);
|
||||
|
||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(bindCallback);
|
||||
|
||||
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -301,9 +310,9 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
|
||||
this.searchQuery = searchQuery;
|
||||
restart();
|
||||
if (searchQuery != null) {
|
||||
setTitle(searchQuery);
|
||||
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(searchQuery);
|
||||
} else {
|
||||
setTitle(R.string.menu_markers);
|
||||
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.menu_markers));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public class MarkerResourceCursorAdapter extends ResourceCursorAdapter implement
|
||||
|
||||
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context);
|
||||
Track track = contentProviderUtils.getTrack(new Track.Id(trackId));
|
||||
ListItemUtils.setListItem(activity, view, false, true, iconId, R.string.image_marker, name, null, null, 0,
|
||||
ListItemUtils.setListItem(activity, view, false, iconId, R.string.image_marker, name, null, null, 0,
|
||||
OffsetDateTime.ofInstant(Instant.ofEpochMilli(time), track.getZoneOffset()), category, description, hasPhoto);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActivityUtils {
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
// Do nothing
|
||||
contextualActionModeCallback.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,5 +127,10 @@ public class ActivityUtils {
|
||||
* @param ids the selected items' ids, if available
|
||||
*/
|
||||
boolean onClick(int itemId, int[] positions, long[] ids);
|
||||
|
||||
/**
|
||||
* Invoked when contextual action mode is destroyed.
|
||||
*/
|
||||
void onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ public class ListItemUtils {
|
||||
* @param context the context
|
||||
* @param view the list item view
|
||||
* @param isRecording true if recording
|
||||
* @param isPaused true if paused
|
||||
* @param iconId the icon id
|
||||
* @param iconContentDescriptionId the icon content description id
|
||||
* @param name the name value
|
||||
@@ -56,11 +55,11 @@ public class ListItemUtils {
|
||||
* @param description the description value
|
||||
* @param hasPhoto true if this list item has photo
|
||||
*/
|
||||
public static void setListItem(Context context, View view, boolean isRecording, boolean isPaused, int iconId, int iconContentDescriptionId, String name, String totalTime, String totalDistance, int markerCount, OffsetDateTime offsetDateTime, String category, String description, boolean hasPhoto) {
|
||||
public static void setListItem(Context context, View view, boolean isRecording, int iconId, int iconContentDescriptionId, String name, String totalTime, String totalDistance, int markerCount, OffsetDateTime offsetDateTime, String category, String description, boolean hasPhoto) {
|
||||
// Set icon
|
||||
if (isRecording) {
|
||||
iconId = isPaused ? R.drawable.ic_track_paused : R.drawable.ic_track_recording;
|
||||
iconContentDescriptionId = isPaused ? R.string.image_pause : R.string.image_record;
|
||||
iconId = R.drawable.ic_track_recording;
|
||||
iconContentDescriptionId = R.string.image_record;
|
||||
}
|
||||
|
||||
ImageView iconImageView = view.findViewById(R.id.list_item_icon);
|
||||
@@ -75,7 +74,7 @@ public class ListItemUtils {
|
||||
TextView timeDistanceTextView = view.findViewById(R.id.list_item_time_distance);
|
||||
String timeDistanceText;
|
||||
if (isRecording) {
|
||||
timeDistanceText = context.getString(isPaused ? R.string.generic_paused : R.string.generic_recording);
|
||||
timeDistanceText = context.getString(R.string.generic_recording);
|
||||
} else {
|
||||
// Match list_item_time_distance in list_item.xml
|
||||
timeDistanceText = getTimeDistance(totalTime, totalDistance);
|
||||
|
||||
Reference in New Issue
Block a user