kotlinx.android.synthetic は使わないほうがいいのか

2) Replaced kotlinx synthetic with findViewById

kotlinx.android.synthetic is no longer a recommended practice. Removing
in favour of explicit findViewById.

Sample updates: Fragment state, synth accessors (Ic472f90e) · Gerrit Code Review

Hey! Developer Advocate for Android at Google here!

I wanted to add a bit of background here. Kotlin Extensions with synthetic views was never intentionally “recommended” though that shouldn’t be taken as a recommendation to not use them. If they're working for you please feel free to continue using them in your app!

We’ve been shifting away from them (e.g. we don’t teach them in the Udacity course) because they expose a global namespace of ids that’s unrelated to the layout that’s actually inflated with no checks against invalid lookups, are Kotlin only, and don't expose nullability when views are only present in some configuration. All together, these issues cause the API to increase number of crashes for Android apps.

On the other hand, they do offer a lightweight API that can help simplify view lookups. In this space it's also worth taking a look at Data Binding which also does automatic view lookups - as well as integrates with LiveData to automatically update your views as data changes.

Today, there's a few options in this space that work:

Data Binding is the recommendation for view lookup as well as binding, but it does add a bit of overhead when compared to Android Kotlin Extensions. It's worth taking a look to see if this is a good fit for your app. Data Binding also allows you to observe LiveData to bind views automatically when data changes. Compared to Kotlin Extensions, it adds compile time checking of view lookups and type safety.

Android Kotlin Extensions is not officially recommended (which is not the same as recommendation against). It does come with the issues mentioned above, so for our code we're not using them.

Butter Knife is another solution that is extremely popular and works for both Kotlin and the Java Programming Language.

Reading through the comments here there's a lot of developers that are having great luck with Kotlin Extensions. That's great - and something we'll keep in mind as we look at ways to continue improving our APIs. If you haven't taken a look at Data Binding, definitely give it a shot.

As an aside, our internal code style guide is not intended to be directly applied outside of our codebase. For example, we use mPrefixVariables, but there's no reason that every app should follow that style.

Why kotlinx synthetic is no longer a recommended practice : androiddev

Jake他、著名な人々のコードを見ていると、「そもそも使ってない」ことは明らか。

そもそも、

「user_name」 と 「userName」

の気持ち悪さはありましたよね。

mobile - Android id naming convention: lower case with underscore vs. camel case - Stack Overflow

強制的に禁止はしてないけど、そういうことだろうと思う。

findViewById 万歳!

ButterKnife 万歳!

kotlin-examples/gradle/android-butterknife at master · JetBrains/kotlin-examples

「Google+」の終了が2019年8月から4月に繰り上げ 5250万人に影響の新たなバグ発見で - ITmedia NEWS


JetBrains Toolbox で Android Studio の Stable/Beta/Canary が同時に管理できる?

これ。

The New Toolbox App 1.13 with Android Studio inside! | JetBrains Blog

Jakeも何か言っています。


JetBrains のIDEのパッケージ群を管理したり起動できるランチャーのようです。

それに、新たに AndroidStudio も使えるようになった。ということでしょうか。

インストールしてみます。



 

Toolbox Extension

そして、それをChrome上のGitHub画面から起動できるChromeエクステンションも登場しています。

JetBrains Toolbox Extension - Chrome ウェブストア

GitHubページに表示されるアイコンをクリックすると、ソースをダウンロードして、ローカルで起動しようとします。

 

Toolbox(本体)

アドビのパッケージ管理のウィジェットにも似た雰囲気です。

OS画面上部の常駐のバー(?)にアイコンが表示されるのでそれから起動します。

ローカル内のプロジェクトの選択してのIDEの起動と、それぞれのIDEパッケージのバージョン管理が可能になります。

アドビのパッケージマネージャ的なやつと思ったらいいでしょう。

Android Studio/Intellij は、複数のバージョンが並行利用できそうです。

無料です。

👉 AndroidStudio 利用する Java (JDK) の選択・設定の方法 hatena-bookmark
👉 Android Studio Chipmunk の起動時がかわいい件 


新「元号」の西暦へ変換方法と「Build.VERSON_CODES」

今回もまた、和暦と西暦の変換の方法とか。

昭和:元号に25を足すと西暦。
平成:元号から12を引くと西暦。
?? : 元号に18を足すと西暦。

面倒ですね。

一方、Android OS (API) バージョンの呼び方。


19 KITKAT                 4.4 - 4.4.4   KitKat
21 LOLLIPOP               5             Lollipop
22 LOLLIPOP_MR1           5.1           Lollipop
23 M                      6             Marshmallow
24 N                      7             Nougat
25 N_MR1                  7.1           Nougat
26 O                      8.0           Oreo
27 O_MR1                  8.1           Oreo
28 P	                  9.0           Pie

Android バージョンやコードネームなどからのシェアの一覧取得


同じ意味なのに別の呼称があることは、少し考えての変換が必要になる。

いらなくね? 元号とかコードネームとか。

まあ、コードネームを付けることで話題として取り上げやすくはなるわな。

キャバ嬢の「平成生まれ」をうれしがってた時もあったけどなあ。

Android OS バージョン確認方法 (platform versions)

The Unicode Blog: New Japanese Era


【生実録】 MacをApple無料公式キーボード修理プログラムに出す

不意にキーボードが連打されるので調べると、以下の流れが起きている。

■ 2017年9月頃
MacBook Proキーボードの交換を求めるキャンペーンなどが行われ始める。

キャンペーン · Apple: Apple: Recall MacBook Pro w/ Defective Keyboard, Replace with DIFFERENT Working Keyboard · Change.org

今やネットは、不平や不満の出力先です。

■ 2018年05月
AppleInsiderがシザー構造とバタフライ構造のキーボードを採用したMacBook Proの不具合発生率のデータを公開。

The keyboard data

All data has been collected from assorted Apple Genius Bars in the U.S. that we have been working with for several years, as well as Apple-authorized third-party repair shops.

The 2014 MacBook Pro model year saw 2120 service events in the first year, with 118 related to keyboard issues necessitating an upper case replacement —5.6 percent of all MacBook Pros serviced in the first year. The 2015 has 1904 service tickets, with 114 relating to the keyboard, making 6.0 percent.

The two numbers are very similar, which is to be expected. The keyboards were essentially unchanged since the 2012 Retina MacBook Pro, and should have failure rates similar to each other.

Apple released the new keyboard with the MacBook, and moved the design to the 2016 MacBook Pro. In the first year of the 2016 MacBook Pro, our data gathered 1402 warranty events, with 165 related to only the keyboard and not including the Touch Bar —11.8 percent.

We don't have a full year of data for the 2017 MacBook Pro yet. But, since release in June 2017, our data set has 1161 captured service events with 94 related to keyboard issues also not including any Touch Bar issues —8.1 percent.

Failure rates across all four models are relatively static, with no appreciable increase or decrease in events reported at any time after release. Percentages of failures were comparable between the third-party authorized shops, and the Genius Bar data.

2016 MacBook Pro butterfly keyboards failing twice as frequently as older models

■ 2018年06月
AppleがMacBook Early 2015およびMacBook Pro 2016モデル以降の一部のキーボードに、文字が入力されない、押したキーのスムーズな跳ね返りや反応がない問題が確認されたとして「MacBook および MacBook Pro キーボード修理プログラム」を開始。

MacBook および MacBook Pro キーボード修理プログラム - Apple サポート

ということで、私、もろ該当なので修理に出します。

銀座に持ち込もうと思いましたが、日時予約をしようとすると一週間後まで待たされるようだったので、郵送修理をすることにしました。

 

実際の経過

アップル公式ページからチャットでそのまま申し込みすると、宅配業者の引取りを待つだけとなります。

可能な限り最短日程で進めました。

■ 12/20 (木) 午後
公式チャットから依頼。

管理者アカウントを整備用にその場で作らされる。
最短で 12/23(土) 9:00-12:00 に引き取りだったのでそれにしました。

■ 12/21 (金)
教えられた手順にしたがって準備する。

iCould/iTune Store を認証解除する。
→ 使ってないので放置。

iTunes でコンピュータの認証を解除する - Apple サポート

バックアップ
→ 設定 > TimeMachine を使ってUSB2.0HDに80Gで2時間位かかった。

Time Machine で Mac をバックアップする - Apple サポート

■ 12/22 (土) 12:30
宅配便引取。

Appleのチャットで依頼した 9:00-12:00 より 30分ほど遅れましたが、 宅配便の人も忙しそうでした。

業者はクロネコヤマトです。

梱包不要で本体のみで渡せばいいです。

この引取りに来た人が梱包してくれます。

この梱包材でやってました。

パソコン宅急便 | ヤマト運輸

どうやら厚木にいくらしい。

■ 12/23 (日) AM
厚木リペアセンター到着。

クロネコヤマトの荷物お問い合わせシステム

通常、製品は集荷から 3 ~ 5 営業日ほどでご返却致します。症状、パーツの在庫状況によっては、さらに時間をいただく場合もございます。

まずは、検査から。

そして、修理。

その日のうちに修理は終わり、即返送してくれる。

Apple の修理と修理状況の確認 - Apple サポート 公式サイト

■ 12/24 (月) 14:30
修理後返却受け取り

キーボードだけでなく、バッテリーも交換されていました。

 

まとめ

全体として時間をまとめてみました。
→ Mac の修理、「持ち込み」より「郵送」の方が早かった件

あと、データは消えずに元のまま残っていたので、以下の復元作業は、不要でした。

mac OS 復元から起動
→ 電源を入れて直後に、Command + R

バックアップから Mac を復元する - Apple サポート


WordPress の エディタ が意味不明になった場合 →「Classic Editor」

なにこれ?

画像の添付ができないんだけど。

プラグイン「Classic Editor」を入れると

今までどおりに編集できるようになります。

とりあえず、そんな方法でこの記事を書いたけど、

本筋的にはどうやるの?

衝撃に備えろ!WordPress 5.0では新エディタ「Gutenberg」が採用され旧エディタは廃止!? | 陸マイラーとーみねのほったらかし投資録