Skip to content

Commit 7089877

Browse files
committed
Fix build error
1 parent 99f53d7 commit 7089877

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
import java.util.Collections;
5656
import java.util.List;
5757

58-
import androidx.annotation.NonNull;
59-
6058
/**
6159
* Baseclass of all Chart-Views.
6260
*
@@ -174,11 +172,6 @@ public abstract class Chart<T extends ChartData<? extends IDataSet<? extends Ent
174172
*/
175173
private float mExtraTopOffset = 0.f, mExtraRightOffset = 0.f, mExtraBottomOffset = 0.f, mExtraLeftOffset = 0.f;
176174

177-
/**
178-
* Tag for logging accessibility related content
179-
*/
180-
private String TAG = "abilityTag";
181-
182175
/**
183176
* Additional data on top of dynamically generated description. This can be set by the user.
184177
*/
@@ -754,7 +747,7 @@ public ChartTouchListener getOnTouchListener() {
754747
/**
755748
* the view that represents the marker
756749
*/
757-
protected List<IMarker> mMarkers;
750+
protected List<IMarker> mMarkers = new ArrayList<>();
758751

759752
/**
760753
* draws all MarkerViews on the highlighted positions
@@ -766,7 +759,9 @@ protected void drawMarkers(Canvas canvas) {
766759
return;
767760
}
768761

769-
for (Highlight highlight : mIndicesToHighlight) {
762+
for (int i = 0; i < mIndicesToHighlight.length; i++) {
763+
764+
Highlight highlight = mIndicesToHighlight[i];
770765

771766
// When changing data sets and calling animation functions, sometimes an erroneous highlight is generated
772767
// on the dataset that is removed. Null check to prevent crash
@@ -778,7 +773,7 @@ protected void drawMarkers(Canvas canvas) {
778773
Entry e = mData.getEntryForHighlight(highlight);
779774

780775
// make sure entry not null before using it
781-
if (e == null || set == null) {
776+
if (e == null) {
782777
continue;
783778
}
784779

@@ -1153,7 +1148,7 @@ public void setMarkers(List<IMarker> marker) {
11531148
* sets the marker that is displayed when a value is clicked on the chart
11541149
*/
11551150
public void setMarker(IMarker marker) {
1156-
setMarkers(Collections.unmodifiableList(Collections.singletonList(marker)));
1151+
setMarkers(Collections.singletonList(marker));
11571152
}
11581153
/**
11591154
* returns the marker that is set as a marker view for the chart
@@ -1703,7 +1698,7 @@ public void setAccessibilitySummaryDescription(String accessibilitySummaryDescri
17031698
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
17041699

17051700
boolean completed = super.dispatchPopulateAccessibilityEvent(event);
1706-
Log.d(TAG, "Dispatch called for Chart <View> and completed as " + completed);
1701+
Log.d(LOG_TAG, "Dispatch called for Chart <View> and completed as " + completed);
17071702

17081703
event.getText().add(getAccessibilityDescription());
17091704

MPChartLib/src/main/java/com/github/mikephil/charting/charts/CombinedChart.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ protected void drawMarkers(Canvas canvas) {
236236
return;
237237
}
238238

239-
for (Highlight highlight : mIndicesToHighlight) {
239+
for (int i = 0; i < mIndicesToHighlight.length; i++) {
240240

241+
Highlight highlight = mIndicesToHighlight[i];
241242
IDataSet set = mData.getDataSetByHighlight(highlight);
242243

243244
Entry e = mData.getEntryForHighlight(highlight);

app/src/main/java/info/appdev/chartexample/LineChartActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec
6262

6363
// Set the marker to the chart
6464
mv.chartView = binding.chart1
65-
binding.chart1.marker = mv
65+
binding.chart1.marker.add(mv)
6666

6767
// enable scaling and dragging
6868
binding.chart1.isDragEnabled = true

app/src/main/java/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener,
8181
// to use for it
8282
val mv = MyMarkerView(this, R.layout.custom_marker_view)
8383
mv.chartView = mChart // For bounds control
84-
mChart!!.marker = mv // Set the marker to the chart
84+
mChart!!.marker.add(mv) // Set the marker to the chart
8585

8686
// x-axis limit line
8787
val llXAxis = LimitLine(10f, "Index 10")

0 commit comments

Comments
 (0)