ソースコード source code

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

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

下記コードの最終ビルド日: 2022-11-21

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.3.1' apply false
    id 'com.android.library' version '7.3.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}

app/build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}
android {
    namespace 'jp.aosystem.roulettewheel'
    compileSdk 33
    defaultConfig {
        applicationId "jp.aosystem.roulettewheel"
        minSdk 24
        targetSdk 33

        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.google.android.gms:play-services-ads-lite:21.3.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}

app/src/main/AndroidManifest.xml

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

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

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.RouletteWheel"
        tools:targetApi="31">
        <activity
            android:name=".SettingActivity"
            android:exported="false">
            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
        <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/roulettewheel/MainActivity.kt

package jp.aosystem.roulettewheel

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.os.Handler
import android.os.LocaleList
import android.os.Looper
import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener
import android.util.DisplayMetrics
import android.view.ViewGroup
import android.view.ViewTreeObserver
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.res.ResourcesCompat
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 java.util.*
import kotlin.math.cos
import kotlin.math.sin

class MainActivity : AppCompatActivity(), TextToSpeech.OnInitListener {

    private lateinit var vTextStart: TextView
    private lateinit var vImageGear: ImageView
    private lateinit var vLayoutBase: FrameLayout
    private lateinit var vImageWheelBase: ImageView
    private lateinit var vLinearlayoutWheelTop: LinearLayout
    private lateinit var vImageWheelTop: ImageView
    private lateinit var vLinearlayoutBall: LinearLayout
    private lateinit var vImageBall: ImageView
    private lateinit var vImageTextThree: ImageView
    private lateinit var vImageTextTwo: ImageView
    private lateinit var vImageTextOne: ImageView
    private lateinit var vImageTextNoMoreBets: ImageView
    private lateinit var vTextResult: TextView
    private lateinit var vAdContainer: LinearLayout
    //
    private lateinit var bgGreen: Drawable
    private lateinit var bgBlack: Drawable
    private lateinit var bgRed: Drawable
    //
    private lateinit var textToSpeech: TextToSpeech
    private var speechVoices: ArrayList<String> = arrayListOf()
    //
    private var baseWidth: Int = 0
    private var baseHeight: Int = 0
    private var boxSize: Int = 0
    private var busyFlag: Boolean = false       //回転中
    private var speechNumber: Int = 0   //数字を読み上げるか否か 0 or 1
    private var speechVoice: String = "en-US-language"   //voice e.g. "ja-jp-x-jad-local"
    private var shortNumber: Int = 0   //短く回転 0 to 9
    private var themeNumber: Int = 0    //0:light 1:dark
    private var localeLanguage: String = "" //en or ja or else
    private var wheelAngle: Float = 360F
    private var ballAngle: Float = 0F
    private var wheelAngleStart: Float = 0F
    private var ballRotateFlag: Boolean = false //ball回転中はTrue
    private var ballTick: Int = 0   //回転をこの数値の減算で制御
    private var adjustAngle: Float = 0F //最終の確度調整用
    private var ballDistanceRatio: Float = 0F   //BALL_DISTANCE_START to BALL_DISTANCE_END
    private val mainHandler: Handler = Handler(Looper.getMainLooper())
    private var wheelRunnable: Runnable? = null
    private var wheelRunnerAlready: Boolean = false //wheel回転開始済み。アプリ退避からの復帰で2重処理を防ぐ
    //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.vAdContainer.width.toFloat()
            if (adWidthPixels == 0f) {
                adWidthPixels = outMetrics.widthPixels.toFloat()
            }
            val adWidth = (adWidthPixels / density).toInt()
            return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(this, adWidth)
        }

    companion object {
        internal const val AD_UNIT_ID: String = "ca-app-pub-3940256099942544/6300978111"     //adMob Test
        internal const val SETTINGS: String = "settings"
        internal const val SPEECH_NUMBER: String = "speechNumber"
        internal const val SPEECH_VOICE: String = "speechVoice"
        internal const val SPEECH_VOICES: String = "speechVoices"
        internal const val SHORT_NUMBER: String = "shortNumber"
        internal const val THEME_NUMBER: String = "themeNumber"
        internal const val LOCALE_LANGUAGE: String = "localeLanguage"
        private const val BALL_SIZE_RATIO: Float = 0.04F
        private const val BALL_DISTANCE_START: Float = 0.89F
        private const val BALL_DISTANCE_END: Float = 0.535F
        private val LIST_NUMBER: List<String> = listOf("0","28","9","26","30","11","7","20","32","17","5","22","34","15","3","24","36","13","1","00","27","10","25","29","12","8","19","31","18","6","21","33","16","4","23","35","14","2")
        private val LIST_COLOR: List<String> = listOf("g","k","r","k","r","k","r","k","r","k","r","k","r","k","r","k","r","k","r","g","r","k","r","k","r","k","r","k","r","k","r","k","r","k","r","k","r","k")
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        supportActionBar?.hide()    //タイトルバー非表示
        //
        this.vTextStart = findViewById(R.id.textStart)
        this.vImageGear = findViewById(R.id.imageGear)
        this.vLayoutBase = findViewById(R.id.layoutBase)
        this.vImageWheelBase = findViewById(R.id.imageWheelBase)
        this.vLinearlayoutWheelTop = findViewById(R.id.linearLayoutWheelTop)
        this.vImageWheelTop = findViewById(R.id.imageWheelTop)
        this.vLinearlayoutBall = findViewById(R.id.linearLayoutBall)
        this.vImageBall = findViewById(R.id.imageBall)
        this.vImageTextThree = findViewById(R.id.imageTextThree)
        this.vImageTextTwo = findViewById(R.id.imageTextTwo)
        this.vImageTextOne = findViewById(R.id.imageTextOne)
        this.vImageTextNoMoreBets = findViewById(R.id.imageTextNoMoreBets)
        this.vTextResult = findViewById(R.id.textResult)
        this.vAdContainer = findViewById(R.id.adContainer)
        this.vTextStart.setOnClickListener {
            this.onClickStart()
        }
        this.vImageGear.setOnClickListener {
            this.onClickSetting()
        }
        //resource
        this.bgGreen = ResourcesCompat.getDrawable(this.resources,R.drawable.bg_green_border,null)!!
        this.bgBlack = ResourcesCompat.getDrawable(this.resources,R.drawable.bg_black_border,null)!!
        this.bgRed = ResourcesCompat.getDrawable(this.resources,R.drawable.bg_red_border,null)!!
        //設定
        this.loadThemeNumber()
        this.setTheme()
        this.loadSpeechNumber()
        this.loadSpeechVoice()
        this.loadShortNumber()
        //読み上げ
        this.textToSpeech = TextToSpeech(this, this)
        this.textToSpeech.setOnUtteranceProgressListener(object : UtteranceProgressListener() {
            override fun onDone(utteranceId: String) {
            }
            override fun onError(p0: String?) {
            }
            override fun onStart(utteranceId: String) {
            }
        })
        //adMob
        MobileAds.initialize(this) {}
        this.adView = AdView(this)
        this.vAdContainer.addView(this.adView)
        this.adView.adUnitId = AD_UNIT_ID
        this.adView.setAdSize(this.adSize)
        val adRequest = AdRequest.Builder().build()
        this.adView.loadAd(adRequest)
    }

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

    override fun onInit(status: Int) {
        if (status == TextToSpeech.SUCCESS) {
            this.speechVoices = arrayListOf()
            val vs = textToSpeech.voices
            vs.forEach{v ->
                this.speechVoices += v.locale.toString() + " " + v.name
            }
            this.speechVoices.sort()
            this.setSpeechVoiceName()
        }
    }

    override fun onDestroy() {
        this.textToSpeech.shutdown()
        super.onDestroy()
    }

    private fun init() {
        this.boxSize = minOf(this.baseWidth, this.baseHeight)
        val topPadding: Int = (this.boxSize * 0.14).toInt()
        this.vLinearlayoutWheelTop.setPadding(topPadding,topPadding,topPadding,topPadding)
        this.wheelRunnable = object: Runnable {
            override fun run() {
                this@MainActivity.wheelAngle -= 0.5F
                if (this@MainActivity.wheelAngle < 0F) {
                    this@MainActivity.wheelAngle = 359.5F
                }
                this@MainActivity.vImageWheelTop.rotation = this@MainActivity.wheelAngle
                if (this@MainActivity.ballRotateFlag) {
                    this@MainActivity.adjustAngle += 0.5F   //wheelAngleと同じ数値にする
                    this@MainActivity.ballAngle += 5F
                    if (this@MainActivity.ballAngle >= 360F) {
                        this@MainActivity.ballAngle = 0F
                    }
                    if (this@MainActivity.ballTick > 0) {
                        this@MainActivity.ballTick -= 1
                        if (this@MainActivity.ballTick == 500) {
                            this@MainActivity.vImageTextThree.alpha = 1F
                            this@MainActivity.speakText("3")
                        }
                        if (this@MainActivity.ballTick == 450) {
                            this@MainActivity.vImageTextThree.alpha = 0F
                            this@MainActivity.vImageTextTwo.alpha = 1F
                            this@MainActivity.speakText("2")
                        }
                        if (this@MainActivity.ballTick == 400) {
                            this@MainActivity.vImageTextTwo.alpha = 0F
                            this@MainActivity.vImageTextOne.alpha = 1F
                            this@MainActivity.speakText("1")
                        }
                        if (this@MainActivity.ballTick == 350) {
                            this@MainActivity.vImageTextOne.alpha = 0F
                            this@MainActivity.vImageTextNoMoreBets.alpha = 1F
                            this@MainActivity.speakText(resources.getString(R.string.nomorebets))
                        }
                        if (this@MainActivity.ballTick == 250) {
                            this@MainActivity.vImageTextNoMoreBets.alpha = 0F
                            this@MainActivity.ballTick -= (Math.random() * 100).toInt()
                        }
                        if (this@MainActivity.ballTick < 5) {
                            this@MainActivity.ballDistanceRatio = (BALL_DISTANCE_START + BALL_DISTANCE_END) / 2
                        }
                        if (this@MainActivity.ballTick < 1) {
                            this@MainActivity.ballDistanceRatio = BALL_DISTANCE_END
                        }
                        if (this@MainActivity.ballTick <= 0) {
                            this@MainActivity.ballRotateFlag = false
                            this@MainActivity.startButtonColor(true)
                            this@MainActivity.resultNumber()
                            this@MainActivity.busyFlag = false
                        }
                    }
                }
                ballPosition()
                this@MainActivity.mainHandler.postDelayed(this,25)
            }
        }
        if (!wheelRunnerAlready) {  //アプリ退避からの復帰で2重処理を防ぐ
            mainHandler.post(this.wheelRunnable as Runnable)
            wheelRunnerAlready = true
        }
        this.startButtonColor(true)
        //
        val vImageBallLayout: ViewGroup.LayoutParams = this.vImageBall.layoutParams
        vImageBallLayout.width = (this.boxSize * BALL_SIZE_RATIO).toInt()
        vImageBallLayout.height = (this.boxSize * BALL_SIZE_RATIO).toInt()
        this.vImageBall.alpha = 0F
        this.vImageTextThree.alpha = 0F
        this.vImageTextTwo.alpha = 0F
        this.vImageTextOne.alpha = 0F
        this.vImageTextNoMoreBets.alpha = 0F
        this.vTextResult.alpha = 0F
    }

    private fun onClickStart() {
        if (this.busyFlag) {
            return
        }
        this.busyFlag = true
        this.vTextResult.alpha = 0F
        this.startButtonColor(false)
        this.ballAngle = 0F
        this.vImageBall.alpha = 1F
        this.ballDistanceRatio = BALL_DISTANCE_START
        this.wheelAngleStart = this.wheelAngle
        this.ballTick = (10 - this.shortNumber) * 100 + 260  //1260 to 360
        this.adjustAngle = 0F
        this.ballRotateFlag = true
    }

    private fun ballPosition() {
        val ballSize: Float = this.boxSize * BALL_SIZE_RATIO
        var angle: Float = this.ballAngle
        if (this.ballRotateFlag == false) {
            angle = ((angle - this.wheelAngleStart + this.adjustAngle) / (360 / 38F)).toInt() * (360 / 38F) + (180 / 38F)
            angle += this.wheelAngle
        }
        var x: Double = (-sin(angle * (Math.PI / 180)) * (this.boxSize / 2))    //回転
        var y: Double = (cos(angle * (Math.PI / 180)) * (this.boxSize / 2))    //回転
        x *= this.ballDistanceRatio //内側の距離
        y *= this.ballDistanceRatio //内側の距離
        x += this.boxSize / 2.0 * 0.89 //中心位置
        y += this.boxSize / 2.0 * 0.89 //中心位置
        x += ballSize * 0.9 //微調整
        y += ballSize * 0.9 //微調整
        this.vLinearlayoutBall.setPadding(x.toInt(),y.toInt(),0,0)
    }

    private fun resultNumber() {
        var angle: Float = this.ballAngle
        angle = ((angle - this.wheelAngleStart + this.adjustAngle) / (360 / 38F)).toInt() * (360 / 38F) + (180 / 38F)
        angle = 180F - angle
        angle += 3600F
        angle %= 360F
        var num: Int = 38 - (angle / (360 / 38F)).toInt() - 1
        num %= 38
        val resultNumber: String = LIST_NUMBER[num]
        val resultColor: String = LIST_COLOR[num]
        this.vTextResult.text = resultNumber

        val greenBlackRed: Drawable? = when (resultColor) {
            "g" -> bgGreen
            "k" -> bgBlack
            "r" -> bgRed
            else -> null
        }
        this.vTextResult.background = greenBlackRed
        this.vTextResult.alpha = 1F
        this.speakText(resultNumber)
    }

    //start,settingのボタン色
    private fun startButtonColor(onOff: Boolean) {
        if (onOff) {
            this.vTextStart.alpha = 1F
            this.vImageGear.alpha = 0.6F
        } else {
            this.vTextStart.alpha = 0F
            this.vImageGear.alpha = 0F
        }
    }

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

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

    private fun onClickSetting() {
        if (this.busyFlag) {
            return
        }
        val intent = Intent(applicationContext, SettingActivity::class.java)
        intent.putExtra(SPEECH_NUMBER, this.speechNumber)
        intent.putExtra(SPEECH_VOICE, this.speechVoice)
        intent.putStringArrayListExtra(SPEECH_VOICES, this.speechVoices)
        intent.putExtra(SHORT_NUMBER, this.shortNumber)
        intent.putExtra(THEME_NUMBER, this.themeNumber)
        intent.putExtra(LOCALE_LANGUAGE, this.localeLanguage)
        this.settingStartForResult.launch(intent)
    }
    private val settingStartForResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
        if (result.resultCode == Activity.RESULT_OK && result.data != null) {
            val intent: Intent = result.data!!
            val lastSpeechNumber: Int = this.speechNumber
            this.speechNumber = intent.getIntExtra(SPEECH_NUMBER, 1)
            if (lastSpeechNumber != this.speechNumber) {
                this.saveSpeechNumber()
            }
            val lastSpeechVoice: String = this.speechVoice
            this.speechVoice = intent.getStringExtra(SPEECH_VOICE) ?: ""
            if (lastSpeechVoice != this.speechVoice) {
                this.saveSpeechVoice()
                this.setSpeechVoiceName()
            }
            val lastShortNumber: Int = this.shortNumber
            this.shortNumber = intent.getIntExtra(SHORT_NUMBER, 1)
            if (lastShortNumber != this.shortNumber) {
                this.saveShortNumber()
            }
            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()
            }
        }
        recreate()
    }

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

    //数字読み上げを保存
    private fun saveSpeechNumber() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putInt(SPEECH_NUMBER, this@MainActivity.speechNumber)
            apply()
        }
    }

    //数字読み上げを読み出し
    private fun loadSpeechNumber() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.speechNumber = pref.getInt(SPEECH_NUMBER, 1)
    }

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

    //声を保存
    private fun saveSpeechVoice() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putString(SPEECH_VOICE, this@MainActivity.speechVoice)
            apply()
        }
    }

    //声を読み出し
    private fun loadSpeechVoice() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.speechVoice = pref.getString(SPEECH_VOICE,"en-US-language").toString()
    }

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

    //回転早くを保存
    private fun saveShortNumber() {
        getSharedPreferences(SETTINGS, Context.MODE_PRIVATE).edit().apply {
            putInt(SHORT_NUMBER, this@MainActivity.shortNumber)
            apply()
        }
    }

    //回転早くを読み出し
    private fun loadShortNumber() {
        val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
        this.shortNumber = pref.getInt(SHORT_NUMBER, 0)
    }

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

    //テーマを保存
    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 setSpeechVoiceName() {
        this.textToSpeech.voice = this.textToSpeech.voices.find { it.name == this.speechVoice } ?: this.textToSpeech.defaultVoice
    }

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

    //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)
            val localeList = LocaleList(loc)
            LocaleList.setDefault(localeList)
            config.setLocales(localeList)
            super.attachBaseContext(base.createConfigurationContext(config))
        } else {
            super.attachBaseContext(base)
        }
    }

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

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

package jp.aosystem.roulettewheel

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.LocaleList
import android.view.View
import android.widget.*
import androidx.appcompat.widget.SwitchCompat
import java.util.*
import kotlin.collections.ArrayList

class SettingActivity : AppCompatActivity() {

    private lateinit var vTextCancel: TextView
    private lateinit var vTextApply: TextView
    private lateinit var vSwitchSpeechNumber: SwitchCompat
    private lateinit var vSpinnerVoice: Spinner
    private lateinit var vSeekBarShortNumber: SeekBar
    private lateinit var vRadioLanguageSystem: RadioButton
    private lateinit var vRadioLanguageEn: RadioButton
    private lateinit var vRadioLanguageBg: RadioButton
    private lateinit var vRadioLanguageCs: RadioButton
    private lateinit var vRadioLanguageDa: RadioButton
    private lateinit var vRadioLanguageDe: RadioButton
    private lateinit var vRadioLanguageEl: RadioButton
    private lateinit var vRadioLanguageEs: RadioButton
    private lateinit var vRadioLanguageEt: RadioButton
    private lateinit var vRadioLanguageFi: RadioButton
    private lateinit var vRadioLanguageFr: RadioButton
    private lateinit var vRadioLanguageHu: RadioButton
    private lateinit var vRadioLanguageIt: RadioButton
    private lateinit var vRadioLanguageJa: RadioButton
    private lateinit var vRadioLanguageKo: RadioButton
    private lateinit var vRadioLanguageLt: RadioButton
    private lateinit var vRadioLanguageLv: RadioButton
    private lateinit var vRadioLanguageNl: RadioButton
    private lateinit var vRadioLanguagePl: RadioButton
    private lateinit var vRadioLanguagePt: RadioButton
    private lateinit var vRadioLanguageRo: RadioButton
    private lateinit var vRadioLanguageRu: RadioButton
    private lateinit var vRadioLanguageSk: RadioButton
    private lateinit var vRadioLanguageSv: RadioButton
    private lateinit var vRadioLanguageTh: RadioButton
    private lateinit var vRadioLanguageZh: RadioButton
    private lateinit var vSwitchTheme: SwitchCompat
    private var spinnerSelectVoice: String = ""

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_setting)
        supportActionBar?.hide()    //タイトルバー非表示
        //
        this.vTextCancel = findViewById(R.id.textCancel)
        this.vTextApply = findViewById(R.id.textApply)
        this.vSwitchSpeechNumber = findViewById(R.id.switchSpeechNumber)
        this.vSpinnerVoice = findViewById(R.id.spinnerVoice)
        this.vSeekBarShortNumber = findViewById(R.id.seekBarShortNumber)
        this.vRadioLanguageSystem = findViewById(R.id.radioLanguageSystem)
        this.vRadioLanguageEn = findViewById(R.id.radioLanguageEn)
        this.vRadioLanguageBg = findViewById(R.id.radioLanguageBg)
        this.vRadioLanguageCs = findViewById(R.id.radioLanguageCs)
        this.vRadioLanguageDa = findViewById(R.id.radioLanguageDa)
        this.vRadioLanguageDe = findViewById(R.id.radioLanguageDe)
        this.vRadioLanguageEl = findViewById(R.id.radioLanguageEl)
        this.vRadioLanguageEs = findViewById(R.id.radioLanguageEs)
        this.vRadioLanguageEt = findViewById(R.id.radioLanguageEt)
        this.vRadioLanguageFi = findViewById(R.id.radioLanguageFi)
        this.vRadioLanguageFr = findViewById(R.id.radioLanguageFr)
        this.vRadioLanguageHu = findViewById(R.id.radioLanguageHu)
        this.vRadioLanguageIt = findViewById(R.id.radioLanguageIt)
        this.vRadioLanguageJa = findViewById(R.id.radioLanguageJa)
        this.vRadioLanguageKo = findViewById(R.id.radioLanguageKo)
        this.vRadioLanguageLt = findViewById(R.id.radioLanguageLt)
        this.vRadioLanguageLv = findViewById(R.id.radioLanguageLv)
        this.vRadioLanguageNl = findViewById(R.id.radioLanguageNl)
        this.vRadioLanguagePl = findViewById(R.id.radioLanguagePl)
        this.vRadioLanguagePt = findViewById(R.id.radioLanguagePt)
        this.vRadioLanguageRo = findViewById(R.id.radioLanguageRo)
        this.vRadioLanguageRu = findViewById(R.id.radioLanguageRu)
        this.vRadioLanguageSk = findViewById(R.id.radioLanguageSk)
        this.vRadioLanguageSv = findViewById(R.id.radioLanguageSv)
        this.vRadioLanguageTh = findViewById(R.id.radioLanguageTh)
        this.vRadioLanguageZh = findViewById(R.id.radioLanguageZh)
        this.vSwitchTheme = findViewById(R.id.switchTheme)
        //
        //データ受け取り
        val intent = this.intent
        val speechNumber: Int = intent.getIntExtra(MainActivity.SPEECH_NUMBER,0)
        this.vSwitchSpeechNumber.isChecked = speechNumber != 0
        val speechVoice: String = intent.getStringExtra(MainActivity.SPEECH_VOICE) ?: ""
        this.spinnerSelectVoice = speechVoice
        val speechVoices: ArrayList<String> = intent.getStringArrayListExtra(MainActivity.SPEECH_VOICES) as ArrayList<String>
        val shortNumber: Int = intent.getIntExtra(MainActivity.SHORT_NUMBER,0)
        this.vSeekBarShortNumber.progress = shortNumber
        val themeNumber: Int = intent.getIntExtra(MainActivity.THEME_NUMBER,0)
        this.vSwitchTheme.isChecked = themeNumber != 0
        val localeLanguage: String = intent.getStringExtra(MainActivity.LOCALE_LANGUAGE) ?: ""
        when (localeLanguage) {
            "en" -> this.vRadioLanguageEn.isChecked = true
            "bg" -> this.vRadioLanguageBg.isChecked = true
            "cs" -> this.vRadioLanguageCs.isChecked = true
            "da" -> this.vRadioLanguageDa.isChecked = true
            "de" -> this.vRadioLanguageDe.isChecked = true
            "el" -> this.vRadioLanguageEl.isChecked = true
            "es" -> this.vRadioLanguageEs.isChecked = true
            "et" -> this.vRadioLanguageEt.isChecked = true
            "fi" -> this.vRadioLanguageFi.isChecked = true
            "fr" -> this.vRadioLanguageFr.isChecked = true
            "hu" -> this.vRadioLanguageHu.isChecked = true
            "it" -> this.vRadioLanguageIt.isChecked = true
            "ja" -> this.vRadioLanguageJa.isChecked = true
            "ko" -> this.vRadioLanguageKo.isChecked = true
            "lt" -> this.vRadioLanguageLt.isChecked = true
            "lv" -> this.vRadioLanguageLv.isChecked = true
            "nl" -> this.vRadioLanguageNl.isChecked = true
            "pl" -> this.vRadioLanguagePl.isChecked = true
            "pt" -> this.vRadioLanguagePt.isChecked = true
            "ro" -> this.vRadioLanguageRo.isChecked = true
            "ru" -> this.vRadioLanguageRu.isChecked = true
            "sk" -> this.vRadioLanguageSk.isChecked = true
            "sv" -> this.vRadioLanguageSv.isChecked = true
            "th" -> this.vRadioLanguageTh.isChecked = true
            "zh" -> this.vRadioLanguageZh.isChecked = true
            else -> this.vRadioLanguageSystem.isChecked = true
        }
        //
        this.vTextCancel.setOnClickListener {
            this.onClickCancel()
        }
        this.vTextApply.setOnClickListener {
            this.onClickApply()
        }
        this.setSpinnerVoice(speechVoice,speechVoices)
    }

    private fun setSpinnerVoice(speechVoice: String, speechVoices: ArrayList<String>) {
        //データ用意
        val adapter1 = ArrayAdapter<String>(this, android.R.layout.simple_spinner_item)
        adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
        speechVoices.forEach { v ->
            adapter1.add(v)
        }
        //スピナー設定
        this.vSpinnerVoice.adapter = adapter1
        this.vSpinnerVoice.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
            // アイテムが選択された時
            override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
                val spinnerParent: Spinner = parent as Spinner
                val selectedValue: String = spinnerParent.selectedItem as String
                val ary: List<String> = selectedValue.split(" ")
                val selectedVoice: String = ary[1] ?: ""
                this@SettingActivity.spinnerSelectVoice = selectedVoice
            }
            // アイテムが選択されなかった
            override fun onNothingSelected(parent: AdapterView<*>?) {
            }
        }
        //初期選択を設定
        if (speechVoice != "" && speechVoices.isNotEmpty()) {
            for (i in 0..speechVoices.count()) {
                val ary = speechVoices[i].split(" ")
                val s1: String = ary[1] ?: ""
                if (s1 == speechVoice) {
                    this.vSpinnerVoice.setSelection(i)
                    break
                }
            }
        }
    }

    private fun onClickApply() {
        val speechNumber: Int = if (this.vSwitchSpeechNumber.isChecked) 1 else 0
        val speechVoice: String = this.spinnerSelectVoice
        val shortNumber: Int = this.vSeekBarShortNumber.progress
        val themeNumber: Int = if (this.vSwitchTheme.isChecked) 1 else 0
        var localeLanguage: String = ""
        if (this.vRadioLanguageEn.isChecked) {
            localeLanguage = "en"
        } else if (this.vRadioLanguageBg.isChecked) {
            localeLanguage = "bg"
        } else if (this.vRadioLanguageCs.isChecked) {
            localeLanguage = "cs"
        } else if (this.vRadioLanguageDa.isChecked) {
            localeLanguage = "da"
        } else if (this.vRadioLanguageDe.isChecked) {
            localeLanguage = "de"
        } else if (this.vRadioLanguageEl.isChecked) {
            localeLanguage = "el"
        } else if (this.vRadioLanguageEs.isChecked) {
            localeLanguage = "es"
        } else if (this.vRadioLanguageEt.isChecked) {
            localeLanguage = "et"
        } else if (this.vRadioLanguageFi.isChecked) {
            localeLanguage = "fi"
        } else if (this.vRadioLanguageFr.isChecked) {
            localeLanguage = "fr"
        } else if (this.vRadioLanguageHu.isChecked) {
            localeLanguage = "hu"
        } else if (this.vRadioLanguageIt.isChecked) {
            localeLanguage = "it"
        } else if (this.vRadioLanguageJa.isChecked) {
            localeLanguage = "ja"
        } else if (this.vRadioLanguageKo.isChecked) {
            localeLanguage = "ko"
        } else if (this.vRadioLanguageLt.isChecked) {
            localeLanguage = "lt"
        } else if (this.vRadioLanguageLv.isChecked) {
            localeLanguage = "lv"
        } else if (this.vRadioLanguageNl.isChecked) {
            localeLanguage = "nl"
        } else if (this.vRadioLanguagePl.isChecked) {
            localeLanguage = "pl"
        } else if (this.vRadioLanguagePt.isChecked) {
            localeLanguage = "pt"
        } else if (this.vRadioLanguageRo.isChecked) {
            localeLanguage = "ro"
        } else if (this.vRadioLanguageRu.isChecked) {
            localeLanguage = "ru"
        } else if (this.vRadioLanguageSk.isChecked) {
            localeLanguage = "sk"
        } else if (this.vRadioLanguageSv.isChecked) {
            localeLanguage = "sv"
        } else if (this.vRadioLanguageTh.isChecked) {
            localeLanguage = "th"
        } else if (this.vRadioLanguageZh.isChecked) {
            localeLanguage = "zh"
        }
        val intent = Intent()
        intent.putExtra(MainActivity.SPEECH_NUMBER, speechNumber)
        intent.putExtra(MainActivity.SPEECH_VOICE, speechVoice)
        intent.putExtra(MainActivity.SHORT_NUMBER, shortNumber)
        intent.putExtra(MainActivity.THEME_NUMBER, themeNumber)
        intent.putExtra(MainActivity.LOCALE_LANGUAGE, localeLanguage)
        setResult(Activity.RESULT_OK, intent)
        finish()
    }

    private fun onClickCancel() {
        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)
            val localeList = LocaleList(loc)
            LocaleList.setDefault(localeList)
            config.setLocales(localeList)
            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"
    android:background="@color/main_back"
    tools:context=".MainActivity">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="10dp"
                    android:orientation="vertical">

                    <FrameLayout
                        android:id="@+id/layoutBase"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/imageWheelBase"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:adjustViewBounds="true"
                            app:srcCompat="@drawable/roulettewheel_base" />

                        <LinearLayout
                            android:id="@+id/linearLayoutWheelTop"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:orientation="vertical">

                            <ImageView
                                android:id="@+id/imageWheelTop"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:adjustViewBounds="true"
                                app:srcCompat="@drawable/roulettewheel_top" />

                        </LinearLayout>

                        <LinearLayout
                            android:id="@+id/linearLayoutBall"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:orientation="vertical">

                            <ImageView
                                android:id="@+id/imageBall"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:adjustViewBounds="true"
                                app:srcCompat="@drawable/ball" />
                        </LinearLayout>

                        <ImageView
                            android:id="@+id/imageTextThree"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:adjustViewBounds="true"
                            app:srcCompat="@drawable/three" />

                        <ImageView
                            android:id="@+id/imageTextTwo"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:adjustViewBounds="true"
                            app:srcCompat="@drawable/two" />

                        <ImageView
                            android:id="@+id/imageTextOne"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:adjustViewBounds="true"
                            app:srcCompat="@drawable/one" />

                        <ImageView
                            android:id="@+id/imageTextNoMoreBets"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:adjustViewBounds="true"
                            app:srcCompat="@drawable/nomorebets" />

                        <TextView
                            android:id="@+id/textResult"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:paddingLeft="20dp"
                            android:paddingTop="1dp"
                            android:paddingRight="20dp"
                            android:paddingBottom="1dp"
                            android:textColor="@color/white"
                            android:textSize="48sp"
                            android:textStyle="bold" />

                        <ImageView
                            android:id="@+id/imageGear"
                            android:layout_width="44dp"
                            android:layout_height="44dp"
                            android:layout_gravity="right"
                            android:layout_margin="5dp"
                            android:padding="10dp"
                            app:srcCompat="@drawable/gear" />

                    </FrameLayout>

                    <TextView
                        android:id="@+id/textStart"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginTop="10dp"
                        android:background="@drawable/border_white"
                        android:gravity="center"
                        android:minHeight="60dp"
                        android:text="@string/start" />

                </LinearLayout>

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


            </LinearLayout>
        </ScrollView>

        <LinearLayout
            android:id="@+id/adContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="vertical" />
    </LinearLayout>


</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_marginLeft="1dp"
        android:layout_marginTop="1dp"
        android:layout_marginRight="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="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@color/setting_cancel_back"
            android:gravity="center"
            android:minHeight="48dip"
            android:text="@string/cancel" />

        <TextView
            android:id="@+id/textApply"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="1dp"
            android:layout_weight="1"
            android:background="@color/setting_apply_back"
            android:gravity="center"
            android:minHeight="48dip"
            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">


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

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

            <Spinner
                android:id="@+id/spinnerVoice"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:layout_marginBottom="10dp"
                android:gravity="start" />

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

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

            <SeekBar
                android:id="@+id/seekBarShortNumber"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:max="9"
                android:padding="10dp"
                android:progress="0" />

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

            <View
                android:id="@+id/divider2"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="20dp"
                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/textView3"
                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/radioLanguageKo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageKo" />
                <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/radioLanguageTh"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageTh" />
                <RadioButton
                    android:id="@+id/radioLanguageZh"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/languageZh" />
            </RadioGroup>

            <View
                android:id="@+id/divider"
                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="15dp"
                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:layout_marginTop="5dp"
                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>