
Android OS version market share over time | AppBrain

Mobile & Tablet Android Version Market Share Worldwide | StatCounter Global Stats
Oreo(8.0-0.1) の伸びが止まったまま、Pie(9.0)のみが割合を増やし続けている様子。

なぜ、公式は情報公開しないのだろう。

Android OS version market share over time | AppBrain

Mobile & Tablet Android Version Market Share Worldwide | StatCounter Global Stats
Oreo(8.0-0.1) の伸びが止まったまま、Pie(9.0)のみが割合を増やし続けている様子。

なぜ、公式は情報公開しないのだろう。
サムスンの折り畳みスマホGalaxy Foldの実物をようやく触った
折り畳みスマホSamsung Galaxy Fold使用レポート(1日目)
折りたたみスマホ「Galaxy Fold」、発売前に「壊れた」というレビュアー報告多数 - ITmedia NEWS
Samsung、折りたたみスマホ「Galaxy Fold」を発売延期 - PC Watch
iFixit、折りたたみスマホGalaxy Foldをさっそく料理。評価は「驚くほど壊れやすい」
iFixitがGalaxy Foldの分解レポートを公開〜ゴミが入りやすい? - iPhone Mania
手のひらサイズの「Palm Phone」、4月24日発売 - ケータイ Watch
超小型スマホ「Palm Phone」日本上陸 3.3型液晶で手のひら大
バイクや自転車、腕にも装着できる超小型スマホ「Palm Phone」 - AV Watch
小さいスマホを探している人あつまれー! 「Palm」がSIMフリーで日本上陸 | ギズモード・ジャパン
クレジットカードサイズの3.3型スマホ「Palm Phone」、4月24日に国内発売! – すまほん!!
汎用性のある使えるシングルトン、
どのように書いてますか?
class Singleton private constructor() {
// getInstance() ???
}
ここから、どんな getInstance() を?
いくつか。
fun getInstance(): Singleton {
synchronized(this) {
if(INSTANCE == null){
INSTANCE = Singleton()
}
return INSTANCE!!
}
}
companion object {
private var INSTANCE: Singleton ? = null
fun getInstance(): Singleton {
if(INSTANCE == null){
INSTANCE = Singleton()
}
return INSTANCE!!
}
}
companion object {
val INSTANCE = Singleton()
fun getInstance(): Singleton {
return INSTANCE
}
}
@Volatile private var INSTANCE: Singleton ? = null
fun getInstance(): Singleton {
if(INSTANCE == null){
synchronized(this) {
INSTANCE = Singleton()
}
}
return INSTANCE!!
}
companion object {
@Volatile private var INSTANCE: Singleton ? = null
fun getInstance(): Singleton {
return INSTANCE?: synchronized(this){
Singleton().also {
INSTANCE = it
}
}
}
}
Singleton Pattern — What you might be doing wrong! – Hacker Noon
Googleの人はこう書いてます。
class CheeseRepository(
private val api: CheeseApi,
private val db: CheeseDatabase,
private val executor: Executor
) {
companion object {
private const val PAGE_SIZE = 30
private var instance: CheeseRepository? = null
fun getInstance(context: Context) = instance ?: synchronized(this) {
instance ?: CheeseRepository(
CheeseApi(),
Room.databaseBuilder(context, CheeseDatabase::class.java, "cheese").build(),
Executors.newFixedThreadPool(4)
).also { instance = it }
}
}
CheesePage/CheeseRepository.kt at master · yaraki/CheesePage
あと、Dagger の @Singleton もこのスタイルに変換されますので安心です。覚えておきたい記述です。
なんだか気持ちが悪くても、
なかなか正解が見つけられないこと多くね? 最近。
Javaのこのコードが、
public class ConcertViewModel extends ViewModel {
private ConcertDao concertDao;
public final Observable<PagedList<Concert>> concertList;
public ConcertViewModel(ConcertDao concertDao) {
this.concertDao = concertDao;
concertList = new RxPagedListBuilder<>(
concertDao.concertsByDate(), 50)
.buildObservable();
}
}
Kotlinでこう書けるはずなのに!
class ConcertViewModel(concertDao: ConcertDao) : ViewModel() {
val concertList: Observable<PagedList<Concert>> =
concertDao.concertsByDate().toObservable(pageSize = 50)
}
Paging library overview | Android Developers
見つからない toObservable()。
- Added DataSourceFactory.toLiveData() as a Kotlin alternative for LivePagedListBuilder
- Added DataSourceFactory.toObservable() and toFlowable() as Kotlin alternatives for RxPagedListBuilder
どうやら -ktx のようです。
implementation "androidx.paging:paging-runtime-ktx:2.1.0"
implementation "androidx.paging:paging-rxjava2-ktx:2.1.0"

Maven Repository: androidx.paging
最近は、同じ処理でも複数の書き方があることが多くなって最初混乱したりします。
Android Java ではあまり見かけなかったその記述。
Kotlin では、たくさん見かけてはいましたが、
個人的な明示記述小技かと思っていました。
private val _items = MutableLiveData<List<Task>>().apply { value = emptyList() }
val items: LiveData<List<Task>>
get() = _items
private val _dataLoading = MutableLiveData<Boolean>()
val dataLoading: LiveData<Boolean>
get() = _dataLoading
android-architecture/TasksViewModel.kt at todo-mvvm-live-kotlin · googlesamples/android-architecture
private val _repositories = MutableLiveData<List<Repo>>()
val repositories : LiveData<List<Repo>>
get() = _repositories
private val _models = ConflatedBroadcastChannel<Model>()
override val models: ReceiveChannel<Model> get() = _models.openSubscription()
private val _events = Channel<Event>(RENDEZVOUS)
override val events: SendChannel<Event> get() = _events
SdkSearch/SearchPresenter.kt at JakeWharton/SdkSearch
Kotlin公式リファレンスにも書かれていたのですね!
Names for backing properties
If a class has two properties which are conceptually the same but one is part of a public API and another is an implementation detail, use an underscore as the prefix for the name of the private property:
class C {
private val _elementList = mutableListOf<Element>()
val elementList: List<Element>
get() = _elementList
}
Properties and Fields: Getters, Setters, const, lateinit - Kotlin Programming Language
クラス内の処理実装に利用するのが _elementList で、
外部にただ公開するだけのが elementList。
こうやって並べてみると、自然に馴染じめてしまう不思議。
ViewModel作成時のイメージとして持っておくと良い。