Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1533df8894
10 changed files with 168 additions and 44 deletions
|
@ -412,6 +412,16 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_top_bar_refresh_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="top"
|
||||
android:contentDescription="@string/shared_string_refresh"
|
||||
android:src="@drawable/ic_action_refresh_dark"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_top_bar_close_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
|
|
|
@ -215,6 +215,16 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_top_bar_refresh_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="top"
|
||||
android:contentDescription="@string/shared_string_refresh"
|
||||
android:src="@drawable/ic_action_refresh_dark"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_top_bar_close_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
|
|
|
@ -486,6 +486,10 @@ public class GPXUtilities {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (totalDistance < 0) {
|
||||
hasElevationData = false;
|
||||
hasSpeedData = false;
|
||||
}
|
||||
if (!isTimeSpecified()) {
|
||||
startTime = filestamp;
|
||||
endTime = filestamp;
|
||||
|
|
|
@ -247,11 +247,14 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
|||
List<ILineDataSet> dataSets = new ArrayList<>();
|
||||
elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis,
|
||||
GPXDataSetAxisType.DISTANCE, false, true);
|
||||
dataSets.add(elevationDataSet);
|
||||
if (elevationDataSet != null) {
|
||||
dataSets.add(elevationDataSet);
|
||||
}
|
||||
slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis,
|
||||
GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true);
|
||||
dataSets.add(slopeDataSet);
|
||||
|
||||
if (slopeDataSet != null) {
|
||||
dataSets.add(slopeDataSet);
|
||||
}
|
||||
LineData data = new LineData(dataSets);
|
||||
mChart.setData(data);
|
||||
mChart.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -116,7 +116,7 @@ public class TrackActivity extends TabActivity {
|
|||
|
||||
if (!stopped) {
|
||||
setGpx(result);
|
||||
setGpxDataItem(getMyApplication().getGpxDatabase().getItem(file));
|
||||
setGpxDataItem(file != null ? getMyApplication().getGpxDatabase().getItem(file) : null);
|
||||
|
||||
for (WeakReference<Fragment> f : fragList) {
|
||||
Fragment frag = f.get();
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.widget.AdapterView;
|
|||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.ImageView;
|
||||
|
@ -59,7 +58,6 @@ import net.osmand.CallbackWithObject;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.GPXDatabase;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.Elevation;
|
||||
|
@ -67,7 +65,6 @@ import net.osmand.plus.GPXUtilities.GPXFile;
|
|||
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.plus.GPXUtilities.Speed;
|
||||
import net.osmand.plus.GPXUtilities.TrkSegment;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -83,7 +80,6 @@ import net.osmand.plus.dialogs.ConfigureMapMenu;
|
|||
import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||
import net.osmand.render.RenderingRuleProperty;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -1237,13 +1233,6 @@ public class GpxUiHelper {
|
|||
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange));
|
||||
yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_grid));
|
||||
yAxis.setAxisMinimum(0f);
|
||||
yAxis.setValueFormatter(new IAxisValueFormatter() {
|
||||
|
||||
@Override
|
||||
public String getFormattedValue(float value, AxisBase axis) {
|
||||
return (int)value + " " + mainUnitY;
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<Entry> values = new ArrayList<>();
|
||||
List<Speed> speedData = analysis.speedData;
|
||||
|
@ -1272,6 +1261,23 @@ public class GpxUiHelper {
|
|||
|
||||
OrderedLineDataSet dataSet = new OrderedLineDataSet(values, "", GPXDataSetType.SPEED, axisType);
|
||||
|
||||
String format = null;
|
||||
if (dataSet.getYMax() < 3) {
|
||||
format = "{0,number,0.#} ";
|
||||
}
|
||||
final String formatY = format;
|
||||
yAxis.setValueFormatter(new IAxisValueFormatter() {
|
||||
|
||||
@Override
|
||||
public String getFormattedValue(float value, AxisBase axis) {
|
||||
if (!Algorithms.isEmpty(formatY)) {
|
||||
return MessageFormat.format(formatY + mainUnitY, value);
|
||||
} else {
|
||||
return (int)value + " " + mainUnitY;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Float.isNaN(divSpeed)) {
|
||||
dataSet.priority = analysis.avgSpeed * mulSpeed;
|
||||
} else {
|
||||
|
@ -1322,6 +1328,9 @@ public class GpxUiHelper {
|
|||
GPXDataSetAxisType axisType,
|
||||
List<Entry> eleValues,
|
||||
boolean useRightAxis, boolean drawFilled) {
|
||||
if (axisType == GPXDataSetAxisType.TIME) {
|
||||
return null;
|
||||
}
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
boolean light = settings.isLightContent();
|
||||
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||
|
@ -1329,13 +1338,8 @@ public class GpxUiHelper {
|
|||
final float convEle = useFeet ? 3.28084f : 1.0f;
|
||||
final float totalDistance = analysis.totalDistance;
|
||||
|
||||
float divX;
|
||||
XAxis xAxis = mChart.getXAxis();
|
||||
if (axisType == GPXDataSetAxisType.TIME && analysis.isTimeSpecified()) {
|
||||
divX = setupXAxisTime(xAxis, analysis.timeSpan);
|
||||
} else {
|
||||
divX = setupXAxisDistance(ctx, xAxis, analysis.totalDistance);
|
||||
}
|
||||
float divX = setupXAxisDistance(ctx, xAxis, analysis.totalDistance);
|
||||
|
||||
final String mainUnitY = "%";
|
||||
|
||||
|
@ -1359,7 +1363,7 @@ public class GpxUiHelper {
|
|||
});
|
||||
|
||||
List<Entry> values;
|
||||
if (eleValues == null || axisType == GPXDataSetAxisType.TIME) {
|
||||
if (eleValues == null) {
|
||||
values = calculateElevationArray(analysis, GPXDataSetAxisType.DISTANCE, 1f, 1f);
|
||||
} else {
|
||||
values = new ArrayList<>(eleValues.size());
|
||||
|
@ -1376,12 +1380,6 @@ public class GpxUiHelper {
|
|||
|
||||
double STEP = 5;
|
||||
|
||||
float timeDistKoef = 1f;
|
||||
if (axisType == GPXDataSetAxisType.TIME) {
|
||||
timeDistKoef = analysis.timeSpan / totalDistance / 1000;
|
||||
divX = 1f;
|
||||
}
|
||||
|
||||
double[] calculatedDist = new double[(int) (totalDistance / STEP) + 1];
|
||||
double[] calculatedH = new double[(int) (totalDistance / STEP) + 1];
|
||||
int nextW = 0;
|
||||
|
@ -1399,12 +1397,16 @@ public class GpxUiHelper {
|
|||
|
||||
double SLOPE_PROXIMITY = 150;
|
||||
|
||||
if (totalDistance - SLOPE_PROXIMITY < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
double[] calculatedSlopeDist = new double[(int) ((totalDistance - SLOPE_PROXIMITY) / STEP) + 1];
|
||||
double[] calculatedSlope = new double[(int) ((totalDistance - SLOPE_PROXIMITY) / STEP) + 1];
|
||||
|
||||
int index = (int) ((SLOPE_PROXIMITY / STEP) / 2);
|
||||
for (int k = 0; k < calculatedSlopeDist.length; k++) {
|
||||
calculatedSlopeDist[k] = calculatedDist[index + k] * timeDistKoef;
|
||||
calculatedSlopeDist[k] = calculatedDist[index + k];
|
||||
calculatedSlope[k] = (calculatedH[ 2 * index + k] - calculatedH[k]) * 100 / SLOPE_PROXIMITY;
|
||||
if (Double.isNaN(calculatedSlope[k])) {
|
||||
calculatedSlope[k] = 0;
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.github.mikephil.charting.data.Entry;
|
|||
import com.github.mikephil.charting.data.LineData;
|
||||
import com.github.mikephil.charting.highlight.Highlight;
|
||||
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
||||
import com.github.mikephil.charting.listener.ChartTouchListener;
|
||||
import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture;
|
||||
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||
|
@ -93,6 +92,17 @@ public class TrackDetailsMenu {
|
|||
hide();
|
||||
}
|
||||
});
|
||||
/*
|
||||
if (gpxItem.group.getGpx().showCurrentTrack) {
|
||||
toolbarController.setRefreshBtnVisible(true);
|
||||
toolbarController.setOnRefreshButtonClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
mapActivity.showTopToolbar(toolbarController);
|
||||
}
|
||||
|
||||
|
@ -381,7 +391,9 @@ public class TrackDetailsMenu {
|
|||
gpxItem.chartAxisType, null, gpxItem.chartTypes.length > 1, true);
|
||||
break;
|
||||
}
|
||||
dataSets.add(dataSet);
|
||||
if (dataSet != null) {
|
||||
dataSets.add(dataSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,21 +415,30 @@ public class TrackDetailsMenu {
|
|||
TextView yAxisTitle = (TextView) parentView.findViewById(R.id.y_axis_title);
|
||||
View yAxisArrow = parentView.findViewById(R.id.y_axis_arrow);
|
||||
final List<GPXDataSetType[]> availableTypes = new ArrayList<>();
|
||||
boolean hasSlopeChart = false;
|
||||
if (analysis != null) {
|
||||
if (analysis.hasElevationData) {
|
||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.ALTITUDE });
|
||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.SLOPE });
|
||||
if (gpxItem.chartAxisType != GPXDataSetAxisType.TIME) {
|
||||
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SLOPE});
|
||||
}
|
||||
}
|
||||
if (analysis.hasSpeedData) {
|
||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.SPEED });
|
||||
}
|
||||
if (analysis.hasElevationData) {
|
||||
if (analysis.hasElevationData && gpxItem.chartAxisType != GPXDataSetAxisType.TIME) {
|
||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE });
|
||||
}
|
||||
if (analysis.hasElevationData && analysis.hasSpeedData) {
|
||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED });
|
||||
}
|
||||
}
|
||||
for (GPXDataSetType t : gpxItem.chartTypes) {
|
||||
if (t == GPXDataSetType.SLOPE) {
|
||||
hasSlopeChart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
yAxisIcon.setImageDrawable(GPXDataSetType.getImageDrawable(app, gpxItem.chartTypes));
|
||||
yAxisTitle.setText(GPXDataSetType.getName(app, gpxItem.chartTypes));
|
||||
if (availableTypes.size() > 0) {
|
||||
|
@ -461,7 +482,7 @@ public class TrackDetailsMenu {
|
|||
xAxisIcon.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_marker_dark));
|
||||
xAxisTitle.setText(app.getString(R.string.distance));
|
||||
}
|
||||
if (analysis != null && analysis.isTimeSpecified()) {
|
||||
if (analysis != null && analysis.isTimeSpecified() && !hasSlopeChart) {
|
||||
xAxis.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -513,6 +534,7 @@ public class TrackDetailsMenu {
|
|||
TrackDetailsBarController() {
|
||||
super(MapInfoWidgetsFactory.TopToolbarControllerType.TRACK_DETAILS);
|
||||
setBackBtnIconClrIds(0, 0);
|
||||
setRefreshBtnIconClrIds(0, 0);
|
||||
setCloseBtnIconClrIds(0, 0);
|
||||
setTitleTextClrIds(R.color.primary_text_dark, R.color.primary_text_dark);
|
||||
setDescrTextClrIds(R.color.primary_text_dark, R.color.primary_text_dark);
|
||||
|
|
|
@ -1606,8 +1606,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (sgpx != null) {
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_polygom_dark, R.color.color_distance));
|
||||
analysis = sgpx.getTrackAnalysis();
|
||||
} else if (child.currentlyRecordingTrack) {
|
||||
analysis = app.getSavingTrackHelper().getCurrentTrack().getTrackAnalysis();
|
||||
} else {
|
||||
GpxDataItem dataItem = app.getGpxDatabase().getItem(child.file);
|
||||
GpxDataItem dataItem = child.file == null ? null : app.getGpxDatabase().getItem(child.file);
|
||||
if (dataItem != null) {
|
||||
analysis = dataItem.getAnalysis();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ import com.github.mikephil.charting.listener.OnChartGestureListener;
|
|||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GPXDatabase;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.plus.GPXUtilities.Track;
|
||||
|
@ -171,13 +171,27 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
});
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
if (getGpx() != null && getGpx().showCurrentTrack) {
|
||||
MenuItem item = menu.add(R.string.shared_string_refresh).setIcon(R.drawable.ic_action_refresh_dark)
|
||||
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
if (updateEnable) {
|
||||
updateContent();
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
private GPXFile getGpx() {
|
||||
return getMyActivity().getGpx();
|
||||
}
|
||||
|
||||
private GPXDatabase.GpxDataItem getGpxDataItem() {
|
||||
private GpxDataItem getGpxDataItem() {
|
||||
return getMyActivity().getGpxDataItem();
|
||||
}
|
||||
|
||||
|
@ -201,7 +215,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
updateContent();
|
||||
updateEnable = true;
|
||||
if (getGpx() != null && getGpx().showCurrentTrack) {
|
||||
startHandler();
|
||||
//startHandler();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,7 +232,9 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
final View splitIntervalView = headerView.findViewById(R.id.split_interval_view);
|
||||
final View colorView = headerView.findViewById(R.id.color_view);
|
||||
final SwitchCompat vis = (SwitchCompat) headerView.findViewById(R.id.showOnMapToggle);
|
||||
vis.setChecked(getGpx() != null && app.getSelectedGpxHelper().getSelectedFileByPath(getGpx().path) != null);
|
||||
vis.setChecked(getGpx() != null &&
|
||||
((getGpx().showCurrentTrack && app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null) ||
|
||||
(getGpx().path != null && app.getSelectedGpxHelper().getSelectedFileByPath(getGpx().path) != null)));
|
||||
vis.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
|
@ -279,9 +295,11 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
if (clr != 0 && sf.getModifiableGpxFile() != null) {
|
||||
sf.getModifiableGpxFile().setColor(clr);
|
||||
app.getGpxDatabase().updateColor(getGpxDataItem(), clr);
|
||||
if (getGpxDataItem() != null) {
|
||||
app.getGpxDatabase().updateColor(getGpxDataItem(), clr);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (getGpxDataItem() != null) {
|
||||
app.getGpxDatabase().updateColor(getGpxDataItem(), clr);
|
||||
}
|
||||
}
|
||||
|
@ -663,11 +681,15 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
case GPX_TAB_ITEM_ALTITUDE: {
|
||||
OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, chart,
|
||||
analysis, GPXDataSetAxisType.DISTANCE, false, true);
|
||||
dataSets.add(elevationDataSet);
|
||||
if (elevationDataSet != null) {
|
||||
dataSets.add(elevationDataSet);
|
||||
}
|
||||
if (analysis.hasElevationData) {
|
||||
OrderedLineDataSet slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, chart,
|
||||
analysis, GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true);
|
||||
dataSets.add(slopeDataSet);
|
||||
if (slopeDataSet != null) {
|
||||
dataSets.add(slopeDataSet);
|
||||
}
|
||||
}
|
||||
dataSetsMap.put(GPXTabItemType.GPX_TAB_ITEM_ALTITUDE, dataSets);
|
||||
break;
|
||||
|
@ -675,7 +697,9 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
case GPX_TAB_ITEM_SPEED: {
|
||||
OrderedLineDataSet speedDataSet = GpxUiHelper.createGPXSpeedDataSet(app, chart,
|
||||
analysis, GPXDataSetAxisType.DISTANCE, false, true);
|
||||
dataSets.add(speedDataSet);
|
||||
if (speedDataSet != null) {
|
||||
dataSets.add(speedDataSet);
|
||||
}
|
||||
dataSetsMap.put(GPXTabItemType.GPX_TAB_ITEM_SPEED, dataSets);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -191,6 +191,12 @@ public class MapInfoWidgetsFactory {
|
|||
int closeBtnIconClrLightId = R.color.icon_color;
|
||||
int closeBtnIconClrDarkId = 0;
|
||||
|
||||
int refreshBtnIconLightId = R.drawable.ic_action_refresh_dark;
|
||||
int refreshBtnIconDarkId = R.drawable.ic_action_refresh_dark;
|
||||
int refreshBtnIconClrLightId = R.color.icon_color;
|
||||
int refreshBtnIconClrDarkId = 0;
|
||||
boolean refreshBtnVisible = false;
|
||||
|
||||
int titleTextClrLightId = R.color.primary_text_light;
|
||||
int titleTextClrDarkId = R.color.primary_text_dark;
|
||||
int descrTextClrLightId = R.color.primary_text_light;
|
||||
|
@ -206,6 +212,7 @@ public class MapInfoWidgetsFactory {
|
|||
OnClickListener onBackButtonClickListener;
|
||||
OnClickListener onTitleClickListener;
|
||||
OnClickListener onCloseButtonClickListener;
|
||||
OnClickListener onRefreshButtonClickListener;
|
||||
|
||||
|
||||
public TopToolbarController(TopToolbarControllerType type) {
|
||||
|
@ -255,6 +262,20 @@ public class MapInfoWidgetsFactory {
|
|||
this.closeBtnIconClrDarkId = closeBtnIconClrDarkId;
|
||||
}
|
||||
|
||||
public void setRefreshBtnIconIds(int refreshBtnIconLightId, int refreshBtnIconDarkId) {
|
||||
this.refreshBtnIconLightId = refreshBtnIconLightId;
|
||||
this.refreshBtnIconDarkId = refreshBtnIconDarkId;
|
||||
}
|
||||
|
||||
public void setRefreshBtnIconClrIds(int refreshBtnIconClrLightId, int refreshBtnIconClrDarkId) {
|
||||
this.refreshBtnIconClrLightId = refreshBtnIconClrLightId;
|
||||
this.refreshBtnIconClrDarkId = refreshBtnIconClrDarkId;
|
||||
}
|
||||
|
||||
public void setRefreshBtnVisible(boolean visible) {
|
||||
this.refreshBtnVisible = visible;
|
||||
}
|
||||
|
||||
public void setTitleTextClrIds(int titleTextClrLightId, int titleTextClrDarkId) {
|
||||
this.titleTextClrLightId = titleTextClrLightId;
|
||||
this.titleTextClrDarkId = titleTextClrDarkId;
|
||||
|
@ -277,6 +298,10 @@ public class MapInfoWidgetsFactory {
|
|||
this.onCloseButtonClickListener = onCloseButtonClickListener;
|
||||
}
|
||||
|
||||
public void setOnRefreshButtonClickListener(OnClickListener onRefreshButtonClickListener) {
|
||||
this.onRefreshButtonClickListener = onRefreshButtonClickListener;
|
||||
}
|
||||
|
||||
public void updateToolbar(TopToolbarView view) {
|
||||
TextView titleView = view.getTitleView();
|
||||
TextView descrView = view.getDescrView();
|
||||
|
@ -308,6 +333,7 @@ public class MapInfoWidgetsFactory {
|
|||
private ImageButton backButton;
|
||||
private TextView titleView;
|
||||
private TextView descrView;
|
||||
private ImageButton refreshButton;
|
||||
private ImageButton closeButton;
|
||||
private View shadowView;
|
||||
private boolean nightMode;
|
||||
|
@ -319,6 +345,7 @@ public class MapInfoWidgetsFactory {
|
|||
topBarLayout = map.findViewById(R.id.widget_top_bar_layout);
|
||||
topBarTitleLayout = map.findViewById(R.id.widget_top_bar_title_layout);
|
||||
backButton = (ImageButton) map.findViewById(R.id.widget_top_bar_back_button);
|
||||
refreshButton = (ImageButton) map.findViewById(R.id.widget_top_bar_refresh_button);
|
||||
closeButton = (ImageButton) map.findViewById(R.id.widget_top_bar_close_button);
|
||||
titleView = (TextView) map.findViewById(R.id.widget_top_bar_title);
|
||||
descrView = (TextView) map.findViewById(R.id.widget_top_bar_description);
|
||||
|
@ -354,6 +381,10 @@ public class MapInfoWidgetsFactory {
|
|||
return closeButton;
|
||||
}
|
||||
|
||||
public ImageButton getRefreshButton() {
|
||||
return refreshButton;
|
||||
}
|
||||
|
||||
public View getShadowView() {
|
||||
return shadowView;
|
||||
}
|
||||
|
@ -414,6 +445,7 @@ public class MapInfoWidgetsFactory {
|
|||
backButton.setOnClickListener(controller.onBackButtonClickListener);
|
||||
topBarTitleLayout.setOnClickListener(controller.onTitleClickListener);
|
||||
closeButton.setOnClickListener(controller.onCloseButtonClickListener);
|
||||
refreshButton.setOnClickListener(controller.onRefreshButtonClickListener);
|
||||
}
|
||||
|
||||
public void updateInfo() {
|
||||
|
@ -443,6 +475,11 @@ public class MapInfoWidgetsFactory {
|
|||
} else {
|
||||
closeButton.setImageDrawable(app.getIconsCache().getIcon(controller.closeBtnIconDarkId, controller.closeBtnIconClrDarkId));
|
||||
}
|
||||
if (controller.refreshBtnIconDarkId == 0) {
|
||||
refreshButton.setImageDrawable(null);
|
||||
} else {
|
||||
refreshButton.setImageDrawable(app.getIconsCache().getIcon(controller.refreshBtnIconDarkId, controller.refreshBtnIconClrDarkId));
|
||||
}
|
||||
int titleColor = map.getResources().getColor(controller.titleTextClrDarkId);
|
||||
int descrColor = map.getResources().getColor(controller.descrTextClrDarkId);
|
||||
titleView.setTextColor(titleColor);
|
||||
|
@ -459,6 +496,11 @@ public class MapInfoWidgetsFactory {
|
|||
} else {
|
||||
closeButton.setImageDrawable(app.getIconsCache().getIcon(controller.closeBtnIconLightId, controller.closeBtnIconClrLightId));
|
||||
}
|
||||
if (controller.refreshBtnIconLightId == 0) {
|
||||
refreshButton.setImageDrawable(null);
|
||||
} else {
|
||||
refreshButton.setImageDrawable(app.getIconsCache().getIcon(controller.refreshBtnIconLightId, controller.refreshBtnIconClrLightId));
|
||||
}
|
||||
int titleColor = map.getResources().getColor(controller.titleTextClrLightId);
|
||||
int descrColor = map.getResources().getColor(controller.descrTextClrLightId);
|
||||
titleView.setTextColor(titleColor);
|
||||
|
@ -469,6 +511,11 @@ public class MapInfoWidgetsFactory {
|
|||
} else {
|
||||
titleView.setSingleLine(false);
|
||||
}
|
||||
if (controller.refreshBtnVisible && refreshButton.getVisibility() == View.GONE) {
|
||||
refreshButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
refreshButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateColors() {
|
||||
|
|
Loading…
Reference in a new issue