by Дмитрий Песков
Automatically scans and renames Pokemon with Calcy IV. Requires Automate Premium (>30 blocks)! Requires root on Android versions before 7!
Start Pokemon Go and Calcy IV.
Start the flow.
Open the first Pokemon to rename.
Click the "Calcy IV auto rename" notification to start.
Click the notification again or switch to another app to stop.
* Uses Android intents to interact with Calcy IV. Doesn't use floating button.
* Doesn't use appraisal. IMHO speed is more important than knowing the exact stats of ~50%IV Pidgey. If you find something worth a closer look, scan it manually afterwards.
* Doesn't rename properly named Pokemon. See below details on tuning this for your own naming scheme.
* Retries incomplete scans (e. g. Lugia's head covering CP value) while "nagging" the Pokemon with repeated clicks to give Calcy IV a better chance of scanning it successfully in motion. Works great with legendaries and other large Pokemon whose body parts often obstruct the view. If scan fails completely (e. g. Pokemon is defending a gym), proceeds to the next one.
MORE TECHNICAL DETAILS
* Tested on ZTE Axon 9 Pro (Qualcomm Snapdragon 845, 1080x2248).
* Slower phones may require longer delays after clicks and swipes. For me 0.5s is usually enough. The delay after clicking the OK button in rename dialog is longer (1.5s) because communicating with the game server adds latency. The delay between repeated clicks on Pokemon while retrying the scan is also longer (2s) to give it enough time to complete its animation.
* Phones with different screen width to height ratio may require tweaking click coordinates. The X coord for all clicks is 50% and it is unlikely to change. For convenience the Y coords are defined as the following variables:
y_name - Pokemon name. Click here opens the rename dialog. Another click here dismisses the on-screen keyboard.
y_ok - OK button in the rename dialog. Click here confirms renaming.
y_pokemon - Pokemon itself. Click here to "nag" it so that Calcy IV has a better view of its stats.
* To prevent the flow from stopping when the on-screen keyboard steals focus from Pokemon Go an additional check is performed upon focus loss - foreground app name is compared to known on-screen keyboards. Gboard and SwiftKey are known out of the box. If you use some other keyboard, modify this check. Look for the "Expression true?" block where the "fg_app" variable is checked.
* To prevent the flow from renaming properly named Pokemon their names are first checked against a regular expression. If the name matches, it is left unchanged. This allows you to name Pokemon manually without worrying about overwriting their names automatically. This also prevents the flow from retrying failed scans of properly named Pokemon. I use "IV/Combs/Attacks" format. If you use a different naming scheme, modify the regexp to match your needs. Look for the "Expression true?" block where the "old_name" variable is matched against a regexp.