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.8k
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
450
Androidについて.
hunachi
0
120
Other Decks in Technology
See All in Technology
"君は見ているが観察していない"で考えるインシデントマネジメント
grimoh
4
920
オーティファイ会社紹介資料 / Autify Company Deck
autifyhq
9
120k
ZOZOTOWNでの推薦システム活用事例の紹介
f6wbl6
1
380
AWS CDKでデータリストアの運用、どのように設計する?~Aurora・EFSの実践事例を紹介~/aws-cdk-data-restore-aurora-efs
mhrtech
4
840
AWS reInvent 2024 関西組 事前勉強会
shinyayamada
0
150
Autify Company Deck
autifyhq
1
39k
SREの組織類型に応じた リーダシップの考察
kenta_hi
PRO
0
540
Fargateを使った研修の話
takesection
0
160
組み込みLinuxの時系列
puhitaku
3
860
What to do after `laravel new`
mattstauffer
0
130
製造現場のデジタル化における課題とPLC Data to Cloudによる新しいアプローチ
hamadakoji
0
170
Microsoft MVPになる前、なってから/Fukuoka_Tech_Women_Community_1_baba
nina01
0
160
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
510
110k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Six Lessons from altMBA
skipperchong
26
3.5k
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Statistics for Hackers
jakevdp
796
220k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Designing for humans not robots
tammielis
249
25k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
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ՄѪ͍ʂ