IEには対応していません。Edgeでサイトを開く ≫

ソースコード source code

下記アプリの主要なソースコードを公開しています。アプリ開発の参考になれば幸いです。

画像等が別途必要ですので下記情報のみでアプリが完成するものではありません。 アプリは少しずつ機能拡張していますのでストア公開されているアプリと内容が異なる場合があります。 コードはコピーして自由にお使いいただけます。ただし著作権は放棄しておりませんので全部の再掲載はご遠慮ください。部分的に再掲載したり、改変して再掲載するのは構いません。 自身のアプリ作成の参考として個人使用・商用問わず自由にお使いいただけます。 コード記述のお手本を示すものではありません。ミニアプリですので変数名などさほど気遣いしていない部分も有りますし間違いも有るかと思いますので参考程度にお考え下さい。 他の賢者の皆様が公開されているコードを参考にした箇所も含まれます。Androidアプリ開発の熟練者が書いたコードではありません。 エンジニア向け技術情報共有サービスではありませんので説明は省いています。ご了承ください。 GitHubなどへの公開は予定しておりません。

下記コードの最終ビルド日: 2021-05-09

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.4.32"
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "jp.aosystem.wheellotterymachine"
        minSdkVersion 21
        targetSdkVersion 30
        multiDexEnabled true
        versionCode 13
        versionName "1.12"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.android.gms:play-services-ads:20.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

app/src/main/AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="jp.aosystem.wheellotterymachine">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.WheelLotteryMachine">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".SettingActivity" />

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-0000000000000000~0000000000">
    </application>

</manifest>

app/src/main/java/jp/aosystem/wheellotterymachine/MainActivity.kt

package jp.aosystem.wheellotterymachine

import android.app.Activity
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.os.*
import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener
import android.text.InputType
import android.util.DisplayMetrics
import android.view.View
import android.view.ViewTreeObserver.OnGlobalLayoutListener
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.constraintlayout.widget.ConstraintLayout
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.AdSize
import com.google.android.gms.ads.AdView
import com.google.android.gms.ads.MobileAds
import jp.aosystem.wheellotterymachine.databinding.ActivityMainBinding
import java.util.*
import kotlin.random.Random


class MainActivity : AppCompatActivity(), TextToSpeech.OnInitListener {
    private lateinit var binding: ActivityMainBinding
    private lateinit var viewModel: ConstraintLayout
    //
    private val resourceImg: List<Int> = listOf(
            R.drawable.garapon001,
            R.drawable.garapon002,
            R.drawable.garapon003,
            R.drawable.garapon004,
            R.drawable.garapon005,
            R.drawable.garapon006,
            R.drawable.garapon007,
            R.drawable.garapon008,
            R.drawable.garapon009,
            R.drawable.garapon010,
            R.drawable.garapon011,
            R.drawable.garapon012,
            R.drawable.garapon013,
            R.drawable.garapon014,
            R.drawable.garapon015,
            R.drawable.garapon016,
            R.drawable.garapon017,
            R.drawable.garapon018,
            R.drawable.garapon019,
            R.drawable.garapon020,
            R.drawable.garapon021,
            R.drawable.garapon022,
            R.drawable.garapon023,
            R.drawable.garapon024,
            R.drawable.garapon025,
            R.drawable.garapon026,
            R.drawable.garapon027,
            R.drawable.garapon028,
            R.drawable.garapon029,
            R.drawable.garapon030,
            R.drawable.garapon031,
            R.drawable.garapon032,
            R.drawable.garapon033,
            R.drawable.garapon034,
            R.drawable.garapon035,
            R.drawable.garapon036,
            R.drawable.garapon037,
            R.drawable.garapon038,
            R.drawable.garapon039,
            R.drawable.garapon040,
            R.drawable.garapon041,
            R.drawable.garapon042,
            R.drawable.garapon043,
            R.drawable.garapon044,
            R.drawable.garapon045,
            R.drawable.garapon046,
            R.drawable.garapon047,
            R.drawable.garapon048,
            R.drawable.garapon049,
            R.drawable.garapon050,
            R.drawable.garapon051,
            R.drawable.garapon052,
            R.drawable.garapon053,
            R.drawable.garapon054,
            R.drawable.garapon055,
            R.drawable.garapon056,
            R.drawable.garapon057,
            R.drawable.garapon058,
            R.drawable.garapon059,
            R.drawable.garapon060,
            R.drawable.garapon061,
            R.drawable.garapon062,
            R.drawable.garapon063,
            R.drawable.garapon064,
            R.drawable.garapon065,
            R.drawable.garapon066,
            R.drawable.garapon067,
            R.drawable.garapon068,
            R.drawable.garapon069,
            R.drawable.garapon070,
            R.drawable.garapon071,
            R.drawable.garapon072,
            R.drawable.garapon073,
            R.drawable.garapon074,
            R.drawable.garapon075,
            R.drawable.garapon076,
            R.drawable.garapon077,
            R.drawable.garapon078,
            R.drawable.garapon079,
            R.drawable.garapon080,
            R.drawable.garapon081,
            R.drawable.garapon082,
            R.drawable.garapon083,
            R.drawable.garapon084,
            R.drawable.garapon085,
            R.drawable.garapon086,
            R.drawable.garapon087,
            R.drawable.garapon088,
            R.drawable.garapon089,
            R.drawable.garapon090,
            R.drawable.garapon091,
            R.drawable.garapon092,
            R.drawable.garapon093,
            R.drawable.garapon094,
            R.drawable.garapon095,
            R.drawable.garapon096,
            R.drawable.garapon097,
            R.drawable.garapon098,
            R.drawable.garapon099,
            R.drawable.garapon100,
            R.drawable.garapon101,
            R.drawable.garapon102,
            R.drawable.garapon103,
            R.drawable.garapon104,
            R.drawable.garapon105,
            R.drawable.garapon106,
            R.drawable.garapon107,
            R.drawable.garapon108,
            R.drawable.garapon109,
            R.drawable.garapon110,
            R.drawable.garapon111,
            R.drawable.garapon112,
            R.drawable.garapon113,
            R.drawable.garapon114,
            R.drawable.garapon115,
            R.drawable.garapon116,
            R.drawable.garapon117,
            R.drawable.garapon118,
            R.drawable.garapon119,
            R.drawable.garapon120,
    )
    private val resourceBallImg: List<Int> = listOf(
            R.drawable.ball_gold,
            R.drawable.ball_silver,
            R.drawable.ball_purple,
            R.drawable.ball_blue,
            R.drawable.ball_green,
            R.drawable.ball_yellow,
            R.drawable.ball_red,
            R.drawable.ball_white,
    )
    private val ballPositions: List<Triple<Int, Int, Int>> = listOf(
            //time,x,y
            Triple(95, 440, 540),
            Triple(96, 457, 558),
            Triple(97, 474, 589),
            Triple(98, 492, 630),
            Triple(99, 508, 620),
            Triple(100, 527, 614),
            Triple(101, 547, 616),
            Triple(102, 567, 627),
            Triple(103, 586, 651),
            Triple(104, 601, 647),
            Triple(105, 617, 650),
            Triple(106, 634, 657),
            Triple(107, 646, 650),
            Triple(108, 657, 653),
            Triple(109, 669, 665),
            Triple(110, 680, 665),
    )
    private lateinit var ballImage: ImageView
    private lateinit var textResult: TextView
    private lateinit var textToSpeech: TextToSpeech
    private var baseWidth: Int = 0
    private var baseHeight: Int = 0
    private var boxSize: Int = 0
    private var marginLeft: Int = 0
    private var marginTop: Int = 0
    private var actionCount: Int = 0    //回転の制御
    private var destroyFlag: Boolean = false    //Activity破棄された場合など
    private var busyFlag: Boolean = false       //回転中
    data class ItemState(
            var name: String,
            var qty: Int,
    )
    private var itemStates: Array<ItemState> = arrayOf()
    private var choiceBall = 0
    private var pin: String = ""
    private var animationSpeed: Int = 10
    private var speechFreebie: Int = 0   //景品を読み上げるか否か 0 or 1
    private var themeNumber: Int = 0
    private var localeLanguage: String = ""

    //adMob
    private lateinit var adView: AdView     //adMob
    private val adSize: AdSize
        get() {
            val display = windowManager.defaultDisplay
            val outMetrics = DisplayMetrics()
            display.getMetrics(outMetrics)
            val density = outMetrics.density
            var adWidthPixels = this.binding.adContainer.width.toFloat()
            if (adWidthPixels == 0f) {
                adWidthPixels = outMetrics.widthPixels.toFloat()
            }
            val adWidth = (adWidthPixels / density).toInt()
            return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(this, adWidth)
        }

    companion object {
        //private const val AD_UNIT_ID: String = "ca-app-pub-3940256099942544/6300978111"     //adMob Test
        private const val AD_UNIT_ID: String = "ca-app-pub-0000000000000000/0000000000"     //adMob
        private const val RESULT_SETTING_ACTIVITY: Int = 1
        internal const val SETTINGS: String = "settings"
        internal const val PIN: String = "pin"
        internal const val ANIMATION_SPEED: String = "animationSpeed"
        internal const val SPEECH_FREEBIE: String = "speechFreebie"
        internal const val THEME_NUMBER: String = "themeNumber"
        internal const val LOCALE_LANGUAGE: String = "localeLanguage"
        internal const val ITEM_NAME1: String = "itemName1"
        internal const val ITEM_NAME2: String = "itemName2"
        internal const val ITEM_NAME3: String = "itemName3"
        internal const val ITEM_NAME4: String = "itemName4"
        internal const val ITEM_NAME5: String = "itemName5"
        internal const val ITEM_NAME6: String = "itemName6"
        internal const val ITEM_NAME7: String = "itemName7"
        internal const val ITEM_NAME8: String = "itemName8"
        internal const val ITEM_QTY1: String = "itemQty1"
        internal const val ITEM_QTY2: String = "itemQty2"
        internal const val ITEM_QTY3: String = "itemQty3"
        internal const val ITEM_QTY4: String = "itemQty4"
        internal const val ITEM_QTY5: String = "itemQty5"
        internal const val ITEM_QTY6: String = "itemQty6"
        internal const val ITEM_QTY7: String = "itemQty7"
        internal const val ITEM_QTY8: String = "itemQty8"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //setContentView(R.layout.activity_main)
        this.binding = ActivityMainBinding.inflate(layoutInflater)
        this.viewModel = this.binding.root
        setContentView(this.viewModel)
        //タイトルバー非表示
        supportActionBar?.hide()
        //テーマ読み込みと設定
        this.loadThemeNumber()
        this.setTheme()
        //設定読み出し
        this.loadSpeechFreebie()
        this.loadItemStates()
        this.loadPin()
        this.loadSpeed()
        //読み上げ
        this.textToSpeech = TextToSpeech(this, this)
        this.textToSpeech.setOnUtteranceProgressListener(object : UtteranceProgressListener() {
            override fun onDone(utteranceId: String) {
            }
            override fun onError(utteranceId: String) {
            }
            override fun onStart(utteranceId: String) {
            }
        })
        this.setSpeechLocale()
        //adMob
        MobileAds.initialize(this) {}
        this.adView = AdView(this)
        this.binding.adContainer.addView(this.adView)
        this.loadBanner()
    }

    override fun onResume() {
        super.onResume()
        //準備が出来たらwidth,heightを取得して次へ進む
        this.binding.layoutBase.viewTreeObserver.addOnGlobalLayoutListener(object : OnGlobalLayoutListener {
            override fun onGlobalLayout() {
                this@MainActivity.binding.layoutBase.viewTreeObserver.removeOnGlobalLayoutListener(this)
                this@MainActivity.baseWidth = this@MainActivity.binding.layoutBase.width
                this@MainActivity.baseHeight = this@MainActivity.binding.layoutBase.height
                this@MainActivity.initGarapon()
            }
        })
    }

    override fun onInit(status: Int) {
        if (status == TextToSpeech.SUCCESS) {
            this.setSpeechLocale()
        }
    }

    override fun onDestroy() {
        this.destroyFlag = true
        super.onDestroy()
    }

    //adMob
    private fun loadBanner() {
        this.adView.adUnitId = AD_UNIT_ID
        this.adView.adSize = adSize
        val adRequest = AdRequest
            .Builder()
            //.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build()
        this.adView.loadAd(adRequest)
    }

    private fun speakText(text: String) {
        this.textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null, "utteranceId")
    }

    private fun initGarapon() {
        if (::ballImage.isInitialized) {
            this.binding.layoutBase.removeView(this.ballImage)
        }
        if (::textResult.isInitialized) {
            this.binding.layoutBase.removeView(this.textResult)
        }
        this.boxSize = minOf(this.baseWidth, this.baseHeight)
        this.marginLeft = (this.baseWidth - this.boxSize).div(2)
        this.marginTop = (this.baseHeight - this.boxSize).div(2)
        //ball
        this.ballImage = ImageView(this)
        this.ballImage.setImageResource(resourceBallImg[0])
        this.ballImage.alpha = 0F
        this.binding.layoutBase.addView(this.ballImage, this.boxSize.div(25), this.boxSize.div(25))
        //text
        this.textResult = TextView(this)
        this.textResult.text = ""
        this.textResult.textSize = 16F
        this.textResult.setTextColor(Color.rgb(255,255,255))
        this.textResult.alpha = 0F
        this.binding.layoutBase.addView(this.textResult)
        //
        this.startButtonColor(true)
    }

    fun onClickStart(v: View) {
        if (this.busyFlag) {
            return
        }
        this.busyFlag = true
        this.ballImage.alpha = 0F
        this.textResult.alpha = 0F
        this.startButtonColor(false)
        //ballを選ぶ
        var ballSum: Int = 0
        this.itemStates.forEach {
            ballSum += it.qty
        }
        if (ballSum == 0) {    //選ぶものが無くなった
            this.textResult.text = getString(R.string.empty)
            this.textResult.x = 50F
            this.textResult.y = 40F
            this.textResult.alpha = 1F
            this.startButtonColor(true)
            this.busyFlag = false
            return
        }
        var remainNum: Int = Random.nextInt(ballSum)
        var choiceColor: Int = -1
        for (i in this.itemStates.indices) {
            if (this.itemStates[i].qty != 0) {
                if (this.itemStates[i].qty < remainNum) {
                    remainNum -= this.itemStates[i].qty
                } else {
                    choiceColor = i     //この色に決定
                    this.itemStates[i].qty -= 1     //1個減らす
                    this.saveItemStates()
                    break
                }
            }
        }
        //
        this.choiceBall = choiceColor
        this.destroyFlag = false
        this.actionCount = 0
        this.ballImage.setImageResource(resourceBallImg[this.choiceBall])
        this.textResult.text = this.itemStates[choiceBall].name
        this.actionTimeline()
    }

    private fun actionTimeline() {
        Handler(Looper.getMainLooper()).postDelayed({
            if (this.destroyFlag) {
                this.startButtonColor(true)
                return@postDelayed
            }
            this.binding.imageGarapon.setImageResource(resourceImg[this.actionCount])   //ガラポン画像切り替え
            this.ballMove(this.actionCount) //ball移動
            this.actionCount += 1
            if (this.actionCount > 119) {
                if (this.destroyFlag) {
                    this.startButtonColor(true)
                    return@postDelayed
                }
                this.binding.imageGarapon.setImageResource(resourceImg[0])  //ガラポン0番画像
                this.busyFlag = false
                this.startButtonColor(true)
                return@postDelayed
            }
            actionTimeline()
        }, this.animationSpeed.toLong())
    }

    private fun ballMove(num: Int) {
        if (num < 95 || num > 110) {
            return
        }
        for (i in this.ballPositions.indices) {
            val (t, x, y) = this.ballPositions[i]
            if (t == num) {
                val boxPixel: Float = this.boxSize.div(900F)
                val ballSizeHalf: Float = this.boxSize.div(25F).div(2F)
                this.ballImage.x = this.marginLeft + boxPixel.times(x) - ballSizeHalf
                this.ballImage.y = this.marginTop + boxPixel.times(y) - ballSizeHalf
                break
            }
        }
        when (num) {
            95 -> this.ballImage.alpha = 1F
            110 -> {
                this.textResult.x = 80F
                this.textResult.y = this.marginTop + this.boxSize - 100F
                this.textResult.alpha = 1F
                if (this.speechFreebie == 1) {
                    this.speakText(this.textResult.text.toString())
                }
            }
        }
    }

    fun onClickSetting(v: View) {
        if (this.busyFlag) {
            return
        }
        this.destroyFlag = true
        if (this.pin == "") {
            this.openSetting()
        } else {
            val editPin = EditText(this)
            editPin.inputType = InputType.TYPE_CLASS_NUMBER
            AlertDialog.Builder(this).apply {
                setTitle("PIN")
                setView(editPin)
                setPositiveButton("OK", DialogInterface.OnClickListener { _, _ ->
                    val inputPin = editPin.text.toString()
                    if (this@MainActivity.pin == inputPin) {
                        this@MainActivity.openSetting()
                    }
                })
                setNegativeButton("Cancel", null)
                show()
            }
        }
    }

    private fun startButtonColor(onOff: Boolean) {
        if (onOff) {
            this.binding.textStart.alpha = 1F
            this.binding.textSetting.alpha = 1F
        } else {
            this.binding.textStart.alpha = 0F
            this.binding.textSetting.alpha = 0F
        }
    }

    //-------------------------------------------------

    private fun openSetting() {
        val intent = Intent(applicationContext, SettingActivity::class.java)
        intent.putExtra(ITEM_NAME1, this.itemStates[0].name)
        intent.putExtra(ITEM_QTY1, this.itemStates[0].qty)
        intent.putExtra(ITEM_NAME2, this.itemStates[1].name)
        intent.putExtra(ITEM_QTY2, this.itemStates[1].qty)
        intent.putExtra(ITEM_NAME3, this.itemStates[2].name)
        intent.putExtra(ITEM_QTY3, this.itemStates[2].qty)
        intent.putExtra(ITEM_NAME4, this.itemStates[3].name)
        intent.putExtra(ITEM_QTY4, this.itemStates[3].qty)
        intent.putExtra(ITEM_NAME5, this.itemStates[4].name)
        intent.putExtra(ITEM_QTY5, this.itemStates[4].qty)
        intent.putExtra(ITEM_NAME6, this.itemStates[5].name)
        intent.putExtra(ITEM_QTY6, this.itemStates[5].qty)
        intent.putExtra(ITEM_NAME7, this.itemStates[6].name)
        intent.putExtra(ITEM_QTY7, this.itemStates[6].qty)
        intent.putExtra(ITEM_NAME8, this.itemStates[7].name)
        intent.putExtra(ITEM_QTY8, this.itemStates[7].qty)
        intent.putExtra(PIN, this.pin)
        intent.putExtra(ANIMATION_SPEED, this.animationSpeed)
        intent.putExtra(SPEECH_FREEBIE, this.speechFreebie)
        intent.putExtra(THEME_NUMBER, this.themeNumber)
        intent.putExtra(LOCALE_LANGUAGE, this.localeLanguage)
        startActivityForResult(intent, RESULT_SETTING_ACTIVITY)
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
        super.onActivityResult(requestCode, resultCode, intent)
        if (resultCode == Activity.RESULT_OK && requestCode == RESULT_SETTING_ACTIVITY && intent != null) {
            val itemName1: String = intent.getStringExtra(ITEM_NAME1) ?: ""
            val itemQty1: Int = intent.getIntExtra(ITEM_QTY1, 0)
            val itemName2: String = intent.getStringExtra(ITEM_NAME2) ?: ""
            val itemQty2: Int = intent.getIntExtra(ITEM_QTY2, 0)
            val itemName3: String = intent.getStringExtra(ITEM_NAME3) ?: ""
            val itemQty3: Int = intent.getIntExtra(ITEM_QTY3, 0)
            val itemName4: String = intent.getStringExtra(ITEM_NAME4) ?: ""
            val itemQty4: Int = intent.getIntExtra(ITEM_QTY4, 0)
            val itemName5: String = intent.getStringExtra(ITEM_NAME5) ?: ""
            val itemQty5: Int = intent.getIntExtra(ITEM_QTY5, 0)
            val itemName6: String = intent.getStringExtra(ITEM_NAME6) ?: ""
            val itemQty6: Int = intent.getIntExtra(ITEM_QTY6, 0)
            val itemName7: String = intent.getStringExtra(ITEM_NAME7) ?: ""
            val itemQty7: Int = intent.getIntExtra(ITEM_QTY7, 0)
            val itemName8: String = intent.getStringExtra(ITEM_NAME8) ?: ""
            val itemQty8: Int = intent.getIntExtra(ITEM_QTY8, 0)
            this.itemStates = arrayOf(
                    ItemState(itemName1, itemQty1),
                    ItemState(itemName2, itemQty2),
                    ItemState(itemName3, itemQty3),
                    ItemState(itemName4, itemQty4),
                    ItemState(itemName5, itemQty5),
                    ItemState(itemName6, itemQty6),
                    ItemState(itemName7, itemQty7),
                    ItemState(itemName8, itemQty8),
            )
            this.saveItemStates()
            //
            val lastPin = this.pin
            this.pin = intent.getStringExtra(PIN) ?: ""
            if (lastPin != this.pin) {
                this.savePin()
            }
            //
            val lastSpeed = this.animationSpeed
            this.animationSpeed = intent.getIntExtra(ANIMATION_SPEED, 10)
            if (lastSpeed != this.animationSpeed) {
                if (this.animationSpeed <= 0) {
                    this.animationSpeed = 1
                } else if (this.animationSpeed > 1000) {
                    this.animationSpeed = 1000
                }
                this.saveSpeed()
            }
            //
            val lastSpeechFreebie: Int = this.speechFreebie
            this.speechFreebie = intent.getIntExtra(SPEECH_FREEBIE, 1)
            if (lastSpeechFreebie != this.speechFreebie) {
                this.saveSpeechFreebie()
            }
            //
            val lastThemeNumber: Int = this.themeNumber
            this.themeNumber = intent.getIntExtra(THEME_NUMBER, 0)
            if (lastThemeNumber != this.themeNumber) {
                this.saveThemeNumber()
            }
            val lastLocaleLanguage = this.localeLanguage
            this.localeLanguage = intent.getStringExtra(LOCALE_LANGUAGE) ?: ""
            if (this.localeLanguage != lastLocaleLanguage) {
                this.saveLocaleLanguage()
            }
        }
        //再構築しないと位置がずれる
        //SettingActivityからMainActivityに戻る時に言語を変更するとクラッシュするので再構築する
        recreate()
    }

    //-------------------------------------------------

    //itemsを保存
    private fun saveItemStates() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putString(ITEM_NAME1, this@MainActivity.itemStates[0].name)
            putInt(ITEM_QTY1, this@MainActivity.itemStates[0].qty)
            putString(ITEM_NAME2, this@MainActivity.itemStates[1].name)
            putInt(ITEM_QTY2, this@MainActivity.itemStates[1].qty)
            putString(ITEM_NAME3, this@MainActivity.itemStates[2].name)
            putInt(ITEM_QTY3, this@MainActivity.itemStates[2].qty)
            putString(ITEM_NAME4, this@MainActivity.itemStates[3].name)
            putInt(ITEM_QTY4, this@MainActivity.itemStates[3].qty)
            putString(ITEM_NAME5, this@MainActivity.itemStates[4].name)
            putInt(ITEM_QTY5, this@MainActivity.itemStates[4].qty)
            putString(ITEM_NAME6, this@MainActivity.itemStates[5].name)
            putInt(ITEM_QTY6, this@MainActivity.itemStates[5].qty)
            putString(ITEM_NAME7, this@MainActivity.itemStates[6].name)
            putInt(ITEM_QTY7, this@MainActivity.itemStates[6].qty)
            putString(ITEM_NAME8, this@MainActivity.itemStates[7].name)
            putInt(ITEM_QTY8, this@MainActivity.itemStates[7].qty)
            apply()
        }
    }

    //itemsを読み出し
    private fun loadItemStates() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.itemStates = arrayOf(
                ItemState(pref.getString(ITEM_NAME1, "") ?: "", pref.getInt(ITEM_QTY1, 0)),
                ItemState(pref.getString(ITEM_NAME2, "") ?: "", pref.getInt(ITEM_QTY2, 0)),
                ItemState(pref.getString(ITEM_NAME3, "") ?: "", pref.getInt(ITEM_QTY3, 0)),
                ItemState(pref.getString(ITEM_NAME4, "") ?: "", pref.getInt(ITEM_QTY4, 0)),
                ItemState(pref.getString(ITEM_NAME5, "") ?: "", pref.getInt(ITEM_QTY5, 0)),
                ItemState(pref.getString(ITEM_NAME6, "") ?: "", pref.getInt(ITEM_QTY6, 0)),
                ItemState(pref.getString(ITEM_NAME7, "") ?: "", pref.getInt(ITEM_QTY7, 0)),
                ItemState(pref.getString(ITEM_NAME8, "") ?: "", pref.getInt(ITEM_QTY8, 0)),
        )
        var emptyFlag: Boolean = true
        for (i in this.itemStates.indices) {
            if (this.itemStates[i].name != "") {
                emptyFlag = false
                break
            }
        }
        if (emptyFlag) {
            this.itemStates[0].name = resources.getString(R.string.rank1)
            this.itemStates[0].qty = 1
            this.itemStates[1].name = resources.getString(R.string.rank2)
            this.itemStates[1].qty = 1
            this.itemStates[2].name = resources.getString(R.string.rank3)
            this.itemStates[2].qty = 2
            this.itemStates[3].name = resources.getString(R.string.rank4)
            this.itemStates[3].qty = 2
            this.itemStates[4].name = resources.getString(R.string.rank5)
            this.itemStates[4].qty = 3
            this.itemStates[5].name = resources.getString(R.string.rank6)
            this.itemStates[5].qty = 10
            this.itemStates[6].name = resources.getString(R.string.rank7)
            this.itemStates[6].qty = 100
            this.itemStates[7].name = resources.getString(R.string.rank8)
            this.itemStates[7].qty = 500
            this.saveItemStates()
        }
    }

    //-------------------------------------------------

    //PINを保存
    private fun savePin() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putString(PIN, this@MainActivity.pin)
            apply()
        }
    }

    //PINを読み出し
    private fun loadPin() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.pin = pref.getString(PIN,"") ?: ""
    }

    //-------------------------------------------------

    //animationSpeedを保存
    private fun saveSpeed() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putInt(ANIMATION_SPEED, this@MainActivity.animationSpeed)
            apply()
        }
    }

    //animationSpeedを読み出し
    private fun loadSpeed() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.animationSpeed = pref.getInt(ANIMATION_SPEED, 10)
        if (this.animationSpeed <= 0) {
            this.animationSpeed = 1
        } else if (this.animationSpeed > 1000) {
            this.animationSpeed = 1000
        }
    }

    //-------------------------------------------------

    //景品読み上げを保存
    private fun saveSpeechFreebie() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putInt(SPEECH_FREEBIE, this@MainActivity.speechFreebie)
            apply()
        }
    }

    //景品読み上げを読み出し
    private fun loadSpeechFreebie() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.speechFreebie = pref.getInt(SPEECH_FREEBIE, 1)
    }

    //-------------------------------------------------

    //テーマを保存
    private fun saveThemeNumber() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putInt(THEME_NUMBER, this@MainActivity.themeNumber)
            apply()
        }
    }

    //テーマを読み出し
    private fun loadThemeNumber() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.themeNumber = pref.getInt(THEME_NUMBER, 0)
    }

    //テーマを設定
    private fun setTheme() {
        when (this.themeNumber) {
            0 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
            1 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
        }
    }

    //-------------------------------------------------

    //音声の言語設定
    private fun setSpeechLocale() {
        this.loadLocaleLanguage()
        val loc: Locale? = if (this.localeLanguage != "") Locale(this.localeLanguage) else null
        if (loc != null) {
            this.textToSpeech.let { tts ->
                if (tts.isLanguageAvailable(loc) > TextToSpeech.LANG_AVAILABLE) {
                    tts.language = loc
                } else {
                    // 言語の設定に失敗
                }
            }
        }
    }

    //----------------------------------------------

    //localeLanguageを保存
    private fun saveLocaleLanguage() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putString(LOCALE_LANGUAGE, this@MainActivity.localeLanguage)
            apply()
        }
    }

    //localeLanguageを読み出し
    private fun loadLocaleLanguage() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.localeLanguage = pref.getString(LOCALE_LANGUAGE, "") ?: ""
    }

    //言語設定
    override fun attachBaseContext(base: Context) {
        val pref = base.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.localeLanguage = pref.getString(LOCALE_LANGUAGE, "") ?: ""
        val loc: Locale? = if (this.localeLanguage != "") Locale(this.localeLanguage) else null
        if (loc != null) {
            val res = base.resources
            val config = Configuration(res.configuration)
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {    //minSdkVersion 24
                val localeList = LocaleList(loc)
                LocaleList.setDefault(localeList)
                config.setLocales(localeList)
            } else {    //minSdkVersion 17  16はダメ
                config.setLocale(loc)
            }
            super.attachBaseContext(base.createConfigurationContext(config))
        } else {
            super.attachBaseContext(base)
        }
    }

    //----------------------------------------------
}

app/src/main/java/jp/aosystem/wheellotterymachine/SettingActivity.kt

package jp.aosystem.wheellotterymachine

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.os.LocaleList
import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintLayout
import jp.aosystem.wheellotterymachine.databinding.ActivitySettingBinding
import java.util.*

class SettingActivity : AppCompatActivity() {
    private lateinit var binding: ActivitySettingBinding
    private lateinit var viewModel: ConstraintLayout
    private var inputMethodManager: InputMethodManager? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //setContentView(R.layout.activity_main)
        this.binding = ActivitySettingBinding.inflate(layoutInflater)
        this.viewModel = this.binding.root
        setContentView(this.viewModel)
        //データ受け取り
        val intent = this.intent
        val itemName1: String = intent.getStringExtra(MainActivity.ITEM_NAME1) ?: ""
        val itemQty1: Int = intent.getIntExtra(MainActivity.ITEM_QTY1,0)
        val itemName2: String = intent.getStringExtra(MainActivity.ITEM_NAME2) ?: ""
        val itemQty2: Int = intent.getIntExtra(MainActivity.ITEM_QTY2,0)
        val itemName3: String = intent.getStringExtra(MainActivity.ITEM_NAME3) ?: ""
        val itemQty3: Int = intent.getIntExtra(MainActivity.ITEM_QTY3,0)
        val itemName4: String = intent.getStringExtra(MainActivity.ITEM_NAME4) ?: ""
        val itemQty4: Int = intent.getIntExtra(MainActivity.ITEM_QTY4,0)
        val itemName5: String = intent.getStringExtra(MainActivity.ITEM_NAME5) ?: ""
        val itemQty5: Int = intent.getIntExtra(MainActivity.ITEM_QTY5,0)
        val itemName6: String = intent.getStringExtra(MainActivity.ITEM_NAME6) ?: ""
        val itemQty6: Int = intent.getIntExtra(MainActivity.ITEM_QTY6,0)
        val itemName7: String = intent.getStringExtra(MainActivity.ITEM_NAME7) ?: ""
        val itemQty7: Int = intent.getIntExtra(MainActivity.ITEM_QTY7,0)
        val itemName8: String = intent.getStringExtra(MainActivity.ITEM_NAME8) ?: ""
        val itemQty8: Int = intent.getIntExtra(MainActivity.ITEM_QTY8,0)
        if (itemName1 != "") {
            this.binding.editName1.setText(itemName1)
        }
        if (itemQty1 != 0) {
            this.binding.editQuantity1.setText(itemQty1.toString())
        }
        this.binding.editName2.setText(itemName2)
        if (itemQty2 != 0) {
            this.binding.editQuantity2.setText(itemQty2.toString())
        }
        this.binding.editName3.setText(itemName3)
        if (itemQty3 != 0) {
            this.binding.editQuantity3.setText(itemQty3.toString())
        }
        this.binding.editName4.setText(itemName4)
        if (itemQty4 != 0) {
            this.binding.editQuantity4.setText(itemQty4.toString())
        }
        this.binding.editName5.setText(itemName5)
        if (itemQty5 != 0) {
            this.binding.editQuantity5.setText(itemQty5.toString())
        }
        this.binding.editName6.setText(itemName6)
        if (itemQty6 != 0) {
            this.binding.editQuantity6.setText(itemQty6.toString())
        }
        this.binding.editName7.setText(itemName7)
        if (itemQty7 != 0) {
            this.binding.editQuantity7.setText(itemQty7.toString())
        }
        this.binding.editName8.setText(itemName8)
        if (itemQty8 != 0) {
            this.binding.editQuantity8.setText(itemQty8.toString())
        }
        val pin: String = intent.getStringExtra(MainActivity.PIN) ?: ""
        this.binding.editPin.setText(pin)
        val animationSpeed: Int = intent.getIntExtra(MainActivity.ANIMATION_SPEED,10)
        this.binding.editSpeed.setText(animationSpeed.toString())
        val speechFreebie: Int = intent.getIntExtra(MainActivity.SPEECH_FREEBIE,0)
        this.binding.switchSpeechFreebie.isChecked = speechFreebie != 0
        val themeNumber: Int = intent.getIntExtra(MainActivity.THEME_NUMBER,0)
        this.binding.switchTheme.isChecked = themeNumber != 0
        val localeLanguage: String = intent.getStringExtra(MainActivity.LOCALE_LANGUAGE) ?: ""
        when (localeLanguage) {
            "en" -> this.binding.radioLanguageEn.isChecked = true
            "bg" -> this.binding.radioLanguageBg.isChecked = true
            "cs" -> this.binding.radioLanguageCs.isChecked = true
            "da" -> this.binding.radioLanguageDa.isChecked = true
            "de" -> this.binding.radioLanguageDe.isChecked = true
            "el" -> this.binding.radioLanguageEl.isChecked = true
            "es" -> this.binding.radioLanguageEs.isChecked = true
            "et" -> this.binding.radioLanguageEt.isChecked = true
            "fi" -> this.binding.radioLanguageFi.isChecked = true
            "fr" -> this.binding.radioLanguageFr.isChecked = true
            "hu" -> this.binding.radioLanguageHu.isChecked = true
            "it" -> this.binding.radioLanguageIt.isChecked = true
            "ja" -> this.binding.radioLanguageJa.isChecked = true
            "lt" -> this.binding.radioLanguageLt.isChecked = true
            "lv" -> this.binding.radioLanguageLv.isChecked = true
            "nl" -> this.binding.radioLanguageNl.isChecked = true
            "pl" -> this.binding.radioLanguagePl.isChecked = true
            "pt" -> this.binding.radioLanguagePt.isChecked = true
            "ro" -> this.binding.radioLanguageRo.isChecked = true
            "ru" -> this.binding.radioLanguageRu.isChecked = true
            "sk" -> this.binding.radioLanguageSk.isChecked = true
            "sv" -> this.binding.radioLanguageSv.isChecked = true
            "zh" -> this.binding.radioLanguageZh.isChecked = true
            else -> this.binding.radioLanguageSystem.isChecked = true
        }
        //
        supportActionBar?.hide()    //タイトルバー非表示
        //
        this.setTouchListener()
    }

    //背景タッチでテキストエリアからフォーカスを外してキーボードを隠す
    private fun setTouchListener() {
        this.inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
        this.binding.editName1.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName1.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity1.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity1.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editName2.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName2.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity2.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity2.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editName3.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName3.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity3.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity3.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editName4.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName4.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity4.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity4.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editName5.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName5.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity5.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity5.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editName6.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName6.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity6.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity6.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editName7.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName7.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity7.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity7.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editName8.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editName8.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editQuantity8.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editQuantity8.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editPin.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editPin.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
        this.binding.editSpeed.setOnFocusChangeListener { _, hasFocus ->
            if (!hasFocus) {
                this.inputMethodManager!!.hideSoftInputFromWindow(   //キーボードを隠す
                        this.binding.editSpeed.windowToken,
                        InputMethodManager.HIDE_NOT_ALWAYS
                )
            }
        }
    }

    fun onClickApply(v: View) {
        val itemName1: String = this.binding.editName1.text.toString()
        val itemQty1: Int = ("0" + this.binding.editQuantity1.text.toString()).toInt()
        val itemName2: String = this.binding.editName2.text.toString()
        val itemQty2: Int = ("0" + this.binding.editQuantity2.text.toString()).toInt()
        val itemName3: String = this.binding.editName3.text.toString()
        val itemQty3: Int = ("0" + this.binding.editQuantity3.text.toString()).toInt()
        val itemName4: String = this.binding.editName4.text.toString()
        val itemQty4: Int = ("0" + this.binding.editQuantity4.text.toString()).toInt()
        val itemName5: String = this.binding.editName5.text.toString()
        val itemQty5: Int = ("0" + this.binding.editQuantity5.text.toString()).toInt()
        val itemName6: String = this.binding.editName6.text.toString()
        val itemQty6: Int = ("0" + this.binding.editQuantity6.text.toString()).toInt()
        val itemName7: String = this.binding.editName7.text.toString()
        val itemQty7: Int = ("0" + this.binding.editQuantity7.text.toString()).toInt()
        val itemName8: String = this.binding.editName8.text.toString()
        val itemQty8: Int = ("0" + this.binding.editQuantity8.text.toString()).toInt()
        val pin: String = this.binding.editPin.text.toString()
        val animationSpeed: Int = ("0" + this.binding.editSpeed.text.toString()).toInt()
        val speechFreebie: Int = if (this.binding.switchSpeechFreebie.isChecked) 1 else 0
        val themeNumber: Int = if (this.binding.switchTheme.isChecked) 1 else 0
        var localeLanguage: String = ""
        if (this.binding.radioLanguageEn.isChecked) {
            localeLanguage = "en"
        } else if (this.binding.radioLanguageBg.isChecked) {
            localeLanguage = "bg"
        } else if (this.binding.radioLanguageCs.isChecked) {
            localeLanguage = "cs"
        } else if (this.binding.radioLanguageDa.isChecked) {
            localeLanguage = "da"
        } else if (this.binding.radioLanguageDe.isChecked) {
            localeLanguage = "de"
        } else if (this.binding.radioLanguageEl.isChecked) {
            localeLanguage = "el"
        } else if (this.binding.radioLanguageEs.isChecked) {
            localeLanguage = "es"
        } else if (this.binding.radioLanguageEt.isChecked) {
            localeLanguage = "et"
        } else if (this.binding.radioLanguageFi.isChecked) {
            localeLanguage = "fi"
        } else if (this.binding.radioLanguageFr.isChecked) {
            localeLanguage = "fr"
        } else if (this.binding.radioLanguageHu.isChecked) {
            localeLanguage = "hu"
        } else if (this.binding.radioLanguageIt.isChecked) {
            localeLanguage = "it"
        } else if (this.binding.radioLanguageJa.isChecked) {
            localeLanguage = "ja"
        } else if (this.binding.radioLanguageLt.isChecked) {
            localeLanguage = "lt"
        } else if (this.binding.radioLanguageLv.isChecked) {
            localeLanguage = "lv"
        } else if (this.binding.radioLanguageNl.isChecked) {
            localeLanguage = "nl"
        } else if (this.binding.radioLanguagePl.isChecked) {
            localeLanguage = "pl"
        } else if (this.binding.radioLanguagePt.isChecked) {
            localeLanguage = "pt"
        } else if (this.binding.radioLanguageRo.isChecked) {
            localeLanguage = "ro"
        } else if (this.binding.radioLanguageRu.isChecked) {
            localeLanguage = "ru"
        } else if (this.binding.radioLanguageSk.isChecked) {
            localeLanguage = "sk"
        } else if (this.binding.radioLanguageSv.isChecked) {
            localeLanguage = "sv"
        } else if (this.binding.radioLanguageZh.isChecked) {
            localeLanguage = "zh"
        }
        val intent = Intent()
        intent.putExtra(MainActivity.ITEM_NAME1, itemName1)
        intent.putExtra(MainActivity.ITEM_QTY1, itemQty1)
        intent.putExtra(MainActivity.ITEM_NAME2, itemName2)
        intent.putExtra(MainActivity.ITEM_QTY2, itemQty2)
        intent.putExtra(MainActivity.ITEM_NAME3, itemName3)
        intent.putExtra(MainActivity.ITEM_QTY3, itemQty3)
        intent.putExtra(MainActivity.ITEM_NAME4, itemName4)
        intent.putExtra(MainActivity.ITEM_QTY4, itemQty4)
        intent.putExtra(MainActivity.ITEM_NAME5, itemName5)
        intent.putExtra(MainActivity.ITEM_QTY5, itemQty5)
        intent.putExtra(MainActivity.ITEM_NAME6, itemName6)
        intent.putExtra(MainActivity.ITEM_QTY6, itemQty6)
        intent.putExtra(MainActivity.ITEM_NAME7, itemName7)
        intent.putExtra(MainActivity.ITEM_QTY7, itemQty7)
        intent.putExtra(MainActivity.ITEM_NAME8, itemName8)
        intent.putExtra(MainActivity.ITEM_QTY8, itemQty8)
        intent.putExtra(MainActivity.PIN, pin)
        intent.putExtra(MainActivity.ANIMATION_SPEED, animationSpeed)
        intent.putExtra(MainActivity.SPEECH_FREEBIE, speechFreebie)
        intent.putExtra(MainActivity.THEME_NUMBER, themeNumber)
        intent.putExtra(MainActivity.LOCALE_LANGUAGE, localeLanguage)
        setResult(Activity.RESULT_OK, intent)
        finish()
    }

    fun onClickCancel(v: View) {
        val intent = Intent()
        setResult(Activity.RESULT_CANCELED, intent)
        finish()
    }

    //--------------------------------------------------

    //言語設定
    override fun attachBaseContext(base: Context) {
        val pref = base.getSharedPreferences(MainActivity.SETTINGS, Context.MODE_PRIVATE)
        val localeLanguage: String = pref.getString(MainActivity.LOCALE_LANGUAGE, "") ?: ""
        val loc: Locale? = if (localeLanguage != "") Locale(localeLanguage) else null
        if (loc != null) {
            val res = base.resources
            val config = Configuration(res.configuration)
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {    //minSdkVersion 24
                val localeList = LocaleList(loc)
                LocaleList.setDefault(localeList)
                config.setLocales(localeList)
            } else {    //minSdkVersion 17  16はダメ
                config.setLocale(loc)
            }
            super.attachBaseContext(base.createConfigurationContext(config))
        } else {
            super.attachBaseContext(base)
        }
    }

    //--------------------------------------------------
}

app/src/main/res/layout/activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".MainActivity">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="#009d34"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:id="@+id/layoutHeader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="1dp"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/textStart"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="6"
                android:background="#86C663"
                android:gravity="center"
                android:minHeight="96dip"
                android:onClick="onClickStart"
                android:text="@string/drawLot" />

            <TextView
                android:id="@+id/textSetting"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="1dp"
                android:layout_weight="1"
                android:background="#5DC674"
                android:gravity="center"
                android:minHeight="96dip"
                android:onClick="onClickSetting"
                android:text="@string/setting" />

        </LinearLayout>

        <Space
            android:layout_width="match_parent"
            android:layout_height="5dp" />

        <FrameLayout
            android:id="@+id/layoutBase"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/imageGarapon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center|center_horizontal|center_vertical"
                android:contentDescription="@string/app_name"
                app:srcCompat="@drawable/garapon001" />

        </FrameLayout>

        <Space
            android:layout_width="match_parent"
            android:layout_height="80dp" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/ad_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent" />



</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/activity_setting.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".SettingActivity">

    <LinearLayout
        android:id="@+id/layoutButtons"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        android:layout_marginTop="1dp"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textCancel"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="#5DC6AF"
            android:gravity="center"
            android:minHeight="48dip"
            android:onClick="onClickCancel"
            android:text="@string/cancel" />

        <TextView
            android:id="@+id/textVerification"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="1dp"
            android:layout_weight="1"
            android:background="#5DC674"
            android:gravity="center"
            android:minHeight="48dip"
            android:onClick="onClickApply"
            android:text="@string/apply" />

    </LinearLayout>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/layoutButtons">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:orientation="vertical"
            android:paddingLeft="20dp"
            android:paddingTop="20dp"
            android:paddingRight="20dp"
            android:paddingBottom="50dp">

            <TableLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp">

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall1"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballGold"
                        app:srcCompat="@drawable/ball_gold" />

                    <TextView
                        android:id="@+id/textName1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballGold" />

                    <EditText
                        android:id="@+id/editName1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number"
                        tools:ignore="Autofill"/>
                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall2"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballSilver"
                        app:srcCompat="@drawable/ball_silver" />

                    <TextView
                        android:id="@+id/textName2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballSilver" />

                    <EditText
                        android:id="@+id/editName2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number" />
                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall3"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballPurple"
                        app:srcCompat="@drawable/ball_purple" />

                    <TextView
                        android:id="@+id/textName3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballPurple" />

                    <EditText
                        android:id="@+id/editName3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number" />
                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall4"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballBlue"
                        app:srcCompat="@drawable/ball_blue" />

                    <TextView
                        android:id="@+id/textName4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballBlue" />

                    <EditText
                        android:id="@+id/editName4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number" />
                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall5"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballGreen"
                        app:srcCompat="@drawable/ball_green" />

                    <TextView
                        android:id="@+id/textName5"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballGreen" />

                    <EditText
                        android:id="@+id/editName5"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity5"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity5"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number" />
                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall6"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballYellow"
                        app:srcCompat="@drawable/ball_yellow" />

                    <TextView
                        android:id="@+id/textName6"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballYellow" />

                    <EditText
                        android:id="@+id/editName6"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity6"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity6"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number" />
                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall7"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballRed"
                        app:srcCompat="@drawable/ball_red" />

                    <TextView
                        android:id="@+id/textName7"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballRed" />

                    <EditText
                        android:id="@+id/editName7"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity7"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity7"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number" />
                </TableRow>

                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageBall8"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="center"
                        android:contentDescription="@string/ballWhite"
                        app:srcCompat="@drawable/ball_white" />

                    <TextView
                        android:id="@+id/textName8"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/ballWhite" />

                    <EditText
                        android:id="@+id/editName8"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:layout_weight="1"
                        android:ems="9"
                        android:inputType="text" />

                    <TextView
                        android:id="@+id/textQuantity8"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:text="@string/quantity" />

                    <EditText
                        android:id="@+id/editQuantity8"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="5dp"
                        android:ems="4"
                        android:inputType="number" />
                </TableRow>

            </TableLayout>

            <TextView
                android:id="@+id/textView8"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="15dp"
                android:text="@string/rankNote"
                android:textSize="12sp" />

            <View
                android:id="@+id/divider1"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="30dp"
                android:background="?android:attr/listDivider" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/textPin"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/pin"
                    android:textColor="?android:attr/textColorPrimary" />

                <EditText
                    android:id="@+id/editPin"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="10dp"
                    android:layout_weight="1"
                    android:ems="6"
                    android:inputType="number"
                    android:autofillHints="" />
            </LinearLayout>

            <TextView
                android:id="@+id/textView5"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/pin01" />

            <TextView
                android:id="@+id/textView6"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:text="@string/pin02"
                android:textSize="12sp" />

            <View
                android:id="@+id/divider5"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="30dp"
                android:background="?android:attr/listDivider" />


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/textSpeed"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/animationSpeed"
                    android:textColor="?android:attr/textColorPrimary" />

                <EditText
                    android:id="@+id/editSpeed"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="10dp"
                    android:layout_weight="1"
                    android:autofillHints=""
                    android:ems="6"
                    android:inputType="number" />
            </LinearLayout>

            <TextView
                android:id="@+id/textView7"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/speed1" />

            <View
                android:id="@+id/divider8"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="20dp"
                android:background="?android:attr/listDivider" />

            <androidx.appcompat.widget.SwitchCompat
                android:id="@+id/switchSpeechFreebie"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="15dp"
                android:text="@string/speechFreebie" />

            <TextView
                android:id="@+id/textView4"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/speechFreebie1" />

            <View
                android:id="@+id/divider6"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="10dp"
                android:background="?android:attr/listDivider" />

            <TextView
                android:id="@+id/textLanguage"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="@string/language"
                android:textColor="?android:attr/textColorPrimary" />

            <TextView
                android:id="@+id/textView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:text="@string/languageNote" />

            <RadioGroup
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
                <RadioButton
                    android:id="@+id/radioLanguageSystem"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageSystem" />
                <RadioButton
                    android:id="@+id/radioLanguageEn"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageEn" />
                <RadioButton
                    android:id="@+id/radioLanguageBg"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageBg" />
                <RadioButton
                    android:id="@+id/radioLanguageCs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageCs" />
                <RadioButton
                    android:id="@+id/radioLanguageDa"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageDa" />
                <RadioButton
                    android:id="@+id/radioLanguageDe"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageDe" />
                <RadioButton
                    android:id="@+id/radioLanguageEl"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageEl" />
                <RadioButton
                    android:id="@+id/radioLanguageEs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageEs" />
                <RadioButton
                    android:id="@+id/radioLanguageEt"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageEt" />
                <RadioButton
                    android:id="@+id/radioLanguageFi"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageFi" />
                <RadioButton
                    android:id="@+id/radioLanguageFr"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageFr" />
                <RadioButton
                    android:id="@+id/radioLanguageHu"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageHu" />
                <RadioButton
                    android:id="@+id/radioLanguageIt"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageIt" />
                <RadioButton
                    android:id="@+id/radioLanguageJa"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageJa" />
                <RadioButton
                    android:id="@+id/radioLanguageLt"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageLt" />
                <RadioButton
                    android:id="@+id/radioLanguageLv"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageLv" />
                <RadioButton
                    android:id="@+id/radioLanguageNl"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageNl" />
                <RadioButton
                    android:id="@+id/radioLanguagePl"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languagePl" />
                <RadioButton
                    android:id="@+id/radioLanguagePt"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languagePt" />
                <RadioButton
                    android:id="@+id/radioLanguageRo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageRo" />
                <RadioButton
                    android:id="@+id/radioLanguageRu"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageRu" />
                <RadioButton
                    android:id="@+id/radioLanguageSk"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageSk" />
                <RadioButton
                    android:id="@+id/radioLanguageSv"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageSv" />
                <RadioButton
                    android:id="@+id/radioLanguageZh"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageZh" />
            </RadioGroup>

            <View
                android:id="@+id/divider2"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="20dp"
                android:background="?android:attr/listDivider" />

            <androidx.appcompat.widget.SwitchCompat
                android:id="@+id/switchTheme"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="@string/darkTheme" />

            <View
                android:id="@+id/divider3"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="20dp"
                android:background="?android:attr/listDivider" />

            <TextView
                android:id="@+id/textUsage"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="@string/usage" />

            <TextView
                android:id="@+id/textUsage1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/usage1" />

            <View
                android:id="@+id/divider4"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="20dp"
                android:background="?android:attr/listDivider" />

            <Space
                android:layout_width="match_parent"
                android:layout_height="120dp" />

        </LinearLayout>
    </ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
このページでお気付きの点がございましたら
ご連絡いただけますと幸いです。
Eメール(任意)
送信内容
 

■ 便利ウェブサイト