Merge pull request #11255 from osmandapp/fix_trip_recording_p1
Quick fix trip recording
This commit is contained in:
commit
ce475077fe
8 changed files with 114 additions and 53 deletions
|
@ -18,6 +18,7 @@
|
||||||
android:paddingEnd="@dimen/content_padding"
|
android:paddingEnd="@dimen/content_padding"
|
||||||
android:paddingRight="@dimen/content_padding"
|
android:paddingRight="@dimen/content_padding"
|
||||||
android:paddingBottom="@dimen/content_padding"
|
android:paddingBottom="@dimen/content_padding"
|
||||||
|
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
|
||||||
android:weightSum="2">
|
android:weightSum="2">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
|
|
@ -5,11 +5,13 @@ import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -163,7 +165,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
ContextCompat.getColor(app, getActiveTextColorId(nightMode)));
|
ContextCompat.getColor(app, getActiveTextColorId(nightMode)));
|
||||||
|
|
||||||
CardView cardLeft = itemView.findViewById(R.id.button_left);
|
CardView cardLeft = itemView.findViewById(R.id.button_left);
|
||||||
createItem(cardLeft, ItemType.CANCEL);
|
createItem(cardLeft, ItemType.CLOSE);
|
||||||
cardLeft.setOnClickListener(new View.OnClickListener() {
|
cardLeft.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -237,15 +239,11 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show(String... keys) {
|
||||||
Dialog dialog = getDialog();
|
Dialog dialog = getDialog();
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void show(String... keys) {
|
|
||||||
show();
|
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
if (key.equals(UPDATE_TRACK_ICON)) {
|
if (key.equals(UPDATE_TRACK_ICON)) {
|
||||||
updateTrackIcon(app, trackAppearanceIcon);
|
updateTrackIcon(app, trackAppearanceIcon);
|
||||||
|
@ -300,6 +298,9 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
AndroidUiHelper.setVisibility(View.GONE, segmentView.findViewById(R.id.list_item_divider));
|
AndroidUiHelper.setVisibility(View.GONE, segmentView.findViewById(R.id.list_item_divider));
|
||||||
WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager);
|
WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager);
|
||||||
PagerSlidingTabStrip tabLayout = segmentView.findViewById(R.id.sliding_tabs);
|
PagerSlidingTabStrip tabLayout = segmentView.findViewById(R.id.sliding_tabs);
|
||||||
|
tabLayout.setDividerWidth(AndroidUtils.dpToPx(app, 1));
|
||||||
|
tabLayout.setDividerColor(ContextCompat.getColor(app, nightMode ?
|
||||||
|
R.color.stroked_buttons_and_links_outline_dark : R.color.stroked_buttons_and_links_outline_light));
|
||||||
tabLayout.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() {
|
tabLayout.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTabSelected(int position) {
|
public void onTabSelected(int position) {
|
||||||
|
@ -314,6 +315,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
|
|
||||||
graphsAdapter = new GPXItemPagerAdapter(app, GpxUiHelper.makeGpxDisplayItem(app,
|
graphsAdapter = new GPXItemPagerAdapter(app, GpxUiHelper.makeGpxDisplayItem(app,
|
||||||
displayHelper.getGpx()), displayHelper, nightMode, this, true);
|
displayHelper.getGpx()), displayHelper, nightMode, this, true);
|
||||||
|
graphsAdapter.setChartHMargin(getResources().getDimensionPixelSize(R.dimen.content_padding));
|
||||||
|
|
||||||
pager.setAdapter(graphsAdapter);
|
pager.setAdapter(graphsAdapter);
|
||||||
tabLayout.setViewPager(pager);
|
tabLayout.setViewPager(pager);
|
||||||
|
@ -453,6 +455,21 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
setItemBackground(context, nightMode, view, enabled);
|
setItemBackground(context, nightMode, view, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void createItemActive(Context context, boolean nightMode, View view, ItemType type) {
|
||||||
|
view.setTag(type);
|
||||||
|
AppCompatImageView icon = view.findViewById(R.id.icon);
|
||||||
|
if (icon != null) {
|
||||||
|
setTintedIconActive(context, icon, nightMode, type);
|
||||||
|
}
|
||||||
|
TextView title = view.findViewById(R.id.button_text);
|
||||||
|
Integer titleId = type.getTitleId();
|
||||||
|
if (title != null && titleId != null) {
|
||||||
|
title.setText(titleId);
|
||||||
|
setTextColorActive(context, title, nightMode, type);
|
||||||
|
}
|
||||||
|
setItemBackgroundActive(context, nightMode, view);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) {
|
public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) {
|
||||||
if (view instanceof CardView) {
|
if (view instanceof CardView) {
|
||||||
int colorId = enabled ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode);
|
int colorId = enabled ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode);
|
||||||
|
@ -472,6 +489,12 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
view.setBackgroundDrawable(background);
|
view.setBackgroundDrawable(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setItemBackgroundActive(Context context, boolean nightMode, View view) {
|
||||||
|
if (view instanceof CardView) {
|
||||||
|
((CardView) view).setCardBackgroundColor(ContextCompat.getColor(context, getActiveTextColorId(nightMode)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum ItemType {
|
public enum ItemType {
|
||||||
SHOW_TRACK(R.string.shared_string_show_on_map, null),
|
SHOW_TRACK(R.string.shared_string_show_on_map, null),
|
||||||
APPEARANCE(null, null),
|
APPEARANCE(null, null),
|
||||||
|
@ -486,8 +509,10 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
STOP(R.string.shared_string_control_stop, R.drawable.ic_action_rec_stop),
|
STOP(R.string.shared_string_control_stop, R.drawable.ic_action_rec_stop),
|
||||||
STOP_AND_DISCARD(R.string.track_recording_stop_without_saving, R.drawable.ic_action_rec_stop),
|
STOP_AND_DISCARD(R.string.track_recording_stop_without_saving, R.drawable.ic_action_rec_stop),
|
||||||
STOP_AND_SAVE(R.string.track_recording_save_and_stop, R.drawable.ic_action_save_to_file),
|
STOP_AND_SAVE(R.string.track_recording_save_and_stop, R.drawable.ic_action_save_to_file),
|
||||||
STOP_ONLINE(R.string.live_monitoring_stop, R.drawable.ic_world_globe_dark),
|
START_ONLINE(R.string.live_monitoring_start, R.drawable.ic_world_globe_dark),
|
||||||
|
STOP_ONLINE(R.string.live_monitoring_stop, R.drawable.ic_action_offline),
|
||||||
CANCEL(R.string.shared_string_cancel, R.drawable.ic_action_close),
|
CANCEL(R.string.shared_string_cancel, R.drawable.ic_action_close),
|
||||||
|
CLOSE(R.string.shared_string_close, R.drawable.ic_action_close),
|
||||||
START_RECORDING(R.string.shared_string_control_start, R.drawable.ic_action_direction_movement),
|
START_RECORDING(R.string.shared_string_control_start, R.drawable.ic_action_direction_movement),
|
||||||
SETTINGS(R.string.shared_string_settings, R.drawable.ic_action_settings),
|
SETTINGS(R.string.shared_string_settings, R.drawable.ic_action_settings),
|
||||||
FINISH(R.string.shared_string_finish, R.drawable.ic_action_point_destination),
|
FINISH(R.string.shared_string_finish, R.drawable.ic_action_point_destination),
|
||||||
|
@ -497,7 +522,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
private final Integer titleId;
|
private final Integer titleId;
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
private final Integer iconId;
|
private final Integer iconId;
|
||||||
private static final List<ItemType> negative = Arrays.asList(CLEAR_DATA, STOP_AND_DISCARD);
|
private static final List<ItemType> negative = Arrays.asList(CLEAR_DATA, STOP, STOP_AND_DISCARD);
|
||||||
|
|
||||||
ItemType(@Nullable @StringRes Integer titleId, @Nullable @DrawableRes Integer iconId) {
|
ItemType(@Nullable @StringRes Integer titleId, @Nullable @DrawableRes Integer iconId) {
|
||||||
this.titleId = titleId;
|
this.titleId = titleId;
|
||||||
|
@ -528,6 +553,12 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static void setTextColorActive(Context context, TextView tv, boolean nightMode, ItemType type) {
|
||||||
|
if (tv != null) {
|
||||||
|
tv.setTextColor(ContextCompat.getColor(context, getPressedColorId(nightMode)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected static void setTintedIcon(Context context, AppCompatImageView iv, boolean enabled, boolean nightMode, ItemType type) {
|
protected static void setTintedIcon(Context context, AppCompatImageView iv, boolean enabled, boolean nightMode, ItemType type) {
|
||||||
Integer iconId = type.getIconId();
|
Integer iconId = type.getIconId();
|
||||||
if (iv != null && iconId != null) {
|
if (iv != null && iconId != null) {
|
||||||
|
@ -550,6 +581,17 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static void setTintedIconActive(Context context, AppCompatImageView iv, boolean nightMode, ItemType type) {
|
||||||
|
Integer iconId = type.getIconId();
|
||||||
|
if (iv != null && iconId != null) {
|
||||||
|
Drawable icon = AppCompatResources.getDrawable(context, iconId);
|
||||||
|
if (icon != null) {
|
||||||
|
DrawableCompat.setTint(icon, ContextCompat.getColor(context, getPressedColorId(nightMode)));
|
||||||
|
}
|
||||||
|
iv.setImageDrawable(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointSelected(TrkSegment segment, double lat, double lon) {
|
public void onPointSelected(TrkSegment segment, double lat, double lon) {
|
||||||
if (trackChartPoints == null) {
|
if (trackChartPoints == null) {
|
||||||
|
@ -649,6 +691,36 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
|
||||||
return nightMode ? R.drawable.btn_background_inactive_dark : R.drawable.btn_background_inactive_light;
|
return nightMode ? R.drawable.btn_background_inactive_dark : R.drawable.btn_background_inactive_light;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupHeightAndBackground(final View mainView) {
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
if (activity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (AndroidUiHelper.isOrientationPortrait(activity)) {
|
||||||
|
super.setupHeightAndBackground(mainView);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
ViewTreeObserver obs = mainView.getViewTreeObserver();
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
obs.removeOnGlobalLayoutListener(this);
|
||||||
|
} else {
|
||||||
|
obs.removeGlobalOnLayoutListener(this);
|
||||||
|
}
|
||||||
|
final View contentView = mainView.findViewById(R.id.scroll_view);
|
||||||
|
contentView.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
contentView.requestLayout();
|
||||||
|
boolean showTopShadow = AndroidUtils.getScreenHeight(activity) - AndroidUtils.getStatusBarHeight(activity)
|
||||||
|
- mainView.getHeight() >= AndroidUtils.dpToPx(activity, 8);
|
||||||
|
drawTopShadow(showTopShadow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hideButtonsContainer() {
|
protected boolean hideButtonsContainer() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -42,13 +42,13 @@ public class TripRecordingDiscardBottomSheet extends MenuBottomSheetDialogFragme
|
||||||
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
|
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
|
||||||
int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin);
|
int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin);
|
||||||
int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding);
|
int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||||
final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD);
|
final View buttonDiscard = createItem(inflater, ItemType.STOP);
|
||||||
final View buttonCancel = createItem(inflater, ItemType.CANCEL);
|
final View buttonCancel = createItem(inflater, ItemType.CANCEL);
|
||||||
|
|
||||||
items.add(new BottomSheetItemWithDescription.Builder()
|
items.add(new BottomSheetItemWithDescription.Builder()
|
||||||
.setDescription(getString(R.string.track_recording_description))
|
.setDescription(getString(R.string.track_recording_description))
|
||||||
.setDescriptionColorId(getPrimaryTextColorId(nightMode))
|
.setDescriptionColorId(getPrimaryTextColorId(nightMode))
|
||||||
.setTitle(app.getString(R.string.track_recording_title))
|
.setTitle(app.getString(R.string.track_recording_stop_without_saving))
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_title_with_description)
|
.setLayoutId(R.layout.bottom_sheet_item_title_with_description)
|
||||||
.create());
|
.create());
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ public class TripRecordingOptionsBottomSheet extends MenuBottomSheetDialogFragme
|
||||||
private SelectedGpxFile selectedGpxFile;
|
private SelectedGpxFile selectedGpxFile;
|
||||||
private final Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
private Runnable updatingTimeTrackSaved;
|
private Runnable updatingTimeTrackSaved;
|
||||||
private int indexButtonOnline = -1;
|
|
||||||
private int indexButtonOnlineDivider = -1;
|
|
||||||
|
|
||||||
private GPXFile getGPXFile() {
|
private GPXFile getGPXFile() {
|
||||||
return selectedGpxFile.getGpxFile();
|
return selectedGpxFile.getGpxFile();
|
||||||
|
@ -91,7 +89,8 @@ public class TripRecordingOptionsBottomSheet extends MenuBottomSheetDialogFragme
|
||||||
|
|
||||||
buttonClear = createItem(inflater, ItemType.CLEAR_DATA, hasDataToSave());
|
buttonClear = createItem(inflater, ItemType.CLEAR_DATA, hasDataToSave());
|
||||||
final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD);
|
final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD);
|
||||||
final View buttonOnline = createItem(inflater, ItemType.STOP_ONLINE, hasDataToSave());
|
final View buttonOnline = createItem(inflater, settings.LIVE_MONITORING.get()
|
||||||
|
? ItemType.STOP_ONLINE : ItemType.START_ONLINE);
|
||||||
buttonSave = createItem(inflater, ItemType.SAVE, hasDataToSave());
|
buttonSave = createItem(inflater, ItemType.SAVE, hasDataToSave());
|
||||||
final View buttonSegment = createItem(inflater, ItemType.START_NEW_SEGMENT, wasTrackMonitored());
|
final View buttonSegment = createItem(inflater, ItemType.START_NEW_SEGMENT, wasTrackMonitored());
|
||||||
|
|
||||||
|
@ -131,27 +130,19 @@ public class TripRecordingOptionsBottomSheet extends MenuBottomSheetDialogFragme
|
||||||
|
|
||||||
items.add(new DividerSpaceItem(app, dp36));
|
items.add(new DividerSpaceItem(app, dp36));
|
||||||
|
|
||||||
if (app.getLiveMonitoringHelper().isLiveMonitoringEnabled()) {
|
items.add(new BaseBottomSheetItem.Builder()
|
||||||
items.add(new BaseBottomSheetItem.Builder()
|
.setCustomView(buttonOnline)
|
||||||
.setCustomView(buttonOnline)
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
boolean wasOnlineMonitored = !settings.LIVE_MONITORING.get();
|
||||||
settings.LIVE_MONITORING.set(false);
|
settings.LIVE_MONITORING.set(wasOnlineMonitored);
|
||||||
if (indexButtonOnline != -1) {
|
createItem(buttonOnline, wasOnlineMonitored ? ItemType.STOP_ONLINE : ItemType.START_ONLINE);
|
||||||
AndroidUiHelper.updateVisibility(items.get(indexButtonOnline).getView(), false);
|
}
|
||||||
}
|
})
|
||||||
if (indexButtonOnlineDivider != -1) {
|
.create());
|
||||||
AndroidUiHelper.updateVisibility(items.get(indexButtonOnlineDivider).getView(), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.create());
|
|
||||||
indexButtonOnline = items.size() - 1;
|
|
||||||
|
|
||||||
items.add(new DividerSpaceItem(app, dp36));
|
items.add(new DividerSpaceItem(app, dp36));
|
||||||
indexButtonOnlineDivider = items.size() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
items.add(new BaseBottomSheetItem.Builder()
|
items.add(new BaseBottomSheetItem.Builder()
|
||||||
.setCustomView(buttonSave)
|
.setCustomView(buttonSave)
|
||||||
|
@ -181,17 +172,12 @@ public class TripRecordingOptionsBottomSheet extends MenuBottomSheetDialogFragme
|
||||||
.create());
|
.create());
|
||||||
|
|
||||||
items.add(new DividerSpaceItem(app, getResources().getDimensionPixelSize(R.dimen.content_padding_small)));
|
items.add(new DividerSpaceItem(app, getResources().getDimensionPixelSize(R.dimen.content_padding_small)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
runUpdatingTimeTrackSaved();
|
runUpdatingTimeTrackSaved();
|
||||||
Fragment target = getTargetFragment();
|
|
||||||
if (target instanceof TripRecordingBottomSheet) {
|
|
||||||
((TripRecordingBottomSheet) target).hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -243,6 +229,10 @@ public class TripRecordingOptionsBottomSheet extends MenuBottomSheetDialogFragme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createItem(View view, ItemType type) {
|
||||||
|
TripRecordingBottomSheet.createItem(app, nightMode, view, type, true, null);
|
||||||
|
}
|
||||||
|
|
||||||
private View createItem(LayoutInflater inflater, ItemType type, boolean enabled) {
|
private View createItem(LayoutInflater inflater, ItemType type, boolean enabled) {
|
||||||
return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type, enabled, null);
|
return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type, enabled, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenTyp
|
||||||
|
|
||||||
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES;
|
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES;
|
||||||
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS;
|
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS;
|
||||||
|
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createItemActive;
|
||||||
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createItem;
|
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createItem;
|
||||||
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createShowTrackItem;
|
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createShowTrackItem;
|
||||||
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.updateTrackIcon;
|
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.updateTrackIcon;
|
||||||
|
@ -123,7 +124,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
|
||||||
});
|
});
|
||||||
|
|
||||||
CardView cardCenter = itemView.findViewById(R.id.button_center);
|
CardView cardCenter = itemView.findViewById(R.id.button_center);
|
||||||
createItem(app, nightMode, cardCenter, ItemType.START_RECORDING, true, null);
|
createItemActive(app, nightMode, cardCenter, ItemType.START_RECORDING);
|
||||||
cardCenter.setOnClickListener(new View.OnClickListener() {
|
cardCenter.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture;
|
||||||
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||||
|
@ -82,6 +83,11 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
|
||||||
private boolean chartClicked;
|
private boolean chartClicked;
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
private boolean onlyGraphs;
|
private boolean onlyGraphs;
|
||||||
|
private int chartHMargin = 0;
|
||||||
|
|
||||||
|
public void setChartHMargin(int chartHMargin) {
|
||||||
|
this.chartHMargin = chartHMargin;
|
||||||
|
}
|
||||||
|
|
||||||
public GPXItemPagerAdapter(@NonNull OsmandApplication app,
|
public GPXItemPagerAdapter(@NonNull OsmandApplication app,
|
||||||
@NonNull GpxDisplayItem gpxItem,
|
@NonNull GpxDisplayItem gpxItem,
|
||||||
|
@ -201,6 +207,8 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
|
||||||
if (gpxFile != null && gpxItem != null) {
|
if (gpxFile != null && gpxItem != null) {
|
||||||
GPXTrackAnalysis analysis = gpxItem.analysis;
|
GPXTrackAnalysis analysis = gpxItem.analysis;
|
||||||
LineChart chart = view.findViewById(R.id.chart);
|
LineChart chart = view.findViewById(R.id.chart);
|
||||||
|
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) chart.getLayoutParams();
|
||||||
|
AndroidUtils.setMargins(lp, chartHMargin, lp.topMargin, chartHMargin, lp.bottomMargin);
|
||||||
setupChart(view, chart);
|
setupChart(view, chart);
|
||||||
|
|
||||||
switch (tabType) {
|
switch (tabType) {
|
||||||
|
@ -436,8 +444,8 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
|
||||||
view.findViewById(R.id.list_divider).setVisibility(View.GONE);
|
view.findViewById(R.id.list_divider).setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.bottom_line_blocks).setVisibility(View.GONE);
|
view.findViewById(R.id.bottom_line_blocks).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
updateJoinGapsInfo(view, position);
|
|
||||||
if (!onlyGraphs) {
|
if (!onlyGraphs) {
|
||||||
|
updateJoinGapsInfo(view, position);
|
||||||
view.findViewById(R.id.analyze_on_map).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.analyze_on_map).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
|
|
|
@ -129,7 +129,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
|
|
||||||
|
|
||||||
private int dividerWidth = 0;
|
private int dividerWidth = 0;
|
||||||
private int dividerPadding = 0;
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
private int dividerColor;
|
private int dividerColor;
|
||||||
|
|
||||||
|
@ -183,7 +182,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm);
|
scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm);
|
||||||
indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm);
|
indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm);
|
||||||
underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
|
underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
|
||||||
dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm);
|
|
||||||
tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
|
tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
|
||||||
dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm);
|
dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm);
|
||||||
tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);
|
tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);
|
||||||
|
@ -214,7 +212,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
dividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, dividerWidth);
|
dividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, dividerWidth);
|
||||||
indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight);
|
indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight);
|
||||||
underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight);
|
underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight);
|
||||||
dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding);
|
|
||||||
tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding);
|
tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding);
|
||||||
tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId);
|
tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId);
|
||||||
indicatorBgColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsTabBackground, Color.TRANSPARENT);
|
indicatorBgColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsTabBackground, Color.TRANSPARENT);
|
||||||
|
@ -485,7 +482,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
dividerPaint.setColor(dividerColor);
|
dividerPaint.setColor(dividerColor);
|
||||||
for (int i = 0; i < tabCount - 1; i++) {
|
for (int i = 0; i < tabCount - 1; i++) {
|
||||||
View tab = tabsContainer.getChildAt(i);
|
View tab = tabsContainer.getChildAt(i);
|
||||||
canvas.drawLine(tab.getRight(), dividerPadding, tab.getRight(), height - dividerPadding, dividerPaint);
|
canvas.drawLine(tab.getRight(), tabsContainer.getTop(), tab.getRight(), tabsContainer.getBottom(), dividerPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -720,10 +717,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
return underlineHeight;
|
return underlineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDividerPadding() {
|
|
||||||
return dividerPadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getScrollOffset() {
|
public int getScrollOffset() {
|
||||||
return scrollOffset;
|
return scrollOffset;
|
||||||
}
|
}
|
||||||
|
@ -826,11 +819,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDividerPadding(int dividerPaddingPx) {
|
|
||||||
this.dividerPadding = dividerPaddingPx;
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScrollOffset(int scrollOffsetPx) {
|
public void setScrollOffset(int scrollOffsetPx) {
|
||||||
this.scrollOffset = scrollOffsetPx;
|
this.scrollOffset = scrollOffsetPx;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
Loading…
Reference in a new issue