├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── 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 │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable │ │ │ │ ├── ic_progress_bar.xml │ │ │ │ ├── ic_heart.xml │ │ │ │ ├── ic_graph.xml │ │ │ │ ├── ic_github.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── values │ │ │ │ ├── themes.xml │ │ │ │ ├── strings.xml │ │ │ │ └── colors.xml │ │ │ ├── layout │ │ │ │ ├── activity_pie_graph.xml │ │ │ │ ├── activity_dot_progress.xml │ │ │ │ ├── activity_linear_progress.xml │ │ │ │ ├── menu_option_item.xml │ │ │ │ └── activity_main.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── sung2063 │ │ │ │ └── tableau_app │ │ │ │ ├── model │ │ │ │ └── MainOptionModel.kt │ │ │ │ ├── DotProgressActivity.kt │ │ │ │ ├── LinearProgressActivity.kt │ │ │ │ ├── PieGraphActivity.kt │ │ │ │ ├── data │ │ │ │ └── DataCollection.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ └── adapter │ │ │ │ └── MenuOptionRecyclerViewAdapter.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── sung2063 │ │ │ └── tableau_app │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── sung2063 │ │ └── tableau_app │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── .idea ├── .name ├── .gitignore ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── compiler.xml ├── vcs.xml ├── misc.xml ├── gradle.xml └── jarRepositories.xml ├── TableauLibrary ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── attrs.xml │ │ │ ├── drawable │ │ │ │ ├── linear_progress_active_bar.xml │ │ │ │ ├── linear_progress_back_stack_bar.xml │ │ │ │ ├── dot_progress_unfilled.xml │ │ │ │ ├── dot_progress_filled.xml │ │ │ │ └── shape_pie_graph_data_color_legend.xml │ │ │ ├── layout │ │ │ │ ├── pie_graph_layout.xml │ │ │ │ ├── dot_progress_layout.xml │ │ │ │ ├── linear_progress_layout.xml │ │ │ │ ├── dot_progress_view.xml │ │ │ │ ├── rv_pie_graph_data_row.xml │ │ │ │ └── linear_progress_view.xml │ │ │ └── anim │ │ │ │ └── zoom_out_in.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── sung2063 │ │ │ │ └── tableau_library │ │ │ │ ├── graph │ │ │ │ ├── handler │ │ │ │ │ ├── GraphHandler.kt │ │ │ │ │ └── PieGraphHandler.kt │ │ │ │ ├── util │ │ │ │ │ └── GraphUtil.kt │ │ │ │ ├── model │ │ │ │ │ └── PieGraphModel.kt │ │ │ │ ├── adapter │ │ │ │ │ └── PieGraphDataAdapter.kt │ │ │ │ └── PieGraphView.kt │ │ │ │ ├── exception │ │ │ │ └── IllegalArgumentException.kt │ │ │ │ ├── progress │ │ │ │ ├── handler │ │ │ │ │ ├── ProgressHandler.kt │ │ │ │ │ ├── DotProgressHandler.kt │ │ │ │ │ └── LinearProgressHandler.kt │ │ │ │ ├── model │ │ │ │ │ ├── DotProgressModel.kt │ │ │ │ │ └── LinearProgressModel.kt │ │ │ │ ├── DotProgressView.kt │ │ │ │ ├── LinearProgressView.kt │ │ │ │ └── adapter │ │ │ │ │ ├── DotProgressItemsAdapter.kt │ │ │ │ │ └── LinearProgressItemsAdapter.kt │ │ │ │ └── util │ │ │ │ └── RegexTool.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── sung2063 │ │ │ └── tableau_library │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── sung2063 │ │ └── tableau_library │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── marketing ├── banner.png └── sponsor_iconx64.png ├── images └── PieGraphView.jpg ├── settings.gradle ├── .github └── FUNDING.yml ├── gifs ├── DotProgressView_GIF.gif └── LinearProgressView_GIF.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── LICENSE ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Tableau Project Sample -------------------------------------------------------------------------------- /TableauLibrary/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /TableauLibrary/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /marketing/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/marketing/banner.png -------------------------------------------------------------------------------- /images/PieGraphView.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/images/PieGraphView.jpg -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | //include ':TableauLibrary' 2 | include ':app' 3 | rootProject.name = "Tableau Project Sample" -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # repo: sung2063/AndroidTableauLibrary 2 | # filename: FUNDING.YML 3 | 4 | github: sung2063 5 | -------------------------------------------------------------------------------- /gifs/DotProgressView_GIF.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/gifs/DotProgressView_GIF.gif -------------------------------------------------------------------------------- /gifs/LinearProgressView_GIF.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/gifs/LinearProgressView_GIF.gif -------------------------------------------------------------------------------- /marketing/sponsor_iconx64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/marketing/sponsor_iconx64.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #555 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sung2063/AndroidTableauLibrary/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/graph/handler/GraphHandler.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.graph.handler 2 | 3 | open class GraphHandler( 4 | ) -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HEX color code must be #000000 format. 5 | 6 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/exception/IllegalArgumentException.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.exception 2 | 3 | class IllegalArgumentException(override val message: String): Exception(message) -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/graph/util/GraphUtil.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.graph.util 2 | 3 | class GraphUtil { 4 | 5 | companion object { 6 | const val maxDegree = 360 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/progress/handler/ProgressHandler.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.progress.handler 2 | 3 | open class ProgressHandler( 4 | var filledColor: String, 5 | var unfilledColor: String 6 | ) -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/util/RegexTool.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.util 2 | 3 | class RegexTool { 4 | 5 | companion object { 6 | const val HEX_COLOR_CODE = "^#[0-9a-fA-F]{6}$" 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/graph/model/PieGraphModel.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.graph.model 2 | 3 | data class PieGraphModel( 4 | var name: String, 5 | var value: Float = 0f, 6 | var color: String? = "#023047" 7 | ) -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/drawable/linear_progress_active_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/drawable/linear_progress_back_stack_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/drawable/dot_progress_unfilled.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Apr 25 18:42:14 EDT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 7 | -------------------------------------------------------------------------------- /.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 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/graph/handler/PieGraphHandler.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.graph.handler 2 | 3 | import com.sung2063.tableau_library.graph.model.PieGraphModel 4 | 5 | class PieGraphHandler( 6 | var dataList: ArrayList 7 | ) : GraphHandler() -------------------------------------------------------------------------------- /app/src/main/java/com/sung2063/tableau_app/model/MainOptionModel.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app.model 2 | 3 | data class MainOptionModel( 4 | val backgroundId: Int, 5 | val iconId: Int, 6 | val iconColor: Int, 7 | val title: String, 8 | val description: String, 9 | val textColorId: Int 10 | ) -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/progress/model/DotProgressModel.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.progress.model 2 | 3 | data class DotProgressModel( 4 | var name: String, 5 | var value: Float = 0f, 6 | var progressColor: String = "#395F7C", 7 | var backStackColor: String = "#fbf8fa" 8 | ) -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/drawable/dot_progress_filled.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/progress/model/LinearProgressModel.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.progress.model 2 | 3 | data class LinearProgressModel( 4 | var name: String, 5 | var value: Float = 0f, 6 | var filledColor: String = "#395F7C", 7 | var unfilledColor: String = "#fbf8fa" 8 | ) 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/drawable/shape_pie_graph_data_color_legend.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_progress_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/progress/handler/DotProgressHandler.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.progress.handler 2 | 3 | import com.sung2063.tableau_library.progress.model.DotProgressModel 4 | 5 | class DotProgressHandler( 6 | var dataList: List, 7 | filledColor: String = "#395F7C", 8 | unfilledColor: String = "#fbf8fa" 9 | ) : ProgressHandler(filledColor, unfilledColor) -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/progress/handler/LinearProgressHandler.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.progress.handler 2 | 3 | import com.sung2063.tableau_library.progress.model.LinearProgressModel 4 | 5 | class LinearProgressHandler( 6 | var dataList: List, 7 | filledColor: String = "#395F7C", 8 | unfilledColor: String = "#fbf8fa", 9 | var space: Int = 5 10 | ) : ProgressHandler(filledColor, unfilledColor) -------------------------------------------------------------------------------- /app/src/test/java/com/sung2063/tableau_app/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /TableauLibrary/src/test/java/com/sung2063/tableau_library/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_heart.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/layout/pie_graph_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/anim/zoom_out_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/layout/dot_progress_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/layout/linear_progress_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_graph.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /app/src/androidTest/java/com/sung2063/tableau_app/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.ellet.tableau_project_sample", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tableau App 4 | 5 | 6 | Sample Tableau App 7 | (@sung2063/AndroidTableauLibrary) 8 | Sponsor to @sung2063 9 | 10 | Pie Bar Graph 11 | Dot Progress 12 | Linear Progress 13 | GitHub 14 | 15 | Graph 16 | Progress 17 | Progress 18 | \@sung2063 19 | 20 | -------------------------------------------------------------------------------- /TableauLibrary/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 -------------------------------------------------------------------------------- /TableauLibrary/src/androidTest/java/com/sung2063/tableau_library/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.sung2063.tableau_library.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_pie_graph.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_dot_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_linear_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sung Hyun 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/sung2063/tableau_app/DotProgressActivity.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import com.sung2063.tableau_library.progress.DotProgressView 6 | import com.sung2063.tableau_library.progress.handler.DotProgressHandler 7 | import com.sung2063.tableau_library.progress.model.DotProgressModel 8 | 9 | class DotProgressActivity : AppCompatActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | setContentView(R.layout.activity_dot_progress) 13 | 14 | val dotProgressView: DotProgressView = findViewById(R.id.dot_progress_view) 15 | 16 | // [1] Create the data 17 | val dataList = mutableListOf( 18 | DotProgressModel("Category 1", 30f, "#cfaf25"), 19 | DotProgressModel("Category 2", 50f, "#25cfcc"), 20 | DotProgressModel("Category 3", 70f, "#6325cf"), 21 | DotProgressModel("Category 4", 95f, "#cf2569") 22 | ) 23 | 24 | // [2] Set Handler and link with the view 25 | dotProgressView.setHandler(DotProgressHandler(dataList)) 26 | } 27 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /app/src/main/java/com/sung2063/tableau_app/LinearProgressActivity.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import com.sung2063.tableau_library.progress.LinearProgressView 6 | import com.sung2063.tableau_library.progress.handler.LinearProgressHandler 7 | import com.sung2063.tableau_library.progress.model.LinearProgressModel 8 | 9 | class LinearProgressActivity : AppCompatActivity() { 10 | 11 | override fun onCreate(savedInstanceState: Bundle?) { 12 | super.onCreate(savedInstanceState) 13 | setContentView(R.layout.activity_linear_progress) 14 | 15 | val linearProgressView: LinearProgressView = findViewById(R.id.linear_progress_view) 16 | 17 | // [1] Create the data 18 | val dataList = mutableListOf( 19 | LinearProgressModel("Category 1", 40f, "#395F7C"), 20 | LinearProgressModel("Category 2", 55f, "#7c3961"), 21 | LinearProgressModel("Category 3", 100f, "#397c6f"), 22 | LinearProgressModel("Category 4", 30f, "#7c3958"), 23 | LinearProgressModel("Category 5", 80f, "#7c7939") 24 | ) 25 | 26 | // [2] Set Handler and link with the view 27 | linearProgressView.setHandler(LinearProgressHandler(dataList)) 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/sung2063/tableau_app/PieGraphActivity.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import androidx.recyclerview.widget.LinearLayoutManager 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.sung2063.tableau_library.graph.PieGraphView 8 | import com.sung2063.tableau_library.graph.adapter.PieGraphDataAdapter 9 | import com.sung2063.tableau_library.graph.handler.PieGraphHandler 10 | import com.sung2063.tableau_library.graph.model.PieGraphModel 11 | 12 | class PieGraphActivity : AppCompatActivity() { 13 | 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | setContentView(R.layout.activity_pie_graph) 17 | 18 | val pieGraphView: PieGraphView = findViewById(R.id.pie_graph_view) 19 | 20 | // [1] Create the data 21 | val dataList = arrayListOf( 22 | PieGraphModel("Category 1", 20f, "#ed6234"), 23 | PieGraphModel("Category 2", 40f, "#ebdf38"), 24 | PieGraphModel("Category 3", 60f, "#81e82c"), 25 | PieGraphModel("Category 4", 35f, "#2784d6"), 26 | PieGraphModel("Category 5", 15f, "#7225c4") 27 | ) 28 | 29 | // [2] Set Handler and link with the view 30 | pieGraphView.setHandler(PieGraphHandler(dataList)) 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 29 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /TableauLibrary/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.0" 9 | 10 | defaultConfig { 11 | minSdkVersion 21 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | consumerProguardFiles "consumer-rules.pro" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | kotlinOptions { 31 | jvmTarget = '1.8' 32 | } 33 | } 34 | 35 | dependencies { 36 | 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 38 | implementation 'androidx.core:core-ktx:1.3.2' 39 | implementation 'androidx.appcompat:appcompat:1.2.0' 40 | implementation 'com.google.android.material:material:1.3.0' 41 | testImplementation 'junit:junit:4.+' 42 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 43 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 44 | 45 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3' 46 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3' 47 | 48 | } -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | #FFBB86FC 6 | #FF6200EE 7 | #FF3700B3 8 | #FF03DAC5 9 | #FF018786 10 | #FF000000 11 | #FFFFFFFF 12 | 13 | 14 | #73c7ba 15 | #8dc9c0 16 | #EEEEEE 17 | 18 | #E69419 19 | #684985 20 | #019FC3 21 | #c3b901 22 | #eb1a6d 23 | 24 | #77E69419 25 | #99684985 26 | #99019FC3 27 | #991A6B9E 28 | #88eb1a6d 29 | 30 | #E69419 31 | #684985 32 | #019FC3 33 | #1A6B9E 34 | #eb1a6d 35 | 36 | #e82e8e 37 | 38 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.0" 9 | 10 | defaultConfig { 11 | applicationId "com.sung2063.tableau_app" 12 | minSdkVersion 21 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | kotlinOptions { 31 | jvmTarget = '1.8' 32 | } 33 | } 34 | 35 | dependencies { 36 | 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 38 | implementation 'androidx.core:core-ktx:1.3.2' 39 | implementation 'androidx.appcompat:appcompat:1.2.0' 40 | implementation 'com.google.android.material:material:1.3.0' 41 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 42 | testImplementation 'junit:junit:4.+' 43 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 44 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 45 | implementation 'com.github.sung2063:AndroidTableauLibrary:1.0-rc-2' 46 | 47 | // Dependency on a local library module 48 | //implementation project(":TableauLibrary") 49 | } -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/layout/dot_progress_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 18 | 19 | 29 | 30 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/graph/adapter/PieGraphDataAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.graph.adapter 2 | 3 | import android.graphics.Color 4 | import android.graphics.drawable.GradientDrawable 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.widget.ImageView 9 | import android.widget.TextView 10 | import androidx.recyclerview.widget.RecyclerView 11 | import com.sung2063.tableau_library.R 12 | import com.sung2063.tableau_library.graph.model.PieGraphModel 13 | 14 | class PieGraphDataAdapter( 15 | private val data: List, 16 | private val isUsingArcColor: Boolean, 17 | private val graphColor: String?, 18 | private val alphaList: List? 19 | ) : RecyclerView.Adapter() { 20 | 21 | class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { 22 | val ivLegendColor: ImageView = view.findViewById(R.id.iv_legend_color) 23 | val tvLegendTitle: TextView = view.findViewById(R.id.tv_legend_title) 24 | val tvLegendValue: TextView = view.findViewById(R.id.tv_legend_value) 25 | } 26 | 27 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { 28 | val view = LayoutInflater.from(parent.context) 29 | .inflate(R.layout.rv_pie_graph_data_row, parent, false) 30 | return ViewHolder(view) 31 | } 32 | 33 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { 34 | holder.tvLegendTitle.text = data[position].name 35 | holder.tvLegendValue.text = data[position].value.toString() 36 | 37 | val gradientDrawable = holder.ivLegendColor.drawable as GradientDrawable 38 | var legendColor: String? 39 | if (isUsingArcColor) { 40 | legendColor = data[position].color 41 | } else { 42 | legendColor = graphColor 43 | alphaList.let { gradientDrawable.alpha = it?.get(position)!! } 44 | } 45 | gradientDrawable.setColor(Color.parseColor(legendColor)) 46 | } 47 | 48 | override fun getItemCount() = data.size 49 | 50 | } -------------------------------------------------------------------------------- /app/src/main/java/com/sung2063/tableau_app/data/DataCollection.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app.data 2 | 3 | import android.content.Context 4 | import android.graphics.Color 5 | import com.sung2063.tableau_app.R 6 | import com.sung2063.tableau_app.model.MainOptionModel 7 | 8 | class DataCollection { 9 | 10 | companion object { 11 | 12 | fun getMainOptionData(context: Context): List { 13 | val mainOptionList = ArrayList() 14 | mainOptionList.add( 15 | MainOptionModel( 16 | -1, 17 | R.drawable.ic_graph, 18 | R.color.menuColor1, 19 | context.getString(R.string.app_menu1), 20 | context.getString(R.string.app_menu1_description), 21 | Color.BLACK 22 | ) 23 | ) 24 | mainOptionList.add( 25 | MainOptionModel( 26 | -1, 27 | R.drawable.ic_progress_bar, 28 | R.color.menuColor2, 29 | context.getString(R.string.app_menu2), 30 | context.getString(R.string.app_menu2_description), 31 | Color.BLACK 32 | ) 33 | ) 34 | mainOptionList.add( 35 | MainOptionModel( 36 | -1, 37 | R.drawable.ic_progress_bar, 38 | R.color.menuColor3, 39 | context.getString(R.string.app_menu3), 40 | context.getString(R.string.app_menu3_description), 41 | Color.BLACK 42 | ) 43 | ) 44 | mainOptionList.add( 45 | MainOptionModel( 46 | Color.BLACK, 47 | R.drawable.ic_github, 48 | R.color.menuColor5, 49 | context.getString(R.string.app_menu4), 50 | context.getString(R.string.app_menu4_description), 51 | Color.WHITE 52 | ) 53 | ) 54 | return mainOptionList 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/layout/rv_pie_graph_data_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | 27 | 28 | 38 | 39 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_github.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/sung2063/tableau_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app 2 | 3 | import android.content.Intent 4 | import android.graphics.Paint 5 | import android.net.Uri 6 | import androidx.appcompat.app.AppCompatActivity 7 | import android.os.Bundle 8 | import android.widget.Button 9 | import androidx.recyclerview.widget.LinearLayoutManager 10 | import androidx.recyclerview.widget.RecyclerView 11 | import com.sung2063.tableau_app.adapter.MenuOptionRecyclerViewAdapter 12 | import com.sung2063.tableau_app.data.DataCollection 13 | 14 | class MainActivity : AppCompatActivity(), MenuOptionRecyclerViewAdapter.EventListener { 15 | 16 | private lateinit var btSponsorship: Button 17 | private lateinit var rvOptions: RecyclerView 18 | private lateinit var menuOptionAdapter: MenuOptionRecyclerViewAdapter 19 | 20 | override fun onCreate(savedInstanceState: Bundle?) { 21 | super.onCreate(savedInstanceState) 22 | setContentView(R.layout.activity_main) 23 | 24 | btSponsorship = findViewById(R.id.bt_sponsorship) 25 | rvOptions = findViewById(R.id.rv_options) 26 | 27 | // Setup Main Menu 28 | val mainOptionList = DataCollection.getMainOptionData(applicationContext) 29 | rvOptions.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false) 30 | menuOptionAdapter = MenuOptionRecyclerViewAdapter(this, mainOptionList) 31 | menuOptionAdapter.setListener(this) 32 | rvOptions.adapter = menuOptionAdapter 33 | 34 | btSponsorship.paintFlags = btSponsorship.paintFlags or Paint.UNDERLINE_TEXT_FLAG 35 | 36 | // Responds 37 | btSponsorship.setOnClickListener { 38 | val intent = Intent(Intent.ACTION_VIEW) 39 | intent.data = Uri.parse("https://github.com/sponsors/sung2063") 40 | startActivity(intent) 41 | } 42 | } 43 | 44 | override fun onMenuClicked(position: Int) { 45 | var intent: Intent? = null 46 | when (position) { 47 | NavigateConstant.GRAPH_PIE_CHART -> intent = Intent(this, PieGraphActivity::class.java) 48 | NavigateConstant.DOT_PROGRESS -> intent = Intent(this, DotProgressActivity::class.java) 49 | NavigateConstant.LINEAR_PROGRESS -> intent = Intent(this, LinearProgressActivity::class.java) 50 | NavigateConstant.GIT_HUB_WEB_PAGE -> { 51 | intent = Intent(Intent.ACTION_VIEW) 52 | intent.data = Uri.parse("https://github.com/sung2063") 53 | } 54 | } 55 | 56 | intent?.let { 57 | startActivity(intent) 58 | } 59 | } 60 | 61 | object NavigateConstant { 62 | const val GRAPH_PIE_CHART = 0 63 | const val DOT_PROGRESS = 1 64 | const val LINEAR_PROGRESS = 2 65 | const val GIT_HUB_WEB_PAGE = 3 66 | } 67 | } -------------------------------------------------------------------------------- /app/src/main/java/com/sung2063/tableau_app/adapter/MenuOptionRecyclerViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_app.adapter 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.ImageView 8 | import android.widget.TextView 9 | import androidx.constraintlayout.widget.ConstraintLayout 10 | import androidx.core.content.ContextCompat 11 | import androidx.core.graphics.drawable.DrawableCompat 12 | import androidx.recyclerview.widget.RecyclerView 13 | import com.sung2063.tableau_app.R 14 | import com.sung2063.tableau_app.model.MainOptionModel 15 | 16 | class MenuOptionRecyclerViewAdapter( 17 | private val context: Context, 18 | private val optionList: List 19 | ) : RecyclerView.Adapter() { 20 | 21 | private var layoutInflater: LayoutInflater = LayoutInflater.from(context) 22 | private lateinit var menuOptionListener: EventListener 23 | 24 | inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), 25 | View.OnClickListener { 26 | 27 | var clContainer: ConstraintLayout = itemView.findViewById(R.id.cl_container) 28 | var ivIcon: ImageView = itemView.findViewById(R.id.iv_icon) 29 | var tvTitle: TextView = itemView.findViewById(R.id.tv_title) 30 | var tvDescription: TextView = itemView.findViewById(R.id.tv_description) 31 | 32 | init { 33 | itemView.setOnClickListener(this) 34 | } 35 | 36 | override fun onClick(view: View?) { 37 | menuOptionListener.onMenuClicked(adapterPosition) 38 | } 39 | } 40 | 41 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { 42 | val view = layoutInflater.inflate(R.layout.menu_option_item, parent, false) 43 | return ViewHolder(view) 44 | } 45 | 46 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { 47 | val mainOptionData = optionList[position] 48 | val backgroundId = mainOptionData.backgroundId 49 | if (backgroundId != -1) { 50 | holder.clContainer.setBackgroundColor(backgroundId) 51 | } 52 | holder.ivIcon.setImageResource(mainOptionData.iconId) 53 | DrawableCompat.setTint( 54 | holder.ivIcon.drawable, 55 | ContextCompat.getColor(context, mainOptionData.iconColor) 56 | ) 57 | holder.tvTitle.text = mainOptionData.title 58 | holder.tvTitle.setTextColor(mainOptionData.textColorId) 59 | holder.tvDescription.text = mainOptionData.description 60 | holder.tvDescription.setTextColor(mainOptionData.textColorId) 61 | } 62 | 63 | override fun getItemCount(): Int { 64 | return optionList.size 65 | } 66 | 67 | fun setListener(listener: EventListener) { 68 | this.menuOptionListener = listener 69 | } 70 | 71 | interface EventListener { 72 | fun onMenuClicked(position: Int) 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /TableauLibrary/src/main/res/layout/linear_progress_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 19 | 20 | 29 | 30 | 37 | 38 | 45 | 46 | 55 | 56 | 66 | 67 | 77 | 78 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/progress/DotProgressView.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.progress 2 | 3 | import android.content.Context 4 | import android.util.AttributeSet 5 | import android.view.View 6 | import androidx.constraintlayout.widget.ConstraintLayout 7 | import androidx.recyclerview.widget.GridLayoutManager 8 | import androidx.recyclerview.widget.LinearLayoutManager 9 | import androidx.recyclerview.widget.RecyclerView 10 | import com.sung2063.tableau_library.R 11 | import com.sung2063.tableau_library.exception.IllegalArgumentException 12 | import com.sung2063.tableau_library.progress.adapter.DotProgressItemsAdapter 13 | import com.sung2063.tableau_library.progress.adapter.LinearProgressItemsAdapter 14 | import com.sung2063.tableau_library.progress.handler.DotProgressHandler 15 | import com.sung2063.tableau_library.progress.handler.LinearProgressHandler 16 | import com.sung2063.tableau_library.util.RegexTool 17 | 18 | class DotProgressView @JvmOverloads constructor( 19 | context: Context, 20 | attrs: AttributeSet? = null 21 | ) : ConstraintLayout(context, attrs) { 22 | 23 | // UI objects 24 | private var isUsingCommonColor: Boolean 25 | private var commonFilledColor: String? 26 | private var commonUnfilledColor: String? 27 | 28 | init { 29 | val typedArray = context.theme.obtainStyledAttributes(attrs, R.styleable.DotProgressView, 0, 0) 30 | isUsingCommonColor = typedArray.getBoolean(R.styleable.DotProgressView_useCommonColor, false) 31 | commonFilledColor = typedArray.getString(R.styleable.DotProgressView_filledColor) 32 | commonUnfilledColor = typedArray.getString(R.styleable.DotProgressView_unfilledColor) 33 | 34 | // Check conditions & exceptions 35 | if (commonFilledColor == null) { 36 | commonFilledColor = "#023047" // Default color 37 | } else if (!RegexTool.HEX_COLOR_CODE.toRegex() 38 | .matches(input = commonFilledColor.toString()) 39 | ) { 40 | throw IllegalArgumentException(context.getString(R.string.hex_color_code_illegal_error)) 41 | } 42 | 43 | if (commonUnfilledColor == null) { 44 | commonUnfilledColor = "#fbf8fa" // Default color 45 | } else if (!RegexTool.HEX_COLOR_CODE.toRegex() 46 | .matches(input = commonUnfilledColor.toString()) 47 | ) { 48 | throw IllegalArgumentException(context.getString(R.string.hex_color_code_illegal_error)) 49 | } 50 | } 51 | 52 | fun setHandler(_handler: DotProgressHandler) { 53 | 54 | View.inflate(context, R.layout.dot_progress_layout, this) 55 | val recyclerView: RecyclerView = findViewById(R.id.rv_dot_progress_list) 56 | 57 | // Get the data 58 | val adapter = DotProgressItemsAdapter(context, _handler.dataList, isUsingCommonColor, commonFilledColor, commonUnfilledColor) 59 | 60 | val gridLayoutManager = GridLayoutManager(context, _handler.dataList.size) 61 | recyclerView.layoutManager = gridLayoutManager 62 | recyclerView.adapter = adapter 63 | 64 | } 65 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/menu_option_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 24 | 25 | 31 | 32 | 41 | 42 | 53 | 54 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /TableauLibrary/src/main/java/com/sung2063/tableau_library/progress/LinearProgressView.kt: -------------------------------------------------------------------------------- 1 | package com.sung2063.tableau_library.progress 2 | 3 | import android.content.Context 4 | import android.util.AttributeSet 5 | import android.view.View 6 | import androidx.constraintlayout.widget.ConstraintLayout 7 | import androidx.recyclerview.widget.LinearLayoutManager 8 | import androidx.recyclerview.widget.RecyclerView 9 | import com.sung2063.tableau_library.R 10 | import com.sung2063.tableau_library.exception.IllegalArgumentException 11 | import com.sung2063.tableau_library.progress.adapter.LinearProgressItemsAdapter 12 | import com.sung2063.tableau_library.progress.handler.LinearProgressHandler 13 | import com.sung2063.tableau_library.util.RegexTool 14 | 15 | class LinearProgressView @JvmOverloads constructor( 16 | context: Context, 17 | attrs: AttributeSet? = null 18 | ) : ConstraintLayout(context, attrs) { 19 | 20 | // UI objects 21 | private var isUsingCommonColor: Boolean 22 | private var commonFilledColor: String? 23 | private var commonUnfilledColor: String? 24 | private var maxValue: Int 25 | 26 | init { 27 | val typedArray = 28 | context.theme.obtainStyledAttributes(attrs, R.styleable.LinearProgressView, 0, 0) 29 | isUsingCommonColor = 30 | typedArray.getBoolean(R.styleable.LinearProgressView_useCommonColor, false) 31 | commonFilledColor = typedArray.getString(R.styleable.LinearProgressView_filledColor) 32 | commonUnfilledColor = typedArray.getString(R.styleable.LinearProgressView_unfilledColor) 33 | maxValue = typedArray.getInteger(R.styleable.LinearProgressView_maxValue, 100) 34 | 35 | // Check conditions & exceptions 36 | if (commonFilledColor == null) { 37 | commonFilledColor = "#023047" // Default color 38 | } else if (!RegexTool.HEX_COLOR_CODE.toRegex() 39 | .matches(input = commonFilledColor.toString()) 40 | ) { 41 | throw IllegalArgumentException(context.getString(R.string.hex_color_code_illegal_error)) 42 | } 43 | 44 | if (commonUnfilledColor == null) { 45 | commonUnfilledColor = "#fbf8fa" // Default color 46 | } else if (!RegexTool.HEX_COLOR_CODE.toRegex() 47 | .matches(input = commonUnfilledColor.toString()) 48 | ) { 49 | throw IllegalArgumentException(context.getString(R.string.hex_color_code_illegal_error)) 50 | } 51 | } 52 | 53 | fun setHandler(_handler: LinearProgressHandler) { 54 | 55 | View.inflate(context, R.layout.linear_progress_layout, this) 56 | val recyclerView: RecyclerView = findViewById(R.id.rv_linear_progress_list) 57 | 58 | // Create a RecyclerView with user data 59 | val adapter = LinearProgressItemsAdapter( 60 | context, 61 | _handler.dataList, 62 | isUsingCommonColor, 63 | commonFilledColor, 64 | commonUnfilledColor, 65 | maxValue, 66 | _handler.space 67 | ) 68 | recyclerView.layoutManager = 69 | LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) 70 | recyclerView.adapter = adapter 71 | } 72 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 23 | 24 | 37 | 38 | 50 | 51 |