Slide 1

Slide 1 text

Support Library v23.2 overview @androhi 1

Slide 2

Slide 2 text

About me 4 Zaim Inc. 4 GitHub / Twitter / Qiita 4 @androhi 4 DroidKaigi 2016 staff & speaker @androhi 2

Slide 3

Slide 3 text

Agenda 4 v23.2ͷτϐοΫ 4 RecyclerViewͷࣗಈαΠζௐ੔ػೳ @androhi 3

Slide 4

Slide 4 text

v23.2ͷτϐοΫ 1. VectorDrawableͷαϙʔτ 4 Ξχϝʔγϣϯ෇͖͸Ұ෦੍ݶ͋Γ 2. AppCompatͷDayNightςʔϚ 3. BottomSheetͷαϙʔτ 4. ΧελϜλϒʹϘτϜόʔͷ௥Ճ 5. AndroidTVͷLeanbackڧԽ @androhi 4

Slide 5

Slide 5 text

VectorDrawable ͷαϙʔτ 4 VectorDrawableରԠ·ͱΊ @konifar 4 AppCompat v23.2 — Age of the vectors @androhi 5

Slide 6

Slide 6 text

DayNight ςʔϚͷ௥Ճ ... // ΞϓϦશମʹઃఆ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); // Activity΍Dialog୯ҐͰઃఆ AppCompatDelegate delegate = getDelegate(); delegate.setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO); @androhi 6

Slide 7

Slide 7 text

BottomSheet ͷαϙʔτ 4 αϙʔτϥΠϒϥϦ @yuichi_araki 4 BottomSheetBehaviorΛ࢖͏ @napplecomputer @androhi 7

Slide 8

Slide 8 text

ΧελϜλϒͷϘ τϜόʔ ※ chrome v49 Ҏ্ @androhi 8

Slide 9

Slide 9 text

ΧελϜλϒͷϘτϜόʔ // VectorDrawableͰ΋େৎ෉ʂ Bitmap icon1 = BitmapFactory.decodeResource(getResources(), R.drawable.ic_room_24dp); Bitmap icon2 = BitmapFactory.decodeResource(getResources(), R.drawable.ic_favorite_24dp); CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() .setToolbarColor(getResources().getColor(R.color.colorPrimary)) .setSecondaryToolbarColor(getResources().getColor(R.color.colorPrimary)) // ௥ՃͰ͖Δͷ͸4ݸ·ͰɻͦΕҎ্͸IllegalStateException .addToolbarItem(1, icon1, "description1", pendingIntent) .addToolbarItem(2, icon2, "description2", pendingIntent) .build(); customTabsIntent.launchUrl(this, Uri.parse("http://zaim.net")); @androhi 9

Slide 10

Slide 10 text

Leanback ڧԽ 4 GuidedStepFragment ͷେ෯ͳվળ 4 ࠓճ͸ࢼͤ·ͤΜͰͨ͠... @androhi 10

Slide 11

Slide 11 text

RecyclerViewͷ ࣗಈαΠζௐ੔ػೳ @androhi 11

Slide 12

Slide 12 text

WRAP_CONTENT ͷ༗ޮԽ RecyclerView ΛίϯςϯπͷαΠζʹԠͯ͡α ΠζมߋͰ͖ΔΑ͏ʹͳΓ·͢ɻͭ·ΓɺҎલ͸ Ͱ͖ͳ͔ͬͨ RecyclerView ͷੇ๏஋ʹ WRAP_CONTENT Λ࢖༻͢Δ͜ͱ͕Ͱ͖ΔΑ͏ ʹͳ͍ͬͯ·͢ɻ — Google Developers Japan @androhi 12

Slide 13

Slide 13 text

activity.xml @androhi 13

Slide 14

Slide 14 text

list_item.xml @androhi 14

Slide 15

Slide 15 text

@androhi 15

Slide 16

Slide 16 text

@androhi 16

Slide 17

Slide 17 text

΋͜͠Μͳ list_item.xml ͩͬͨ Β... @androhi 17

Slide 18

Slide 18 text

@androhi 18

Slide 19

Slide 19 text

v23.1 -> v23.2 ͷΞοϓσʔτ RecyclerView ͷ࢖༻Օॴ͸ཁ஫ҙ @androhi 19

Slide 20

Slide 20 text

LayoutManager ͷมߋ ϏϧτΠϯͷ LayoutManager ΛܧঝͤͣɺΧε λϜͷ LayoutManager Λ࢖༻͍ͯ͠Δ৔߹ɺ͜ Ε͸ΦϓτΠϯ API ʹͳΓ·͢ɻ setAutoMeasureEnabled(true) Λݺͼग़͠ɺ ϝιουͷ Javadoc ʹৄ͘͠هࡌ͞Ε͍ͯΔͱ ͓Γɺࡉ͔ͳมߋΛՃ͑Δඞཁ͕͋Γ·͢ɻ — Google Developers Japan @androhi 20

Slide 21

Slide 21 text

LayoutManager#setAutoMeasureEn abled(boolean) ϨΠΞ΢τͷଌఆ( onMeasure )Λɺ RecyclerView ͕ߦ͏( =true )ͷ͔ LayoutManager ͕ߦ͏( =false )ͷ͔Λఆٛ͢ Δϝιουɻ -> RecyclerView ͕ଌఆ͢Δ৔߹͸ɺࢠͷཁૉ͔ ΒαΠζΛࣗಈܭࢉ͢Δɻ @androhi 21

Slide 22

Slide 22 text

v23.1 ͷ LinearLayoutManager // Constructor public LinearLayoutManager(Context context, int orientation, boolean reverseLayout) { setOrientation(orientation); setReverseLayout(reverseLayout); } @androhi 22

Slide 23

Slide 23 text

v23.2 ͷ LinearLayoutManager public LinearLayoutManager(Context context, int orientation, boolean reverseLayout) { setOrientation(orientation); setReverseLayout(reverseLayout); setAutoMeasureEnabled(true); } @androhi 23

Slide 24

Slide 24 text

LayoutManager ΛΧελϜͯ͠Δ ͳΒ onMeasure Λ override ͍ͯ͠Δ৔߹͸ɺΧε λϜ LayoutMnagerͷதͰ setAutoMeasureEnabled(false) ΛݺͿɻ @androhi 24

Slide 25

Slide 25 text

·ͱΊ 4 VectorDrawable αϙʔτ࠷ߴ 4 RecyclerView ͸ཁ஫ҙ @androhi 25