Upgrade to Pro — share decks privately, control downloads, hide ads and more …

今さら角丸のTransition

magiepooh
September 27, 2019

 今さら角丸のTransition

Rounded Image Transition

magiepooh

September 27, 2019
Tweet

More Decks by magiepooh

Other Decks in Programming

Transcript

  1. 今さら⾓丸画像のTransition
    2019/09/27

    View full-size slide

  2. • ふじたく @magie_pooh
    • Androider
    • ⾁、酒、マジック、催眠術、T
    シャツ作り(とんぼやーじゅ)
    ⾃⼰紹介

    View full-size slide

  3. 今さら⾓丸画像のTransition
    2019/09/27

    View full-size slide

  4. おかわりいただけただろうか?
    もう⼀度ごはんいただこう

    View full-size slide

  5. ⾓がピコンってなってるのを
    どうにかしたいッ・・・!

    View full-size slide

  6. 1. ⾓丸のImageViewを作る
    2. 遷移元、遷移先で⾓丸のImageViewを使う
    3. Transitionしながら⾓丸を調整する
    対応⽅法(特殊ですがこの⽅法でやりたいのです)

    View full-size slide

  7. ⾓丸のImageViewを作る

    View full-size slide

  8. 省略
    CardViewの内部で使われている
    RoundRectDrawableを使うと作りやすいよ。

    コードは以下に置いてます。

    https://github.com/magiepooh/ImageTransitionSample

    View full-size slide

  9. android:id="@+id/image1"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:flo_top_left_radius="@dimen/radius_card"
    app:flo_top_right_radius="@dimen/radius_card"
    android:src="@drawable/mountain"
    app:layout_constraintDimensionRatio="H,400:267"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    />

    View full-size slide

  10. 遷移元、遷移先で⾓丸の
    ImageViewを使う

    View full-size slide

  11. android:id="@+id/image1"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:flo_top_left_radius="@dimen/radius_card"
    app:flo_top_right_radius="@dimen/radius_card"
    android:src="@drawable/mountain"
    app:layout_constraintDimensionRatio="H,400:267"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    />
    android:id="@+id/header"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:src="@drawable/mountain"
    app:flo_top_left_radius="@dimen/radius_card"
    app:flo_top_right_radius="@dimen/radius_card"
    app:layout_constraintDimensionRatio="H,400:267"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    />
    ؙ֯͸͓ͳ͡ʹ͓ͯ͘͠

    View full-size slide

  12. Transitionしながら
    ⾓丸を調整する

    View full-size slide







  13. IUUQTHJUIVCDPNBPTQNJSSPSQMBUGPSN@GSBNFXPSLT@CBTFCMPCMPMMJQPQSFMFBTFDPSFSFTSFTUSBOTJUJPONPWFYNM

    View full-size slide

  14. // DetailActivity.kt (ભҠઌͷActivity
    window.sharedElementEnterTransition = RoundedImageTransitionSet()

    // RoundedImageTransitionSet.kt

    class RoundedImageTransitionSet : TransitionSet() {
    init {
    addTransition(ChangeBounds())
    addTransition(ChangeTransform())
    addTransition(ChangeImageTransform())
    addTransition(ChangeClipBounds())
    addTransition(RoundedImageTransition().addTarget(R.id.header))
    }
    }

    View full-size slide

  15. ͍͍ײ͡ʹ࠷ॳͷ஋Λอଘ͢Δ

    View full-size slide

  16. ͍͍ײ͡ʹΞχϝʔγϣϯ͢Δ

    View full-size slide