Some time ago, I wrote about the ridiculous testing method,
"But are you not a goat, user?" . Today I discovered another funny method for the new Android 8.0.
Purely accidentally re-read the documentation for the
Chronometer component. I discovered that new methods appeared in API 24 that allow the chronometer to work in the countdown mode. He began to check, wrote a simple example. Everything is working. The code is trivial, I will not give here.
And then the eye caught on another new method that was added to API 26 -
isFinalCountDown () . The description of the method was very meager -
whether this is the final countdown . For some reason I thought that with its help you can determine the moment when the counter in the chronometer will be equal to 00:00. Although it seems possible to arrange such a check yourself. Strange. Decided to call the method at the click of a button. Launched on the emulator.
public void onClick(View view) { mChronometer.isTheFinalCountDown(); }
The effect was unexpected. Suddenly, the Youtube application is launched and the Europe's last reading song starts playing in it. At first, I thought it was some kind of glitch and I clicked somewhere wrong. But surprised by the coincidence of the name of the song with the method. Launched again - the video starts again. Became interesting. I started looking for Android 8.0 sources and found
this place .
')
public boolean isTheFinalCountDown() { try { getContext().startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("https://youtu.be/9jK-NcRmVcw")) .addCategory(Intent.CATEGORY_BROWSABLE) .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT)); return true; } catch (Exception e) { return false; } }
The method contains the address of the video on YouTube, which is launched using the
Intent mechanism.
Screenshot of the running video:
