This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : AppCompatActivity() { | |
| private val viewModel: MainViewModel by viewModels() | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| val splashScreen = installSplashScreen() // ★ SplashScreenを適用 | |
| setContentView(R.layout.activity_main) | |
| splashScreen.setKeepVisibleCondition { // ★ ここでtrueを返してる間はSplashScreenが表示されたまま |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun ConcatAdapter.findAdapter(position: Int): RecyclerView.Adapter<*>? { | |
| var totalCount = 0 | |
| adapters.forEach { adapter -> | |
| totalCount += adapter.itemCount | |
| if (position < totalCount) { | |
| return adapter | |
| } | |
| } | |
| return null | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| dir=$(dirname $0) | |
| java -jar "$dir/bundletool-all-0.3.3.jar" $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def supportLibraryVersion = '27.1.1' | |
| android { | |
| // ... | |
| defaultConfig { | |
| // ... | |
| multiDexEnabled true | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task searchCompileDependencies() { | |
| doLast { | |
| configurations.find { it.name == 'compile' }?.dependencies?.each { | |
| println "$it.group:$it.name" | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| app:layout_anchor="@id/toolbar" | |
| tools:context=".MainActivity"> | |
| <android.support.design.widget.AppBarLayout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def robolectricDependenciesFolder = project.rootDir.path + "/.robolectric-dependencies" | |
| configurations.create('robolectricRuntime') | |
| dependencies { | |
| robolectricRuntime "org.robolectric:android-all:o-preview-4-robolectric-0" | |
| } | |
| rootProject.task(type: Copy, overwrite: true, "downloadRobolectricDependencies") { | |
| from configurations.robolectricRuntime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // compile "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.16" | |
| // compile "android.arch.lifecycle:runtime:1.0.0-alpha3" | |
| // compile "android.arch.lifecycle:extensions:1.0.0-alpha3" | |
| // kapt "android.arch.lifecycle:compiler:1.0.0-alpha3" | |
| class AsyncLiveData<T> private constructor(private val exec: suspend () -> T) : LiveData<T>() { | |
| private var observer: Observer<T>? = null | |
| private var job: Job? = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Test: SequenceType { | |
| typealias Generator = IndexingGenerator<[String]> | |
| func generate() -> Generator { | |
| return ["A", "B", "C"].generate() | |
| } | |
| } | |
| let test = Test() | |
| for t in test { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func foo() -> String? { | |
| return nil | |
| } | |
| let hoge: String | |
| if let t = foo() { | |
| // nilじゃなければ、その値を使いたい | |
| hoge = t | |
| } else { | |
| // nilだったらデフォルト設定したい |
NewerOlder