Commit 4c62cf61 authored by chris.crook's avatar chris.crook

> login button pretty much done

parent a6e15b2a
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Summative_Chris_Crook"> android:theme="@style/Theme.Summative_Chris_Crook">
<activity android:name=".register_page"></activity> <activity android:name=".AdminMenu"></activity>
<activity android:name=".UserMenu" />
<activity android:name=".register_page" />
<activity android:name=".MainActivity"> <activity android:name=".MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
package com.example.summative_chris_crook;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class AdminMenu extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_menu);
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.example.summative_chris_crook; ...@@ -2,6 +2,7 @@ package com.example.summative_chris_crook;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
...@@ -121,6 +122,12 @@ public class MainActivity extends AppCompatActivity { ...@@ -121,6 +122,12 @@ public class MainActivity extends AppCompatActivity {
} }
} }
/*public void openpage(View view,String destination){
destination += ".class";
Intent intent = new Intent(this,destination);
startActivity(intent);
}*/
public void testlogin (View view){ public void testlogin (View view){
file1 = new File(getApplicationContext().getFilesDir(), filename1 + ".txt"); file1 = new File(getApplicationContext().getFilesDir(), filename1 + ".txt");
file2 = new File(getApplicationContext().getFilesDir(), filename2 + ".txt"); file2 = new File(getApplicationContext().getFilesDir(), filename2 + ".txt");
...@@ -208,10 +215,14 @@ public class MainActivity extends AppCompatActivity { ...@@ -208,10 +215,14 @@ public class MainActivity extends AppCompatActivity {
if (magicwords [i] [4].equals("ADMIN")){ if (magicwords [i] [4].equals("ADMIN")){
// user is an admin // user is an admin
Toast.makeText(getApplicationContext(), "Signed in as admin", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "Signed in as admin", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this,AdminMenu.class);
startActivity(intent);
return; return;
} }
else{ else{
Toast.makeText(getApplicationContext(), "Signed in as user", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "Signed in as user", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this,UserMenu.class);
startActivity(intent);
return; return;
} }
} }
......
package com.example.summative_chris_crook;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class UserMenu extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_menu);
}
}
\ 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=".AdminMenu">
</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=".UserMenu">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment