Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Google I/O 2018’s Extensions🦔
Search
Hunachi
September 20, 2018
Technology
1
2.5k
Google I/O 2018’s Extensions🦔
Kotlin大好き!Kotlin愛好会 vol4で発表しました.
是非Googleさんを参考にしましょう!
Hunachi
September 20, 2018
Tweet
Share
More Decks by Hunachi
See All by Hunachi
PDF Viewer作成の今までとこれから
hunachi
0
1.9k
Google Play ポリシー対応周りの整理/改善をしてみた
hunachi
0
360
レビューダイアログ機能の取り組みAndroid編 / Review Dialog for Android
hunachi
0
1.3k
Git Hands On for my lab.
hunachi
0
100
ML Kitはいいぞ!
hunachi
0
850
Paging Library は便利だぞ!
hunachi
1
460
Androidについて.
hunachi
0
120
Other Decks in Technology
See All in Technology
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
990
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
Taming you application's environments
salaboy
0
180
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
Lambdaと地方とコミュニティ
miu_crescent
2
370
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.2k
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
470
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Faster Mobile Websites
deanohume
305
30k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Automating Front-end Workflow
addyosmani
1366
200k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Transcript
ˏ)VOBDIJ ,PUMJOѪձWPM (PPHMF*0`T &YUFOTJPOT
ࣗݾհ ;ͳͪ ߴઐੜ (JU)VC!)VOBDIJ 5XJUUFS!@IVOBDIJ ,PUMJOΛॻ͖࢝Ί͔ͯΒϓϩάϥϛϯά͕͖ʹͳͬͨɽ ࠓ8BOUFEMZ*OD͞ΜͷݩͰΠϯλʔϯதͰ͢ʗʢ,PUMJOಋೖ͠·ͨ͠ʣ
$PEFɿIUUQTHJUIVCDPNHPPHMFJPTDIFE 0⒏DJBM#MPHɿIUUQTNFEJVNDPNBOESPJEEFWFMPQFSTHPPHMFJPBQQ BSDIJUFDUVSFBOEUFTUJOHGFGDFC (PPHMF*0BQQ
w ,PUMJO w ࠓྫΑΓσεϚͯ͠ͳͦ͞͏ ʢ$POUSJCVUJPO͚ͩͰݴ͑ͳ͍͔ ͚ͩͲʣ
6TFE5PPMBOE-JCSBSZ w 'JSF4UPSFɼ'JSF#BTF"VUIFOUJDBUJPO w "OESPJEY w %BHHFSɼ5JNCFSɼ(TPOɼ5ISFF5FOɼ$SBTIMZUJDTɼ(MJEFɼ&TQSFTTPɼ .PDLJUPɼ+6OJUɼMFBLDBOBSZɽ
"SDIJUFDUVSF w $MFBO"SDIJUFDUVSF w 1SFTFOUBUJPOɿ7JFXˍ7JFX.PEFM w %PNBJOɿ6TF$BTF w %BUBɿ3FQPTJUPSZ 6TFS.BOBHFS
w .77.
None
&YUFOTJPOT /PUBMM FYUFOTJPOTPG NZGBWPSJUF
// Listͱ͔ͰView͕ΨλϯͬͯͳͬͨΓ͢ΔͷΛ͙༻ɽ inline fun <T : ViewDataBinding> T.executeAfter(block: T.() ->Unit){
block() // ͙͢ʹbinding͍ͤͨ࣌͞ʹ͏ɽ executePendingBindings() } // ༻ྫ binding.executeAfter { //͜͜Ͱbind͢Δɽ event = item } ᶃ
// TransitionΛԆͤ͞Δ fun Activity.postponeEnterTransition(timeout: Long) { postponeEnterTransition() window.decorView.postDelayed(timeout) { startPostponedEnterTransition()
} } // ༻ྫ activity?.postponeEnterTransition(500L) ᶄ
// ॳظԽɼࢀর͕ৗʹγϯάϧεϨουͰ͔͠ߦΘΕͳ͍࣌༻ɽ fun <T> lazyFast(operation: () -> T): Lazy<T> =
lazy(LazyThreadSafetyMode.NONE) { operation() } // SYNCRONIZED: σϑΥϧτɽ୯ҰεϨου͔ΒͷॳظԽͰɼෳεϨου͔Βͷࢀর͕Մೳɽ // PUBLICATION: ෳεϨου͔ΒॳظԽ͠Α͏ͱ͢Δࣄ͕Մೳɽ // ༻ྫ private val day: Int by lazyFast { val args = arguments ?: throw IllegalStateException("Missing arguments!") args.getInt(ARG_INT) } ᶅ
inline fun <reified VM : ViewModel> FragmentActivity.viewModelProvider( provider: ViewModelProvider.Factory )
= ViewModelProviders.of(this, provider).get(VM::class.java) // ༻ྫ // Before val viewModel: HogeViewModel = ViewModelProviders.of(this, viewModelFactory) .get(HogeViewModel::class.java) //After val viewModel: HogeViewModel = viewModelProvider(viewModelFactory) ᶆ
fun ViewGroup.inflate( @LayoutRes layout: Int, attachToRoot: Boolean = false ):
View { return LayoutInflater.from(context) .inflate(layout, this, attachToRoot) } // ༻ྫ … Holder( parent.inflate(VIEW_TYPE_HEADING, false) ) ᶇ
inline fun FragmentManager.inTransaction( func: FragmentTransaction.() -> FragmentTransaction ) { beginTransaction().func().commit()
} // ༻ྫ supportFragmentManager.inTransaction { add(FRAGMENT_ID, fragment) } ᶈ
// enumΫϥεΛbundleʹೖΕΕΔܗʹ͢Δ fun <T : Enum<T>> Bundle.putEnum(key: String, value: T)
= putString(key, value.name) // ↑ͰೖΕͨenumΫϥεΛऔΓग़͢ inline fun <reified T : Enum<T>> Bundle.getEnum(key: String): T = enumValueOf(getString(key)) // ParcelʹbooleanΛॻ͖ࠐΉ fun Parcel.writeBoolean(value: Boolean) = writeInt(if (value) 1 else 0) // ↑Ͱมͨ͠booleanΛಡΈࠐΉ fun Parcel.readBoolean() = readInt() != 0 ᶉ
// ༻ྫ // ಡΈ͍͢ʂ pacel.apply { writeInt(state) writeInt(peekHeight) writeBoolean(isFitToContents) writeBoolean(isHideable)
writeBoolean(skipCollapsed) writeBoolean(isDraggable) }
fun <T> MutableLiveData<T>.setValueIfNew(newValue: T) { if (this.value != newValue) value
= newValue } fun <T> MutableLiveData<T>.postValueIfNew(newValue: T) { if (this.value != newValue) postValue(newValue) } // ObserverଆͰఆͨ͠ํ͕҆શͳؾ͕͢Δ͚ͲͲ͏ͳΜͩΖ͏ɽɽ ᶊ
fun <X, Y> LiveData<X>.map(body: (X) -> Y): LiveData<Y> { return
Transformations.map(this, body) } fun <X, Y> LiveData<X>.switchMap(body: (X) -> LiveData<Y>): LiveData<Y> { return Transformations.switchMap(this, body) } ᶋ
// ༻ྫ liveData = parentLiveData.map { (it as? Result.Success)?.data?: 0
} liveData = parentLiveData.switchMap { if(value == null) dataLiveData else parentLiveData } // ࠷ॳ֦ுؔͬͯࣄʹؾ͔ͮͣɼڻ͍ͨɽ
val <T> T.checkAllMatched: T get() = this // ༻ྫ //
OK when (sealed) { ONE -> {…} TWO -> {…} }.checkAllMatch // error when (sealed) { ONE -> {…} //TWO -> {…} }.checkAllMatch ᶌ
w ஸೡʂ ͜ͷ࣮७ਮʹ಄ ͍͍ͱࢥ͏ɽ
5IBOLZPV ,PUMJOՄѪ͍ʂ