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
2.3k
Google Play ポリシー対応周りの整理/改善をしてみた
hunachi
0
370
レビューダイアログ機能の取り組みAndroid編 / Review Dialog for Android
hunachi
0
1.3k
Git Hands On for my lab.
hunachi
0
100
ML Kitはいいぞ!
hunachi
0
860
Paging Library は便利だぞ!
hunachi
1
460
Androidについて.
hunachi
0
120
Other Decks in Technology
See All in Technology
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
760
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
360
.NET 9 のパフォーマンス改善
nenonaninu
0
1k
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
490
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
37
15k
サーバーなしでWordPress運用、できますよ。
sogaoh
PRO
0
110
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
290
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
170
5分でわかるDuckDB
chanyou0311
10
3.2k
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
3
310
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
570
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Being A Developer After 40
akosma
87
590k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
The Language of Interfaces
destraynor
154
24k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Scaling GitHub
holman
458
140k
A better future with KSS
kneath
238
17k
GraphQLとの向き合い方2022年版
quramy
44
13k
Adopting Sorbet at Scale
ufuk
73
9.1k
For a Future-Friendly Web
brad_frost
175
9.4k
Site-Speed That Sticks
csswizardry
2
190
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ՄѪ͍ʂ