画像読み込みライブラリ「COIL」

Glide や Picasso のような画像読み込みライブラリです。

COroutine
Image
Loader

の略だそうです。

以下の特徴を持っており、ナウい感じです。

- 拡張関数、ラムダなどKotlinの持つ機能を活用。
- コルーチンを利用。
- ディスクキャッシュとストリームバッファリング機能。
- androidx.lifecycle に対応。
- 軽量。
- R8対応。ルール不要。

👉 Introducing Coil: Kotlin-first image loading on Android 

記述例です。


// To load an image into an ImageView, use the load extension function.
imageView.load("https://www.example.com/image.jpg")

// Coil supports urls, uris, resources, drawables, bitmaps, files, and more.
imageView.load(R.drawable.image)

imageView.load(File("/path/to/image.jpg"))

imageView.load(Uri.parse("content://com.android.externalstorage/image.jpg"))

// Requests can be configured with an optional trailing lambda.
imageView.load("https://www.example.com/image.jpg") {
    crossfade(true)
    placeholder(R.drawable.image)
    transformations(CircleCropTransformation())
}

// Custom targets can be created using lambda syntax (onStart and onError are optional).
Coil.load(context, "https://www.example.com/image.jpg") {
    target { drawable ->
        // Handle the successful result.
    }
}

// To get an image imperatively, use the get suspend function.
val drawable = Coil.get("https://www.example.com/image.jpg")

👉 GitHub - coil-kt/coil: Image loading for Android backed by Kotlin Coroutines. 

パフォーマンスを Glide や Picasso と比較した記事がありますが、まあまあのようです。

Coil is a new library, so its performance may increase in the next versions. We are comparing it with mature libraries, so let’s see how it evolves.

Coil は新しいライブラリであるため、次のバージョンでパフォーマンスが向上する可能性があります。成熟したライブラリと比較しているので、どのように進化するか見ておきましょう。

👉 Coil vs Picasso vs Glide: Get Ready… Go! - ProAndroidDev 

ちなみに、必要環境は以下。

- AndroidX
- Min SDK 14+
- Compile SDK: 28+
- Java 8+

今後に期待できますかね。


Studio does not have write access to /private/var/folders/Android Studio.app/Contents. Please run it by a privileged user to update. で Android Studio が更新できない。

これ。

Studio does not have write access to /private/var/folders/Android Studio.app/Contents. Please run it by a privileged user to update.

と表示されて、新バージョンに更新できません。

Toolbox App のトッラカーにて。

👉 Android 3.5.0 not available many hours after release : TBX-3894 

Toolbox App 公式ブログ。


👉 JetBrains Toolbox 2019.2 | JetBrains Blog 

こういうところで、Google と JetBrains 間で微妙にズレちゃうんでしょう。

今現在私のMac版は最新で。

Toolbox App 側が更新されるのをじっと待つのが吉でしょうな。

追記:2019-08-21 20:07

Toolbox App のバージョンはそのままだけども、Android Studio 3.4 の「UPDATE」ボタンが有効になって3.5へのアップデートが可能となりました!

そして、何度かのダイアログ「OK」→「Restart」を経てやっとアップデート完了できましたとさ。

👉 さらば proguard、ようこそ R8。 

(👉つづく...)


「Google Go」からの読み上げ機能が楽ちん!

👉 軽量版Googleアプリ「Google Go」、日本を含む世界で公開 音声読み上げ機能も - ITmedia NEWS 

カメラ起動からでは見えない「読み上げ機能」が分かりやすく使いやすく利用できるようになります。

ここでは、パソコンのディスプレイに写ったブラウザ上の英文を読み上げしてみました。



英文のまま読み上げたり、日本語に翻訳して読み上げたり、単語を選択して辞書を開いたりできます。

👉 Google Go: A lighter, faster way to search - Google Play のアプリ