Migrate to Material3 design.

Fixes #1586.
This commit is contained in:
Dennis Guse
2023-06-09 22:53:52 +02:00
parent dbd64a8075
commit 9f1ea4d745
39 changed files with 288 additions and 201 deletions
@@ -11,10 +11,9 @@ import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anything;
import static de.dennisguse.opentracks.util.EspressoUtils.childAtPosition;
import static de.dennisguse.opentracks.util.EspressoUtils.waitFor;
import android.Manifest;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
@@ -53,7 +52,15 @@ public class EspressoDeleteTrackTest {
onData(anything()).inAdapterView(withId(R.id.track_list)).atPosition(0).perform(longClick());
// open menu and delete selected track
onView(allOf(withContentDescription("More options"), isDisplayed()))
//TODO openActionBarOverflowOrOptionsMenu(); doesn't work
onView(
allOf(withContentDescription("More options"),
childAtPosition(
childAtPosition(
withId(androidx.appcompat.R.id.action_mode_bar),
1),
2),
isDisplayed()))
.perform(click());
onView(withText("Delete")).perform(click());
@@ -59,8 +59,8 @@ public class EspressoAggregatedFilterTest {
public void espressoAggregatedFilterTest() {
// open AggregatedStatisticsActivity through toolbar's menu item
onView(ViewMatchers.withId(R.id.bottom_app_bar)).check(matches(isDisplayed()));
onView(withId(R.id.bottom_app_bar)).check(matches(hasDescendant(withId(R.id.track_list_aggregated_stats))));
onView(withId(R.id.track_list_aggregated_stats)).perform(click());
onView(withId(R.id.bottom_app_bar)).check(matches(hasDescendant(withId(R.id.aggregated_stats_button))));
onView(withId(R.id.aggregated_stats_button)).perform(click());
// open FilterDialogFragment through toolbar's menu item
onView(withId(R.id.bottom_app_bar)).check(matches(isDisplayed()));
@@ -24,7 +24,7 @@ public class ShowErrorActivity extends AbstractActivity {
super.onCreate(savedInstanceState);
viewBinding.textViewError.setText(getIntent().getStringExtra(EXTRA_ERROR_TEXT));
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(createErrorTitle());
viewBinding.showErrorToolbar.setTitle(createErrorTitle());
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
}
@@ -109,7 +109,6 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
viewBinding.trackEditCancel.setOnClickListener(v -> finish());
viewBinding.trackEditCancel.setVisibility(View.VISIBLE);
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.menu_edit));
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
}
@@ -35,6 +35,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.cursoradapter.widget.ResourceCursorAdapter;
@@ -42,12 +43,12 @@ import androidx.loader.app.LoaderManager;
import androidx.loader.content.CursorLoader;
import androidx.loader.content.Loader;
import com.google.android.material.button.MaterialButton;
import java.time.Duration;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays;
import de.dennisguse.opentracks.data.models.Distance;
import de.dennisguse.opentracks.data.models.DistanceFormatter;
@@ -82,7 +83,7 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
private static final String TAG = TrackListActivity.class.getSimpleName();
// The following are setFrequency in onCreate
// The following are set in onCreate
private TrackRecordingServiceConnection trackRecordingServiceConnection;
private ResourceCursorAdapter resourceCursorAdapter;
@@ -136,7 +137,6 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
// Menu items
private MenuItem searchMenuItem;
private MenuItem startGpsMenuItem;
private final TrackRecordingServiceConnection.Callback bindChangedCallback = (service, unused) -> {
service.getRecordingStatusObservable()
@@ -164,6 +164,25 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
trackRecordingServiceConnection = new TrackRecordingServiceConnection(bindChangedCallback);
viewBinding.aggregatedStatsButton.setOnClickListener((view) -> startActivity(IntentUtils.newIntent(this, AggregatedStatisticsActivity.class)));
viewBinding.sensorStartButton.setOnClickListener((view) -> {
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
if (locationManager != null && !locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
} else {
// Invoke trackRecordingService
if (!gpsStatusValue.isGpsStarted()) {
trackRecordingServiceConnection.startAndBindWithCallback(this);
} else {
TrackRecordingService trackRecordingService = trackRecordingServiceConnection.getServiceIfBound();
if (trackRecordingService != null) {
trackRecordingService.stopSensorsAndShutdown(); //TODO Handle this in TrackRecordingServiceConnection
}
trackRecordingServiceConnection.unbindAndStop(this);
}
}
});
viewBinding.trackList.setEmptyView(viewBinding.trackListEmptyView);
viewBinding.trackList.setOnItemClickListener((parent, view, position, trackIdId) -> {
Track.Id trackId = new Track.Id(trackIdId);
@@ -253,7 +272,7 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
return true;
});
setSupportActionBar(viewBinding.bottomAppBar);
setSupportActionBar(viewBinding.trackListToolbar);
loadData(getIntent());
}
@@ -308,21 +327,7 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
getMenuInflater().inflate(R.menu.track_list, menu);
searchMenuItem = menu.findItem(R.id.track_list_search);
SearchView searchView = ActivityUtils.configureSearchWidget(this, searchMenuItem);
searchView.findViewById(androidx.appcompat.R.id.search_edit_frame).setPadding(0, 0, 48, 0);
SearchView.SearchAutoComplete searchAutoComplete = searchView.findViewById(androidx.appcompat.R.id.search_src_text);
searchAutoComplete.setHintTextColor(ContextCompat.getColor(this, android.R.color.white));
searchAutoComplete.setTextColor(ContextCompat.getColor(this, android.R.color.white));
searchView.setOnCloseListener(() -> {
searchView.clearFocus();
searchMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
return true;
});
startGpsMenuItem = menu.findItem(R.id.track_list_start_gps);
ActivityUtils.configureSearchWidget(this, searchMenuItem);
return super.onCreateOptionsMenu(menu);
}
@@ -339,34 +344,6 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.track_list_start_gps) {
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
if (locationManager != null && !locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
} else {
// Invoke trackRecordingService
if (!gpsStatusValue.isGpsStarted()) {
trackRecordingServiceConnection.startAndBindWithCallback(this);
} else {
TrackRecordingService trackRecordingService = trackRecordingServiceConnection.getServiceIfBound();
if (trackRecordingService != null) {
trackRecordingService.stopSensorsAndShutdown(); //TODO Handle this in TrackRecordingServiceConnection
}
trackRecordingServiceConnection.unbindAndStop(this);
}
// Update menu after starting or stopping gps
this.invalidateOptionsMenu();
}
return true;
}
if (item.getItemId() == R.id.track_list_aggregated_stats) {
startActivity(IntentUtils.newIntent(this, AggregatedStatisticsActivity.class));
return true;
}
if (item.getItemId() == R.id.track_list_markers) {
startActivity(IntentUtils.newIntent(this, MarkerListActivity.class));
return true;
@@ -460,14 +437,12 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
*/
//TODO Check if if can be avoided to call this outside of onGpsStatusChanged()
private void updateGpsMenuItem(boolean isGpsStarted, boolean isRecording) {
if (startGpsMenuItem != null) {
startGpsMenuItem.setVisible(!isRecording);
if (!isRecording) {
startGpsMenuItem.setTitle(isGpsStarted ? R.string.menu_stop_gps : R.string.menu_start_gps);
startGpsMenuItem.setIcon(isGpsStarted ? gpsStatusValue.icon : R.drawable.ic_gps_off_24dp);
if (startGpsMenuItem.getIcon() instanceof AnimatedVectorDrawable) {
((AnimatedVectorDrawable) startGpsMenuItem.getIcon()).start();
}
MaterialButton startGpsMenuItem = viewBinding.sensorStartButton;
startGpsMenuItem.setVisibility(!isRecording ? View.VISIBLE : View.INVISIBLE);
if (!isRecording) {
startGpsMenuItem.setIcon(AppCompatResources.getDrawable(this, isGpsStarted ? gpsStatusValue.icon : R.drawable.ic_gps_off_24dp));
if (startGpsMenuItem.getIcon() instanceof AnimatedVectorDrawable) {
((AnimatedVectorDrawable) startGpsMenuItem.getIcon()).start();
}
}
}
@@ -509,13 +484,6 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
return true;
}
if (itemId == R.id.list_context_menu_aggregated_stats) {
Intent intent = IntentUtils.newIntent(this, AggregatedStatisticsActivity.class)
.putParcelableArrayListExtra(AggregatedStatisticsActivity.EXTRA_TRACK_IDS, new ArrayList<>(Arrays.asList(trackIds)));
startActivity(intent);
return true;
}
if (itemId == R.id.list_context_menu_select_all) {
for (int i = 0; i < viewBinding.trackList.getCount(); i++) {
viewBinding.trackList.setItemChecked(i, true);
@@ -537,11 +505,7 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
public void setSearch(String searchQuery) {
this.searchQuery = searchQuery;
restart();
if (searchQuery != null) {
setTitle(searchQuery);
} else {
setTitle(R.string.app_name);
}
viewBinding.trackListToolbar.setTitle(searchQuery == null ? getString(R.string.app_name) : searchQuery);
}
public void restart() {
@@ -103,7 +103,6 @@ public class TrackRecordedActivity extends AbstractTrackDeleteActivity implement
trackRecordingServiceConnection = new TrackRecordingServiceConnection(bindCallback);
Track track = contentProviderUtils.getTrack(trackId);
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(track != null ? track.getName() : "");
viewBinding.bottomAppBarLayout.bottomAppBar.replaceMenu(R.menu.track_detail);
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
@@ -187,7 +187,7 @@ public class ExportActivity extends FragmentActivity implements ExportServiceRes
nextExport(null);
}
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.export_progress_message, directoryDisplayName));
viewBinding.exportActivityToolbar.setTitle(getString(R.string.export_progress_message, directoryDisplayName));
viewBinding.bottomAppBarLayout.bottomAppBar.setNavigationIcon(R.drawable.ic_logo_color_24dp);
}
@@ -112,7 +112,7 @@ public class ImportActivity extends FragmentActivity {
});
//Works for a directory, but we might have received multiple files via SEND_MULTIPLE.
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.import_progress_message, documentFiles.get(0).getName()));
viewBinding.importActivityToolbar.setTitle(getString(R.string.import_progress_message, documentFiles.get(0).getName()));
viewBinding.bottomAppBarLayout.bottomAppBar.setNavigationIcon(R.drawable.ic_logo_color_24dp);
}
@@ -40,7 +40,6 @@ public class SettingsActivity extends AbstractActivity implements ChooseActivity
fragment = new MainSettingsFragment();
}
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.menu_settings));
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
getSupportFragmentManager().beginTransaction().replace(R.id.settings_fragment, fragment).commit();
@@ -95,7 +95,7 @@ public class SettingsCustomLayoutEditActivity extends AbstractActivity implement
recyclerViewNotVisible.setLayoutManager(new LinearLayoutManager(this));
recyclerViewNotVisible.setAdapter(adapterFieldsHidden);
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(profile);
// viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(profile); TODO
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
}
@@ -113,7 +113,6 @@ public class SettingsCustomLayoutListActivity extends AbstractActivity implement
ItemTouchHelper itemTouchhelper = new ItemTouchHelper(recyclerViewSwipeDeleteCallback);
itemTouchhelper.attachToRecyclerView(recyclerView);
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.custom_layout_list_title));
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
}
@@ -62,7 +62,6 @@ public class AggregatedStatisticsActivity extends AbstractActivity implements Fi
});
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(R.string.menu_aggregated_statistics));
}
@Override
@@ -105,7 +105,8 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
@Override
public void onPageSelected(int position) {
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(markerAdapter.getPageTitle(position));
viewBinding.markerDetailToolbar.setTitle(markerAdapter.getPageTitle(position));
// viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(markerAdapter.getPageTitle(position)); TOOD
}
@Override
@@ -110,7 +110,9 @@ public class MarkerEditActivity extends AbstractActivity {
});
boolean isNewMarker = markerId == null;
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(getString(isNewMarker ? R.string.menu_insert_marker : R.string.menu_edit));
if (!isNewMarker) {
viewBinding.markerEditToolbar.setTitle(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(),
@@ -131,7 +131,7 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
trackRecordingServiceConnection = new TrackRecordingServiceConnection(bindCallback);
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
setSupportActionBar(viewBinding.markerListToolbar);
}
@Override
@@ -311,7 +311,7 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
public void setSearch(String searchQuery) {
this.searchQuery = searchQuery;
restart();
viewBinding.bottomAppBarLayout.bottomAppBarTitle.setText(Objects.requireNonNullElseGet(searchQuery, () -> getString(R.string.menu_markers)));
viewBinding.markerListToolbar.setTitle(Objects.requireNonNullElseGet(searchQuery, () -> getString(R.string.menu_markers)));
}
public void restart() {
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"
android:fillColor="#000000" />
</vector>
+15 -1
View File
@@ -1,14 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/track_list_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:title="@string/about_preference_title"
app:navigationIcon="@drawable/ic_baseline_info_24" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ScrollView
android:layout_width="match_parent"
@@ -1,11 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/export_activity_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:title="@string/custom_layout_list_title" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
@@ -13,7 +24,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/rows_options_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"
style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/settings_recording_customize_layout_select_columns">
@@ -26,7 +26,7 @@
android:id="@+id/custom_layout_list_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
app:errorEnabled="true"
android:layout_margin="16dp">
@@ -52,7 +52,7 @@
android:id="@+id/custom_layout_list_cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Button.TextButton"
style="@style/Widget.Material3.Button.TextButton"
android:text="@android:string/cancel" />
<com.google.android.material.button.MaterialButton
@@ -3,6 +3,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/show_error_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_baseline_info_24" />
</com.google.android.material.appbar.AppBarLayout>
<ScrollView
android:id="@+id/error_page_container"
android:layout_width="match_parent"
+14 -1
View File
@@ -1,14 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_statistics_24dp"
app:title="@string/menu_aggregated_statistics" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ListView
android:id="@+id/aggregated_stats_list"
+3 -24
View File
@@ -1,36 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_height="match_parent">
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottom_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:navigationIcon="@drawable/ic_baseline_arrow_back_24">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/bottom_app_bar_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:maxLines="1"
android:singleLine="true"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.OpenTracks.OnBottomBarText" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.bottomappbar.BottomAppBar>
app:navigationIcon="@drawable/ic_baseline_arrow_back_24" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+14 -3
View File
@@ -1,16 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/export_activity_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_baseline_import_export_24" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingBottom="50dp">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.core.widget.NestedScrollView
android:layout_weight="1"
@@ -5,7 +5,7 @@
android:id="@+id/filter_dialog_check_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
style="@style/Widget.Material3.Button.OutlinedButton"
android:checkable="true"
android:gravity="center"
tools:text="Check Button" />
+14 -1
View File
@@ -1,14 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_help_black_24dp"
app:title="@string/menu_help" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ScrollView
android:layout_width="match_parent"
+14 -3
View File
@@ -1,16 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/import_activity_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_baseline_import_export_24" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingBottom="50dp">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.core.widget.NestedScrollView
android:layout_weight="1"
+14 -1
View File
@@ -14,13 +14,26 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/marker_detail_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_marker_show_24dp" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.viewpager.widget.ViewPager
android:id="@+id/maker_detail_activity_view_pager"
+19 -6
View File
@@ -14,14 +14,28 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/marker_edit_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_marker_add_24dp"
app:title="@string/menu_insert_marker" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
android:layout_marginBottom="@dimen/m3_bottom_nav_min_height"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ScrollView style="@style/ScrollView.WithBottomButtons">
@@ -109,11 +123,10 @@ limitations under the License.
android:layout_height="32dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_margin="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/shape_circle_darkgray"
android:padding="4dp"
android:src="@drawable/ic_delete_forever_24dp" />
+16 -2
View File
@@ -14,14 +14,28 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/marker_list_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_marker_show_24dp"
app:title="@string/menu_markers" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ListView
android:id="@+id/marker_list"
@@ -30,9 +44,9 @@ limitations under the License.
<TextView
android:id="@+id/marker_list_empty"
style="?attr/textAppearanceHeadline4"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="?attr/textAppearanceHeadline4"
android:gravity="center_horizontal|center_vertical"
android:text="@string/marker_list_empty_message" />
+14 -1
View File
@@ -1,14 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_settings_24dp"
app:title="@string/menu_settings" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout
android:id="@+id/settings_fragment"
+1 -1
View File
@@ -21,7 +21,7 @@ limitations under the License.
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="60dp">
android:paddingBottom="@dimen/m3_bottom_nav_min_height">
<include
android:id="@+id/fields"
+43 -13
View File
@@ -14,16 +14,30 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/track_list_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_logo_color_24dp"
app:title="@string/app_name"
app:menu="@menu/track_list" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingBottom="50dp"
android:clipToPadding="false">
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ListView
android:id="@+id/track_list"
@@ -43,19 +57,19 @@ limitations under the License.
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingTop="16dp"
android:paddingBottom="12dp">
android:paddingBottom="0dp">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.7" />
android:layout_weight="3" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:paddingBottom="50dp"
android:layout_weight="1"
android:contentDescription="@string/image_arrow"
android:paddingBottom="50dp"
android:src="@drawable/ic_arrow_long" />
</LinearLayout>
@@ -92,16 +106,32 @@ limitations under the License.
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:fabAlignmentMode="end"
app:logo="@drawable/ic_logo_color_24dp"
app:menu="@menu/track_list" />
app:fabAlignmentMode="end">
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.IconButton"
android:id="@+id/aggregated_stats_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/ic_statistics_24dp"
app:iconTint="?attr/colorOnBackground" />
<com.google.android.material.button.MaterialButton
android:id="@+id/sensor_start_button"
style="@style/Widget.Material3.Button.IconButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/ic_gps_off_24dp"
app:iconTint="?attr/colorOnBackground" />
</com.google.android.material.bottomappbar.BottomAppBar>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/track_list_fab_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_record_24"
android:contentDescription="@string/image_record"
android:src="@drawable/ic_baseline_record_24"
app:layout_anchor="@id/bottom_app_bar" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
-5
View File
@@ -35,11 +35,6 @@ limitations under the License.
android:icon="@drawable/ic_delete_forever_24dp"
android:title="@string/menu_delete"
app:showAsAction="ifRoom" />
<item
android:id="@+id/list_context_menu_aggregated_stats"
android:icon="@drawable/ic_statistics_24dp"
android:title="@string/menu_aggregated_statistics"
app:showAsAction="ifRoom" />
<item
android:id="@+id/list_context_menu_select_all"
android:icon="@drawable/ic_select_all_24dp"
+1 -12
View File
@@ -15,18 +15,6 @@ limitations under the License.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/track_list_aggregated_stats"
android:icon="@drawable/ic_statistics_24dp"
android:title="@string/menu_aggregated_statistics"
app:showAsAction="ifRoom" />
<!-- Icon, title, and visibility is managed by TrackListActivity -->
<item
android:id="@+id/track_list_start_gps"
android:icon="@drawable/ic_gps_off_24dp"
android:title="@string/menu_start_gps"
android:visible="false"
app:showAsAction="ifRoom" />
<!-- TODO SearchAction is only working if it is shown as action. However, only two slots are available. See #757. -->
<item
android:id="@+id/track_list_search"
@@ -44,6 +32,7 @@ limitations under the License.
android:title="@string/menu_settings" />
<item
android:id="@+id/track_list_help"
android:icon="@drawable/ic_help_black_24dp"
android:title="@string/menu_help" />
</menu>
+5 -11
View File
@@ -1,22 +1,18 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ThemeCustom" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="ThemeCustom" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/opentracks_secondary_color</item>
<item name="colorPrimaryVariant">@android:color/black</item>
<item name="colorOnPrimary">@android:color/white</item>
<item name="colorSecondary">@color/opentracks_secondary_color</item>
<item name="colorSecondaryVariant">@color/opentracks_secondary_color</item>
<item name="colorOnSecondary">@color/opentracks_on_secondary_color</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">@android:color/black</item>
<item name="android:colorBackground">@android:color/black</item>
<item name="colorOnBackground">@android:color/white</item>
<item name="colorSurface">@color/opentracks_surface_night_background_color</item>
<item name="colorOnSurface">@color/opentracks_surface_night_on_background_color</item>
<item name="android:activatedBackgroundIndicator">@drawable/activated_background</item>
<item name="bottomAppBarStyle">@style/Widget.OpenTracks.BottomAppBar</item>
@@ -27,17 +23,15 @@
</style>
<style name="Widget.OpenTracks.BottomAppBar" parent="Widget.MaterialComponents.BottomAppBar.Colored">
<style name="Widget.OpenTracks.BottomAppBar" parent="Widget.Material3.BottomAppBar">
<item name="materialThemeOverlay">@style/ThemeOverlay.OpenTracks.BottomAppBar</item>
</style>
<style name="ThemeOverlay.OpenTracks.BottomAppBar" parent="">
<item name="colorPrimary">@android:color/black</item>
<item name="colorOnPrimary">@android:color/white</item>
</style>
<item name="colorAccent">@android:color/white</item>
<!-- <item name="android:drawableTint">@android:color/white</item>-->
<style name="Widget.OpenTracks.FloatingActionButton" parent="Widget.MaterialComponents.FloatingActionButton">
<item name="fabCustomSize">64dp</item>
</style>
</resources>
-6
View File
@@ -22,12 +22,6 @@ limitations under the License.
<color name="opentracks_secondary_transparent">#55FF6D00</color>
<color name="opentracks_on_secondary_color">@android:color/white</color>
<color name="opentracks_surface_day_background_color">#f5f5f5</color>
<color name="opentracks_surface_day_on_background_color">@android:color/black</color>
<color name="opentracks_surface_night_background_color">@android:color/black</color>
<color name="opentracks_surface_night_on_background_color">@android:color/white</color>
<!-- Chart colors -->
<color name="chart_cadence_border">#FFF128F3</color> <!-- pink -->
<color name="chart_cadence_fill">#40F128F3</color> <!-- transparent pink -->
+4 -4
View File
@@ -16,7 +16,7 @@ limitations under the License.
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- bottom buttons bar -->
<style name="BottomButton" parent="Widget.MaterialComponents.Button.TextButton">
<style name="BottomButton" parent="Widget.Material3.Button.TextButton">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_width">0dp</item>
@@ -70,19 +70,19 @@ limitations under the License.
</style>
<!-- Snackbar -->
<style name="MaterialSnackbarTheme" parent="@style/Widget.MaterialComponents.Snackbar">
<style name="MaterialSnackbarTheme" parent="@style/Widget.Material3.Snackbar">
<item name="materialThemeOverlay">@style/ThemeOverlay.OpenTracks.Snackbar</item>
<item name="actionTextColorAlpha">1</item>
<item name="backgroundTint">@android:color/holo_red_dark</item>
</style>
<style name="MaterialSnackbarTextButtonTheme" parent="@style/Widget.MaterialComponents.Button.TextButton.Snackbar">
<style name="MaterialSnackbarTextButtonTheme" parent="@style/Widget.Material3.Button.TextButton.Snackbar">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">14sp</item>
</style>
<style name="MaterialSnackbarTextViewTheme" parent="@style/Widget.MaterialComponents.Snackbar.TextView">
<style name="MaterialSnackbarTextViewTheme" parent="@style/Widget.Material3.Snackbar.TextView">
<item name="android:textColor">@android:color/white</item>
<item name="android:textAppearance">?textAppearanceLabelMedium</item>
<item name="android:textSize">14sp</item>
+5 -10
View File
@@ -15,26 +15,21 @@ limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ThemeCustom" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="ThemeCustom" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/opentracks_primary_color</item>
<item name="colorPrimaryVariant">@color/opentracks_primary_variant_color</item>
<item name="colorOnPrimary">@color/opentracks_on_primary_color</item>
<item name="colorSecondary">@color/opentracks_secondary_color</item>
<item name="colorSecondaryVariant">@color/opentracks_secondary_color</item>
<item name="colorOnSecondary">@color/opentracks_on_secondary_color</item>
<item name="colorError">@color/red_dark</item>
<item name="colorOnError">@android:color/white</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">@color/opentracks_primary_variant_color</item>
<item name="android:colorBackground">@android:color/white</item>
<item name="colorOnBackground">@android:color/black</item>
<item name="colorSurface">@color/opentracks_surface_day_background_color</item>
<item name="colorOnSurface">@color/opentracks_surface_day_on_background_color</item>
<item name="android:activatedBackgroundIndicator">@drawable/activated_background</item>
<!-- Snackbar -->
@@ -46,16 +41,16 @@ limitations under the License.
<item name="linearProgressIndicatorStyle">@style/OpenTracksLinearProgressIndicator</item>
<!-- Bottom bar -->
<item name="bottomAppBarStyle">@style/Widget.MaterialComponents.BottomAppBar.Colored</item>
<item name="bottomAppBarStyle">@style/Widget.Material3.BottomAppBar</item>
<!-- Floating buttons -->
<item name="floatingActionButtonStyle">@style/Widget.OpenTracks.FloatingActionButton</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="OpenTracksLinearProgressIndicator" parent="Widget.MaterialComponents.LinearProgressIndicator">
<style name="OpenTracksLinearProgressIndicator" parent="Widget.Material3.LinearProgressIndicator">
<item name="indicatorColor">?attr/colorSecondary</item>
</style>
+1 -5
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- migrate MaterialComponents to Material3 -->
<resources>
<style name="TextAppearance.OpenTracks.PrimaryHeader" parent="TextAppearance.MaterialComponents.Subtitle1">
<item name="android:textColor">?attr/colorSecondary</item>
@@ -52,9 +53,4 @@
<item name="android:textColor">?attr/colorOnBackground</item>
<item name="android:singleLine">true</item>
</style>
<style name="TextAppearance.OpenTracks.OnBottomBarText" parent="TextAppearance.MaterialComponents.Headline6">
<item name="android:textColor">?attr/colorOnPrimary</item>
<item name="android:singleLine">true</item>
</style>
</resources>