diff --git a/OsmAnd/res/layout/item_gpx_stat_block.xml b/OsmAnd/res/layout/item_gpx_stat_block.xml index 6b94dd4047..18dfa5cdde 100644 --- a/OsmAnd/res/layout/item_gpx_stat_block.xml +++ b/OsmAnd/res/layout/item_gpx_stat_block.xml @@ -3,42 +3,62 @@ xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_height="@dimen/list_header_height" + android:layout_marginStart="@dimen/content_padding" + android:layout_marginLeft="@dimen/content_padding" + android:gravity="center_vertical" + android:orientation="horizontal"> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginEnd="@dimen/content_padding" + android:layout_marginRight="@dimen/content_padding" + android:orientation="vertical"> - + + + + + + + + - - + tools:text="@string/distance" /> - + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/track/OverviewCard.java b/OsmAnd/src/net/osmand/plus/track/OverviewCard.java index dcebdc31da..f91b45419b 100644 --- a/OsmAnd/src/net/osmand/plus/track/OverviewCard.java +++ b/OsmAnd/src/net/osmand/plus/track/OverviewCard.java @@ -2,9 +2,9 @@ package net.osmand.plus.track; import android.annotation.SuppressLint; import android.content.Context; -import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -18,10 +18,12 @@ import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatImageView; +import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView.ItemDecoration; +import net.osmand.AndroidUtils; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; @@ -30,6 +32,7 @@ import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType; import net.osmand.plus.myplaces.SegmentActionsListener; import net.osmand.plus.routepreparationmenu.cards.BaseCard; @@ -125,8 +128,10 @@ public class OverviewCard extends BaseCard { final StatBlockAdapter sbAdapter = new StatBlockAdapter(items); rvOverview.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.HORIZONTAL, false)); - rvOverview.addItemDecoration(new HorizontalDividerDecoration(app)); +// rvOverview.addItemDecoration(new HorizontalDividerDecoration(app, nightMode)); rvOverview.setAdapter(sbAdapter); + } else { + AndroidUiHelper.updateVisibility(rvOverview, false); } } @@ -265,6 +270,10 @@ public class OverviewCard extends BaseCard { } }); setImageDrawable(holder.imageView, item.imageResId, item.imageColorId); + AndroidUtils.setBackgroundColor(view.getContext(), holder.divider, nightMode, R.color.divider_color_light, R.color.divider_color_dark); + if (position == statBlocks.size() - 1) { + AndroidUiHelper.setVisibility(View.GONE, holder.divider); + } } } @@ -273,12 +282,14 @@ public class OverviewCard extends BaseCard { private final TextViewEx valueText; private final TextView titleText; private final AppCompatImageView imageView; + private final View divider; StatBlockViewHolder(View view) { super(view); valueText = view.findViewById(R.id.value); titleText = view.findViewById(R.id.title); imageView = view.findViewById(R.id.image); + divider = view.findViewById(R.id.divider); } } @@ -288,12 +299,8 @@ public class OverviewCard extends BaseCard { private final int marginV; private final int marginH; - public HorizontalDividerDecoration(Context context) { - int[] ATTRS = {android.R.attr.listDivider}; - final TypedArray ta = context.obtainStyledAttributes(ATTRS); - divider = ta.getDrawable(0); -// DrawableCompat.setTint(divider, context.getResources().getColor(R.color.divider_color_light)); //todo change drawable color - ta.recycle(); + public HorizontalDividerDecoration(Context context, boolean nightMode) { + divider = new ColorDrawable(ContextCompat.getColor(context, nightMode ? R.color.divider_color_dark : R.color.divider_color_light)); marginV = context.getResources().getDimensionPixelSize(R.dimen.map_small_button_margin); marginH = context.getResources().getDimensionPixelSize(R.dimen.content_padding); } diff --git a/gradle.properties b/gradle.properties index f565c6e638..dffb2e0a79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,24 @@ -## For more details on how to configure your build environment visit +## Project-wide Gradle settings. +# +# For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx1024m -XX:MaxPermSize=256m +# Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -#Mon Dec 28 12:25:02 EET 2020 +#Fri Apr 08 18:47:31 EEST 2016 +# android.useDeprecatedNdk=true + +# for enableD8=true min sdk must be > 22 +# UPDATE: temporairly commented since gradle plugin updated to 3.1.3 and claims INSTALL_FAILED_DEXOPT is fixed +# UPDATE 2: D8 causes problems on arm64 devices with Android 6.0 (API 23) +# UPDATE 3: Turn on D8 to recover builds with new gradle 6.5 and pluigin 4.1.1 +#android.enableD8=false android.enableJetifier=true -android.useAndroidX=true -org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" +android.useAndroidX=true \ No newline at end of file