├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── dictionaries
│ └── alex.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── demo.apk
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── qwert2603
│ │ └── vector_integer_view_example
│ │ └── MainActivity.java
│ └── res
│ ├── layout
│ └── activity_main.xml
│ └── values
│ ├── dimens.xml
│ ├── integer.xml
│ └── styles.xml
├── art
├── device-2018-08-22-111118.png
├── device-2018-08-22-111149.png
├── device-2018-08-22-120319 (3).gif
├── device-2018-08-22-120319.gif
└── device-2018-08-22-124411.gif
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── qwert2603
│ │ │ ├── rename_viv.kt_xt
│ │ │ └── vector_integer_view
│ │ │ ├── DigitAdapter.java
│ │ │ ├── DigitItemAnimator.java
│ │ │ ├── Utils.java
│ │ │ └── VectorIntegerView.java
│ └── res
│ │ ├── drawable
│ │ ├── viv_asl_pathmorph_digits.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_0_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_1_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_2_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_3_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_4_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_5_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_6_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_7_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_8_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_m.xml
│ │ ├── viv_avd_pathmorph_digits_9_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_m_to_n.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_0.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_1.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_2.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_3.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_4.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_5.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_6.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_7.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_8.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_9.xml
│ │ ├── viv_avd_pathmorph_digits_n_to_m.xml
│ │ ├── viv_vd_pathmorph_digits_eight.xml
│ │ ├── viv_vd_pathmorph_digits_five.xml
│ │ ├── viv_vd_pathmorph_digits_four.xml
│ │ ├── viv_vd_pathmorph_digits_minus.xml
│ │ ├── viv_vd_pathmorph_digits_nine.xml
│ │ ├── viv_vd_pathmorph_digits_nth.xml
│ │ ├── viv_vd_pathmorph_digits_one.xml
│ │ ├── viv_vd_pathmorph_digits_seven.xml
│ │ ├── viv_vd_pathmorph_digits_six.xml
│ │ ├── viv_vd_pathmorph_digits_three.xml
│ │ ├── viv_vd_pathmorph_digits_two.xml
│ │ └── viv_vd_pathmorph_digits_zero.xml
│ │ ├── layout
│ │ ├── viv_item_digit.xml
│ │ └── viv_vector_digit_view.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── integer.xml
│ │ └── pathmorph_digits.xml
│ └── test
│ └── java
│ └── com
│ └── qwert2603
│ └── vector_integer_view
│ └── UtilsTest.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/codeStyles/Project.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 |
--------------------------------------------------------------------------------
/.idea/dictionaries/alex.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | qwert
5 | strokewidth
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.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 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VectorIntegerView
2 |
3 | [](https://jitpack.io/#qwert2603/VectorIntegerView)
4 |
5 | `VectorIntegerView` (viv) is custom view to display integers on Android via great animations `minSdkVersion 21`.
6 |
7 | Paths for vector drawables drawables are taken [here](https://github.com/alexjlockwood/adp-delightful-details).
8 |
9 | ## [Showcase video](https://www.youtube.com/watch?v=tTQlPH3ROMw)
10 |
11 | ## [Demo APK](https://github.com/qwert2603/VectorIntegerView/blob/master/app/demo.apk)
12 |
13 | ## Article on [Habr.com](https://habr.com/post/420919/)
14 |
15 | 
16 |
17 | ## Customizing
18 |
19 | ### `VectorIntegerView` has following XML-attributes:
20 |
21 | * ***viv_vector_integer*** initial integer to show (0 by default).
22 | * ***viv_digit_color*** color of integer (black by default).
23 |
24 | ### Other properties may be configured by overriding resourses from library:
25 | #### (those will be applied to all `VectorIntegerView` in app, for example see [demo-app](https://github.com/qwert2603/VectorIntegerView/tree/master/app))
26 |
27 | * ***@integer/viv_animation_duration*** defines duration of animation (400ms by default).
28 | * ***@dimen/viv_digit_size*** defines size of one digit (24dp by default).
29 | * ***@dimen/viv_digit_translateX*** applied to all avd-digits, to center them horizontally.
30 | * ***@dimen/viv_digit_translateY*** applied to all avd-digits, to center them vertically.
31 | * ***@dimen/viv_digit_strokewidth*** applied to all avd-digits.
32 | * ***@dimen/viv_digit_margin_horizontal*** applied to all digit-views (-3dp by default). This is needed to make horizontal spaces between digits smaller, because avd-digits are square.
33 |
34 | ## In code
35 | ### XML
36 | ```xml
37 |
44 | ```
45 |
46 | ### Java / Kotlin
47 | Digit can be set also via code as `BigInteger` as well as digit color:
48 | ```java
49 | final VectorIntegerView vectorIntegerView = findViewById(R.id.vectorIntegerView);
50 | vectorIntegerView.setInteger(
51 | vectorIntegerView.getInteger().add(BigInteger.ONE),
52 | /* animated = */ true
53 | );
54 | vectorIntegerView.setDigitColor(getColor(R.color.colorAccent));
55 | ```
56 | Also there is overloaded function that allows set integer as ```long```:
57 | ```java
58 | vectorIntegerView.setInteger(1918L, false);
59 | ```
60 | For example see [demo-app](https://github.com/qwert2603/VectorIntegerView/tree/master/app).
61 |
62 | ## Under the hood
63 |
64 | [`VectorIntegerView`](https://github.com/qwert2603/VectorIntegerView/blob/master/library/src/main/java/com/qwert2603/vector_integer_view/VectorIntegerView.java) is implemented by `RecyclerView` and each digit is `ImageView` with `` drawable.
65 |
66 | Animation are controlled by custom `RecyclerView`'s item animator: [`DigitItemAnimator`](https://github.com/qwert2603/VectorIntegerView/blob/master/library/src/main/java/com/qwert2603/vector_integer_view/DigitItemAnimator.java).
67 |
68 | When animated each digit stays on it's own position. This is done via `DiffUtil` in [`DigitAdapter`](https://github.com/qwert2603/VectorIntegerView/blob/master/library/src/main/java/com/qwert2603/vector_integer_view/DigitAdapter.java).
69 |
70 | ## Download
71 |
72 | ```
73 | allprojects {
74 | repositories {
75 | ...
76 | maven { url 'https://jitpack.io' }
77 | }
78 | }
79 | ```
80 |
81 | ```
82 | dependencies {
83 | implementation 'com.github.qwert2603:VectorIntegerView:x.y.z'
84 | }
85 | ```
86 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.qwert2603.vector_integer_view_example"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | }
12 | buildTypes {
13 | release {
14 | shrinkResources true
15 | minifyEnabled true
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation project(path: ':library')
23 | // implementation 'com.github.qwert2603:VectorIntegerView:1.2.1'
24 |
25 | ext.support_version = '28.0.0'
26 | implementation "com.android.support:appcompat-v7:$support_version"
27 | implementation "com.android.support:design:$support_version"
28 | }
29 |
--------------------------------------------------------------------------------
/app/demo.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qwert2603/VectorIntegerView/d7d87ae261ce7ffe88b00b3da5e4e8fbaa2e57a1/app/demo.apk
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/qwert2603/vector_integer_view_example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.qwert2603.vector_integer_view_example;
2 |
3 | import android.graphics.Color;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.CheckBox;
8 | import android.widget.EditText;
9 |
10 | import com.qwert2603.vector_integer_view.VectorIntegerView;
11 |
12 | import java.math.BigInteger;
13 |
14 | public class MainActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_main);
20 |
21 | final VectorIntegerView vectorIntegerView = findViewById(R.id.vectorIntegerView);
22 | final VectorIntegerView vectorIntegerView_2 = findViewById(R.id.vectorIntegerView_2);
23 | final CheckBox animateCheckBox = findViewById(R.id.animate_CheckBox);
24 |
25 | findViewById(R.id.plus_Button).setOnClickListener(new View.OnClickListener() {
26 | @Override
27 | public void onClick(View v) {
28 | vectorIntegerView.setInteger(
29 | vectorIntegerView.getInteger().add(BigInteger.ONE),
30 | /* animated = */ animateCheckBox.isChecked()
31 | );
32 | }
33 | });
34 | findViewById(R.id.minus_Button).setOnClickListener(new View.OnClickListener() {
35 | @Override
36 | public void onClick(View v) {
37 | vectorIntegerView.setInteger(
38 | vectorIntegerView.getInteger().subtract(BigInteger.ONE),
39 | animateCheckBox.isChecked()
40 | );
41 | }
42 | });
43 | findViewById(R.id.x17_Button).setOnClickListener(new View.OnClickListener() {
44 | @Override
45 | public void onClick(View v) {
46 | vectorIntegerView.setInteger(
47 | vectorIntegerView.getInteger().multiply(BigInteger.valueOf(17)),
48 | animateCheckBox.isChecked()
49 | );
50 | }
51 | });
52 | findViewById(R.id.setNumber_Button).setOnClickListener(new View.OnClickListener() {
53 | @Override
54 | public void onClick(View v) {
55 | long number = 0;
56 | try {
57 | number = Long.parseLong(((EditText) findViewById(R.id.number_EditText)).getText().toString());
58 | } catch (NumberFormatException ignored) {
59 | }
60 | vectorIntegerView.setInteger(number, animateCheckBox.isChecked());
61 | vectorIntegerView_2.setInteger(number, true);
62 | }
63 | });
64 | findViewById(R.id.red_Button).setOnClickListener(new View.OnClickListener() {
65 | @Override
66 | public void onClick(View v) {
67 | vectorIntegerView.setDigitColor(Color.RED);
68 | }
69 | });
70 | findViewById(R.id.green_Button).setOnClickListener(new View.OnClickListener() {
71 | @Override
72 | public void onClick(View v) {
73 | vectorIntegerView.setDigitColor(Color.GREEN);
74 | }
75 | });
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
21 |
22 |
29 |
30 |
31 |
32 |
41 |
42 |
47 |
48 |
53 |
54 |
60 |
61 |
62 |
63 |
68 |
69 |
75 |
76 |
82 |
83 |
88 |
89 |
90 |
91 |
96 |
97 |
103 |
104 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 22dp
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/integer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 500
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/art/device-2018-08-22-111118.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qwert2603/VectorIntegerView/d7d87ae261ce7ffe88b00b3da5e4e8fbaa2e57a1/art/device-2018-08-22-111118.png
--------------------------------------------------------------------------------
/art/device-2018-08-22-111149.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qwert2603/VectorIntegerView/d7d87ae261ce7ffe88b00b3da5e4e8fbaa2e57a1/art/device-2018-08-22-111149.png
--------------------------------------------------------------------------------
/art/device-2018-08-22-120319 (3).gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qwert2603/VectorIntegerView/d7d87ae261ce7ffe88b00b3da5e4e8fbaa2e57a1/art/device-2018-08-22-120319 (3).gif
--------------------------------------------------------------------------------
/art/device-2018-08-22-120319.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qwert2603/VectorIntegerView/d7d87ae261ce7ffe88b00b3da5e4e8fbaa2e57a1/art/device-2018-08-22-120319.gif
--------------------------------------------------------------------------------
/art/device-2018-08-22-124411.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qwert2603/VectorIntegerView/d7d87ae261ce7ffe88b00b3da5e4e8fbaa2e57a1/art/device-2018-08-22-124411.gif
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 |
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.2.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | maven { url 'https://jitpack.io' }
17 | }
18 | }
19 |
20 | task clean(type: Delete) {
21 | delete rootProject.buildDir
22 | }
23 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qwert2603/VectorIntegerView/d7d87ae261ce7ffe88b00b3da5e4e8fbaa2e57a1/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Aug 16 20:00:51 NOVT 2018
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-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | minSdkVersion 21
7 | targetSdkVersion 28
8 | versionCode 1
9 | versionName "1.0"
10 | }
11 |
12 | resourcePrefix 'viv'
13 |
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | ext.support_version = '28.0.0'
24 | ext.junit_version = '4.12'
25 |
26 | implementation "com.android.support:appcompat-v7:$support_version"
27 | implementation "com.android.support:design:$support_version"
28 |
29 | testImplementation "junit:junit:$junit_version"
30 | }
31 |
--------------------------------------------------------------------------------
/library/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 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/src/main/java/com/qwert2603/rename_viv.kt_xt:
--------------------------------------------------------------------------------
1 | import java.io.File
2 | import java.io.FileWriter
3 |
4 | fun main(args: Array) {
5 | val names = arrayOf(
6 | "zero", "one", "two", "three",
7 | "four", "five", "six", "seven",
8 | "eight", "nine", "nth", "minus"
9 | )
10 |
11 | fun getLetter(i: Int) = when (i) {
12 | in 0..9 -> i.toString()
13 | 10 -> "n"
14 | 11 -> "m"
15 | else -> null!!
16 | }
17 |
18 | val dirName = "viv_out"
19 | File(dirName).mkdir()
20 | for (from in 0..11) {
21 | for (to in 0..11) {
22 | if (from == to) continue
23 | FileWriter(File(dirName, "viv_avd_pathmorph_digits_${getLetter(from)}_to_${getLetter(to)}.xml")).use {
24 | it.write("""
25 |
26 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 | """.trimIndent())
45 | }
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/library/src/main/java/com/qwert2603/vector_integer_view/DigitAdapter.java:
--------------------------------------------------------------------------------
1 | package com.qwert2603.vector_integer_view;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.graphics.Color;
5 | import android.graphics.PorterDuff;
6 | import android.support.annotation.ColorInt;
7 | import android.support.annotation.IntRange;
8 | import android.support.annotation.NonNull;
9 | import android.support.v7.util.DiffUtil;
10 | import android.support.v7.widget.RecyclerView;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.ImageView;
15 |
16 | import java.math.BigInteger;
17 |
18 | class DigitAdapter extends RecyclerView.Adapter {
19 |
20 | @ColorInt
21 | private int digitColor = Color.BLACK;
22 |
23 | @NonNull
24 | private BigInteger mInteger = BigInteger.ZERO;
25 |
26 | @NonNull
27 | @SuppressLint("InflateParams")
28 | @Override
29 | public DigitViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
30 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.viv_item_digit, parent, false);
31 | ImageView imageView = view.findViewById(R.id.viv_img);
32 | imageView.setColorFilter(digitColor, PorterDuff.Mode.SRC_ATOP);
33 | return new DigitViewHolder(view);
34 | }
35 |
36 | @Override
37 | public void onBindViewHolder(@NonNull DigitViewHolder holder, int position) {
38 | holder.setDigit(Utils.getDigitAt(mInteger, position));
39 | holder.setDigitColor(digitColor);
40 | }
41 |
42 | @Override
43 | public int getItemCount() {
44 | return Utils.getDigitCount(mInteger);
45 | }
46 |
47 | @NonNull
48 | BigInteger getInteger() {
49 | return mInteger;
50 | }
51 |
52 | void setInteger(@NonNull final BigInteger integer) {
53 | final BigInteger old = mInteger;
54 | mInteger = integer;
55 | DiffUtil.calculateDiff(new DiffUtil.Callback() {
56 | @Override
57 | public int getOldListSize() {
58 | return Utils.getDigitCount(old);
59 | }
60 |
61 | @Override
62 | public int getNewListSize() {
63 | return Utils.getDigitCount(integer);
64 | }
65 |
66 | @Override
67 | public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
68 | if (oldItemPosition == 0 && Utils.getDigitAt(old, 0) == VectorIntegerView.DIGIT_MINUS) {
69 | return Utils.getDigitAt(integer, newItemPosition) == VectorIntegerView.DIGIT_MINUS;
70 | }
71 | if (newItemPosition == 0 && Utils.getDigitAt(integer, 0) == VectorIntegerView.DIGIT_MINUS) {
72 | return Utils.getDigitAt(old, oldItemPosition) == VectorIntegerView.DIGIT_MINUS;
73 | }
74 | return getOldListSize() - oldItemPosition == getNewListSize() - newItemPosition;
75 | }
76 |
77 | @Override
78 | public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
79 | return Utils.getDigitAt(old, oldItemPosition) == Utils.getDigitAt(integer, newItemPosition);
80 | }
81 | }, true).dispatchUpdatesTo(this);
82 | }
83 |
84 | @ColorInt
85 | public int getDigitColor() {
86 | return digitColor;
87 | }
88 |
89 | public void setDigitColor(@ColorInt int digitColor) {
90 | this.digitColor = digitColor;
91 | notifyItemRangeChanged(0, getItemCount());
92 | }
93 |
94 | private static final int[] ATTRS = {
95 | R.attr.viv_state_zero,
96 | R.attr.viv_state_one,
97 | R.attr.viv_state_two,
98 | R.attr.viv_state_three,
99 | R.attr.viv_state_four,
100 | R.attr.viv_state_five,
101 | R.attr.viv_state_six,
102 | R.attr.viv_state_seven,
103 | R.attr.viv_state_eight,
104 | R.attr.viv_state_nine,
105 | R.attr.viv_state_nth,
106 | R.attr.viv_state_minus,
107 | };
108 |
109 | static class DigitViewHolder extends RecyclerView.ViewHolder {
110 | ImageView mImageView;
111 |
112 | @IntRange(from = 0, to = VectorIntegerView.MAX_DIGIT)
113 | int d;
114 |
115 | DigitViewHolder(View itemView) {
116 | super(itemView);
117 | mImageView = itemView.findViewById(R.id.viv_img);
118 | }
119 |
120 | void setDigit(@IntRange(from = 0, to = VectorIntegerView.MAX_DIGIT) int digit) {
121 | d = digit;
122 |
123 | int[] state = new int[ATTRS.length];
124 |
125 | for (int i = 0; i < ATTRS.length; i++) {
126 | if (i == digit) {
127 | state[i] = ATTRS[i];
128 | } else {
129 | state[i] = -ATTRS[i];
130 | }
131 | }
132 |
133 | mImageView.setImageState(state, true);
134 | }
135 |
136 | void setDigitColor(@ColorInt int color) {
137 | mImageView.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
138 | }
139 | }
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/library/src/main/java/com/qwert2603/vector_integer_view/DigitItemAnimator.java:
--------------------------------------------------------------------------------
1 | package com.qwert2603.vector_integer_view;
2 |
3 | import android.content.res.Resources;
4 | import android.support.annotation.IntRange;
5 | import android.support.annotation.NonNull;
6 | import android.support.v7.widget.DefaultItemAnimator;
7 | import android.support.v7.widget.RecyclerView;
8 |
9 | import java.util.List;
10 |
11 | class DigitItemAnimator extends DefaultItemAnimator {
12 |
13 | private final int animationDuration;
14 |
15 | private static class VHI extends RecyclerView.ItemAnimator.ItemHolderInfo {
16 | @IntRange(from = 0, to = VectorIntegerView.MAX_DIGIT) final int d;
17 |
18 | VHI(@IntRange(from = 0, to = VectorIntegerView.MAX_DIGIT) int d) {
19 | this.d = d;
20 | }
21 | }
22 |
23 | DigitItemAnimator(@NonNull Resources resources) {
24 | animationDuration = resources.getInteger(R.integer.viv_animation_duration);
25 | }
26 |
27 | @Override
28 | public long getMoveDuration() {
29 | return animationDuration;
30 | }
31 |
32 | @Override
33 | public long getAddDuration() {
34 | return animationDuration;
35 | }
36 |
37 | @Override
38 | public long getRemoveDuration() {
39 | return animationDuration;
40 | }
41 |
42 | @Override
43 | public long getChangeDuration() {
44 | return animationDuration;
45 | }
46 |
47 | @Override
48 | public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, @NonNull List