From 73e519753f19d06517bd1edb97118235f59d8f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sun, 6 Oct 2019 16:20:41 +0200 Subject: [PATCH] Add Stub RegistExecuteActivity to Android --- android/app/src/main/AndroidManifest.xml | 5 +++ .../metallic/chiaki/regist/RegistActivity.kt | 16 +++++--- .../chiaki/regist/RegistExecuteActivity.kt | 39 +++++++++++++++++++ .../res/layout/activity_regist_execute.xml | 10 +++++ android/app/src/main/res/values/strings.xml | 3 ++ android/app/src/main/res/values/styles.xml | 5 ++- 6 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 android/app/src/main/java/com/metallic/chiaki/regist/RegistExecuteActivity.kt create mode 100644 android/app/src/main/res/layout/activity_regist_execute.xml diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 9c5b4bd..326f866 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -40,6 +40,11 @@ android:theme="@style/MageTheme" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustResize"/> + + \ No newline at end of file diff --git a/android/app/src/main/java/com/metallic/chiaki/regist/RegistActivity.kt b/android/app/src/main/java/com/metallic/chiaki/regist/RegistActivity.kt index 128251d..ef30146 100644 --- a/android/app/src/main/java/com/metallic/chiaki/regist/RegistActivity.kt +++ b/android/app/src/main/java/com/metallic/chiaki/regist/RegistActivity.kt @@ -62,13 +62,19 @@ class RegistActivity: AppCompatActivity(), RevealActivity val pin = pinEditText.text.toString() val pinValid = pin.length == PIN_LENGTH - hostEditText.error = if(!hostValid) "Please enter a valid host name" else null - psnIdEditText.error = if(!psnIdValid) "Please enter a valid PSN ID" else null - pinEditText.error = if(!pinValid) "Please enter a valid 8-digit PIN" else null + hostEditText.error = if(!hostValid) getString(R.string.regist_host_invalid) else null + psnIdEditText.error = if(!psnIdValid) getString(R.string.regist_psn_id_invalid) else null + pinEditText.error = if(!pinValid) getString(R.string.regist_pin_invalid, PIN_LENGTH) else null - if(!hostValid || !psnIdValid || ! pinValid) + if(!hostValid || !psnIdValid || !pinValid) return - // TODO + Intent(this, RegistExecuteActivity::class.java).also { + it.putExtra(RegistExecuteActivity.EXTRA_HOST, host) + it.putExtra(RegistExecuteActivity.EXTRA_BROADCAST, broadcast) + it.putExtra(RegistExecuteActivity.EXTRA_PSN_ID, psnId) + it.putExtra(RegistExecuteActivity.EXTRA_PIN, pin) + startActivity(it) + } } } \ No newline at end of file diff --git a/android/app/src/main/java/com/metallic/chiaki/regist/RegistExecuteActivity.kt b/android/app/src/main/java/com/metallic/chiaki/regist/RegistExecuteActivity.kt new file mode 100644 index 0000000..f1b2238 --- /dev/null +++ b/android/app/src/main/java/com/metallic/chiaki/regist/RegistExecuteActivity.kt @@ -0,0 +1,39 @@ +/* + * This file is part of Chiaki. + * + * Chiaki is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Chiaki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Chiaki. If not, see . + */ + +package com.metallic.chiaki.regist + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import com.metallic.chiaki.R + +class RegistExecuteActivity: AppCompatActivity() +{ + companion object + { + const val EXTRA_HOST = "regist_host" + const val EXTRA_BROADCAST = "regist_broadcast" + const val EXTRA_PSN_ID = "regist_psn_id" + const val EXTRA_PIN = "regist_pin" + } + + override fun onCreate(savedInstanceState: Bundle?) + { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_regist_execute) + } +} \ No newline at end of file diff --git a/android/app/src/main/res/layout/activity_regist_execute.xml b/android/app/src/main/res/layout/activity_regist_execute.xml new file mode 100644 index 0000000..2ab963a --- /dev/null +++ b/android/app/src/main/res/layout/activity_regist_execute.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 477f86d..c9e2df3 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -23,4 +23,7 @@ PSN ID (username, case-sensitive) PIN Register + Please enter a valid host name + Please enter a valid PSN ID + Please enter a valid %d-digit PIN diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index a5e4046..5ade4e0 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -46,10 +46,13 @@ @style/MageTheme.TextInputStyle true - true true + +