Regiser Activity

This commit is contained in:
wiecktobi 2020-05-03 19:52:58 +02:00 committed by Marcel Schwarz
parent 99313fc877
commit 67379787b3
13 changed files with 216 additions and 27 deletions

View File

@ -37,6 +37,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.preference:preference:1.1.0-rc01'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

View File

@ -9,9 +9,14 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".login">
<activity android:name=".Register"></activity>
<activity
android:name=".Settings"
android:label="@string/title_activity_settings" />
<activity android:name=".Login">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

View File

@ -3,26 +3,33 @@ package de.hft.geotracker
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
/**
* A simple [Fragment] subclass.
*/
class login : AppCompatActivity() {
class Login : AppCompatActivity() {
lateinit var login : TextView
lateinit var reg : TextView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
login = findViewById(R.id.button_login)
login = findViewById(R.id.button_create_account)
login.setOnClickListener {
login()
}
reg = findViewById(R.id.button_register)
reg.setOnClickListener {
register()
}
}
private fun register() {
val intent = Intent(this, Register::class.java)
startActivity(intent)
}
private fun login() {
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)

View File

@ -1,7 +1,10 @@
package de.hft.geotracker
import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Spinner
import androidx.navigation.findNavController
import androidx.databinding.DataBindingUtil
import androidx.navigation.ui.NavigationUI
@ -15,6 +18,16 @@ class MainActivity : AppCompatActivity() {
// val binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
// val navController = this.findNavController(R.id.HostFragment)
// NavigationUI.setupActionBarWithNavController(this, navController)
val spinner: Spinner = findViewById(R.id.account_spinner)
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter.createFromResource(this, R.array.accounts, android.R.layout.simple_spinner_item).also { adapter ->
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
// Apply the adapter to the spinner
spinner.adapter = adapter
}
}
override fun onBackPressed() {

View File

@ -1,12 +1,25 @@
package de.hft.geotracker
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
class Register : AppCompatActivity() {
lateinit var reg : TextView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_register)
reg = findViewById(R.id.button_create_account)
reg.setOnClickListener {
createAccount()
}
}
private fun createAccount() {
var intent = Intent(this, MainActivity::class.java)
startActivity(intent)
}
}

View File

@ -30,8 +30,8 @@
android:id="@+id/display_acc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin16"
android:layout_marginEnd="@dimen/margin16"
android:layout_marginTop="140dp"
android:layout_marginEnd="28dp"
android:text="@string/no_account"
android:textAppearance="@style/text_style"
app:layout_constraintEnd_toEndOf="parent"
@ -86,4 +86,15 @@
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<Spinner
android:id="@+id/account_spinner"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin16"
android:layout_marginEnd="@dimen/margin16"
android:background="@color/logo_white"
android:textAlignment="textEnd"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_grey"
tools:context=".login">
tools:context=".Login">
<EditText
android:id="@+id/input_username"
@ -38,7 +38,7 @@
android:hint="@string/password"
android:inputType="textPassword"
android:textAlignment="center"
app:layout_constraintBottom_toTopOf="@+id/button_login"
app:layout_constraintBottom_toTopOf="@+id/button_create_account"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
@ -46,7 +46,7 @@
app:layout_constraintVertical_bias="0.13" />
<Button
android:id="@+id/button_login"
android:id="@+id/button_create_account"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
@ -55,25 +55,25 @@
android:text="@string/login"
android:textAppearance="@style/text_style"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/button_signin"
app:layout_constraintBottom_toTopOf="@+id/button_register"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/input_password" />
<Button
android:id="@+id/button_signin"
android:id="@+id/button_register"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:background="@drawable/outlined_button"
android:text="@string/sign_in"
android:text="@string/register"
android:textAppearance="@style/text_style"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_login"
app:layout_constraintTop_toBottomOf="@+id/button_create_account"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,6 +4,84 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_grey"
tools:context=".Register">
<EditText
android:id="@+id/input_password2"
style="@style/input_field"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin16"
android:ems="10"
android:hint="@string/confirm_password"
android:inputType="textPassword"
android:textAlignment="center"
app:layout_constraintBottom_toTopOf="@+id/button_create_account"
app:layout_constraintEnd_toEndOf="@+id/input_email_register"
app:layout_constraintTop_toBottomOf="@+id/input_password" />
<EditText
android:id="@+id/input_password"
style="@style/input_field"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin16"
android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
android:textAlignment="center"
app:layout_constraintBottom_toTopOf="@+id/input_password2"
app:layout_constraintEnd_toEndOf="@+id/input_email_register"
app:layout_constraintTop_toBottomOf="@+id/input_username_register" />
<EditText
android:id="@+id/input_email_register"
style="@style/input_field"
android:layout_width="240dp"
android:layout_height="42dp"
android:layout_marginTop="50dp"
android:colorControlNormal="@color/logo_blue"
android:ems="10"
android:hint="@string/email"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="@color/logo_white"
app:layout_constraintBottom_toTopOf="@+id/input_username_register"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.49" />
<EditText
android:id="@+id/input_username_register"
style="@style/input_field"
android:layout_width="240dp"
android:layout_height="42dp"
android:layout_marginBottom="@dimen/margin16"
android:colorControlNormal="@color/logo_blue"
android:ems="10"
android:foregroundTint="@color/colorAccent"
android:hint="@string/username"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="@color/logo_white"
app:layout_constraintBottom_toTopOf="@+id/input_password"
app:layout_constraintEnd_toEndOf="@+id/input_email_register"
app:layout_constraintTop_toBottomOf="@+id/input_email_register" />
<Button
android:id="@+id/button_create_account"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin16"
android:layout_marginBottom="175dp"
android:background="@color/logo_blue"
android:text="@string/create_account"
android:textAppearance="@style/text_style"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/input_email_register"
app:layout_constraintTop_toBottomOf="@+id/input_password2" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="@color/logo_white"
android:fontFamily="@font/montserrat"
/>

View File

@ -7,7 +7,7 @@
<fragment
android:id="@+id/login"
android:name="de.hft.geotracker.login"
android:name="de.hft.geotracker.Login"
android:label="fragment_login"
tools:layout="@layout/activity_login" />
<activity

View File

@ -10,6 +10,7 @@
<item>reply_all</item>
</string-array>
<string-array name="accounts">
<item>No Account</item>
<item>Select Account</item>
<item>Default</item>
</string-array>
</resources>

View File

@ -8,8 +8,29 @@
<string name="btn_start_text">START</string>
<string name="pause">PAUSE</string>
<string name="stop">STOP</string>
<string name="username">Your Username or E-Mail</string>
<string name="username_email">Your Username or E-Mail</string>
<string name="username">Choose a Username</string>
<string name="email">E-Mail</string>
<string name="password">Password</string>
<string name="login">Login</string>
<string name="sign_in">Sign In</string>
<string name="title_activity_settings">Settings</string>
<!-- Preference Titles -->
<string name="messages_header">Messages</string>
<string name="sync_header">Sync</string>
<!-- Messages Preferences -->
<string name="signature_title">Your signature</string>
<string name="reply_title">Default reply action</string>
<!-- Sync Preferences -->
<string name="sync_title">Sync email periodically</string>
<string name="attachment_title">Download incoming attachments</string>
<string name="attachment_summary_on">Automatically download attachments for incoming emails
</string>
<string name="attachment_summary_off">Only download attachments when manually requested</string>
<string name="confirm_password">Confirm Password</string>
<string name="register">Register</string>
<string name="create_account">Create Account</string>
</resources>

View File

@ -0,0 +1,35 @@
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/messages_header">
<EditTextPreference
app:key="signature"
app:title="@string/signature_title"
app:useSimpleSummaryProvider="true" />
<ListPreference
app:defaultValue="reply"
app:entries="@array/reply_entries"
app:entryValues="@array/reply_values"
app:key="reply"
app:title="@string/reply_title"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/sync_header">
<SwitchPreferenceCompat
app:key="sync"
app:title="@string/sync_title" />
<SwitchPreferenceCompat
app:dependency="sync"
app:key="attachment"
app:summaryOff="@string/attachment_summary_off"
app:summaryOn="@string/attachment_summary_on"
app:title="@string/attachment_title" />
</PreferenceCategory>
</PreferenceScreen>