【Google Admob】Inline Adaptive Banner (インラインアダプティブバナー)

今、現在日本語での説明ページはありませんが登場しています。

Inline adaptive banners

👉 Inline adaptive banners  |  Android  |  Google Developers 

 

特徴

バナーの幅を指定する。画面全幅に最適。

バナーの高さがこれまでのアダプティブバナーより大きくなる。最大値で制限も可能。

スクロールする画面にも配置できる。

300x250 サイズのバナーの代替を担うのでしょうか。

スクロールする縦長の文章画面などにいいと思われます。

 

実装

変わるのは AdSize の取得部分のみ。


// Adaptive Banner
adSize = AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(context, 320)

↓

// Inline Adaptive Banner
adSize = AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(context, 320)

その他はすべて、これまでの Admob アダプティブバナー実装と同じ。

AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize
👉 顔文字/絵文字辞書 単語リスト - Google Play のアプリ 

最近、SDK APIの仕様設計とか説明とか雑になってないか。

👉 公式 android デベロッパー の英語ページに日本語ページが遅れてる件 hatena-bookmark


Day/Night テーマ切替時に Vector Drawables アイコンの色を自動変更させたい

Vector Drawableの各パスの色は、XML形式の一部として


android:fillColor="..."

という形式で定義されています。

これは、


android:fillColor="@color/colorPrimary"

などのカラーリソース や、


android:fillColor="?attr/colorControlNormal"

などのテーマ属性 に対応しています。


<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportHeight="24.0"
    android:viewportWidth="24.0">
    <path
        android:fillColor="?attr/colorControlNormal"
        android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
    <path
        android:fillColor="?attr/colorControlNormal"
        android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
</vector>

colorControlNormal 属性は Day/Night テーマのデフォルトです。

👉 Combining Vector Drawables with Day/Night Theme | by Tim Mutton | Medium 

 

まとめ

以下のように、Day/Night テーマ変更時にアイコンの色を変化させるには、

Day/Night theme Vector Drawables

Vector Drawable 内


<path
    android:fillColor="?attr/colorControlNormal"
    ...

とするとよい。


Rx の Hot が扱うのは State か Event か

RxのHotとColdについて
👉 RxのHotとColdについて - Qiita 

 

なかなか理屈ではくっきり区別しづらくなってきたような気がしています。

kotlin や swift でいうところの

Rx の Hot。

検索キーワードとして

ざっくりと2つに分ける。

 

State


ConflatedBroatcastChannel (Kotlin - Channel)

  ↓

StateFlow (Kotlin - Flow)


BehaviorSubject (RxSwift/RxJava)

  ↓

BehaviorRelay (RxRelay/RxCoCoa)

  ↓

Driver (RxCocoa)

 

Event


BroadcastChannel (Kotlin - Channel)

  ↓

SharedFlow (Kotlin - Flow)


PublishSubject (RxSwift/RxJava)

  ↓

PublishRelay (RxRelay/RxCoCoa)

  ↓

Signal (RxCocoa)

 

まとめ

最近では日本語だけの検索では情報が足りません。

iOS ↔ Android 間の意味合いを考えながら、

まずは、

扱うのが State か Event か、を区別すると理解しやすいと思います。

 

👉 com.jakewharton.rxrelay2 (RxRelay 2.0.0 API) 
👉 ReactiveX/RxSwift: Reactive Programming in Swift 
👉 【RxSwift】BehaviorRelayとPublishRelayについてまとめてみた 
👉 RxSwiftのSubjectとRelayについて理解する - Qiita 
👉 関数型プログラマのための Rx 入門(前編) - Okapies' Archive 
👉 RxSwift/RxRelay at main · ReactiveX/RxSwift 
👉 RxSwift(RxCocoa) における Subject・Relay を理解する - iOSエンジニアのつぶやき 
👉 「Rx」の検索結果 - Qiita 

👉 [B!] Rx の Hot が扱うのは State か Event か