diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 92abf24..d97d5f5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,20 +15,23 @@ + android:exported="true"> + + + + + - - - - - + android:parentActivityName=".LoginActivity" + android:exported="true"/> + diff --git a/app/src/main/java/com/example/camlingo/DailyQuestActivity.java b/app/src/main/java/com/example/camlingo/DailyQuestActivity.java index b179ab5..9f250ab 100644 --- a/app/src/main/java/com/example/camlingo/DailyQuestActivity.java +++ b/app/src/main/java/com/example/camlingo/DailyQuestActivity.java @@ -1,20 +1,66 @@ package com.example.camlingo; +import android.content.Intent; import android.os.Bundle; +import android.view.View; +import android.widget.Button; import androidx.activity.EdgeToEdge; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.cardview.widget.CardView; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; +import java.util.Objects; + public class DailyQuestActivity extends AppCompatActivity { + private Button ClaimButton, StarQuestButton; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EdgeToEdge.enable(this); setContentView(R.layout.activity_daily_quest); + + //find button by id + ClaimButton = findViewById(R.id.claim_button_DailyQuest); + StarQuestButton = findViewById(R.id.startQuest_button_DailyQuest); + + //back button on toolbar + Toolbar toolbar = findViewById(R.id.dailyQuest_toolbar); + setSupportActionBar(toolbar); + + // Clear default title + Objects.requireNonNull(getSupportActionBar()).setDisplayShowTitleEnabled(false); + + //this adds the back button, so when pressed it goes back to the login page + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + + //"Claim Now" button click + ClaimButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //no activity to open yet, just a placeholder here + Intent intent = new Intent(DailyQuestActivity.this, DailyQuestActivity.class); + startActivity(intent); + } + }); + + //Start today's quest button click + StarQuestButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //no activity to open yet, just a placeholder here + Intent intent = new Intent(DailyQuestActivity.this, DailyQuestActivity.class); + startActivity(intent); + } + }); + + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.daily_quests), (v, insets) -> { Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); diff --git a/app/src/main/java/com/example/camlingo/LoginActivity.java b/app/src/main/java/com/example/camlingo/LoginActivity.java index 2def736..bfdd5cd 100644 --- a/app/src/main/java/com/example/camlingo/LoginActivity.java +++ b/app/src/main/java/com/example/camlingo/LoginActivity.java @@ -1,6 +1,11 @@ package com.example.camlingo; +import android.content.Intent; +import android.content.SharedPreferences; import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; import androidx.activity.EdgeToEdge; import androidx.appcompat.app.AppCompatActivity; @@ -10,11 +15,44 @@ public class LoginActivity extends AppCompatActivity { + private Button loginButton; + private EditText UsernameEditText; + private EditText PassWEditText; + private SharedPreferences prefs; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EdgeToEdge.enable(this); setContentView(R.layout.activity_login); + + loginButton = findViewById(R.id.button_login); + UsernameEditText = findViewById(R.id.username_input); + PassWEditText = findViewById(R.id.password_input); + prefs = getSharedPreferences("UserPrefs", MODE_PRIVATE); + + //preserve username so it will appear next time + String inputusername = prefs.getString("DefaultEmail", "email@domain.com"); + UsernameEditText.setText(inputusername); + + //when the login button is pressed + loginButton.setOnClickListener(view -> { + String user = UsernameEditText.getText().toString(); + String password = PassWEditText.getText().toString(); + + //place for checking user and password validation + + //preserved username + SharedPreferences.Editor edit = prefs.edit(); + edit.putString("DefaultUserName", user); + edit.apply(); + + //start login activity + Intent intent = new Intent(LoginActivity.this, MainActivity.class); + startActivity(intent); + }); + + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); diff --git a/app/src/main/java/com/example/camlingo/MainActivity.java b/app/src/main/java/com/example/camlingo/MainActivity.java index 0e9aa4e..c3893b3 100644 --- a/app/src/main/java/com/example/camlingo/MainActivity.java +++ b/app/src/main/java/com/example/camlingo/MainActivity.java @@ -32,6 +32,9 @@ protected void onCreate(Bundle savedInstanceState) { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); + //this adds the back button, so when pressed it goes back to the login page + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + // Clear default title Objects.requireNonNull(getSupportActionBar()).setDisplayShowTitleEnabled(false); @@ -41,6 +44,28 @@ public void onClick(View v) { startActivity(new Intent(MainActivity.this, DailyQuestActivity.class)); } }); + + //ContinueLearning button click + continueLearningCard.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //no activity to open yet, just a placeholder here + Intent intent = new Intent(MainActivity.this, MainActivity.class); + startActivity(intent); + } + }); + + //leader board card button click + leaderboardCard.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //no activity to open yet, just a placeholder here + Intent intent = new Intent(MainActivity.this, MainActivity.class); + startActivity(intent); + } + }); + } @Override diff --git a/app/src/main/res/layout/activity_daily_quest.xml b/app/src/main/res/layout/activity_daily_quest.xml index 1d6425d..862c78d 100644 --- a/app/src/main/res/layout/activity_daily_quest.xml +++ b/app/src/main/res/layout/activity_daily_quest.xml @@ -10,132 +10,172 @@ + android:orientation="vertical"> - + + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + app:contentInsetStart="10dp"> + + - + android:textSize="12sp" + android:fontFamily="@font/rodin" /> - - + - - - - + + + android:orientation="vertical" + tools:context=".MainActivity"> - - + android:columnCount="2" + android:rowCount="1" + android:background="@color/blue_dark" + android:padding="20dp"> -