Titan Slimを入手したので、その他の特殊な画面サイズの端末と一緒にリソース解像度を取得しました。
MainActivity.kt
val qualifier = getString(R.string.qualifier)
val configuration = resources.configuration
val dpHeight = configuration.screenHeightDp
val dpWidth = configuration.screenWidthDp
val density = configuration.densityDpi
val swdp = configuration.smallestScreenWidthDp
val aspect = resources.configuration.screenLayout
val LongNo = (aspect and Configuration.SCREENLAYOUT_LONG_NO) != 0
val LongYes = (aspect and Configuration.SCREENLAYOUT_LONG_YES) != 0
val textView = findViewById<TextView>(R.id.text)
textView.text = "qualifier = ${qualifier}\n-----\n" +
"smallestWidth = ${swdp} [dp]\n" +
"Width = ${dpWidth} [dp]\n" +
"Height = ${dpHeight} [dp]\n" +
"Density = ${density} [dpi]\n" +
"Long YES/NO = ${LongYes}/${LongNo}\n" +
"\n------\nconfiguration = ${configuration}"
結果がこちら。
画面タイプ | 機種 | smallestWidth[dp] | Width[dp] | Height[dp] | Long | Qualifier |
---|---|---|---|---|---|---|
正方形 | Titan | 572 | 572 | 542 | not | sw500dp-notLong |
正方形 | Titan Pocket | 520 | 520 | 483 | not | sw500dp-notLong |
短い長方形 | Titan Pocket (narrow mode) | 432 | 432 | 665 | not | sw360dp-notLong |
短い長方形 | Titan Slim | 384 | 384 | 600 | not | sw360dp-notLong |
短い長方形 | BlackBerry KEY2 | 411 | 411 | 593 | not | sw360dp-notLong |
普通のスマートホン | Pixel 5a | 411 | 411 | 838 | long | sw360dp |
タブレット | Lavie Tab 8 | 600 | 600 | 888 | not | sw600dp |
Resource Qualifierは以下の様に設定することで、見分ける事が出来ました。
Titan/Pocketの正方形画面は、sw500dp-notLongで適用。(sw500dpで3:2とかの端末があるかもしれない)
BlackBerryなどの3:2系の画面は、sw360dp-notLongで適用。
いわゆる普通のスマホはlongなので、sw360dpを適用。
タブレットはsw600dpを適用。
Jelly2 などの小型端末については持ってないので分かりません。
誰かの何かの役に立てばいいなあ。
#あらためて上の表見てみると、BlackBerryの解像度設定はわりかしまともで、Titanシリーズの解像度設定がめちゃくちゃだというのが分かる。