Skip to content

Instantly share code, notes, and snippets.

// inspired by http://www.andreamaglie.com/rxjava-listener-to-observable/
interface ValueUpdateListener {
fun onValueChanged(value: String)
}
class ValueUpdater {
fun registerListener(listener: ValueUpdateListener) {
// ...
}
@ookami-kb
ookami-kb / script.sh
Created July 27, 2016 10:24
ValueError: unknown locale: UTF-8
# Добавляем в ~/.bashrc следующие строки:
export LANG="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
class RoundedImageView(context: Context, attributeSet: AttributeSet?) : View(context, attributeSet), Target {
constructor(context: Context) : this(context, null)
private var drawable: Drawable? = null
set(value) {
field = value
postInvalidate()
}
fun loadImage(url: String?) {
#!/bin/sh
set -e
export PATH=$BUILD_SOURCESDIRECTORY/flutter/bin:$BUILD_SOURCESDIRECTORY/flutter/bin/cache/dart-sdk/bin:$PATH
# All scripts will be placed here
"$@"
@ookami-kb
ookami-kb / 01.sh
Last active June 14, 2020 21:11
flutter-azure-ci
#!/bin/sh
set -e
export PATH=$BUILD_SOURCESDIRECTORY/flutter/bin:$BUILD_SOURCESDIRECTORY/flutter/bin/cache/dart-sdk/bin:$PATH
# All scripts will be placed here
"$@"
install_flutter() {
git clone -b stable https://github.com/flutter/flutter.git
flutter precache
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
flutter doctor
}
launch_avd() {
echo "Installing SDK"
$ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-29;default;x86'
echo "Creating emulator"
$ANDROID_HOME/tools/bin/avdmanager create avd -n "pixel" --device "pixel" -k "system-images;android-29;default;x86"
echo "Starting emulator"
$ANDROID_HOME/emulator/emulator -avd "pixel" -no-snapshot &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
start_recording() {
# Each video is 3 minutes max, so 5 videos will give us up to 15 minutes,
# should be enough for test
$ANDROID_HOME/platform-tools/adb shell mkdir /sdcard/video
$ANDROID_HOME/platform-tools/adb shell screenrecord /sdcard/video/1.mp4
$ANDROID_HOME/platform-tools/adb shell screenrecord /sdcard/video/2.mp4
$ANDROID_HOME/platform-tools/adb shell screenrecord /sdcard/video/3.mp4
$ANDROID_HOME/platform-tools/adb shell screenrecord /sdcard/video/4.mp4
$ANDROID_HOME/platform-tools/adb shell screenrecord /sdcard/video/5.mp4
}
flutter_test() {
flutter packages get
flutter packages pub run build_runner build
flutter test
launch_avd
start_recording &
flutter drive --target=test_driver/app.dart
pkill -f screenrecord || true
pull_video() {
$ANDROID_HOME/platform-tools/adb pull /sdcard/video $BUILD_SOURCESDIRECTORY/screenshots
}