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
TypeScript、上達の瞬間
sadnessojisan
46
13k
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
230
組織成長を加速させるオンボーディングの取り組み
sudoakiy
2
220
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
490
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
420
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Rails Girls Zürich Keynote
gr2m
94
13k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Documentation Writing (for coders)
carmenintech
65
4.4k
Why Our Code Smells
bkeepers
PRO
334
57k
Scaling GitHub
holman
458
140k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Speed Design
sergeychernyshev
25
620
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
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ՄѪ͍ʂ