Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android 14 新機能 / Android 14 Meetup Nagoya

star_zero
August 10, 2023

Android 14 新機能 / Android 14 Meetup Nagoya

star_zero

August 10, 2023
Tweet

More Decks by star_zero

Other Decks in Programming

Transcript

  1. • Kenji Abe • Google Developers Expert for Android, Kotlin

    • DeNA Co., Ltd. • X: @STAR_ZERO • Bluesky: @star-zero.com 自己紹介
  2. // app/build.gradle android { androidResources { generateLocaleConfig = true }

    } // res/resources.properties unqualifiedResLocale=en-US
  3. val localManger = getSystemService<LocaleManager>()!! // 言語設定をOverride localManger.overrideLocaleConfig = LocaleConfig( LocaleList(

    Locale.ENGLISH, Locale.ITALIAN ) ) // Overrideした設定を戻す localManger.overrideLocaleConfig = null
  4. • フランス語 ◦ 男性: Vous êtes abonné à… ◦ 女性:

    Vous êtes abonnée à… ◦ 中立: Abonnement à...activé Grammatical Inflection API
  5. class MainActivity : ComponentActivity() { val screenCaptureCallback = ScreenCaptureCallback {

    // ... } override fun onStart() { super.onStart() registerScreenCaptureCallback( mainExecutor, screenCaptureCallback ) } override fun onStop() { super.onStop() unregisterScreenCaptureCallback(screenCaptureCallback) } }
  6. <manifest> <application> <activity android:name=".MainActivity"> <!-- ... --> </activity> <!-- このActivityだけ

    Predicitive back gesture を有効にする --> <activity android:name=".SampleActivity" android:enableOnBackInvokedCallback="true" /> </application> </manifest>
  7. // androidx.activity:activity-ktx:1.8.0-alpha06 val callBack = object : OnBackPressedCallback(true) { override

    fun handleOnBackStarted(backEvent: BackEventCompat) { // Gestureが始まったとき } override fun handleOnBackProgressed(backEvent: BackEventCompat) { // Gestureの進捗 } override fun handleOnBackPressed() { // Gestureが完了したとき } override fun handleOnBackCancelled() { // キャンセルされたとき } }
  8. val path = Path().apply { moveTo(0f, 0f) lineTo(200f, 0f) lineTo(200f,

    200f) lineTo(0f, 200f) close() } canvas.drawPath(path, paint)
  9. val pathIterator = path.pathIterator pathIterator.forEach { segment -> // PathIterator.VERB_MOVE,

    // PathIterator.VERB_LINE, // PathIterator.VERB_CLOSE など val verb = segment.verb // verbの操作のポイントデータ val points = segment.points }
  10. VERB_MOVE - [0, 0, 0, 0, 0, 0, 0, 0]

    VERB_LINE - [0, 0, 200, 0, 0, 0, 0, 0] VERB_LINE - [200, 0, 200, 200, 0, 0, 0, 0] VERB_LINE - [200, 200, 0, 200, 0, 0, 0, 0] VERB_CLOSE - [200, 200, 0, 200, 0, 0, 0, 0] moveTo(0f, 0f) lineTo(200f, 0f) lineTo(200f, 200f) lineTo(0f, 200f) close()