diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 0b142bb169..d4ffb55b7f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -65,6 +65,7 @@ dependencies { implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.activity:activity-compose:1.12.1") implementation("androidx.compose.material:material-icons-extended") + implementation("com.github.AppDevNext.Logcat:LogcatCoreLib:3.4") debugImplementation("androidx.compose.ui:ui-tooling") // Compose testing diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a274041349..05de50e6b7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,6 +8,7 @@ android:hardwareAccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" + android:name="info.hannes.logcat.LoggingApplication" android:theme="@style/AppTheme"> () if (count == VAL_COUNT) { VAL_FIX.forEachIndexed { index, d -> diff --git a/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt index 75fb632708..ee6ff9059d 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt @@ -4,11 +4,9 @@ package info.appdev.chartexample import android.Manifest import android.content.pm.PackageManager import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import androidx.core.content.ContextCompat -import com.github.mikephil.charting.charts.Chart import com.github.mikephil.charting.data.DataSet import com.github.mikephil.charting.data.Entry import com.github.mikephil.charting.data.LineData @@ -18,6 +16,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.listener.OnDrawListener import info.appdev.chartexample.databinding.ActivityDrawChartBinding import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber /** * This Activity demonstrates drawing into the Chart with the finger. Both line, @@ -125,25 +124,25 @@ class DrawChartActivity : DemoBase(), OnChartValueSelectedListener, OnDrawListen } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("VAL SELECTED", ("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex)) + Timber.i(("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex)) } override fun onNothingSelected() = Unit /** callback for each new entry drawn with the finger */ override fun onEntryAdded(entry: Entry) { - Log.i(Chart.LOG_TAG, entry.toString()) + Timber.i(entry.toString()) } /** callback when a DataSet has been drawn (when lifting the finger) */ override fun onDrawFinished(dataSet: DataSet<*>) { - Log.i(Chart.LOG_TAG, "DataSet drawn. " + dataSet.toSimpleString()) + Timber.i("DataSet drawn. " + dataSet.toSimpleString()) // prepare the legend again binding.chart1.data?.let { binding.chart1.legendRenderer.computeLegend(it) } } override fun onEntryMoved(entry: Entry) { - Log.i(Chart.LOG_TAG, "Point moved $entry") + Timber.i("Point moved $entry") } } diff --git a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt index 035fc57ab9..41119da966 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.content.pm.PackageManager import android.graphics.RectF import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -26,6 +25,7 @@ import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase import androidx.core.net.toUri import info.appdev.chartexample.databinding.ActivityHorizontalbarchartBinding +import timber.log.Timber class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { @@ -249,8 +249,8 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV .getAxisDependency() ) - Log.i("bounds", bounds.toString()) - Log.i("position", position.toString()) + Timber.i(bounds.toString()) + Timber.i(position.toString()) MPPointF.recycleInstance(position) } diff --git a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt index ea6edc0f6d..25ceb02303 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.content.pm.PackageManager import android.graphics.RectF import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -27,6 +26,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.utils.MPPointF import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { private var chart: HorizontalBarChart? = null @@ -256,8 +256,8 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener, .getAxisDependency() ) - Log.i("bounds", bounds.toString()) - Log.i("position", position.toString()) + Timber.i("bounds $bounds") + Timber.i("position $position") MPPointF.recycleInstance(position) } diff --git a/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt index 07ba04ba67..02900d8be6 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt @@ -4,7 +4,6 @@ import android.Manifest import android.content.Intent import android.content.pm.PackageManager import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -23,6 +22,7 @@ import com.github.mikephil.charting.utils.EntryXComparator import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.custom.MyMarkerView import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber import java.util.Collections class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { @@ -232,12 +232,12 @@ class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("VAL SELECTED", "Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) + Timber.i("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) } - override fun onNothingSelected() {} + override fun onNothingSelected() = Unit - override fun onStartTrackingTouch(seekBar: SeekBar?) {} + override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit - override fun onStopTrackingTouch(seekBar: SeekBar?) {} + override fun onStopTrackingTouch(seekBar: SeekBar?) = Unit } diff --git a/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt index cb720e22b2..e3003dd733 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.content.pm.PackageManager import android.graphics.Color import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -25,6 +24,7 @@ import info.appdev.chartexample.DataTools.Companion.setData import info.appdev.chartexample.custom.MyMarkerView import info.appdev.chartexample.databinding.ActivityLinechartBinding import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber /** * Example of a heavily customized [LineChart] with limit lines, custom line shapes, etc. @@ -135,7 +135,7 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec // add data binding.seekBarX.progress = 45 binding.seekBarY.progress = 180 - Log.d("setDataCreate", "count=45 range=180f") + Timber.d("count=45 range=180f") setData(this, binding.chart1, 45, 180f) // draw points over time @@ -263,15 +263,10 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec override fun onStartTrackingTouch(seekBar: SeekBar) {} override fun onStopTrackingTouch(seekBar: SeekBar) {} override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("Entry selected", entry.toString()) - Log.i("LOW HIGH", "low: " + binding.chart1.lowestVisibleX + ", high: " + binding.chart1.highestVisibleX) - Log.i( - "MIN MAX", - "xMin: " + binding.chart1.xChartMin + ", xMax: " + binding.chart1.xChartMax + ", yMin: " + binding.chart1.yChartMin + ", yMax: " + binding.chart1.yChartMax - ) + Timber.i(entry.toString()) + Timber.i("LOW HIGH low: " + binding.chart1.lowestVisibleX + ", high: " + binding.chart1.highestVisibleX) + Timber.i("MIN MAX xMin: " + binding.chart1.xChartMin + ", xMax: " + binding.chart1.xChartMax + ", yMin: " + binding.chart1.yChartMin + ", yMax: " + binding.chart1.yChartMax) } - override fun onNothingSelected() { - Log.i("Nothing selected", "Nothing selected.") - } + override fun onNothingSelected() = Unit } diff --git a/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt index b3024be528..50a5623621 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt @@ -5,13 +5,13 @@ import android.content.Intent import android.content.pm.PackageManager import android.graphics.Color import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar import android.widget.SeekBar.OnSeekBarChangeListener import android.widget.TextView import androidx.core.content.ContextCompat +import androidx.core.net.toUri import com.github.mikephil.charting.charts.LineChart import com.github.mikephil.charting.components.Legend import com.github.mikephil.charting.components.Legend.LegendForm @@ -24,7 +24,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.utils.ColorTemplate import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase -import androidx.core.net.toUri +import timber.log.Timber /** * Example of a dual axis [LineChart] with multiple data sets. @@ -357,7 +357,7 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("Entry selected", entry.toString()) + Timber.i(entry.toString()) chart!!.centerViewToAnimated( entry.x, entry.y, chart!!.data!!.getDataSetByIndex(highlight.dataSetIndex) @@ -369,9 +369,7 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa // .getAxisDependency(), 1000); } - override fun onNothingSelected() { - Log.i("Nothing selected", "Nothing selected.") - } + override fun onNothingSelected() = Unit override fun onStartTrackingTouch(seekBar: SeekBar?) {} diff --git a/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt index bf1ccf82c2..7b47ef93c9 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt @@ -4,7 +4,6 @@ import android.Manifest import android.content.Intent import android.content.pm.PackageManager import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.view.MotionEvent @@ -26,6 +25,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.utils.ColorTemplate import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class MultiLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestureListener, OnChartValueSelectedListener { private var chart: LineChart? = null @@ -265,42 +265,42 @@ class MultiLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestu } override fun onChartGestureStart(me: MotionEvent, lastPerformedGesture: ChartGesture?) { - Log.i("Gesture", "START, x: " + me.x + ", y: " + me.y) + Timber.i("START, x: " + me.x + ", y: " + me.y) } override fun onChartGestureEnd(me: MotionEvent, lastPerformedGesture: ChartGesture?) { - Log.i("Gesture", "END, lastGesture: $lastPerformedGesture") + Timber.i("END, lastGesture: $lastPerformedGesture") // un-highlight values after the gesture is finished and no single-tap if (lastPerformedGesture != ChartGesture.SINGLE_TAP) chart!!.highlightValues(null) // or highlightTouch(null) for callback to onNothingSelected(...) } override fun onChartLongPressed(me: MotionEvent) { - Log.i("LongPress", "Chart long pressed.") + Timber.i("Chart long pressed.") } override fun onChartDoubleTapped(me: MotionEvent) { - Log.i("DoubleTap", "Chart double-tapped.") + Timber.i("Chart double-tapped.") } override fun onChartSingleTapped(me: MotionEvent) { - Log.i("SingleTap", "Chart single-tapped.") + Timber.i("Chart single-tapped.") } override fun onChartFling(me1: MotionEvent?, me2: MotionEvent, velocityX: Float, velocityY: Float) { - Log.i("Fling", "Chart fling. VelocityX: $velocityX, VelocityY: $velocityY") + Timber.i("Chart fling. VelocityX: $velocityX, VelocityY: $velocityY") } override fun onChartScale(me: MotionEvent, scaleX: Float, scaleY: Float) { - Log.i("Scale / Zoom", "ScaleX: $scaleX, ScaleY: $scaleY") + Timber.i("ScaleX: $scaleX, ScaleY: $scaleY") } override fun onChartTranslate(me: MotionEvent, dX: Float, dY: Float) { - Log.i("Translate / Move", "dX: $dX, dY: $dY") + Timber.i("dX: $dX, dY: $dY") } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("VAL SELECTED", "Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) + Timber.i("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) } override fun onNothingSelected() = Unit diff --git a/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt index c47389ac1c..cb8ca2e0bd 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt @@ -10,7 +10,6 @@ import android.text.SpannableString import android.text.style.ForegroundColorSpan import android.text.style.RelativeSizeSpan import android.text.style.StyleSpan -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -33,6 +32,7 @@ import com.github.mikephil.charting.utils.ColorTemplate import com.github.mikephil.charting.utils.MPPointF import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { private var chart: PieChart? = null @@ -277,12 +277,10 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("VAL SELECTED", "Value: " + entry.y + ", index: " + highlight.x + ", DataSet index: " + highlight.dataSetIndex) + Timber.i("Value: " + entry.y + ", index: " + highlight.x + ", DataSet index: " + highlight.dataSetIndex) } - override fun onNothingSelected() { - Log.i("PieChart", "nothing selected") - } + override fun onNothingSelected() = Unit override fun onStartTrackingTouch(seekBar: SeekBar?) {} diff --git a/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt index e7e2e7287e..30145e626a 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt @@ -10,7 +10,6 @@ import android.text.SpannableString import android.text.style.ForegroundColorSpan import android.text.style.RelativeSizeSpan import android.text.style.StyleSpan -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -34,6 +33,7 @@ import com.github.mikephil.charting.utils.ColorTemplate import com.github.mikephil.charting.utils.MPPointF import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { private var chart: PieChart? = null @@ -282,12 +282,10 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("VAL SELECTED", "Value: " + entry.y + ", index: " + highlight.x + ", DataSet index: " + highlight.dataSetIndex) + Timber.i("Value: " + entry.y + ", index: " + highlight.x + ", DataSet index: " + highlight.dataSetIndex) } - override fun onNothingSelected() { - Log.i("PieChart", "nothing selected") - } + override fun onNothingSelected() = Unit override fun onStartTrackingTouch(seekBar: SeekBar?) {} diff --git a/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt index 1ea3ea365b..90b45367cf 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt @@ -10,7 +10,6 @@ import android.text.SpannableString import android.text.style.ForegroundColorSpan import android.text.style.RelativeSizeSpan import android.text.style.StyleSpan -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -31,6 +30,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.utils.ColorTemplate import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { private var chart: PieChart? = null @@ -265,12 +265,10 @@ class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVal } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("VAL SELECTED", "Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) + Timber.i("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) } - override fun onNothingSelected() { - Log.i("PieChart", "nothing selected") - } + override fun onNothingSelected() = Unit override fun onStartTrackingTouch(seekBar: SeekBar?) {} diff --git a/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt index 707d187a62..8fca8faa28 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.content.pm.PackageManager import android.graphics.Color import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.Toast @@ -22,6 +21,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.utils.ColorTemplate import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class RealtimeLineChartActivity : DemoBase(), OnChartValueSelectedListener { private var chart: LineChart? = null @@ -199,12 +199,10 @@ class RealtimeLineChartActivity : DemoBase(), OnChartValueSelectedListener { } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("Entry selected", entry.toString()) + Timber.i(entry.toString()) } - override fun onNothingSelected() { - Log.i("Nothing selected", "Nothing selected.") - } + override fun onNothingSelected() = Unit override fun onPause() { super.onPause() diff --git a/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt index a0706e6ba4..a55c7aeeda 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt @@ -4,7 +4,6 @@ import android.Manifest import android.content.Intent import android.content.pm.PackageManager import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -24,6 +23,7 @@ import com.github.mikephil.charting.utils.ColorTemplate import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.custom.CustomScatterShapeRenderer import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class ScatterChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { private var chart: ScatterChart? = null @@ -207,7 +207,7 @@ class ScatterChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSe } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("VAL SELECTED", "Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) + Timber.i("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex) } override fun onNothingSelected() {} diff --git a/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt index c782fbed2a..50614f425e 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt @@ -5,7 +5,6 @@ import android.graphics.Color import android.graphics.DashPathEffect import android.graphics.Typeface import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.view.MotionEvent @@ -32,6 +31,7 @@ import com.github.mikephil.charting.utils.getSDKInt import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.custom.MyMarkerView import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestureListener, OnChartValueSelectedListener { @@ -291,11 +291,11 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, } override fun onChartGestureStart(me: MotionEvent, lastPerformedGesture: ChartGesture?) { - Log.i("Gesture", "START, x: " + me.x + ", y: " + me.y) + Timber.i("START, x: " + me.x + ", y: " + me.y) } override fun onChartGestureEnd(me: MotionEvent, lastPerformedGesture: ChartGesture?) { - Log.i("Gesture", "END, lastGesture: $lastPerformedGesture") + Timber.i("END, lastGesture: $lastPerformedGesture") // un-highlight values after the gesture is finished and no single-tap if (lastPerformedGesture != ChartGesture.SINGLE_TAP) { @@ -304,38 +304,36 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, } override fun onChartLongPressed(me: MotionEvent) { - Log.i("LongPress", "Chart long pressed.") + Timber.i("Chart long pressed.") } override fun onChartDoubleTapped(me: MotionEvent) { - Log.i("DoubleTap", "Chart double-tapped.") + Timber.i("Chart double-tapped.") } override fun onChartSingleTapped(me: MotionEvent) { - Log.i("SingleTap", "Chart single-tapped.") + Timber.i("Chart single-tapped.") } override fun onChartFling(me1: MotionEvent?, me2: MotionEvent, velocityX: Float, velocityY: Float) { - Log.i("Fling", "Chart flinged. VeloX: $velocityX, VeloY: $velocityY") + Timber.i("Chart flinged. VeloX: $velocityX, VeloY: $velocityY") } override fun onChartScale(me: MotionEvent, scaleX: Float, scaleY: Float) { - Log.i("Scale / Zoom", "ScaleX: $scaleX, ScaleY: $scaleY") + Timber.i("ScaleX: $scaleX, ScaleY: $scaleY") } override fun onChartTranslate(me: MotionEvent, dX: Float, dY: Float) { - Log.i("Translate / Move", "dX: $dX, dY: $dY") + Timber.i("dX: $dX, dY: $dY") } override fun onValueSelected(entry: Entry, highlight: Highlight) { - Log.i("Entry selected", entry.toString()) - Log.i("LOWHIGH", "low: ${mChart!!.lowestVisibleX}, high: ${mChart!!.highestVisibleX}") - Log.i("MIN MAX", "xmin: ${mChart!!.xChartMin}, xmax: ${mChart!!.xChartMax}, ymin: ${mChart!!.yChartMin}, ymax: ${mChart!!.yChartMax}") + Timber.i(entry.toString()) + Timber.i("LOWHIGH low: ${mChart!!.lowestVisibleX}, high: ${mChart!!.highestVisibleX}") + Timber.i("MIN MAX xmin: ${mChart!!.xChartMin}, xmax: ${mChart!!.xChartMax}, ymin: ${mChart!!.yChartMin}, ymax: ${mChart!!.yChartMax}") } - override fun onNothingSelected() { - Log.i("Nothing selected", "Nothing selected.") - } + override fun onNothingSelected() = Unit override fun saveToGallery() { saveToGallery(mChart, "SpecificPositionsLineChartActivity") diff --git a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt index bfbfee97b2..348028d3cf 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.content.pm.PackageManager import android.graphics.Color import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import android.widget.SeekBar @@ -29,6 +28,7 @@ import info.appdev.chartexample.DataTools.Companion.getValues import info.appdev.chartexample.formatter.MyAxisValueFormatter import info.appdev.chartexample.formatter.MyValueFormatter import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber class StackedBarActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener { private var chart: BarChart? = null @@ -242,9 +242,9 @@ class StackedBarActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSele val barEntry = entry as BarEntry if (barEntry.yVals != null) - Log.i("VAL SELECTED", "Value: " + barEntry.yVals!![highlight.stackIndex]) + Timber.i("Value: " + barEntry.yVals!![highlight.stackIndex]) else - Log.i("VAL SELECTED", "Value: " + barEntry.y) + Timber.i("Value: " + barEntry.y) } override fun onNothingSelected() {} diff --git a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt index cd1ffaf4fa..9b5a27c173 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.content.pm.PackageManager import android.graphics.Color import android.os.Bundle -import android.util.Log import android.view.Menu import android.view.MenuItem import androidx.core.content.ContextCompat @@ -26,6 +25,7 @@ import com.github.mikephil.charting.highlight.Highlight import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.utils.ViewPortHandler import info.appdev.chartexample.notimportant.DemoBase +import timber.log.Timber import java.text.DecimalFormat import kotlin.math.abs @@ -208,12 +208,10 @@ class StackedBarActivityNegative : DemoBase(), OnChartValueSelectedListener { override fun onValueSelected(entry: Entry, highlight: Highlight) { val barEntry = entry as BarEntry - Log.i("VAL SELECTED", "Value: " + abs(barEntry.yVals!![highlight.stackIndex])) + Timber.i("Value: " + abs(barEntry.yVals!![highlight.stackIndex])) } - override fun onNothingSelected() { - Log.i("NOTING SELECTED", "") - } + override fun onNothingSelected() = Unit private class CustomFormatter : IValueFormatter, IAxisValueFormatter { private val decimalFormat: DecimalFormat = DecimalFormat("###") diff --git a/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt index ca6940aaf5..9849114474 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt @@ -2,7 +2,6 @@ package info.appdev.chartexample.compose import android.graphics.RectF import android.os.Bundle -import android.util.Log import androidx.activity.compose.setContent import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box @@ -49,8 +48,10 @@ import com.github.mikephil.charting.interfaces.datasets.IBarDataSet import com.github.mikephil.charting.listener.OnChartValueSelectedListener import com.github.mikephil.charting.utils.MPPointF import info.appdev.chartexample.DataTools.Companion.getValues +import info.appdev.chartexample.DataTools.Companion.setData import info.appdev.chartexample.R import info.appdev.chartexample.notimportant.DemoBaseCompose +import timber.log.Timber class HorizontalBarComposeActivity : DemoBaseCompose() { private var chart: HorizontalBarChart? = null @@ -279,8 +280,8 @@ class HorizontalBarComposeActivity : DemoBaseCompose() { .axisDependency ) - Log.i("bounds", bounds.toString()) - Log.i("position", position.toString()) + Timber.tag("bounds $bounds") + Timber.tag("position $position") MPPointF.recycleInstance(position) } @@ -344,7 +345,7 @@ class HorizontalBarComposeActivity : DemoBaseCompose() { i * spaceForBar, value, ResourcesCompat.getDrawable(resources, R.drawable.star, null) ) - Log.d("values", "x=${barEntry.x} y=${barEntry.y}") + Timber.d("x=${barEntry.x} y=${barEntry.y}") values.add(barEntry) } diff --git a/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt b/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt index 9ac90fbffc..b27b03e8d5 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt @@ -2,7 +2,6 @@ package info.appdev.chartexample.fragments import android.graphics.Typeface import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.MotionEvent import android.view.View @@ -14,6 +13,7 @@ import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture import com.github.mikephil.charting.listener.OnChartGestureListener import info.appdev.chartexample.R import info.appdev.chartexample.custom.MyMarkerView +import timber.log.Timber class BarChartFrag : SimpleFragment(), OnChartGestureListener { private var chart: BarChart? = null @@ -57,36 +57,36 @@ class BarChartFrag : SimpleFragment(), OnChartGestureListener { } override fun onChartGestureStart(me: MotionEvent, lastPerformedGesture: ChartGesture?) { - Log.i("Gesture", "START") + Timber.i("START") } override fun onChartGestureEnd(me: MotionEvent, lastPerformedGesture: ChartGesture?) { - Log.i("Gesture", "END") + Timber.i("END") chart!!.highlightValues(null) } override fun onChartLongPressed(me: MotionEvent) { - Log.i("LongPress", "Chart long pressed.") + Timber.i("Chart long pressed.") } override fun onChartDoubleTapped(me: MotionEvent) { - Log.i("DoubleTap", "Chart double-tapped.") + Timber.i("Chart double-tapped.") } override fun onChartSingleTapped(me: MotionEvent) { - Log.i("SingleTap", "Chart single-tapped.") + Timber.i("Chart single-tapped.") } override fun onChartFling(me1: MotionEvent?, me2: MotionEvent, velocityX: Float, velocityY: Float) { - Log.i("Fling", "Chart fling. VelocityX: $velocityX, VelocityY: $velocityY") + Timber.i("Chart fling. VelocityX: $velocityX, VelocityY: $velocityY") } override fun onChartScale(me: MotionEvent, scaleX: Float, scaleY: Float) { - Log.i("Scale / Zoom", "ScaleX: $scaleX, ScaleY: $scaleY") + Timber.i("ScaleX: $scaleX, ScaleY: $scaleY") } override fun onChartTranslate(me: MotionEvent, dX: Float, dY: Float) { - Log.i("Translate / Move", "dX: $dX, dY: $dY") + Timber.i("dX: $dX, dY: $dY") } companion object {