forked from organicmaps/organicmaps
Fixed review notes
This commit is contained in:
parent
ecb7b07099
commit
bef9ff2f1a
11 changed files with 61 additions and 73 deletions
|
@ -1,30 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:background="@color/black_primary"
|
||||
tools:ignore="Overdraw">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:src="@drawable/ic_chart_pin"
|
||||
android:layout_below="@id/label"
|
||||
android:background="@drawable/ic_you_marker"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/label"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/ic_you_marker"
|
||||
android:src="@drawable/ic_chart_pin" />
|
||||
<TextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="you"
|
||||
android:background="@drawable/bg_your_location_pin"
|
||||
android:ellipsize="end"
|
||||
android:paddingStart="@dimen/margin_quarter"
|
||||
android:paddingEnd="@dimen/margin_quarter"
|
||||
android:background="@drawable/bg_your_location_pin"
|
||||
android:textSize="@dimen/text_size_icon_title"
|
||||
android:singleLine="true"
|
||||
android:text="you"
|
||||
android:textColor="@color/base_accent"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true" />
|
||||
|
||||
android:textSize="@dimen/text_size_icon_title" />
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -2,50 +2,46 @@
|
|||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/chart_height"
|
||||
android:background="?attr/cardBackground"
|
||||
android:layout_height="@dimen/elevation_profile_height"
|
||||
android:background="?cardBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/elevation_profile_chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highest_altitude"
|
||||
android:background="@drawable/bg_altitude"
|
||||
android:textSize="@dimen/text_size_body_5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:layout_marginStart="@dimen/margin_half"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:layout_marginEnd="@dimen/margin_base_plus"
|
||||
android:paddingLeft="@dimen/margin_quarter_plus"
|
||||
android:background="@drawable/bg_altitude"
|
||||
android:paddingStart="@dimen/margin_quarter_plus"
|
||||
android:paddingRight="@dimen/margin_quarter_plus"
|
||||
android:paddingEnd="@dimen/margin_quarter_plus"
|
||||
android:paddingLeft="@dimen/margin_quarter_plus"
|
||||
android:paddingTop="@dimen/margin_eighth"
|
||||
android:paddingEnd="@dimen/margin_quarter_plus"
|
||||
android:paddingRight="@dimen/margin_quarter_plus"
|
||||
android:paddingBottom="@dimen/margin_eighth"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
android:textSize="@dimen/text_size_body_5" />
|
||||
<TextView
|
||||
android:id="@+id/lowest_altitude"
|
||||
android:textSize="@dimen/text_size_body_5"
|
||||
android:background="@drawable/bg_altitude"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center_horizontal|start"
|
||||
android:layout_marginStart="@dimen/margin_half"
|
||||
android:layout_marginEnd="@dimen/margin_base_plus"
|
||||
android:layout_marginBottom="@dimen/margin_base_plus"
|
||||
android:paddingLeft="@dimen/margin_quarter_plus"
|
||||
android:background="@drawable/bg_altitude"
|
||||
android:paddingStart="@dimen/margin_quarter_plus"
|
||||
android:paddingRight="@dimen/margin_quarter_plus"
|
||||
android:paddingEnd="@dimen/margin_quarter_plus"
|
||||
android:paddingLeft="@dimen/margin_quarter_plus"
|
||||
android:paddingTop="@dimen/margin_eighth"
|
||||
android:paddingEnd="@dimen/margin_quarter_plus"
|
||||
android:paddingRight="@dimen/margin_quarter_plus"
|
||||
android:paddingBottom="@dimen/margin_eighth"
|
||||
android:layout_gravity="center_horizontal|start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
android:textSize="@dimen/text_size_body_5" />
|
||||
</RelativeLayout>
|
|
@ -26,12 +26,14 @@
|
|||
android:gravity="center"
|
||||
android:minHeight="@dimen/elevation_profile_chart_min_height"
|
||||
android:orientation="vertical">
|
||||
<include layout="@layout/altitude_chart"/>
|
||||
<include layout="@layout/elevation_profile"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:layout_marginEnd="@dimen/margin_base"
|
||||
android:minHeight="@dimen/elevation_profile_chart_info_min_height"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
|
@ -154,6 +156,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:layout_marginEnd="@dimen/margin_base"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/chart_height"
|
||||
android:layout_height="@dimen/elevation_profile_height"
|
||||
tools:ignore="Overdraw">
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
|
@ -14,7 +14,7 @@
|
|||
<RelativeLayout
|
||||
android:id="@+id/text_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/half_chart_height"
|
||||
android:layout_height="@dimen/half_elevation_profile_height"
|
||||
android:layout_marginStart="@dimen/margin_eighth"
|
||||
android:layout_marginEnd="@dimen/margin_eighth"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
@ -22,7 +22,7 @@
|
|||
<RelativeLayout
|
||||
android:id="@+id/sliding_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/half_chart_height"
|
||||
android:layout_height="@dimen/half_elevation_profile_height"
|
||||
android:maxWidth="@dimen/dialog_min_height"
|
||||
android:padding="@dimen/margin_quarter_plus"
|
||||
android:background="@drawable/bg_point_desc"
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
|
||||
<include layout="@layout/place_page_fat_shadow"/>
|
||||
|
||||
<include layout="@layout/altitude_chart"/>
|
||||
|
||||
<include layout="@layout/catalog_promo_container"/>
|
||||
|
||||
<include
|
||||
|
|
|
@ -218,5 +218,5 @@
|
|||
<color name="bookmarks_sightseeing_subs_central_content_bg">#DAF8FF</color>
|
||||
|
||||
<color name="elevation_profile_dot_enabled">#FF9600</color>
|
||||
<color name="chart_color">#1E96F0</color>
|
||||
<color name="elevation_profile">#1E96F0</color>
|
||||
</resources>
|
||||
|
|
|
@ -292,6 +292,6 @@
|
|||
<dimen name="subs_btn_min_width">328dp</dimen>
|
||||
<dimen name="bookmarks_all_subscription_pager_item_margin">@dimen/margin_base_plus</dimen>
|
||||
<dimen name="bookmarks_sightseeing_subs_central_content_margin">88dp</dimen>
|
||||
<dimen name="chart_height">144dp</dimen>
|
||||
<dimen name="half_chart_height">72dp</dimen>
|
||||
<dimen name="elevation_profile_height">144dp</dimen>
|
||||
<dimen name="half_elevation_profile_height">72dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
class ChartPresenter implements OnChartValueSelectedListener
|
||||
class ChartController implements OnChartValueSelectedListener
|
||||
{
|
||||
private static final int CHART_Y_LABEL_COUNT = 3;
|
||||
private static final int CHART_X_LABEL_COUNT = 6;
|
||||
|
@ -38,17 +38,22 @@ class ChartPresenter implements OnChartValueSelectedListener
|
|||
private final AppCompatActivity mActivity;
|
||||
|
||||
@NonNull
|
||||
private LineChart mChart;
|
||||
private final LineChart mChart;
|
||||
|
||||
@NonNull
|
||||
private FloatingMarkerView mFloatingMarkerView;
|
||||
private final FloatingMarkerView mFloatingMarkerView;
|
||||
|
||||
@NonNull
|
||||
private MarkerView mCurrentLocationMarkerView;
|
||||
private final MarkerView mCurrentLocationMarkerView;
|
||||
|
||||
public ChartPresenter(@NonNull AppCompatActivity activity)
|
||||
ChartController(@NonNull AppCompatActivity activity)
|
||||
{
|
||||
mActivity = activity;
|
||||
mChart = getActivity().findViewById(R.id.elevation_profile_chart);
|
||||
mFloatingMarkerView = new FloatingMarkerView(getActivity());
|
||||
mCurrentLocationMarkerView = new CurrentLocationMarkerView(getActivity());
|
||||
mFloatingMarkerView.setChartView(mChart);
|
||||
mCurrentLocationMarkerView.setChartView(mChart);
|
||||
initChart();
|
||||
}
|
||||
|
||||
|
@ -65,8 +70,6 @@ class ChartPresenter implements OnChartValueSelectedListener
|
|||
TextView bottomAlt = getActivity().findViewById(R.id.lowest_altitude);
|
||||
bottomAlt.setText("100m");
|
||||
|
||||
|
||||
mChart = getActivity().findViewById(R.id.elevation_profile_chart);
|
||||
mChart.setBackgroundColor(Color.WHITE);
|
||||
mChart.setTouchEnabled(true);
|
||||
mChart.setOnChartValueSelectedListener(this);
|
||||
|
@ -85,10 +88,7 @@ class ChartPresenter implements OnChartValueSelectedListener
|
|||
initAxises();
|
||||
setData(20, 180);
|
||||
|
||||
mFloatingMarkerView = new FloatingMarkerView(getActivity());
|
||||
mCurrentLocationMarkerView = new CurrentLocationMarkerView(getActivity());
|
||||
mFloatingMarkerView.setChartView(mChart);
|
||||
mCurrentLocationMarkerView.setChartView(mChart);
|
||||
|
||||
highlightChartCurrentLocation();
|
||||
mChart.animateX(CHART_ANIMATION_DURATION);
|
||||
}
|
||||
|
@ -157,8 +157,7 @@ class ChartPresenter implements OnChartValueSelectedListener
|
|||
set.setDrawHorizontalHighlightIndicator(false);
|
||||
set.setHighlightLineWidth(lineThickness);
|
||||
set.setHighLightColor(getResources().getColor(R.color.base_accent_transparent));
|
||||
set.setFillColor(getResources().getColor(R.color.chart_color));
|
||||
|
||||
set.setFillColor(getResources().getColor(R.color.elevation_profile));
|
||||
|
||||
LineData data = new LineData(set);
|
||||
data.setValueTextSize(getResources().getDimensionPixelSize(R.dimen.text_size_icon_title));
|
|
@ -270,7 +270,10 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
private Tutorial mTutorial;
|
||||
@Nullable
|
||||
private OnboardingTip mOnboardingTip;
|
||||
private ChartPresenter mChartPresenter;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private ChartController mChartController;
|
||||
|
||||
public interface LeftAnimationTrackListener
|
||||
{
|
||||
|
@ -520,7 +523,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
mPlacePageController.initialize();
|
||||
mPlacePageController.onActivityCreated(this, savedInstanceState);
|
||||
|
||||
mChartPresenter = new ChartPresenter(this);
|
||||
mChartController = new ChartController(this);
|
||||
|
||||
boolean isLaunchByDeepLink = getIntent().getBooleanExtra(EXTRA_LAUNCH_BY_DEEP_LINK, false);
|
||||
initViews(isLaunchByDeepLink);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class FloatingMarkerView extends MarkerView
|
|||
return getOffset();
|
||||
}
|
||||
|
||||
public void updateOffsets(Entry entry, Highlight highlight)
|
||||
public void updateOffsets(@NonNull Entry entry, @NonNull Highlight highlight)
|
||||
{
|
||||
updateVertical(entry);
|
||||
updateHorizontal(highlight);
|
||||
|
@ -112,7 +112,7 @@ public class FloatingMarkerView extends MarkerView
|
|||
final int wholeText = Math.abs(mTextContainer.getWidth());
|
||||
RectF rect = getChartView().getContentRect();
|
||||
|
||||
LayoutParams textParams =(LayoutParams) mTextContainer.getLayoutParams();
|
||||
LayoutParams textParams = (LayoutParams) mTextContainer.getLayoutParams();
|
||||
LayoutParams imgParams = (LayoutParams) mImage.getLayoutParams();
|
||||
|
||||
boolean isLeftToRightDirection = highlight.getXPx() + halfImg + wholeText >= rect.right;
|
||||
|
|
|
@ -39,17 +39,6 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.github.mikephil.charting.charts.LineChart;
|
||||
import com.github.mikephil.charting.components.Legend;
|
||||
import com.github.mikephil.charting.components.MarkerView;
|
||||
import com.github.mikephil.charting.components.XAxis;
|
||||
import com.github.mikephil.charting.components.YAxis;
|
||||
import com.github.mikephil.charting.data.Entry;
|
||||
import com.github.mikephil.charting.data.LineData;
|
||||
import com.github.mikephil.charting.data.LineDataSet;
|
||||
import com.github.mikephil.charting.formatter.ValueFormatter;
|
||||
import com.github.mikephil.charting.highlight.Highlight;
|
||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.MwmActivity;
|
||||
import com.mapswithme.maps.MwmApplication;
|
||||
|
|
Loading…
Add table
Reference in a new issue