Skip to content
Snippets Groups Projects
Commit 196e017a authored by Filip Stanicak's avatar Filip Stanicak Committed by Filip Stanicak
Browse files

Added Login Screen with follow up

parent 98704aba
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".MainActivity"> <activity android:name=".Overview_Screen"></activity>
<activity android:name=".Start_Screen">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
...@@ -4,11 +4,11 @@ import androidx.appcompat.app.AppCompatActivity; ...@@ -4,11 +4,11 @@ import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
public class MainActivity extends AppCompatActivity { public class Overview_Screen extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_overview__screen);
} }
} }
package com.example.mobileapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Start_Screen extends AppCompatActivity {
private EditText Email;
private EditText Password;
private Button Login;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Email = (EditText)findViewById(R.id.etMail);
Password = (EditText)findViewById(R.id.etPassword);
Login = (Button)findViewById(R.id.btnLogin);
Login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validate(Email.getText().toString(), Password.getText().toString());
}
});
}
private void validate(String userName, String userPassword) {
if((userName.equals("Admin")) && (userPassword.equals("123456"))) {
Intent intent = new Intent(Start_Screen.this, Overview_Screen.class);
startActivity(intent);
}
}
}
...@@ -4,15 +4,43 @@ ...@@ -4,15 +4,43 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".Start_Screen">
<TextView <Button
android:id="@+id/btnLogin"
android:layout_width="340dp"
android:layout_height="54dp"
android:background="#C5B358"
android:text="@string/log_in"
android:textColor="#141412"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.492"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.601" />
<EditText
android:id="@+id/etMail"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Hello World!" android:layout_marginTop="160dp"
app:layout_constraintBottom_toBottomOf="parent" android:ems="10"
app:layout_constraintLeft_toLeftOf="parent" android:hint="@string/e_mail"
app:layout_constraintRight_toRightOf="parent" android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/etPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
app:layout_constraintBottom_toTopOf="@+id/btnLogin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etMail" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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=".Overview_Screen">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<resources> <resources>
<string name="app_name">MobileApp</string> <string name="app_name">MobileApp</string>
<string name="log_in">LOG IN</string>
<string name="e_mail">E-MAIL</string>
<string name="password">PASSWORD</string>
</resources> </resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment