Add Stub RegistExecuteActivity to Android

This commit is contained in:
Florian Märkl 2019-10-06 16:20:41 +02:00
commit 73e519753f
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
6 changed files with 72 additions and 6 deletions

View file

@ -40,6 +40,11 @@
android:theme="@style/MageTheme" android:theme="@style/MageTheme"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"/> android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".regist.RegistExecuteActivity"
android:theme="@style/MageTheme"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" />
</application> </application>
</manifest> </manifest>

View file

@ -62,13 +62,19 @@ class RegistActivity: AppCompatActivity(), RevealActivity
val pin = pinEditText.text.toString() val pin = pinEditText.text.toString()
val pinValid = pin.length == PIN_LENGTH val pinValid = pin.length == PIN_LENGTH
hostEditText.error = if(!hostValid) "Please enter a valid host name" else null hostEditText.error = if(!hostValid) getString(R.string.regist_host_invalid) else null
psnIdEditText.error = if(!psnIdValid) "Please enter a valid PSN ID" else null psnIdEditText.error = if(!psnIdValid) getString(R.string.regist_psn_id_invalid) else null
pinEditText.error = if(!pinValid) "Please enter a valid 8-digit PIN" 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 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)
}
} }
} }

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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)
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -23,4 +23,7 @@
<string name="hint_regist_psn_id">PSN ID (username, case-sensitive)</string> <string name="hint_regist_psn_id">PSN ID (username, case-sensitive)</string>
<string name="hint_regist_pin">PIN</string> <string name="hint_regist_pin">PIN</string>
<string name="action_regist">Register</string> <string name="action_regist">Register</string>
<string name="regist_host_invalid">Please enter a valid host name</string>
<string name="regist_psn_id_invalid">Please enter a valid PSN ID</string>
<string name="regist_pin_invalid">Please enter a valid %d-digit PIN</string>
</resources> </resources>

View file

@ -46,10 +46,13 @@
<item name="textInputStyle">@style/MageTheme.TextInputStyle</item> <item name="textInputStyle">@style/MageTheme.TextInputStyle</item>
<item name="android:windowActivityTransitions">true</item> <item name="android:windowActivityTransitions">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style> </style>
<style name="MageTheme.Translucent" parent="MageTheme">
<item name="android:windowIsTranslucent">true</item>
</style>
<style name="MageTheme.TextAppearanceHeadline1" parent="TextAppearance.MaterialComponents.Headline1"> <style name="MageTheme.TextAppearanceHeadline1" parent="TextAppearance.MaterialComponents.Headline1">
<item name="fontFamily">sans-serif-condensed-light</item> <item name="fontFamily">sans-serif-condensed-light</item>
</style> </style>