Compare commits

...

7 Commits

Author SHA1 Message Date
Dennis Guse d76131a34f Release: v4.19.6 2025-06-22 21:41:51 +02:00
Dennis Guse 3bae0869c4 Launcher icon was sometimes incorrectly scaled (e.g., kvaesitso).
Use same icon as OSMDashboard for launcher (w/o background).

This time also for the reproducible build.

Fixes #2108.
2025-06-21 17:22:39 +02:00
Dennis Guse a164876615 Edge-2-edge for Android 10 and below requires a quirk.
Part of #2073.
2025-06-20 19:13:05 +02:00
Dennis Guse 5bbb5f789f Bugfix: apply edge-2-edge insets to everything always.
Fixes #2073.
2025-06-20 19:13:05 +02:00
Dennis Guse 6e42857023 Cleanup: properly name method (has side effect). 2025-06-20 19:13:05 +02:00
Dennis Guse b883bb3862 Track list: center recording icon. 2025-06-19 17:54:45 +02:00
Dennis Guse 9b5ef0707e Cleanup: remove unused code for track list. 2025-06-19 17:54:45 +02:00
22 changed files with 68 additions and 82 deletions
+2 -2
View File
@@ -46,8 +46,8 @@ android {
defaultConfig { defaultConfig {
applicationId 'de.dennisguse.opentracks' applicationId 'de.dennisguse.opentracks'
versionCode 6180 versionCode 6187
versionName "v4.19.5" versionName "v4.19.6"
buildConfigField "String", "VERSION_NAME_FULL", "\"${getVersionName()}\"" buildConfigField "String", "VERSION_NAME_FULL", "\"${getVersionName()}\""
@@ -0,0 +1,4 @@
v4.19.6: OpenTracks
Changes:
- Edge-2-edge should now be working on all Android versions
@@ -3,6 +3,7 @@ package de.dennisguse.opentracks;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import de.dennisguse.opentracks.databinding.AboutBinding; import de.dennisguse.opentracks.databinding.AboutBinding;
@@ -29,7 +30,8 @@ public class AboutActivity extends AbstractActivity {
ViewUtils.makeClickableLinks(findViewById(android.R.id.content)); ViewUtils.makeClickableLinks(findViewById(android.R.id.content));
} }
protected View getRootView() { @NonNull
protected View createRootView() {
viewBinding = AboutBinding.inflate(getLayoutInflater()); viewBinding = AboutBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -16,16 +16,17 @@
package de.dennisguse.opentracks; package de.dennisguse.opentracks;
import android.content.res.TypedArray;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.activity.EdgeToEdge; import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets; import androidx.core.graphics.Insets;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import android.view.ViewGroup.LayoutParams; import androidx.core.view.ViewGroupCompat;
import androidx.core.view.WindowInsetsCompat;
import de.dennisguse.opentracks.services.announcement.TTSManager; import de.dennisguse.opentracks.services.announcement.TTSManager;
import de.dennisguse.opentracks.settings.PreferencesUtils; import de.dennisguse.opentracks.settings.PreferencesUtils;
@@ -40,51 +41,27 @@ public abstract class AbstractActivity extends AppCompatActivity {
setTheme(R.style.OpenTracksThemeOled); setTheme(R.style.OpenTracksThemeOled);
} }
// Enable edge-to-edge rendering
EdgeToEdge.enable(this); EdgeToEdge.enable(this);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Set volume control stream for text to speech // Set volume control stream for text to speech
setVolumeControlStream(TTSManager.AUDIO_STREAM); setVolumeControlStream(TTSManager.AUDIO_STREAM);
View rootView = getRootView(); View rootView = createRootView();
setContentView(rootView); setContentView(rootView);
apply_insets(rootView); edge2edgeApplyInsets(rootView);
} }
private void apply_insets(View rootView) { private void edge2edgeApplyInsets(View rootView) {
View bottom_app_bar = findViewById(R.id.bottom_app_bar); ViewCompat.setOnApplyWindowInsetsListener(rootView, (view, windowInsets) -> {
if (rootView != null) { Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout());
// Apply navbar insets to the whole content view.setPadding(insets.left, insets.top, insets.right, insets.bottom);
ViewCompat.setOnApplyWindowInsetsListener(rootView, (view, windowInsets) -> { return WindowInsetsCompat.CONSUMED;
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); });
// Apply the insets as a padding to the view. // For Android 10 and below.
// Don't need to set the top inset for some reason (?) ViewGroupCompat.installCompatInsetsDispatch(rootView);
view.setPadding(insets.left, 0, insets.right, 0);
// Return the insets to apply to the next view (BottomAppBar)
return windowInsets;
});
}
if (bottom_app_bar != null) {
// Apply status and navbar insets to BottomAppBar
// WARNING: this is called twice for bottomappbar.xml
ViewCompat.setOnApplyWindowInsetsListener(bottom_app_bar, (view, windowInsets) -> {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
// Apply the insets as a padding to the view.
view.setPadding(0, 0, 0, insets.bottom);
// Set new height to account for the inset
LayoutParams layout = view.getLayoutParams();
// Get actionBar height attribute
final TypedArray arr = obtainStyledAttributes(new int[] { com.google.android.material.R.attr.actionBarSize });
int actionBarHeight = (int) arr.getDimension(0, 0f);
arr.recycle();
layout.height = insets.bottom + actionBarHeight;
view.setLayoutParams(layout);
// Return CONSUMED if you don't want the window insets to keep passing down to descendant views.
return WindowInsetsCompat.CONSUMED;
});
}
} }
@Override @Override
@@ -93,5 +70,6 @@ public abstract class AbstractActivity extends AppCompatActivity {
return true; return true;
} }
protected abstract View getRootView(); @NonNull
protected abstract View createRootView();
} }
@@ -3,6 +3,7 @@ package de.dennisguse.opentracks;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import de.dennisguse.opentracks.databinding.HelpBinding; import de.dennisguse.opentracks.databinding.HelpBinding;
@@ -19,8 +20,9 @@ public class HelpActivity extends AbstractActivity {
ViewUtils.makeClickableLinks(findViewById(android.R.id.content)); ViewUtils.makeClickableLinks(findViewById(android.R.id.content));
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
helpBinding = HelpBinding.inflate(getLayoutInflater()); helpBinding = HelpBinding.inflate(getLayoutInflater());
return helpBinding.getRoot(); return helpBinding.getRoot();
} }
@@ -7,6 +7,8 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@@ -28,8 +30,9 @@ public class ShowErrorActivity extends AbstractActivity {
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar); setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = ActivityShowErrorBinding.inflate(getLayoutInflater()); viewBinding = ActivityShowErrorBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -115,8 +115,9 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
outState.putSerializable(ICON_VALUE_KEY, activityType); outState.putSerializable(ICON_VALUE_KEY, activityType);
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = TrackEditBinding.inflate(getLayoutInflater()); viewBinding = TrackEditBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -30,6 +30,7 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@@ -242,8 +243,9 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
adapter = null; adapter = null;
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = TrackListBinding.inflate(getLayoutInflater()); viewBinding = TrackListBinding.inflate(getLayoutInflater());
viewBinding.trackListSearchView.getEditText().setOnEditorActionListener((v, actionId, event) -> { viewBinding.trackListSearchView.getEditText().setOnEditorActionListener((v, actionId, event) -> {
@@ -136,8 +136,9 @@ public class TrackRecordedActivity extends AbstractTrackDeleteActivity implement
outState.putInt(CURRENT_TAB_TAG_KEY, viewBinding.trackDetailActivityViewPager.getCurrentItem()); outState.putInt(CURRENT_TAB_TAG_KEY, viewBinding.trackDetailActivityViewPager.getCurrentItem());
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = TrackRecordedBinding.inflate(getLayoutInflater()); viewBinding = TrackRecordedBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -250,8 +250,9 @@ public class TrackRecordingActivity extends AbstractActivity implements ChooseAc
trackRecordingServiceConnection = null; trackRecordingServiceConnection = null;
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = TrackRecordingBinding.inflate(getLayoutInflater()); viewBinding = TrackRecordingBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -7,6 +7,8 @@ import android.util.Pair;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
import de.dennisguse.opentracks.data.ContentProviderUtils; import de.dennisguse.opentracks.data.ContentProviderUtils;
import de.dennisguse.opentracks.data.models.ActivityType; import de.dennisguse.opentracks.data.models.ActivityType;
import de.dennisguse.opentracks.data.models.DistanceFormatter; import de.dennisguse.opentracks.data.models.DistanceFormatter;
@@ -110,8 +112,9 @@ public class TrackStoppedActivity extends AbstractTrackDeleteActivity implements
contentProviderUtils); contentProviderUtils);
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = TrackStoppedBinding.inflate(getLayoutInflater()); viewBinding = TrackStoppedBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -47,8 +47,9 @@ public class IntroductionActivity extends AbstractActivity {
viewBinding.introductionViewPager.setUserInputEnabled(false); viewBinding.introductionViewPager.setUserInputEnabled(false);
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = IntroductionBinding.inflate(getLayoutInflater()); viewBinding = IntroductionBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -72,8 +72,9 @@ public class SettingsActivity extends AbstractActivity implements ChooseActivity
} }
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = SettingsBinding.inflate(getLayoutInflater()); viewBinding = SettingsBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -116,8 +116,9 @@ public class SettingsCustomLayoutEditActivity extends AbstractActivity implement
recordingLayoutFieldsVisible = null; recordingLayoutFieldsVisible = null;
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = ActivitySettingsCustomLayoutBinding.inflate(getLayoutInflater()); viewBinding = ActivitySettingsCustomLayoutBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -108,8 +108,9 @@ public class SettingsCustomLayoutListActivity extends AbstractActivity implement
adapter.reloadLayouts(); adapter.reloadLayouts();
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
PreferencesUtils.getCustomLayout(); PreferencesUtils.getCustomLayout();
viewBinding = ActivitySettingsCustomLayoutListBinding.inflate(getLayoutInflater()); viewBinding = ActivitySettingsCustomLayoutListBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
@@ -35,7 +35,6 @@ import de.dennisguse.opentracks.settings.UnitSystem;
import de.dennisguse.opentracks.ui.util.ActivityUtils; import de.dennisguse.opentracks.ui.util.ActivityUtils;
import de.dennisguse.opentracks.ui.util.ListItemUtils; import de.dennisguse.opentracks.ui.util.ListItemUtils;
import de.dennisguse.opentracks.util.IntentUtils; import de.dennisguse.opentracks.util.IntentUtils;
import de.dennisguse.opentracks.util.StringUtils;
public class TrackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements ActionMode.Callback { public class TrackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements ActionMode.Callback {
@@ -229,12 +228,6 @@ public class TrackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
viewBinding.trackListItemTime.setText(null); viewBinding.trackListItemTime.setText(null);
} }
//TODO Check if this is needed or a leftover from the MarkerList migration
String category = activityType == null ? activityTypeLocalized : null;
String categoryDescription = StringUtils.getCategoryDescription(category, description);
viewBinding.trackListItemCategoryDescription.setText(categoryDescription);
viewBinding.trackListItemCategoryDescription.setVisibility("".equals(categoryDescription) ? View.GONE : View.VISIBLE);
setSelected(selection.get((int) getId())); setSelected(selection.get((int) getId()));
} }
@@ -83,8 +83,9 @@ public class AggregatedStatisticsActivity extends AbstractActivity implements Fi
outState.putBoolean(STATE_ARE_FILTERS_APPLIED, areFiltersApplied); outState.putBoolean(STATE_ARE_FILTERS_APPLIED, areFiltersApplied);
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = AggregatedStatsBinding.inflate(getLayoutInflater()); viewBinding = AggregatedStatsBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -110,8 +110,9 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar); setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = MarkerDetailActivityBinding.inflate(getLayoutInflater()); viewBinding = MarkerDetailActivityBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -85,8 +85,9 @@ public class MarkerEditActivity extends AbstractActivity {
// UI elements // UI elements
private MarkerEditBinding viewBinding; private MarkerEditBinding viewBinding;
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = MarkerEditBinding.inflate(getLayoutInflater()); viewBinding = MarkerEditBinding.inflate(getLayoutInflater());
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@@ -145,8 +145,9 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
contentProviderUtils = null; contentProviderUtils = null;
} }
@NonNull
@Override @Override
protected View getRootView() { protected View createRootView() {
viewBinding = MarkerListBinding.inflate(getLayoutInflater()); viewBinding = MarkerListBinding.inflate(getLayoutInflater());
viewBinding.markerListSearchView.getEditText().setOnEditorActionListener((v, actionId, event) -> { viewBinding.markerListSearchView.getEditText().setOnEditorActionListener((v, actionId, event) -> {
+4 -16
View File
@@ -11,9 +11,10 @@
<!-- Icon --> <!-- Icon -->
<ImageView <ImageView
android:id="@+id/track_list_item_icon" android:id="@+id/track_list_item_icon"
android:layout_width="wrap_content" android:layout_width="24dp"
android:layout_height="wrap_content" android:layout_height="24dp"
android:contentDescription="@string/image_track" android:contentDescription="@string/image_track"
android:scaleType="centerInside"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_activity_bike_24dp" /> tools:src="@drawable/ic_activity_bike_24dp" />
@@ -94,19 +95,6 @@
app:barrierDirection="bottom" app:barrierDirection="bottom"
app:constraint_referenced_ids="track_list_item_time_distance,track_list_item_marker_count_icon,track_list_item_marker_count,track_list_item_time" /> app:constraint_referenced_ids="track_list_item_time_distance,track_list_item_marker_count_icon,track_list_item_marker_count,track_list_item_time" />
<!-- Category and description -->
<TextView
android:id="@+id/track_list_item_category_description"
style="?attr/textAppearanceBodySmall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/track_list_item_name"
app:layout_constraintTop_toBottomOf="@id/track_list_item_barrier"
tools:text="Description" />
<!-- Bottom Line --> <!-- Bottom Line -->
<View <View
android:id="@+id/marker_list_item_bottom_line" android:id="@+id/marker_list_item_bottom_line"
@@ -114,6 +102,6 @@
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/track_list_item_category_description" /> app:layout_constraintTop_toBottomOf="@+id/track_list_item_barrier" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android" <inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_logo_24dp" /> android:drawable="@drawable/ic_logo_108dp" />