├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── compiler.xml ├── encodings.xml ├── gradle.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml ├── misc.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── debug │ ├── app-debug.apk │ └── output.json ├── miwatch.zip ├── proguard-rules.pro ├── release │ └── output.json └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yxc │ │ └── barchart │ │ └── ExampleInstrumentedTest.java │ ├── debug │ └── res │ │ └── values │ │ └── google_maps_api.xml │ ├── main │ ├── AndroidManifest.xml │ ├── aidl │ │ └── com │ │ │ └── yxc │ │ │ └── barchart │ │ │ └── map │ │ │ └── location │ │ │ └── service │ │ │ ├── ILocationHelperServiceAIDL.aidl │ │ │ └── ILocationServiceAIDL.aidl │ ├── java │ │ ├── com │ │ │ └── yxc │ │ │ │ └── barchart │ │ │ │ ├── ChartApplication.java │ │ │ │ ├── EcgTestData.java │ │ │ │ ├── RateTestData.java │ │ │ │ ├── TestData.java │ │ │ │ ├── formatter │ │ │ │ ├── BarChartValueFormatter.java │ │ │ │ ├── ChartValueMarkFormatter.java │ │ │ │ ├── DayHighLightMarkValueFormatter.java │ │ │ │ ├── XAxisDayFormatter.java │ │ │ │ ├── XAxisHrmFormatter.java │ │ │ │ ├── XAxisMonthFormatter.java │ │ │ │ ├── XAxisWeekFormatter.java │ │ │ │ ├── XAxisYearFormatter.java │ │ │ │ └── YearHighLightMarkValueFormatter.java │ │ │ │ ├── map │ │ │ │ ├── location │ │ │ │ │ ├── LocationActivity.java │ │ │ │ │ ├── MapboxShowActivity.java │ │ │ │ │ ├── RecordCorrectShowActivity.java │ │ │ │ │ ├── RecordListActivity.java │ │ │ │ │ ├── RecordShowActivity.java │ │ │ │ │ ├── database │ │ │ │ │ │ ├── LocationDBHelper.java │ │ │ │ │ │ └── RealmDbHelper.java │ │ │ │ │ ├── event │ │ │ │ │ │ └── LocationEvent.java │ │ │ │ │ ├── recycler │ │ │ │ │ │ ├── RecordAdapter.java │ │ │ │ │ │ └── RecordItemDecoration.java │ │ │ │ │ ├── service │ │ │ │ │ │ ├── LocalLocationService.java │ │ │ │ │ │ ├── LocationHelperService.java │ │ │ │ │ │ ├── LocationService.java │ │ │ │ │ │ ├── LocationStatusManager.java │ │ │ │ │ │ ├── NotiService.java │ │ │ │ │ │ └── android │ │ │ │ │ │ │ └── AndroidLocationComputeUtil.java │ │ │ │ │ ├── tracereplay │ │ │ │ │ │ └── TraceRePlay.java │ │ │ │ │ └── util │ │ │ │ │ │ ├── Gps.java │ │ │ │ │ │ ├── IWifiAutoCloseDelegate.java │ │ │ │ │ │ ├── LocationComputeUtil.java │ │ │ │ │ │ ├── LocationConstants.java │ │ │ │ │ │ ├── LocationStatusManager.java │ │ │ │ │ │ ├── NetUtil.java │ │ │ │ │ │ ├── PositionUtil.java │ │ │ │ │ │ ├── PowerManagerUtil.java │ │ │ │ │ │ ├── Utils.java │ │ │ │ │ │ └── WifiAutoCloseDelegate.java │ │ │ │ ├── model │ │ │ │ │ ├── Record.java │ │ │ │ │ ├── RecordCorrect.java │ │ │ │ │ ├── RecordLocation.java │ │ │ │ │ └── RecordLocationSerializer.java │ │ │ │ └── util │ │ │ │ │ ├── Constants.java │ │ │ │ │ └── SensorEventHelper.java │ │ │ │ ├── tab │ │ │ │ ├── FragmentChangeManager.java │ │ │ │ ├── OnTabSelectListener.java │ │ │ │ └── TopTabLayout.java │ │ │ │ ├── ui │ │ │ │ ├── MainActivity.java │ │ │ │ ├── Person.java │ │ │ │ ├── base │ │ │ │ │ ├── BaseChartFragment.java │ │ │ │ │ └── BaseFragment.java │ │ │ │ ├── bezier │ │ │ │ │ ├── BaseBezierFragment.java │ │ │ │ │ ├── BezierActivity.java │ │ │ │ │ ├── DayBezierFragment.java │ │ │ │ │ ├── MonthBezierFragment.java │ │ │ │ │ ├── WeekBezierFragment.java │ │ │ │ │ └── YearBezierFragment.java │ │ │ │ ├── hrm │ │ │ │ │ ├── EcgDayFragment.java │ │ │ │ │ ├── EcgLandScapeActivity.java │ │ │ │ │ ├── HrmActivity.java │ │ │ │ │ ├── HrmDayFragment.java │ │ │ │ │ └── HrmLandScapeActivity.java │ │ │ │ ├── line │ │ │ │ │ ├── BaseLineFragment.java │ │ │ │ │ ├── DayLineFragment.java │ │ │ │ │ ├── LineActivity.java │ │ │ │ │ ├── MonthLineFragment.java │ │ │ │ │ ├── WeekLineFragment.java │ │ │ │ │ └── YearLineFragment.java │ │ │ │ ├── rainbow │ │ │ │ │ └── RainbowActivity.java │ │ │ │ ├── sleep │ │ │ │ │ ├── SleepActivity.java │ │ │ │ │ ├── SleepFragment.java │ │ │ │ │ └── SleepTestData.java │ │ │ │ ├── step │ │ │ │ │ ├── BaseStepFragment.java │ │ │ │ │ ├── StepActivity.java │ │ │ │ │ ├── StepDayFragment.java │ │ │ │ │ ├── StepMonthFragment.java │ │ │ │ │ ├── StepWeekFragment.java │ │ │ │ │ └── StepYearFragment.java │ │ │ │ └── waterdrop │ │ │ │ │ └── WaterDropActivity.java │ │ │ │ ├── util │ │ │ │ ├── BaseFileUtil.java │ │ │ │ ├── CommonUtil.java │ │ │ │ ├── ScrollCapture.kt │ │ │ │ ├── ScrollHorizontalCapture.kt │ │ │ │ ├── ShareUtil.kt │ │ │ │ ├── ToastUtil.java │ │ │ │ └── Util.java │ │ │ │ └── view │ │ │ │ ├── BezierCircle.java │ │ │ │ ├── BezierCircleModel.java │ │ │ │ ├── HPoint.java │ │ │ │ ├── LocationMarker.java │ │ │ │ ├── PathMeasureModel.java │ │ │ │ ├── PathModel.java │ │ │ │ ├── QuadModel.java │ │ │ │ ├── Rainbow.java │ │ │ │ ├── RainbowCircle.java │ │ │ │ ├── RainbowModel.java │ │ │ │ ├── RainbowView.java │ │ │ │ ├── ThreeTargetConstant.java │ │ │ │ ├── ThreeTargetModel.java │ │ │ │ ├── ThreeTargetView.java │ │ │ │ ├── ThreeTargetView2.java │ │ │ │ ├── ThreeTargetView3.java │ │ │ │ ├── VPoint.java │ │ │ │ └── WaterDrop.java │ │ └── rx │ │ │ └── Observable.java │ ├── jniLibs │ │ ├── arm64-v8a │ │ │ └── libAMapSDK_MAP_v6_5_0.so │ │ ├── armeabi-v7a │ │ │ └── libAMapSDK_MAP_v6_5_0.so │ │ ├── armeabi │ │ │ └── libAMapSDK_MAP_v6_5_0.so │ │ ├── x86 │ │ │ └── libAMapSDK_MAP_v6_5_0.so │ │ └── x86_64 │ │ │ └── libAMapSDK_MAP_v6_5_0.so │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xhdpi │ │ ├── icon_location.png │ │ └── walk.png │ │ ├── drawable-xxhdpi │ │ ├── back_btn_image.png │ │ ├── end.png │ │ ├── gps.png │ │ ├── grasp_flag.png │ │ ├── grasp_trace_line.png │ │ ├── location.png │ │ ├── marker.png │ │ ├── point.png │ │ ├── point5.png │ │ ├── start.png │ │ ├── test.png │ │ └── title_background.9.png │ │ ├── drawable │ │ ├── border_bg.9.png │ │ ├── btn_map_poi.xml │ │ ├── custom_info_bubble.9.png │ │ ├── direct_mapsearch.9.png │ │ ├── direct_mapsearch_pressed.9.png │ │ ├── ic_chevron_left_black_30dp.xml │ │ ├── ic_chevron_left_white_45dp.xml │ │ ├── ic_chevron_right_black_30dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_mile_post_24dp.xml │ │ ├── ic_navigate_back_24dp.xml │ │ ├── ic_navigation_left_black_45dp.xml │ │ ├── shape_data_item_bg_white.xml │ │ └── title_background.9.png │ │ ├── layout │ │ ├── abroadmap_activity.xml │ │ ├── activity_bar_animator.xml │ │ ├── activity_bezier.xml │ │ ├── activity_hrm.xml │ │ ├── activity_main.xml │ │ ├── activity_maps.xml │ │ ├── activity_maps_google.xml │ │ ├── activity_rainbow.xml │ │ ├── activity_rainbow2.xml │ │ ├── activity_record_item.xml │ │ ├── activity_record_mapbox.xml │ │ ├── activity_sleep.xml │ │ ├── activity_step.xml │ │ ├── activity_touch.xml │ │ ├── activity_two_map.xml │ │ ├── activity_water_drop.xml │ │ ├── animatecamera_activity.xml │ │ ├── arc_activity.xml │ │ ├── barchart_main.xml │ │ ├── basemap_fragment_activity.xml │ │ ├── basic_location_map_activity.xml │ │ ├── basicmap_activity.xml │ │ ├── camera_activity.xml │ │ ├── circle_activity.xml │ │ ├── content_barchart.xml │ │ ├── content_main.xml │ │ ├── custom_info_contents.xml │ │ ├── custom_info_window.xml │ │ ├── custom_location_view.xml │ │ ├── custommarker_activity.xml │ │ ├── events_activity.xml │ │ ├── fragment_day_bezier.xml │ │ ├── fragment_day_ecg.xml │ │ ├── fragment_day_hrm.xml │ │ ├── fragment_day_line.xml │ │ ├── fragment_day_step.xml │ │ ├── fragment_month_bezier.xml │ │ ├── fragment_month_line.xml │ │ ├── fragment_month_step.xml │ │ ├── fragment_sleep.xml │ │ ├── fragment_week_bezier.xml │ │ ├── fragment_week_line.xml │ │ ├── fragment_week_step.xml │ │ ├── fragment_year_bezier.xml │ │ ├── fragment_year_line.xml │ │ ├── fragment_year_step.xml │ │ ├── gesture_settings_activity.xml │ │ ├── groundoverlay_activity.xml │ │ ├── item_layout_barchart.xml │ │ ├── layers_activity.xml │ │ ├── layout_record_item.xml │ │ ├── layout_step_bottom_desc.xml │ │ ├── layout_step_date_title.xml │ │ ├── layout_tab_segment.xml │ │ ├── locationmodesource_activity.xml │ │ ├── locationsource_activity.xml │ │ ├── logo_settings_activity.xml │ │ ├── marker_activity.xml │ │ ├── osmmap_activity.xml │ │ ├── polygon_activity.xml │ │ ├── polyline_activity.xml │ │ ├── recorddisplay_activity.xml │ │ ├── recordlist.xml │ │ ├── screenshot_activity.xml │ │ ├── ui_settings_activity.xml │ │ ├── view_item.xml │ │ └── zoom_activity.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── arrow.png │ │ ├── badge_sa.png │ │ ├── badge_wa.png │ │ ├── gps_point.png │ │ ├── groundoverlay.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── location_marker.png │ │ └── navi_map_gps_locked.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── release │ └── res │ │ └── values │ │ └── google_maps_api.xml │ └── test │ └── java │ └── com │ └── yxc │ └── barchart │ └── ExampleUnitTest.java ├── barchartlib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yxc │ │ └── chartlib │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── yxc │ │ │ └── chartlib │ │ │ └── recyclerchart │ │ │ ├── attrs │ │ │ ├── BarChartAttrs.java │ │ │ ├── BaseChartAttrs.java │ │ │ ├── BezierChartAttrs.java │ │ │ ├── ChartAttrsUtil.java │ │ │ ├── LineChartAttrs.java │ │ │ └── SleepChartAttrs.java │ │ │ ├── barchart │ │ │ ├── BarChartAdapter.java │ │ │ ├── BaseBarChartAdapter.java │ │ │ ├── SleepChartDayAdapter.java │ │ │ └── SpeedRatioLayoutManager.java │ │ │ ├── bezier │ │ │ └── ControlPoint.java │ │ │ ├── component │ │ │ ├── AxisBase.java │ │ │ ├── BaseYAxis.java │ │ │ ├── ChartRectF.java │ │ │ ├── ComponentBase.java │ │ │ ├── DistanceCompare.java │ │ │ ├── HrmYAxis.java │ │ │ ├── LimitLine.java │ │ │ ├── XAxis.java │ │ │ └── YAxis.java │ │ │ ├── entrys │ │ │ ├── BarChart.java │ │ │ ├── BarEntry.java │ │ │ ├── BaseEntry.java │ │ │ ├── BubbleEntry.java │ │ │ ├── CandleEntry.java │ │ │ ├── EcgEntry.java │ │ │ ├── Entry.java │ │ │ ├── PieEntry.java │ │ │ ├── RadarEntry.java │ │ │ ├── SleepEntry.java │ │ │ ├── SleepItemEntry.java │ │ │ ├── YAxisMaxEntries.java │ │ │ └── model │ │ │ │ ├── SleepItemTime.java │ │ │ │ └── SleepTime.java │ │ │ ├── formatter │ │ │ ├── DefaultAxisValueFormatter.java │ │ │ ├── DefaultBarChartValueFormatter.java │ │ │ ├── DefaultHighLightMarkValueFormatter.java │ │ │ ├── DefaultValueFormatter.java │ │ │ └── ValueFormatter.java │ │ │ ├── itemdecoration │ │ │ ├── BarChartItemDecoration.java │ │ │ ├── BezierChartItemDecoration.java │ │ │ ├── EcgChartItemDecoration.java │ │ │ ├── HrmChartItemDecoration.java │ │ │ ├── LineChartDrawable.java │ │ │ ├── LineChartItemDecoration.java │ │ │ └── SleepChartDayItemDecoration.java │ │ │ ├── listener │ │ │ ├── RecyclerItemGestureListener.java │ │ │ └── SimpleItemGestureListener.java │ │ │ ├── render │ │ │ ├── BarBoardRender.java │ │ │ ├── BarChartRender.java │ │ │ ├── BaseChartRender.java │ │ │ ├── BezierChartRender.java │ │ │ ├── EcgLineChartRender.java │ │ │ ├── HrmBarBoardRender.java │ │ │ ├── HrmLineChartRender.java │ │ │ ├── HrmXAxisRender.java │ │ │ ├── HrmYAxisRender.java │ │ │ ├── LineChartRender.java │ │ │ ├── SleepChartDayRender.java │ │ │ ├── SleepChartRender.java │ │ │ ├── SleepChartRenderBack.java │ │ │ ├── XAxisRender.java │ │ │ └── YAxisRender.java │ │ │ ├── sleepchart │ │ │ ├── SleepChartAdapter.java │ │ │ └── SleepChartItemDecoration.java │ │ │ ├── util │ │ │ ├── CanvasUtil.java │ │ │ ├── ChartComputeUtil.java │ │ │ ├── DecimalUtil.java │ │ │ ├── FSize.java │ │ │ ├── MPPointD.java │ │ │ ├── MPPointF.java │ │ │ ├── ObjectPool.java │ │ │ ├── RoundRectType.java │ │ │ └── Utils.java │ │ │ └── view │ │ │ ├── AnimatedDecorator.java │ │ │ ├── AnimatedDecoratorDrawable.java │ │ │ ├── BarChartRecyclerView.java │ │ │ ├── BaseChartRecyclerView.java │ │ │ ├── BezierChartRecyclerView.java │ │ │ ├── CustomAnimatedDecorator.java │ │ │ ├── LineChartRecyclerView.java │ │ │ └── SleepChartRecyclerView.java │ └── res │ │ ├── drawable │ │ └── marker2.png │ │ ├── layout │ │ └── item_layout_barchart.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── yxc │ └── chartlib │ └── ExampleUnitTest.java ├── build.gradle ├── chart.jks ├── commonlib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yxc │ │ └── commonlib │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── yxc │ │ │ └── commonlib │ │ │ ├── time │ │ │ └── Hour12.java │ │ │ └── util │ │ │ ├── ColorUtil.java │ │ │ ├── DisplayUtil.java │ │ │ ├── PathUtil.java │ │ │ ├── TextUtil.java │ │ │ └── TimeDateUtil.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── yxc │ └── commonlib │ └── ExampleUnitTest.java ├── device-2019-04-25-115017.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── widgetlib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── yxc │ └── widgetlib │ └── ExampleInstrumentedTest.java ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── yxc │ │ └── widgetlib │ │ ├── calendar │ │ ├── entity │ │ │ ├── Lunar.java │ │ │ └── NDate.java │ │ ├── listener │ │ │ ├── OnCalendarChangedListener.java │ │ │ ├── OnCalendarStateChangedListener.java │ │ │ ├── OnClickDayViewListener.java │ │ │ ├── OnClickDisableDateListener.java │ │ │ ├── OnClickMonthViewListener.java │ │ │ ├── OnClickWeekViewListener.java │ │ │ ├── OnMonthAnimatorListener.java │ │ │ ├── OnMonthSelectListener.java │ │ │ ├── OnWeekSelectListener.java │ │ │ └── OnYearItemSelectListener.java │ │ ├── painter │ │ │ ├── CalendarPainter.java │ │ │ ├── CalendarWeekPainter.java │ │ │ ├── InnerMonthPainter.java │ │ │ └── InnerPainter.java │ │ ├── utils │ │ │ ├── AttrsUtil.java │ │ │ ├── CalendarAttrs.java │ │ │ ├── HolidayUtil.java │ │ │ ├── LunarUtil.java │ │ │ ├── SolarTermUtil.java │ │ │ └── Util.java │ │ └── view │ │ │ ├── CalendarBar.java │ │ │ ├── ChildLayout.java │ │ │ ├── DayCalendarView.java │ │ │ ├── MonthCalendar.java │ │ │ ├── MonthCalendarView.java │ │ │ ├── MyAnimatorListener.java │ │ │ └── WeekCalendarView.java │ │ └── viewpager2 │ │ ├── AnimateLayoutChangeDetector.java │ │ ├── CompositeOnPageChangeCallback.java │ │ ├── FakeDrag.java │ │ ├── PageTransformerAdapter.java │ │ ├── ScrollEventAdapter.java │ │ └── ViewPager2.java └── res │ ├── layout │ ├── cbc_layout_calendar_year_view.xml │ ├── cbc_layout_item_month.xml │ └── item_layout_barchart.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ └── strings.xml └── test └── java └── com └── yxc └── widgetlib └── ExampleUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RecyclerBarChart 2 | 基于Recyclerview实现 动态X/Y轴的运动步数 柱状图 3 | 4 | "RecyclerView柱状图:1.动态无线滑动;2、根据显示中的柱状图动态改变Y坐标 3.通过RecyclerView的Decoration画纵坐标、横坐标、柱状图、value值;" 5 | 6 | 1.动态无线滑动, 接口动态添加数据 ; 7 | 2、根据显示中的柱状图动态改变Y坐标;(已完成) 8 | 3.通过RecyclerView的Decoration画纵坐标、横坐标、柱状图、value值;(已完成) 9 | 10 | 目前需要完成的: 11 | 4. 需要动态添加 边框,左Y轴、右Y轴,顶部的value的文字显示、柱状图颜色、DisplayNumbers, Y坐标、X坐标的自定义。(已完成) 12 | 5. Y轴变化的时候,添加动画。 13 | 6. Canvas画仅顶部为圆角的 RoundRect。 14 | 7. GridLine的控制是否显示 (已完成) 15 | 8. Item的 触摸 事件。 16 | 9. 封装 View。 17 | 10. 画 周、日的 X 轴 (已完成) 18 | 12. 参照 MPAndroidChart 自定义 X 坐标、Y坐标。(已完成 X 轴,完成一半) 19 | 13. Item 中柱状图所占的 比率,也就是 Space的宽度。(已完成) 20 | 14. X轴刻度坐标左右的显示跟 iOS不一样。(已处理,itemDecoration 靠左。) 21 | 15. 底部 X轴左边的 边界显示问题。(已修复) 22 | 16. 周、月、日、年的统计问题,获取当前显示中的 柱状图的 日期跨度 在顶部显示。(已完成) 23 | 17. Recyclerview左右预留空的,并带滑动 阻尼效果 24 | 18. 左滑、右滑 ScrollToPosition是不一样的。 25 | 19. 判断惯性滑动的速度超过某一个值的时候就 进行微调、否则就不调整。(方案调整) 26 | 20. Override Recyclerview 的 fling 方法,降低惯性速度。(已修改) 27 | 21. 超出一个 child width的 value文字显示的时候,有bug ,边界右滑有问题。(已修改,分离画柱状图跟文字的函数,各自单独处理) 28 | 22. Y轴坐标变换,在临界点来回的变动,导致无法准确的改变 ,偶现的。(需要微调后,在继续计算Y轴刻度) 29 | 23. 左右边界进入,颜色渐变动画,丝滑般的进入显示页面。需要处理的,Barchart柱体本身,X轴刻度文字,BarChart 的value文字。(待优化) 30 | 24. 保留原始 RecyclerView的 paddingLeft, paddingRight。todo这里注意Padding是否会因为重绘而累加, 自定义padding属性,动态加入。(已完成) 31 | 25. 自定义 CustomerRecyclerView的 xml attribute列表,解析为 Attrs 类中的静态值,对应代码中的 BarChartConfig,传给ItemDecoration使用。(已完成) 32 | 26. 控制是否 显示的一些元素的 switch, 转移到BarChartConfig,到时候也可以直接用 attribute xml来控制。(完成) 33 | 27. 调整滑动策略,滑动停止处于idle状态时,位置处于右边 1/3 往靠近右边刻度滑,处于左边 1/3往 靠近左边刻度滑动,处于中间 1/3 的保持不动,进行微调(22点处的方案微调), 所有的滑动用 scrollToPosition,不用 smoothScrollToPosition。 34 | 28. 控制是否 scrollToPosition的参数,customerRecyclerView的参数 放入到 attribute xml中?(完成) 35 | 29. 如何自定义 Y轴,参照MPAndroidChart. 36 | 30. 边界处的 lastVisiblePosition跟 FirstVisiblePosition需要 细心处理,目前存在bug。(完成) 37 | 31. 抽取BarChartRecycler的Attrs, 修改部分属性为float,添加工具类 进行 float的 == 比较。(完成) 38 | 32. YAxis、Xaxis 中的属性也要到 Attrs中设置。(已完成) 39 | 33. 右边的 barChart 滑入有问题,没有渐渐消失。(已完成) 40 | 34. 显示顶部的时间间断, 统计步数。(已完成) 41 | 35. 底部有个浮动的 Date的标志, ItemDecoration添加。 42 | 43 | 44 | 微调方案:试图在ItemDecoration中进行微调,根据child的getRight、getLeft跟parentLeft、parentRight的位置来主动判断, 45 | 真正的显示边界(completeDisplayVisibleItemPosition),取到displayEntries; 46 | 通过 XAxis传递给 ItemDecoration 进行微调。 47 | 存在难点:需要在 ItemDecoration本身的onDraw、onDrawOver中的 recycleView 用getChildAt(index)拿到的 child才不为null。 48 | 49 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'realm-android' 3 | apply plugin: 'kotlin-android' 4 | 5 | android { 6 | // signingConfigs { 7 | // debug { 8 | // storeFile file('/Users/xiuchengyin/Documents/opensource/RecyclerBarChart/chart.jks') 9 | // storePassword '861014' 10 | // keyAlias = 'chart' 11 | // keyPassword '861014' 12 | // } 13 | // release { 14 | // storeFile file('/Users/xiuchengyin/Documents/opensource/RecyclerBarChart/chart.jks') 15 | // storePassword '861014' 16 | // keyAlias = 'chart' 17 | // keyPassword '861014' 18 | // } 19 | // } 20 | compileSdkVersion 32 21 | defaultConfig { 22 | applicationId "com.yxc.barchart" 23 | minSdkVersion 24 24 | targetSdkVersion 32 25 | versionCode 1 26 | versionName "1.0" 27 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 28 | externalNativeBuild{ 29 | cmake{ 30 | 31 | } 32 | } 33 | 34 | ndk{ 35 | //设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so) 36 | abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64" 37 | } 38 | } 39 | buildTypes { 40 | release { 41 | minifyEnabled true 42 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 43 | } 44 | } 45 | } 46 | 47 | dependencies { 48 | implementation fileTree(include: ['*.jar'], dir: 'libs') 49 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 50 | implementation 'androidx.appcompat:appcompat:1.5.1' 51 | 52 | implementation 'com.google.android.material:material:1.6.1' 53 | implementation 'org.greenrobot:eventbus:3.1.1' 54 | api 'com.amap.api:3dmap:9.3.0' 55 | api "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1" 56 | api "androidx.lifecycle:lifecycle-common-java8:2.5.1" 57 | api "androidx.core:core-ktx:1.5.0" 58 | implementation 'com.google.code.gson:gson:2.8.9' 59 | 60 | testImplementation 'junit:junit:4.13.2' 61 | androidTestImplementation 'androidx.test:runner:1.4.0' 62 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 63 | 64 | implementation project(':barchartlib') 65 | implementation project(':widgetlib') 66 | } 67 | -------------------------------------------------------------------------------- /app/debug/app-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/debug/app-debug.apk -------------------------------------------------------------------------------- /app/debug/output.json: -------------------------------------------------------------------------------- 1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}] -------------------------------------------------------------------------------- /app/miwatch.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/miwatch.zip -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | # 2D地图 24 | -keep class com.amap.api.maps2d.**{*;} 25 | -keep class com.amap.api.mapcore2d.**{*;} 26 | 27 | # 3D地图 V5.0.0之后 28 | -keep class com.amap.api.maps.**{*;} 29 | -keep class com.autonavi.**{*;} 30 | -keep class com.amap.api.trace.**{*;} 31 | 32 | # 定位 33 | -keep class com.amap.api.location.**{*;} 34 | -keep class com.amap.api.fence.**{*;} 35 | -keep class com.autonavi.aps.amapapi.model.**{*;} 36 | 37 | # 搜索 38 | -keep class com.amap.api.services.**{*;} 39 | 40 | # 导航 41 | -keep class com.amap.api.navi.**{*;} 42 | -keep class com.autonavi.**{*;} 43 | 44 | 45 | -dontwarn org.joda.convert.** 46 | -dontwarn org.joda.time.** 47 | -keep class org.joda.time.** { *; } 48 | -keep interface org.joda.time.** { *; } 49 | -------------------------------------------------------------------------------- /app/release/output.json: -------------------------------------------------------------------------------- 1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] -------------------------------------------------------------------------------- /app/src/androidTest/java/com/yxc/barchart/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.yxc.barchart", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/debug/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | AIzaSyDO2U_8s0b_oKGVe92DuybykfC0lYzfz7A 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/aidl/com/yxc/barchart/map/location/service/ILocationHelperServiceAIDL.aidl: -------------------------------------------------------------------------------- 1 | // ILocationHelperServiceAIDL.aidl 2 | package com.yxc.barchart.map.location.service; 3 | 4 | // Declare any non-default types here with import statements 5 | 6 | interface ILocationHelperServiceAIDL { 7 | 8 | /** 9 | * 定位service绑定完毕后,会通知helperservice自己绑定的notiId 10 | * @param notiId 定位service的notiId 11 | */ 12 | void onFinishBind(int notiId); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/aidl/com/yxc/barchart/map/location/service/ILocationServiceAIDL.aidl: -------------------------------------------------------------------------------- 1 | // ILocationServiceAIDL.aidl 2 | package com.yxc.barchart.map.location.service; 3 | 4 | // Declare any non-default types here with import statements 5 | 6 | interface ILocationServiceAIDL { 7 | /** hook when other service has already binded on it */ 8 | void onFinishBind(); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/ChartApplication.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart; 2 | 3 | import android.app.Application; 4 | 5 | import androidx.appcompat.app.AppCompatActivity; 6 | 7 | import com.yxc.barchart.map.location.database.RealmDbHelper; 8 | import com.yxc.barchart.util.CommonUtil; 9 | 10 | import java.lang.ref.WeakReference; 11 | 12 | public class ChartApplication extends Application { 13 | 14 | private static ChartApplication sApplication; 15 | private WeakReference mCurrentActivity; 16 | private int mActivityCount = 0; 17 | 18 | 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | sApplication = this; 23 | 24 | // service process need not following initialization 25 | if (!CommonUtil.isMainProcess(this)) { 26 | return; 27 | } 28 | //db 29 | RealmDbHelper.init("chartdb", 1); 30 | } 31 | 32 | public static ChartApplication getInstance() { 33 | return sApplication; 34 | } 35 | 36 | public AppCompatActivity getCurrentActivity() { 37 | if (mCurrentActivity != null && mCurrentActivity.get() != null) { 38 | return mCurrentActivity.get(); 39 | } 40 | return null; 41 | } 42 | 43 | /** 44 | * app是否在前台 45 | * 46 | * @return true前台,false后台 47 | */ 48 | public boolean isForeground() { 49 | return mActivityCount > 0; 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/BarChartValueFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.DefaultBarChartValueFormatter; 5 | 6 | /** 7 | * @author yxc 8 | * @date 2019/4/14 9 | */ 10 | public class BarChartValueFormatter extends DefaultBarChartValueFormatter { 11 | /** 12 | * Constructor that specifies to how many digits the value should be 13 | * formatted. 14 | */ 15 | public BarChartValueFormatter() { 16 | super(0); 17 | } 18 | 19 | @Override 20 | public String getBarLabel(BarEntry barEntry) { 21 | return super.getBarLabel(barEntry); 22 | // return barEntry.getY() > 0 ? TimeUtil.getDateStr(barEntry.timestamp, "MM-dd") : ""; 23 | } 24 | 25 | @Override 26 | public String getFormattedValue(float value) { 27 | return super.getFormattedValue(value); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/ChartValueMarkFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.DefaultBarChartValueFormatter; 5 | 6 | /** 7 | * @author yxc 8 | * @date 2019/4/14 9 | */ 10 | public class ChartValueMarkFormatter extends DefaultBarChartValueFormatter { 11 | /** 12 | * Constructor that specifies to how many digits the value should be 13 | * formatted. 14 | */ 15 | public ChartValueMarkFormatter() { 16 | super(0); 17 | } 18 | 19 | @Override 20 | public String getBarLabel(BarEntry barEntry) { 21 | return super.getBarLabel(barEntry); 22 | // return barEntry.getY() > 0 ? TimeUtil.getDateStr(barEntry.timestamp, "MM-dd") : ""; 23 | } 24 | 25 | @Override 26 | public String getFormattedValue(float value) { 27 | return super.getFormattedValue(value); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/DayHighLightMarkValueFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.DefaultHighLightMarkValueFormatter; 5 | import com.yxc.commonlib.util.TimeDateUtil; 6 | 7 | /** 8 | * @author yxc 9 | * @date 2019/4/24 10 | */ 11 | public class DayHighLightMarkValueFormatter extends DefaultHighLightMarkValueFormatter { 12 | /** 13 | * Constructor that specifies to how many digits the value should be 14 | * formatted. 15 | * 16 | * @param digits 17 | */ 18 | public DayHighLightMarkValueFormatter(int digits) { 19 | super(digits); 20 | } 21 | 22 | 23 | @Override 24 | public String getBarLabel(BarEntry barEntry) { 25 | String str1 = TimeDateUtil.getDateStr(barEntry.timestamp, "M月d日"); 26 | String str2 = TimeDateUtil.get12HourOfTheDayStr(barEntry.timestamp); 27 | String str3 = getFormattedValue(barEntry.getY()); 28 | String resultStr = str1 + CONNECT_STR + str2 + CONNECT_STR + str3; 29 | return barEntry.getY() > 0 ? resultStr : ""; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/XAxisDayFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.ValueFormatter; 5 | import com.yxc.commonlib.util.TimeDateUtil; 6 | 7 | /** 8 | * @author yxc 9 | * @date 2019/4/11 10 | */ 11 | public class XAxisDayFormatter extends ValueFormatter { 12 | 13 | @Override 14 | public String getBarLabel(BarEntry barEntry) { 15 | if (barEntry.type == BarEntry.TYPE_XAXIS_SECOND 16 | || barEntry.type == BarEntry.TYPE_XAXIS_SPECIAL) { 17 | return TimeDateUtil.getHourOfTheDay(barEntry.timestamp) + "时"; 18 | } else { 19 | return ""; 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/XAxisHrmFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.ValueFormatter; 5 | 6 | /** 7 | * @author yxc 8 | * @date 2019/4/11 9 | */ 10 | public class XAxisHrmFormatter extends ValueFormatter { 11 | 12 | @Override 13 | public String getBarLabel(BarEntry barEntry) { 14 | if (barEntry.type == BarEntry.TYPE_XAXIS_FIRST || barEntry.type == BarEntry.TYPE_XAXIS_SPECIAL) { 15 | int index = (int)barEntry.getX(); 16 | return index/25 + "秒"; 17 | } else { 18 | return ""; 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/XAxisMonthFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import android.content.Context; 4 | 5 | import com.yxc.barchart.R; 6 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 7 | import com.yxc.chartlib.recyclerchart.formatter.ValueFormatter; 8 | 9 | import org.joda.time.LocalDate; 10 | 11 | /** 12 | * @author yxc 13 | * @date 2019/4/11 14 | */ 15 | public class XAxisMonthFormatter extends ValueFormatter { 16 | 17 | private Context mContext; 18 | 19 | public XAxisMonthFormatter(Context context){ 20 | this.mContext = context; 21 | } 22 | 23 | @Override 24 | public String getBarLabel(BarEntry barEntry) { 25 | LocalDate localDate = barEntry.localDate; 26 | if (barEntry.type == BarEntry.TYPE_XAXIS_SPECIAL || barEntry.type == BarEntry.TYPE_XAXIS_SECOND){ 27 | return String.format(mContext.getString(R.string.str_month_formatter), localDate.getDayOfMonth()); 28 | } 29 | return ""; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/XAxisWeekFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.ValueFormatter; 5 | import com.yxc.commonlib.util.TimeDateUtil; 6 | 7 | import org.joda.time.LocalDate; 8 | 9 | /** 10 | * @author yxc 11 | * @date 2019/4/11 12 | */ 13 | public class XAxisWeekFormatter extends ValueFormatter { 14 | 15 | @Override 16 | public String getBarLabel(BarEntry barEntry) { 17 | LocalDate localDate = barEntry.localDate; 18 | // return TimeUtil.getDateStr(barEntry.timestamp, "MM-dd"); 19 | return TimeDateUtil.getWeekStr(localDate.getDayOfWeek()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/XAxisYearFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.ValueFormatter; 5 | 6 | import org.joda.time.LocalDate; 7 | 8 | /** 9 | * @author yxc 10 | * @date 2019/4/11 11 | */ 12 | public class XAxisYearFormatter extends ValueFormatter { 13 | 14 | @Override 15 | public String getBarLabel(BarEntry barEntry) { 16 | LocalDate localDate = barEntry.localDate; 17 | return Integer.toString(localDate.getMonthOfYear()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/formatter/YearHighLightMarkValueFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.formatter; 2 | 3 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 4 | import com.yxc.chartlib.recyclerchart.formatter.DefaultHighLightMarkValueFormatter; 5 | import com.yxc.commonlib.util.TimeDateUtil; 6 | 7 | /** 8 | * @author yxc 9 | * @date 2019/4/24 10 | */ 11 | public class YearHighLightMarkValueFormatter extends DefaultHighLightMarkValueFormatter { 12 | /** 13 | * Constructor that specifies to how many digits the value should be 14 | * formatted. 15 | * 16 | * @param digits 17 | */ 18 | public YearHighLightMarkValueFormatter(int digits) { 19 | super(digits); 20 | } 21 | 22 | @Override 23 | public String getFormattedValue(float value) { 24 | return super.getFormattedValue(value); 25 | } 26 | 27 | @Override 28 | public String getBarLabel(BarEntry barEntry) { 29 | String str1 = TimeDateUtil.getDateStr(barEntry.timestamp, "M月"); 30 | String str2 = TimeDateUtil.getDateStr(barEntry.timestamp, "yyyy年"); 31 | String str3 = "日均"; 32 | String str4 = getFormattedValue(barEntry.getY()); 33 | String resultStr = str1 + CONNECT_STR + str2 + CONNECT_STR + str3 + CONNECT_STR + str4; 34 | return barEntry.getY() > 0 ?resultStr:""; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/location/event/LocationEvent.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.location.event; 2 | 3 | import android.location.Location; 4 | 5 | import com.amap.api.location.AMapLocation; 6 | import com.yxc.barchart.map.model.RecordLocation; 7 | 8 | /** 9 | * @author yxc 10 | * @date 2019-06-14 11 | */ 12 | public class LocationEvent { 13 | 14 | public AMapLocation mapLocation; 15 | 16 | public final RecordLocation recordLocation; 17 | 18 | public Location location; 19 | 20 | public LocationEvent(AMapLocation mapLocation, RecordLocation recordLocation){ 21 | this.mapLocation = mapLocation; 22 | this.recordLocation = recordLocation; 23 | } 24 | 25 | public LocationEvent(Location mapLocation, RecordLocation recordLocation){ 26 | this.location = mapLocation; 27 | this.recordLocation = recordLocation; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/location/recycler/RecordItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.location.recycler; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Color; 5 | import android.graphics.Paint; 6 | import android.view.View; 7 | 8 | import androidx.annotation.NonNull; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | 11 | /** 12 | * @author yxc 13 | * @date 2019-06-20 14 | */ 15 | public class RecordItemDecoration extends RecyclerView.ItemDecoration { 16 | 17 | Paint mLinePaint; 18 | 19 | public RecordItemDecoration(){ 20 | initPaint(); 21 | } 22 | 23 | private void initPaint(){ 24 | mLinePaint = new Paint(); 25 | mLinePaint.reset(); 26 | mLinePaint.setAntiAlias(true); 27 | mLinePaint.setStyle(Paint.Style.STROKE); 28 | mLinePaint.setStrokeWidth(1); 29 | mLinePaint.setColor(Color.GRAY); 30 | } 31 | 32 | @Override 33 | public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { 34 | super.onDrawOver(canvas, parent, state); 35 | int childCount = parent.getChildCount(); 36 | 37 | for (int i = 0; i < childCount; i++) { 38 | View child = parent.getChildAt(i); 39 | canvas.drawLine(parent.getLeft(), child.getBottom(), parent.getRight(), child.getBottom(), mLinePaint); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/location/util/Gps.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.location.util; 2 | 3 | /** 4 | * @author yxc 5 | * @since 2019-08-30 6 | */ 7 | public class Gps { 8 | 9 | private double latitude; 10 | private double longitude; 11 | private double altitude; 12 | 13 | public Gps(double latitude, double longitude) { 14 | setLatitude(latitude); 15 | setLongitude(longitude); 16 | } 17 | 18 | public Gps(double latitude, double longitude, double altitude) { 19 | this(latitude, longitude); 20 | this.altitude = altitude; 21 | } 22 | 23 | public double getLatitude() { 24 | return latitude; 25 | } 26 | 27 | public void setLatitude(double latitude) { 28 | this.latitude = latitude; 29 | } 30 | 31 | public double getLongitude() { 32 | return longitude; 33 | } 34 | 35 | public void setLongitude(double longitude) { 36 | this.longitude = longitude; 37 | } 38 | 39 | public double getAltitude() { 40 | return altitude; 41 | } 42 | 43 | 44 | @Override 45 | public String toString() { 46 | return latitude + "," + longitude + "," + altitude; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/location/util/IWifiAutoCloseDelegate.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.location.util; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * Created by liangchao_suxun on 17/1/19. 7 | * 代理类,用于处理息屏造成wifi被关掉时再重新点亮屏幕的逻辑 8 | */ 9 | 10 | public interface IWifiAutoCloseDelegate { 11 | 12 | 13 | /** 14 | * 判断在该机型下此逻辑是否有效。目前已知的系统是小米系统存在(用户自助设置的)息屏断掉wifi的功能。 15 | * 16 | * @param context 17 | * @return 18 | */ 19 | public boolean isUseful(Context context); 20 | 21 | 22 | /** 23 | * 点亮屏幕的服务有可能被重启。此处进行初始化 24 | * 25 | * @param context 26 | * @return 27 | */ 28 | public void initOnServiceStarted(Context context); 29 | 30 | 31 | /** 32 | * 定位成功时,如果移动网络无法访问,而且屏幕是点亮状态,则对状态进行保存 33 | */ 34 | public void onLocateSuccess(Context context, boolean isScreenOn, boolean isMobileable); 35 | 36 | /** 37 | * 对定位失败情况的处理 38 | */ 39 | public void onLocateFail(Context context, int errorCode, boolean isScreenOn, boolean isWifiable); 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/location/util/LocationConstants.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.location.util; 2 | 3 | /** 4 | * @author yxc 5 | * @since 2019-06-11 6 | */ 7 | public class LocationConstants { 8 | 9 | public static final int SPORT_TYPE_STEP = 1; //走路 10 | 11 | public static final int SPORT_TYPE_RUNNING = 2; //走路 12 | 13 | public static final int SPORT_TYPE_RIDE = 3;//骑车 14 | 15 | public static final int SPORT_TYPE_DRIVE = 4;//驾驶 16 | 17 | public static final long DEFAULT_INTERVAL_TIME = 2 * 1000; 18 | 19 | public static final String KEY_RECORD_TYPE = "recordType";// 20 | 21 | public static final String KEY_RECORD_ID = "recordId";// 22 | 23 | public static final String ACTION_LOCATION_BACKGROUND = "location_in_background"; 24 | 25 | public static final long MILE_POST_ONE_KILOMETRE = 1000; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/location/util/NetUtil.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.location.util; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * Created by liangchao_suxun on 17/1/16. 9 | * 用于判断设备是否可以访问网络。 10 | */ 11 | 12 | public class NetUtil { 13 | 14 | private static class Holder { 15 | public static NetUtil instance = new NetUtil(); 16 | } 17 | 18 | public static NetUtil getInstance() { 19 | return Holder.instance; 20 | } 21 | 22 | /** 23 | * 是否手机信号可连接 24 | * @param context 25 | * @return 26 | */ 27 | public boolean isMobileAva(Context context) { 28 | 29 | boolean hasMobileCon = false; 30 | 31 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE); 32 | NetworkInfo[] netInfos = cm.getAllNetworkInfo(); 33 | for (NetworkInfo net : netInfos) { 34 | 35 | String type = net.getTypeName(); 36 | if (type.equalsIgnoreCase("MOBILE")) { 37 | if (net.isConnected()) { 38 | hasMobileCon = true; 39 | } 40 | } 41 | } 42 | return hasMobileCon; 43 | } 44 | 45 | 46 | /** 47 | * 是否wifi可连接 48 | * @param context 49 | * @return 50 | */ 51 | public boolean isWifiCon(Context context) { 52 | boolean hasWifoCon = false; 53 | 54 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE); 55 | NetworkInfo[] netInfos = cm.getAllNetworkInfo(); 56 | for (NetworkInfo net : netInfos) { 57 | 58 | String type = net.getTypeName(); 59 | if (type.equalsIgnoreCase("WIFI")) { 60 | if (net.isConnected()) { 61 | hasWifoCon = true; 62 | } 63 | } 64 | 65 | } 66 | return hasWifoCon; 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/location/util/WifiAutoCloseDelegate.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.location.util; 2 | 3 | import android.content.Context; 4 | 5 | import com.amap.api.location.AMapLocation; 6 | 7 | import java.util.regex.Matcher; 8 | import java.util.regex.Pattern; 9 | 10 | public class WifiAutoCloseDelegate implements IWifiAutoCloseDelegate { 11 | 12 | /** 13 | * 请根据后台数据自行添加。此处只针对小米手机 14 | * @param context 15 | * @return 16 | */ 17 | @Override 18 | public boolean isUseful(Context context) { 19 | String manName = Utils.getManufacture(context); 20 | Pattern pattern = Pattern.compile("xiaomi", Pattern.CASE_INSENSITIVE); 21 | Matcher m = pattern.matcher(manName); 22 | return m.find(); 23 | } 24 | 25 | @Override 26 | public void initOnServiceStarted(Context context) { 27 | LocationStatusManager.getInstance().initStateFromPreference(context); 28 | } 29 | 30 | @Override 31 | public void onLocateSuccess(Context context, boolean isScreenOn, boolean isMobileable) { 32 | LocationStatusManager.getInstance().onLocationSuccess(context, isScreenOn, isMobileable); 33 | } 34 | 35 | @Override 36 | public void onLocateFail(Context context, int errorCode, boolean isScreenOn, boolean isWifiable) { 37 | 38 | //如果屏幕点亮情况下,因为断网失败,则表示不是屏幕点亮造成的断网失败,并修改参照值 39 | if (isScreenOn && errorCode == AMapLocation.ERROR_CODE_FAILURE_CONNECTION && !isWifiable) { 40 | LocationStatusManager.getInstance().resetToInit(context); 41 | return; 42 | } 43 | 44 | if (!LocationStatusManager.getInstance().isFailOnScreenOff(context, errorCode, isScreenOn, isWifiable)) { 45 | return; 46 | } 47 | PowerManagerUtil.getInstance().wakeUpScreen(context); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/model/RecordLocationSerializer.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.model; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonObject; 5 | import com.google.gson.JsonSerializationContext; 6 | import com.google.gson.JsonSerializer; 7 | 8 | import java.lang.reflect.Type; 9 | 10 | /** 11 | * @author yxc 12 | * @date 2019-06-14 13 | */ 14 | public class RecordLocationSerializer implements JsonSerializer { 15 | @Override 16 | public JsonElement serialize(RecordLocation src, Type typeOfSrc, JsonSerializationContext context) { 17 | final JsonObject jsonObject = new JsonObject(); 18 | jsonObject.addProperty("timestamp", src.getTimestamp()); 19 | jsonObject.addProperty("endTime", src.getEndTime()); 20 | jsonObject.addProperty("duration", src.getDuration()); 21 | jsonObject.addProperty("longitude", src.getLongitude()); 22 | jsonObject.addProperty("latitude", src.getLatitude()); 23 | jsonObject.addProperty("speed", src.getSpeed()); 24 | jsonObject.addProperty("itemDistance", src.getItemDistance()); 25 | jsonObject.addProperty("distance", src.getDistance()); 26 | jsonObject.addProperty("recordId", src.getRecordId()); 27 | jsonObject.addProperty("recordType", src.getRecordType()); 28 | jsonObject.addProperty("locationStr", src.getLocationStr()); 29 | jsonObject.addProperty("milePost", src.getMilePost()); 30 | return jsonObject; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/map/util/Constants.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.map.util; 2 | 3 | 4 | import com.amap.api.maps.model.LatLng; 5 | 6 | public class Constants { 7 | 8 | public static final int ERROR = 1001;// 网络异常 9 | public static final int ROUTE_START_SEARCH = 2000; 10 | public static final int ROUTE_END_SEARCH = 2001; 11 | public static final int ROUTE_BUS_RESULT = 2002;// 路径规划中公交模式 12 | public static final int ROUTE_DRIVING_RESULT = 2003;// 路径规划中驾车模式 13 | public static final int ROUTE_WALK_RESULT = 2004;// 路径规划中步行模式 14 | public static final int ROUTE_NO_RESULT = 2005;// 路径规划没有搜索到结果 15 | 16 | public static final int GEOCODER_RESULT = 3000;// 地理编码或者逆地理编码成功 17 | public static final int GEOCODER_NO_RESULT = 3001;// 地理编码或者逆地理编码没有数据 18 | 19 | public static final int POISEARCH = 4000;// poi搜索到结果 20 | public static final int POISEARCH_NO_RESULT = 4001;// poi没有搜索到结果 21 | public static final int POISEARCH_NEXT = 5000;// poi搜索下一页 22 | 23 | public static final int BUSLINE_LINE_RESULT = 6001;// 公交线路查询 24 | public static final int BUSLINE_id_RESULT = 6002;// 公交id查询 25 | public static final int BUSLINE_NO_RESULT = 6003;// 异常情况 26 | 27 | public static final LatLng BEIJING = new LatLng(39.90403, 116.407525);// 北京市经纬度 28 | public static final LatLng ZHONGGUANCUN = new LatLng(39.983456, 116.3154950);// 北京市中关村经纬度 29 | public static final LatLng SHANGHAI = new LatLng(31.238068, 121.501654);// 上海市经纬度 30 | public static final LatLng FANGHENG = new LatLng(39.989614, 116.481763);// 方恒国际中心经纬度 31 | public static final LatLng CHENGDU = new LatLng(30.679879, 104.064855);// 成都市经纬度 32 | public static final LatLng XIAN = new LatLng(34.341568, 108.940174);// 西安市经纬度 33 | public static final LatLng ZHENGZHOU = new LatLng(34.7466, 113.625367);// 郑州市经纬度 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/tab/FragmentChangeManager.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.tab; 2 | 3 | import androidx.fragment.app.Fragment; 4 | import androidx.fragment.app.FragmentManager; 5 | import androidx.fragment.app.FragmentTransaction; 6 | 7 | import java.util.ArrayList; 8 | 9 | public class FragmentChangeManager { 10 | private FragmentManager mFragmentManager; 11 | private int mContainerViewId; 12 | /** Fragment切换数组 */ 13 | private ArrayList mFragments; 14 | /** 当前选中的Tab */ 15 | private int mCurrentTab; 16 | 17 | public FragmentChangeManager(FragmentManager fm, int containerViewId, ArrayList fragments) { 18 | this.mFragmentManager = fm; 19 | this.mContainerViewId = containerViewId; 20 | this.mFragments = fragments; 21 | initFragments(); 22 | } 23 | 24 | /** 初始化fragments */ 25 | private void initFragments() { 26 | for (Fragment fragment : mFragments) { 27 | mFragmentManager.beginTransaction().add(mContainerViewId, fragment).hide(fragment).commit(); 28 | } 29 | 30 | setFragments(0); 31 | } 32 | 33 | /** 界面切换控制 */ 34 | public void setFragments(int index) { 35 | for (int i = 0; i < mFragments.size(); i++) { 36 | FragmentTransaction ft = mFragmentManager.beginTransaction(); 37 | Fragment fragment = mFragments.get(i); 38 | if (i == index) { 39 | ft.show(fragment); 40 | } else { 41 | ft.hide(fragment); 42 | } 43 | ft.commit(); 44 | } 45 | mCurrentTab = index; 46 | } 47 | 48 | public int getCurrentTab() { 49 | return mCurrentTab; 50 | } 51 | 52 | public Fragment getCurrentFragment() { 53 | return mFragments.get(mCurrentTab); 54 | } 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/tab/OnTabSelectListener.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.tab; 2 | 3 | public interface OnTabSelectListener { 4 | void onTabSelect(int position); 5 | void onTabReselect(int position); 6 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/ui/base/BaseChartFragment.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.ui.base; 2 | 3 | /** 4 | * @author yxc 5 | * @date 2019-05-07 6 | */ 7 | public abstract class BaseChartFragment extends BaseFragment{ 8 | public abstract void resetSelectedEntry(); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/ui/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.ui.base; 2 | 3 | import androidx.fragment.app.Fragment; 4 | 5 | /** 6 | * @author yxc 7 | * @date 2019/4/26 8 | */ 9 | public class BaseFragment extends Fragment { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/ui/bezier/BaseBezierFragment.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.ui.bezier; 2 | 3 | import android.view.View; 4 | 5 | import com.yxc.barchart.ui.base.BaseChartFragment; 6 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 7 | import com.yxc.chartlib.recyclerchart.listener.RecyclerItemGestureListener; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * @author yxc 14 | * @since 2019-05-13 15 | */ 16 | public abstract class BaseBezierFragment extends BaseChartFragment { 17 | 18 | protected List visibleEntries; 19 | 20 | protected OnRateSelectChangedListener mRateSelectChangedListener; 21 | 22 | protected RecyclerItemGestureListener mItemGestureListener; 23 | 24 | public interface OnRateSelectChangedListener { 25 | 26 | void onDayChanged(List visibleEntries); 27 | 28 | void onMonthChanged(List visibleEntries); 29 | 30 | void onWeekSelectChanged(List visibleEntries); 31 | 32 | void onYearSelectChanged(List visibleEntries); 33 | } 34 | 35 | public void setOnRateSelectChangedListener(OnRateSelectChangedListener listener) { 36 | this.mRateSelectChangedListener = listener; 37 | } 38 | 39 | //防止 Fragment重叠 40 | @Override 41 | public void setMenuVisibility(boolean menuVisible) { 42 | super.setMenuVisibility(menuVisible); 43 | if (this.getView() != null) { 44 | this.getView().setVisibility(menuVisible ? View.VISIBLE : View.GONE); 45 | } 46 | } 47 | 48 | protected void setVisibleEntries(List barEntries) { 49 | if (null == visibleEntries) { 50 | visibleEntries = new ArrayList<>(); 51 | } else { 52 | visibleEntries.clear(); 53 | } 54 | visibleEntries.addAll(barEntries); 55 | displayDateAndRate(); 56 | } 57 | 58 | public void resetSelectedEntry(){ 59 | if (mItemGestureListener != null){ 60 | mItemGestureListener.resetSelectedBarEntry(); 61 | } 62 | } 63 | 64 | public abstract void displayDateAndRate(); 65 | 66 | public abstract void scrollToCurrentCycle();//回到当前周期 67 | 68 | 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/ui/line/BaseLineFragment.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.ui.line; 2 | 3 | import android.view.View; 4 | 5 | import com.yxc.barchart.ui.base.BaseChartFragment; 6 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 7 | import com.yxc.chartlib.recyclerchart.listener.RecyclerItemGestureListener; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * @author yxc 14 | * @since 2019-05-13 15 | */ 16 | public abstract class BaseLineFragment extends BaseChartFragment { 17 | 18 | protected List visibleEntries; 19 | 20 | protected OnRateSelectChangedListener mRateSelectChangedListener; 21 | 22 | protected RecyclerItemGestureListener mItemGestureListener; 23 | 24 | public interface OnRateSelectChangedListener { 25 | 26 | void onDayChanged(List visibleEntries); 27 | 28 | void onMonthChanged(List visibleEntries); 29 | 30 | void onWeekSelectChanged(List visibleEntries); 31 | 32 | void onYearSelectChanged(List visibleEntries); 33 | } 34 | 35 | public void setOnRateSelectChangedListener(OnRateSelectChangedListener listener) { 36 | this.mRateSelectChangedListener = listener; 37 | } 38 | 39 | //防止 Fragment重叠 40 | @Override 41 | public void setMenuVisibility(boolean menuVisible) { 42 | super.setMenuVisibility(menuVisible); 43 | if (this.getView() != null) { 44 | this.getView().setVisibility(menuVisible ? View.VISIBLE : View.GONE); 45 | } 46 | } 47 | 48 | protected void setVisibleEntries(List barEntries) { 49 | if (null == visibleEntries) { 50 | visibleEntries = new ArrayList<>(); 51 | } else { 52 | visibleEntries.clear(); 53 | } 54 | visibleEntries.addAll(barEntries); 55 | displayDateAndRate(); 56 | } 57 | 58 | public void resetSelectedEntry(){ 59 | if (mItemGestureListener != null){ 60 | mItemGestureListener.resetSelectedBarEntry(); 61 | } 62 | } 63 | 64 | public abstract void displayDateAndRate(); 65 | 66 | public abstract void scrollToCurrentCycle();//回到当前周期 67 | 68 | 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/ui/rainbow/RainbowActivity.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.ui.rainbow; 2 | 3 | import android.os.Bundle; 4 | import android.view.MenuItem; 5 | import android.view.View; 6 | import android.widget.Button; 7 | 8 | import androidx.annotation.Nullable; 9 | import androidx.appcompat.app.AppCompatActivity; 10 | import androidx.appcompat.widget.Toolbar; 11 | 12 | import com.yxc.barchart.R; 13 | import com.yxc.barchart.view.Rainbow; 14 | import com.yxc.commonlib.util.ColorUtil; 15 | import com.yxc.commonlib.util.TimeDateUtil; 16 | 17 | import org.joda.time.LocalDate; 18 | 19 | /** 20 | * @author yxc 21 | * @since 2019/4/26 22 | */ 23 | public class RainbowActivity extends AppCompatActivity { 24 | 25 | Toolbar toolbar; 26 | Rainbow mContainer; 27 | 28 | @Override 29 | protected void onCreate(@Nullable Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_rainbow2); 32 | initView(); 33 | } 34 | 35 | private void initView() { 36 | toolbar = findViewById(R.id.toolBar); 37 | toolbar.setTitle(TimeDateUtil.getDateStr(TimeDateUtil.localDateToTimestamp(LocalDate.now()), "M月dd日")); 38 | toolbar.setNavigationIcon(R.drawable.ic_chevron_left_white_45dp); 39 | toolbar.setTitleTextColor(ColorUtil.getResourcesColor(this, R.color.white)); 40 | setSupportActionBar(toolbar); 41 | mContainer = findViewById(R.id.rainbow); 42 | } 43 | 44 | @Override 45 | public boolean onOptionsItemSelected(MenuItem item) { 46 | if(item.getItemId()==android.R.id.home){ 47 | finish(); 48 | return true; 49 | } 50 | return super.onOptionsItemSelected(item); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/ui/step/BaseStepFragment.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.ui.step; 2 | 3 | import android.view.View; 4 | 5 | import com.yxc.barchart.ui.base.BaseChartFragment; 6 | import com.yxc.chartlib.recyclerchart.entrys.BarEntry; 7 | import com.yxc.chartlib.recyclerchart.listener.RecyclerItemGestureListener; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * @author yxc 14 | * @since 2019-05-13 15 | */ 16 | public abstract class BaseStepFragment extends BaseChartFragment { 17 | 18 | protected List visibleEntries; 19 | 20 | protected OnRateSelectChangedListener mRateSelectChangedListener; 21 | 22 | protected RecyclerItemGestureListener mItemGestureListener; 23 | 24 | public interface OnRateSelectChangedListener { 25 | 26 | void onDayChanged(List visibleEntries); 27 | 28 | void onMonthChanged(List visibleEntries); 29 | 30 | void onWeekSelectChanged(List visibleEntries); 31 | 32 | void onYearSelectChanged(List visibleEntries); 33 | } 34 | 35 | public void setOnRateSelectChangedListener(OnRateSelectChangedListener listener) { 36 | this.mRateSelectChangedListener = listener; 37 | } 38 | 39 | //防止 Fragment重叠 40 | @Override 41 | public void setMenuVisibility(boolean menuVisible) { 42 | super.setMenuVisibility(menuVisible); 43 | if (this.getView() != null) { 44 | this.getView().setVisibility(menuVisible ? View.VISIBLE : View.GONE); 45 | } 46 | } 47 | 48 | protected void setVisibleEntries(List barEntries) { 49 | if (null == visibleEntries) { 50 | visibleEntries = new ArrayList<>(); 51 | } else { 52 | visibleEntries.clear(); 53 | } 54 | visibleEntries.addAll(barEntries); 55 | displayDateAndRate(); 56 | } 57 | 58 | public void resetSelectedEntry(){ 59 | if (mItemGestureListener != null){ 60 | mItemGestureListener.resetSelectedBarEntry(); 61 | } 62 | } 63 | 64 | public abstract void displayDateAndRate(); 65 | 66 | public abstract void scrollToCurrentCycle();//回到当前周期 67 | 68 | 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/view/BezierCircleModel.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.view; 2 | 3 | public class BezierCircleModel { 4 | 5 | public VPoint p2; 6 | public VPoint p4; 7 | public HPoint p1; 8 | public HPoint p3; 9 | 10 | public BezierCircleModel(HPoint p1, HPoint p3, VPoint p2, VPoint p4){ 11 | this.p1 = p1; 12 | this.p2 = p2; 13 | this.p3 = p3; 14 | this.p4 = p4; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/view/HPoint.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.view; 2 | 3 | import android.graphics.PointF; 4 | 5 | public class HPoint { 6 | public float x; 7 | public float y; 8 | public PointF left = new PointF(); 9 | public PointF right = new PointF(); 10 | 11 | public void setY(float y) { 12 | this.y = y; 13 | left.y = y; 14 | right.y = y; 15 | } 16 | 17 | public void adjustAllX(float offset) { 18 | this.x += offset; 19 | left.x += offset; 20 | right.x += offset; 21 | } 22 | 23 | public void adjustAllY(float offset) { 24 | this.y += offset; 25 | left.y += offset; 26 | right.y += offset; 27 | } 28 | 29 | public void adjustAllXY(float x, float y) { 30 | adjustAllX(x); 31 | adjustAllY(y); 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/view/PathMeasureModel.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.view; 2 | 3 | public class PathMeasureModel { 4 | 5 | float firstPointLength; 6 | float endPointLength; 7 | 8 | public void setFirstPointLength(float firstPointLength) { 9 | this.firstPointLength = firstPointLength; 10 | } 11 | 12 | public void setEndPointLength(float endPointLength) { 13 | this.endPointLength = endPointLength; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/view/PathModel.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.view; 2 | 3 | import android.graphics.Path; 4 | import android.graphics.PointF; 5 | import android.graphics.RectF; 6 | 7 | public class PathModel { 8 | PointF startPointF; 9 | PointF endPointF; 10 | Path pathArc; 11 | Path startPathArc; 12 | Path endPathArc; 13 | RectF startSmallRectF; 14 | RectF endSmallRectF; 15 | float halfSquareWidth; 16 | 17 | public PathModel(PointF startPointF, PointF endPointF, Path pathArc) { 18 | this.startPointF = startPointF; 19 | this.endPointF = endPointF; 20 | this.pathArc = pathArc; 21 | } 22 | 23 | public void setEndPathArc(Path endPathArc) { 24 | this.endPathArc = endPathArc; 25 | } 26 | 27 | public void setStartPathArc(Path startPathArc) { 28 | this.startPathArc = startPathArc; 29 | } 30 | 31 | public void setStartSmallRectF(RectF startSmallRectF) { 32 | this.startSmallRectF = startSmallRectF; 33 | } 34 | 35 | public void setEndSmallRectF(RectF endSmallRectF) { 36 | this.endSmallRectF = endSmallRectF; 37 | } 38 | 39 | public void setHalfSquareWidth(float halfSquareWidth) { 40 | this.halfSquareWidth = halfSquareWidth; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/view/QuadModel.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.view; 2 | 3 | import android.graphics.Path; 4 | import android.graphics.PathMeasure; 5 | import android.graphics.PointF; 6 | import android.graphics.RectF; 7 | 8 | public class QuadModel { 9 | 10 | public PointF startPointF; 11 | public PointF endPointF; 12 | public PointF ctrlPointF; 13 | public PointF centerPointF; 14 | 15 | Path quadPath; 16 | 17 | public Path createQuadPath(){ 18 | quadPath = new Path(); 19 | quadPath.moveTo(startPointF.x, startPointF.y); 20 | quadPath.quadTo(ctrlPointF.x, ctrlPointF.y, endPointF.x, endPointF.y); 21 | quadPath.lineTo(centerPointF.x, centerPointF.y); 22 | quadPath.close(); 23 | return quadPath; 24 | } 25 | 26 | public PointF createCommonPoint(RectF rectF, float sweepAngel) { 27 | float radius = rectF.width() / 2; 28 | float halfCircleLength = (float) (Math.PI * radius); 29 | Path pathOriginal = new Path(); 30 | pathOriginal.moveTo(rectF.left, (rectF.top + rectF.bottom) / 2); 31 | pathOriginal.arcTo(rectF, 180, 180, false); 32 | PathMeasure pathMeasure = new PathMeasure(pathOriginal, false); 33 | float[] points = new float[2]; 34 | float pointLength = halfCircleLength * sweepAngel / 180.f; 35 | pathMeasure.getPosTan(pointLength, points, null); 36 | return new PointF(points[0], points[1]); 37 | } 38 | 39 | public PointF createEndPoint(RectF rectF, float sweepAngel) { 40 | float radius = rectF.width() / 2; 41 | float halfCircleLength = (float) (Math.PI * radius); 42 | Path pathOriginal = new Path(); 43 | pathOriginal.moveTo(rectF.right, (rectF.top + rectF.bottom) / 2); 44 | pathOriginal.arcTo(rectF, 0, -180, false); 45 | PathMeasure pathMeasure = new PathMeasure(pathOriginal, false); 46 | float[] points = new float[2]; 47 | float pointLength = halfCircleLength * sweepAngel / 180.f; 48 | pathMeasure.getPosTan(pointLength, points, null); 49 | return new PointF(points[0], points[1]); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/view/ThreeTargetConstant.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.view; 2 | 3 | import com.yxc.commonlib.util.DisplayUtil; 4 | 5 | public class ThreeTargetConstant { 6 | 7 | public static float RESIZE = DisplayUtil.dip2px(0.14285712688f); 8 | public static int TRANSPARENT_VALUE = (int) (255 * 0.4); 9 | 10 | public static float FIRST_WRAPPER_FIX_ANGLE = 2.05f; 11 | public static float FIRST_INNER_FIX_ANGLE = 2.7f; 12 | 13 | public static float SECOND_WRAPPER_FIX_ANGLE = 3f; 14 | public static float SECOND_INNER_FIX_ANGLE = 4.7f; 15 | 16 | public static float THIRD_WRAPPER_FIX_ANGLE = 3.8f; 17 | public static float THIRD_INNER_FIX_ANGLE = 15f; 18 | 19 | public static int TARGET_FIRST_TYPE = 1; 20 | public static int TARGET_SECOND_TYPE = 2; 21 | public static int TARGET_THIRD_TYPE = 3; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/yxc/barchart/view/VPoint.java: -------------------------------------------------------------------------------- 1 | package com.yxc.barchart.view; 2 | 3 | import android.graphics.PointF; 4 | 5 | public class VPoint { 6 | public float x; 7 | public float y; 8 | public PointF top = new PointF(); 9 | public PointF bottom = new PointF(); 10 | 11 | public void setX(float x) { 12 | this.x = x; 13 | top.x = x; 14 | bottom.x = x; 15 | } 16 | 17 | public void adjustY(float offset) { 18 | top.y -= offset; 19 | bottom.y += offset; 20 | } 21 | 22 | public void adjustAllX(float offset) { 23 | this.x += offset; 24 | top.x += offset; 25 | bottom.x += offset; 26 | } 27 | 28 | public void adjustAllY(float offset) { 29 | this.y += offset; 30 | top.y += offset; 31 | bottom.y += offset; 32 | } 33 | 34 | public void adjustAllXY(float x, float y) { 35 | adjustAllX(x); 36 | adjustAllY(y); 37 | } 38 | } -------------------------------------------------------------------------------- /app/src/main/java/rx/Observable.java: -------------------------------------------------------------------------------- 1 | package rx; 2 | 3 | /** 4 | * @author yxc 5 | * @date 2019-06-14 6 | */ 7 | public class Observable { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libAMapSDK_MAP_v6_5_0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/jniLibs/arm64-v8a/libAMapSDK_MAP_v6_5_0.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libAMapSDK_MAP_v6_5_0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/jniLibs/armeabi-v7a/libAMapSDK_MAP_v6_5_0.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libAMapSDK_MAP_v6_5_0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/jniLibs/armeabi/libAMapSDK_MAP_v6_5_0.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86/libAMapSDK_MAP_v6_5_0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/jniLibs/x86/libAMapSDK_MAP_v6_5_0.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86_64/libAMapSDK_MAP_v6_5_0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/jniLibs/x86_64/libAMapSDK_MAP_v6_5_0.so -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xhdpi/icon_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/walk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xhdpi/walk.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/back_btn_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/back_btn_image.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/end.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/gps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/gps.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/grasp_flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/grasp_flag.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/grasp_trace_line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/grasp_trace_line.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/marker.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/point.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/point5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/point5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/start.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/test.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/title_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable-xxhdpi/title_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/border_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable/border_bg.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_map_poi.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom_info_bubble.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable/custom_info_bubble.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/direct_mapsearch.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable/direct_mapsearch.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/direct_mapsearch_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable/direct_mapsearch_pressed.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_left_black_30dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_left_white_45dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_right_black_30dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_mile_post_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_navigate_back_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_navigation_left_black_45dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_data_item_bg_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/title_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinxiucheng/RecyclerBarChart/29b4fc9ce0a37ef63631a6b0c04df79e757dcc32/app/src/main/res/drawable/title_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/layout/abroadmap_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 |