├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── androidchils │ │ └── odometerlibrary │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ ├── Lato-Black.ttf │ │ ├── Lato-BlackItalic.ttf │ │ ├── Lato-Bold.ttf │ │ ├── Lato-BoldItalic.ttf │ │ ├── Lato-Hairline.ttf │ │ ├── Lato-HairlineItalic.ttf │ │ ├── Lato-Italic.ttf │ │ ├── Lato-Light.ttf │ │ ├── Lato-LightItalic.ttf │ │ ├── Lato-Regular.ttf │ │ ├── Screenshot 2.png │ │ ├── Screenshot 3.png │ │ └── screenshot 1.png │ ├── java │ │ └── com │ │ │ └── androidchils │ │ │ └── odometerlibrary │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.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 │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── androidchils │ └── odometerlibrary │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── odometer ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── androidchils │ │ └── odometer │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ ├── Lato-Black.ttf │ │ ├── Lato-BlackItalic.ttf │ │ ├── Lato-Bold.ttf │ │ ├── Lato-BoldItalic.ttf │ │ ├── Lato-Hairline.ttf │ │ ├── Lato-HairlineItalic.ttf │ │ ├── Lato-Italic.ttf │ │ ├── Lato-Light.ttf │ │ ├── Lato-LightItalic.ttf │ │ └── Lato-Regular.ttf │ ├── java │ │ └── com │ │ │ └── androidchils │ │ │ └── odometer │ │ │ ├── NumberPicker.java │ │ │ └── Odometer.java │ └── res │ │ ├── drawable │ │ ├── gradient.xml │ │ └── np_numberpicker_selection_divider.9.png │ │ ├── layout │ │ ├── number_picker.xml │ │ └── number_picker_selector_wheel.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── color.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── androidchils │ └── odometer │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 35 | 36 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Odometer 2 | This is an Android Library for making Odometer with little customization with reading, slots, colors, font and size. 3 |
4 | Example is available in app module. 5 | 6 |

7 | 8 | 9 | 10 | 11 | screenshot 12 | 13 | screenshot 14 | 15 |

16 | 17 | 18 | 19 | ## Download 20 | 21 | ### Gradle dependency: 22 | - Add the following to your project level build.gradle: 23 | ~~~ 24 | repositories { 25 | maven { 26 | url "https://jitpack.io" 27 | } 28 | } 29 | ~~~ 30 | - Add this to your app build.gradle: 31 | ~~~ 32 | dependencies { 33 | compile 'com.github.Chils17:OdometerLibrary:687d5ac1e9' 34 | } 35 | ~~~ 36 | 37 | 38 | 39 | ## Usage 40 | 41 | ### Xml 42 | - Create Odometer with their properties.
43 | ~~~ 44 | 47 | 48 | 49 | ~~~ 50 | 51 | - Add EdgeColor of Odometer
52 | ~~~ 53 | chils:np_edgeColor="@android:color/white" 54 | ~~~ 55 | 56 | - Add CenterColor of Odometer
57 | ~~~ 58 | chils:np_centerColor="@android:color/black" 59 | ~~~ 60 | 61 | - Add Reading
62 | Reading is the values that you want to show. 63 | ~~~ 64 | chils:np_reading="0000" 65 | ~~~ 66 | 67 | - Add Slots
68 | Slots means that how many slots you want to create. 69 | ~~~ 70 | chils:np_slots="4" 71 | ~~~ 72 | 73 | - Add TextColor
74 | ~~~ 75 | chils:np_textColor="@color/white" 76 | ~~~ 77 | 78 | - Add TextSize
79 | ~~~ 80 | chils:np_textSize="18sp" 81 | ~~~ 82 | 83 | - Add custom font from .ttf. Put your .ttf file at assets\fonts. Font will apply everywhere title, content, buttons
84 | ~~~ 85 | chils:np_font="@string/lato_regular" 86 | ~~~ 87 | 88 | - Those attributes necessary to add reading and slots together in Odometer
89 | ~~~ 90 | chils:np_reading="0000" 91 | chils:np_slots="4" 92 | ~~~ 93 | 94 | ### Odometer 95 | 96 | - You can even use the Odometer alone.
97 | ~~~ 98 | 109 | ~~~ 110 | 111 | ### Java 112 | 113 | - Create Builder for default Odometer.
114 | Its necessary to add odometer in the layout. 115 | ~~~ 116 | Odometer odometer=new Odometer.Builder(this) 117 | .build(); 118 | ((LinearLayout) findViewById(R.id.linear)).addView(odometer); 119 | ~~~ 120 | 121 | 122 | - Add Customize Color
`.background(int odo_edge_color, int odo_center_color)` 123 | ~~~ 124 | Odometer odometer=new Odometer.Builder(this) 125 | .background(ContextCompat.getColor(this, R.color.white), ContextCompat.getColor(this, R.color.black)) 126 | .build(); 127 | ((LinearLayout) findViewById(R.id.linear)).addView(odometer); 128 | ~~~ 129 | 130 | 131 | - Add custom font from .ttf. Put your .ttf file at assets\fonts.
132 | Font will apply in odometer number.
133 | `.font(String font)` 134 | ~~~ 135 | Odometer odometer=new Odometer.Builder(this) 136 | .background(ContextCompat.getColor(this, R.color.white), ContextCompat.getColor(this, R.color.black)) 137 | .font(getString(R.string.lato_regular)) 138 | .build(); 139 | ((LinearLayout) findViewById(R.id.linear)).addView(odometer); 140 | ~~~ 141 | 142 | - Add reading to set the value of odometer.
143 | It is essential of both reading and slot have to be equal in length.
144 | `.reading(String reading)` 145 | ~~~ 146 | Odometer odometer=new Odometer.Builder(this) 147 | .background(ContextCompat.getColor(this, R.color.white), ContextCompat.getColor(this, R.color.black)) 148 | .font(getString(R.string.lato_regular)) 149 | .reading("1234") 150 | .build(); 151 | ((LinearLayout) findViewById(R.id.linear)).addView(odometer); 152 | ~~~ 153 | 154 | - Add slot.
155 | It is essential of both reading and slot have to be equal in length.
156 | `.slot(int slot)` 157 | ~~~ 158 | Odometer odometer = new Odometer.Builder(this) 159 | .background(ContextCompat.getColor(this, R.color.white), ContextCompat.getColor(this, R.color.black)) 160 | .font(getString(R.string.lato_regular)) 161 | .reading("1234") 162 | .slot(4) 163 | .build(); 164 | ((LinearLayout) findViewById(R.id.linear)).addView(odometer); 165 | ~~~ 166 | 167 | - Add text color.
168 | `.textColor(int odo_text_color)` 169 | ~~~ 170 | Odometer odometer = new Odometer.Builder(this) 171 | .background(ContextCompat.getColor(this, R.color.white), ContextCompat.getColor(this, R.color.black)) 172 | .font(getString(R.string.lato_regular)) 173 | .reading("1234") 174 | .slot(4) 175 | .textColor(ContextCompat.getColor(this, R.color.white)) 176 | .build(); 177 | ((LinearLayout) findViewById(R.id.linear)).addView(odometer); 178 | ~~~ 179 | 180 | - Add text size.
181 | `.textSize(float textSize)` 182 | ~~~ 183 | Odometer odometer = new Odometer.Builder(this) 184 | .background(ContextCompat.getColor(this, R.color.white), ContextCompat.getColor(this, R.color.black)) 185 | .font(getString(R.string.lato_regular)) 186 | .reading("1234") 187 | .slot(4) 188 | .textColor(ContextCompat.getColor(this, R.color.white)) 189 | .textSize(18) 190 | .build(); 191 | ((LinearLayout) findViewById(R.id.linear)).addView(odometer); 192 | ~~~ 193 | 194 | ### Layout Customization 195 | 196 | If you want to get the value of Odometer scrolling value you can create your own. 197 | 198 | Note: You can see an example layout in both sample and library modules. 199 | 200 | Example XML layout: 201 | ~~~ 202 | 210 | 211 |