- エーオーシステム コーポレートサイト
https://www.aosystem.co.jp/ - エーオーシステム プロダクトサイト
https://ao-system.net/ - レンタルサーバー
- バーチャル展示会
- ウェブカタログサービス
- 3Dグラフィック
- Android アプリ
- iOS (iPhone,iPad) アプリ
- Flutter開発
- プログラミング記録QuickAnswer
- 無料画像素材
- スカイボックス 3D SKY BOX
このページのQRコード
下記アプリの主要なソースコードを公開しています。アプリ開発の参考になれば幸いです。
画像等が別途必要ですので下記情報のみでアプリが完成するものではありません。 アプリは少しずつ機能拡張していますのでストア公開されているアプリと内容が異なる場合があります。 コードはコピーして自由にお使いいただけます。ただし著作権は放棄しておりませんので全部の再掲載はご遠慮ください。部分的に再掲載したり、改変して再掲載するのは構いません。 自身のアプリ作成の参考として個人使用・商用問わず自由にお使いいただけます。 コード記述のお手本を示すものではありません。ミニアプリですので変数名などさほど気遣いしていない部分も有りますし間違いも有るかと思いますので参考程度にお考え下さい。 他の賢者の皆様が公開されているコードを参考にした箇所も含まれます。Androidアプリ開発の熟練者が書いたコードではありません。 エンジニア向け技術情報共有サービスではありませんので説明は省いています。ご了承ください。 GitHubなどへの公開は予定しておりません。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 30
defaultConfig {
applicationId "jp.aosystem.gearcombination"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
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.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.android.gms:play-services-ads:20.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.aosystem.gearcombination">
<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.GearCombination">
<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>
</activity>
<activity
android:name=".GameActivity"
android:exported="false" />
<activity
android:name=".SettingActivity"
android:exported="false" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-0000000000000000~0000000000" />
</application>
</manifest>
package jp.aosystem.gearcombination
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.LocaleList
import android.util.DisplayMetrics
import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatDelegate
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.*
class MainActivity : AppCompatActivity() {
private lateinit var vAdContainer: LinearLayout
private lateinit var vTextSetting: TextView
private lateinit var vTextQuest: List<TextView>
private lateinit var vTextClear: List<TextView>
private var destroyFlag: Boolean = false //Activity破棄された場合など
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.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-0000000000000000/0000000000" //adMob Test
internal const val AD_UNIT_ID: String = "ca-app-pub-0000000000000000/0000000000"
internal const val SETTINGS: String = "settings"
internal const val THEME_NUMBER: String = "themeNumber"
internal const val LOCALE_LANGUAGE: String = "localeLanguage"
internal const val GAME_DATA: String = "gameData"
internal const val QUEST_NUMBER: String = "questNumber"
}
private val settingStartForResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
if (result.resultCode == Activity.RESULT_OK) {
val intent: Intent? = result.data
if (intent != null) {
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 val gameStartForResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
if (result.resultCode == Activity.RESULT_OK) {
val intent: Intent? = result.data
if (intent != null) {
val questNumber: Int = intent.getIntExtra(QUEST_NUMBER, 0)
this.saveGameData(questNumber)
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//タイトルバー非表示
supportActionBar?.hide()
//
this.vAdContainer = findViewById(R.id.ad_container)
this.vTextSetting = findViewById(R.id.textSetting)
this.vTextQuest = listOf(
findViewById(R.id.textQuest1),
findViewById(R.id.textQuest2),
findViewById(R.id.textQuest3),
findViewById(R.id.textQuest4),
findViewById(R.id.textQuest5),
findViewById(R.id.textQuest6),
findViewById(R.id.textQuest7),
findViewById(R.id.textQuest8),
findViewById(R.id.textQuest9),
findViewById(R.id.textQuest10),
findViewById(R.id.textQuest11),
findViewById(R.id.textQuest12),
findViewById(R.id.textQuest13),
findViewById(R.id.textQuest14),
findViewById(R.id.textQuest15),
findViewById(R.id.textQuest16),
findViewById(R.id.textQuest17),
findViewById(R.id.textQuest18),
findViewById(R.id.textQuest19),
findViewById(R.id.textQuest20),
findViewById(R.id.textQuest21),
findViewById(R.id.textQuest22),
findViewById(R.id.textQuest23),
findViewById(R.id.textQuest24),
findViewById(R.id.textQuest25),
findViewById(R.id.textQuest26),
findViewById(R.id.textQuest27),
findViewById(R.id.textQuest28),
findViewById(R.id.textQuest29),
findViewById(R.id.textQuest30),
findViewById(R.id.textQuest31),
findViewById(R.id.textQuest32),
findViewById(R.id.textQuest33),
findViewById(R.id.textQuest34),
findViewById(R.id.textQuest35),
findViewById(R.id.textQuest36),
findViewById(R.id.textQuest37),
findViewById(R.id.textQuest38),
findViewById(R.id.textQuest39),
findViewById(R.id.textQuest40),
)
this.vTextClear = listOf(
findViewById(R.id.textClear1),
findViewById(R.id.textClear2),
findViewById(R.id.textClear3),
findViewById(R.id.textClear4),
findViewById(R.id.textClear5),
findViewById(R.id.textClear6),
findViewById(R.id.textClear7),
findViewById(R.id.textClear8),
findViewById(R.id.textClear9),
findViewById(R.id.textClear10),
findViewById(R.id.textClear11),
findViewById(R.id.textClear12),
findViewById(R.id.textClear13),
findViewById(R.id.textClear14),
findViewById(R.id.textClear15),
findViewById(R.id.textClear16),
findViewById(R.id.textClear17),
findViewById(R.id.textClear18),
findViewById(R.id.textClear19),
findViewById(R.id.textClear20),
findViewById(R.id.textClear21),
findViewById(R.id.textClear22),
findViewById(R.id.textClear23),
findViewById(R.id.textClear24),
findViewById(R.id.textClear25),
findViewById(R.id.textClear26),
findViewById(R.id.textClear27),
findViewById(R.id.textClear28),
findViewById(R.id.textClear29),
findViewById(R.id.textClear30),
findViewById(R.id.textClear31),
findViewById(R.id.textClear32),
findViewById(R.id.textClear33),
findViewById(R.id.textClear34),
findViewById(R.id.textClear35),
findViewById(R.id.textClear36),
findViewById(R.id.textClear37),
findViewById(R.id.textClear38),
findViewById(R.id.textClear39),
findViewById(R.id.textClear40),
)
//テーマ読み込みと設定
this.loadThemeNumber()
this.setTheme()
//設定読み出し
this.loadGameData()
//onClickListener
this.vTextSetting.setOnClickListener {
this.onClickSetting()
}
for (i in this.vTextQuest.indices) {
this.vTextQuest[i].setOnClickListener {
this.onClickQuest(i + 1)
}
}
//adMob
MobileAds.initialize(this) {}
this.adView = AdView(this)
this.vAdContainer.addView(this.adView)
this.loadBanner()
}
//adMob
private fun loadBanner() {
this.adView.adUnitId = AD_UNIT_ID
this.adView.adSize = this.adSize
val adRequest = AdRequest
.Builder()
//.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build()
this.adView.loadAd(adRequest)
}
override fun onResume() {
super.onResume()
}
override fun onDestroy() {
this.destroyFlag = true
super.onDestroy()
}
//-------------------------------------------------
private fun onClickSetting() {
this.destroyFlag = true
val intent = Intent(applicationContext, SettingActivity::class.java)
intent.putExtra(THEME_NUMBER, this.themeNumber)
intent.putExtra(LOCALE_LANGUAGE, this.localeLanguage)
this.settingStartForResult.launch(intent)
}
private fun onClickQuest(num: Int) {
this.destroyFlag = true
val intent = Intent(applicationContext, GameActivity::class.java)
intent.putExtra(QUEST_NUMBER, num)
this.gameStartForResult.launch(intent)
}
//-------------------------------------------------
//GameDataを保存
private fun saveGameData(questNumber: Int) {
val pref = getSharedPreferences(SETTINGS, MODE_PRIVATE)
val gameData: String = pref.getString(GAME_DATA, "") ?: ""
val gameDataList: List<String> = gameData.split(",")
val gameDataListInt: ArrayList<Int> = arrayListOf()
for (i in gameDataList.indices) {
if (gameDataList[i] != "") {
gameDataListInt.add(gameDataList[i].toInt())
}
}
val ary: ArrayList<Int> = arrayListOf(questNumber)
ary += gameDataListInt
ary.sort()
val ary2: ArrayList<Int> = arrayListOf()
ary2.add(ary[0])
for (i in 1 until ary.size) {
if (ary[i] != ary[i - 1]) {
ary2.add(ary[i])
}
}
getSharedPreferences(SETTINGS, MODE_PRIVATE).edit().apply {
putString(GAME_DATA, ary2.joinToString(","))
apply()
this@MainActivity.drawGameData(ary2)
}
}
//GameDataを読み出し
private fun loadGameData() {
val pref = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE)
val gameData: String = pref.getString(GAME_DATA, "") ?: ""
val gameDataList: List<String> = gameData.split(",")
val gameDataListInt: ArrayList<Int> = arrayListOf()
for (i in gameDataList.indices) {
if (gameDataList[i] != "") {
gameDataListInt.add(gameDataList[i].toInt())
}
}
this.drawGameData(gameDataListInt)
}
private fun drawGameData(gameDataListInt: ArrayList<Int>) {
for (i in this.vTextClear.indices) {
this.vTextClear[i].alpha = 0F
}
for (i in gameDataListInt.indices) {
this.vTextClear[gameDataListInt[i] - 1].alpha = 1F
}
}
//-------------------------------------------------
//テーマを保存
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)
}
}
//----------------------------------------------
//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)
}
}
//----------------------------------------------
}
package jp.aosystem.gearcombination
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.widget.RadioButton
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SwitchCompat
import java.util.*
class SettingActivity : AppCompatActivity() {
private lateinit var vTextApply: TextView
private lateinit var vTextCancel: TextView
private lateinit var vSwitchTheme: SwitchCompat
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 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
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_setting)
//タイトルバー非表示
supportActionBar?.hide()
//
this.vTextApply = findViewById(R.id.textApply)
this.vTextCancel = findViewById(R.id.textCancel)
this.vSwitchTheme = findViewById(R.id.switchTheme)
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.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)
//データ受け取り
val intent = this.intent
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
//"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
}
//onClickListener
this.vTextApply.setOnClickListener {
this.onClickApply()
}
this.vTextCancel.setOnClickListener {
this.onClickCancel()
}
}
private fun onClickApply() {
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.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.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)
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)
}
}
//--------------------------------------------------
}
package jp.aosystem.gearcombination
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.LocaleList
import android.util.DisplayMetrics
import android.webkit.JsResult
import android.webkit.WebChromeClient
import android.webkit.WebSettings
import android.webkit.WebView
import android.widget.LinearLayout
import android.widget.TextView
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.*
class GameActivity : AppCompatActivity() {
private lateinit var vAdContainer: LinearLayout
private lateinit var vTextReload: TextView
private lateinit var vTextBack: TextView
private lateinit var vWebView: WebView
private var destroyFlag: Boolean = false //Activity破棄された場合など
private var questNumber: Int = 0
//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)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_game)
//タイトルバー非表示
supportActionBar?.hide()
//
this.vAdContainer = findViewById(R.id.ad_container)
this.vTextReload = findViewById(R.id.textReload)
this.vTextBack = findViewById(R.id.textBack)
this.vWebView = findViewById(R.id.webView)
//onClickListener
this.vTextReload.setOnClickListener {
this.onClickReload()
}
this.vTextBack.setOnClickListener {
this.onClickBack()
}
//データ受け取り
val intent = this.intent
this.questNumber = intent.getIntExtra(MainActivity.QUEST_NUMBER,1)
//adMob
MobileAds.initialize(this) {}
this.adView = AdView(this)
this.vAdContainer.addView(this.adView)
this.loadBanner()
}
//adMob
private fun loadBanner() {
this.adView.adUnitId = MainActivity.AD_UNIT_ID
this.adView.adSize = this.adSize
val adRequest = AdRequest
.Builder()
//.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build()
this.adView.loadAd(adRequest)
}
override fun onResume() {
super.onResume()
this.game(this.questNumber)
}
override fun onDestroy() {
this.destroyFlag = true
super.onDestroy()
}
private fun onClickReload() {
this.game(this.questNumber)
}
private fun onClickBack() {
val intent = Intent()
setResult(Activity.RESULT_CANCELED, intent)
finish()
}
private fun onClickClear(questNum: Int) {
val intent = Intent()
intent.putExtra(MainActivity.QUEST_NUMBER, questNum)
setResult(Activity.RESULT_OK, intent)
finish()
}
//-------------------------------------------------
private fun game(questNumber: Int) {
val locale: String = resources.getString(R.string.locale)
val webSettings: WebSettings = this.vWebView.settings
webSettings.javaScriptEnabled = true //setJavaScriptEnabled を使用すると、アプリケーションに XSS の脆弱性が侵入する可能性があります。と表示されているだけ。
//webSettings.cacheMode = WebSettings.LOAD_CACHE_ONLY //WebSettings.LOAD_NO_CACHE
this.vWebView.loadUrl("file:///android_asset/web/index.html?q=$questNumber&locale=$locale")
this.vWebView.webChromeClient = object : WebChromeClient() {
override fun onJsAlert(view: WebView, url: String, message: String, result: JsResult): Boolean {
if (message.substring(0,6) == "clear:") {
// do something
onClickClear(message.substring(6).toInt())
}
result.cancel()
return true
}
}
}
//--------------------------------------------------
//言語設定
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)
}
}
//--------------------------------------------------
}
<?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: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:layout_marginBottom="1dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textLevel"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_weight="3"
android:background="@color/main_level_bg"
android:gravity="center"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textSetting"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:background="@color/main_setting_bg"
android:gravity="center"
android:text="@string/setting"
tools:ignore="TextContrastCheck" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_gearback" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="120dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest1"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest2"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest3"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest4"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest5"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest6"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest7"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest8"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest9"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest10"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest11"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest12"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest13"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest14"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest15"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest16"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest17"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest18"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest19"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest20"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest21"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest22"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest23"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest24"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest25"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest26"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest26"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear26"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest27"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest27"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear27"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest28"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest29"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest30"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest31"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest32"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest33"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest34"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest35"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest35"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear35"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest36"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest36"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear36"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest37"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest37"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear37"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest38"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest39"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@drawable/ic_white50"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/textQuest40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp"
android:text="@string/quest40"
android:textColor="@color/text" />
<TextView
android:id="@+id/textClear40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkMark"
android:textColor="@color/textCheck" />
</LinearLayout>
</TableRow>
</TableLayout>
</FrameLayout>
</ScrollView>
</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>
<?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_marginStart="1dp"
android:layout_marginTop="1dp"
android:layout_marginEnd="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_bg"
android:gravity="center"
android:minHeight="48dip"
android:text="@string/cancel"
tools:ignore="TextContrastCheck" />
<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_bg"
android:gravity="center"
android:minHeight="48dip"
android:text="@string/apply"
tools:ignore="TextContrastCheck" />
</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">
<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/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/divider4"
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/radioLanguageJa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/languageJa" />
</RadioGroup>
<View
android:id="@+id/divider1"
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>
<?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: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:layout_marginBottom="1dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textReload"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_weight="3"
android:background="@color/main_level_bg"
android:gravity="center"
android:text="@string/reload" />
<TextView
android:id="@+id/textBack"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:background="@color/main_setting_bg"
android:gravity="center"
android:text="@string/cancel"
tools:ignore="TextContrastCheck" />
</LinearLayout>
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</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>
このページのQRコード
便利ウェブサイト
便利 Android アプリ
便利 iOS(iPhone,iPad) アプリ