ObjectAnimator change text color with repeat and reverse

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // ...

        TextView notPaidText = findViewById(R.id.not_paid);
        ObjectAnimator colorAnim = ObjectAnimator.ofInt(
                notPaidText,
                "textColor",
                Color.parseColor("#50ff0000"),
                Color.parseColor("#00ffffff")
        );
        colorAnim.setEvaluator(new ArgbEvaluator());
        colorAnim.setDuration(10000);
        TimeInterpolator baseInterpolator = colorAnim.getInterpolator();
        colorAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (animation.getInterpolator() instanceof AccelerateDecelerateInterpolator) {
                    animation.setInterpolator(new ReverseInterpolator());
                } else {
                    animation.setInterpolator(baseInterpolator);
                }
                animation.start();
            }
        });
        colorAnim.start();
    }

    public class ReverseInterpolator implements Interpolator {

        private final Interpolator delegate;

        public ReverseInterpolator(Interpolator delegate) {
            this.delegate = delegate;
        }

        public ReverseInterpolator() {
            this(new LinearInterpolator());
        }

        @Override
        public float getInterpolation(float input) {
            return 1 - delegate.getInterpolation(input);
        }
    }
}

Get current Activity name by adb shell

Here is the command:

adb shell "dumpsys window windows | grep -E 'mCurrentFocus'"

The output would be:

mCurrentFocus=Window{b6a99d1d0 u0 com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity}

My activity name is: LauncherActivity

create RainbowSpan effect

public class RainbowSpan extends CharacterStyle implements UpdateAppearance {
    private final int[] colors;

    public RainbowSpan(Context context) {
        colors = new int[]{
                Color.parseColor("#FF0033"),
                Color.parseColor("#FF8000"),
                Color.parseColor("#FFE600"),
                Color.parseColor("#1AB34D"),
                Color.parseColor("#1A66FF"),
                Color.parseColor("#801AB3")
        };
    }

    @Override
    public void updateDrawState(TextPaint paint) {
        paint.setStyle(Paint.Style.FILL);
        Shader shader = new LinearGradient(
                0, 0, 0,
                paint.getTextSize() * colors.length,
                colors, null,
                Shader.TileMode.MIRROR);
        Matrix matrix = new Matrix();
        matrix.setRotate(90);
        shader.setLocalMatrix(matrix);
        paint.setShader(shader);
    }
}

Raspberry Pi – what Raspberry Pi I have?

All You need is to call in terminal this:

grep Revision /proc/cpuinfo

After You get something like this:

Revision : a22082

Go to page https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md

and search it in text.

Below is a list of information dated as of 08/02/2019 :

CodeModelRevisionRAMManufacturer
900021A+1.1512 MBSony UK
900032B+1.2512 MBSony UK
900092Zero1.2512 MBSony UK
900093Zero1.3512 MBSony UK
9000c1Zero W1.1512 MBSony UK
9020e03A+1.0512 MBSony UK
920092Zero1.2512 MBEmbest
920093Zero1.3512 MBEmbest
a010402B1.01 GBSony UK
a010412B1.11 GBSony UK
a020823B1.21 GBSony UK
a020a0CM31.01 GBSony UK
a020d33B+1.31 GBSony UK
a210412B1.11 GBEmbest
a220422B (with BCM2837)1.21 GBEmbest
a220823B1.21 GBEmbest
a220a0CM31.01 GBEmbest
a320823B1.21 GBSony Japan
a520823B1.21 GBStadium
a02100CM3+1.01 GBSony UK