Commit 25825155 authored by Weesinghe W.M.P.D's avatar Weesinghe W.M.P.D

Merge branch 'IT20019204_Activity_Recognition' into 'master'

Login Page Added

See merge request !7
parents 0396be7c 6c65818e
# Default ignored files
/shelf/
/workspace.xml
The Trek
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -149,6 +149,13 @@
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".activities.VedioActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".HomeActivity"
android:exported="false">
......@@ -156,6 +163,13 @@
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".Login"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".MonitorActivity"
android:exported="false">
......@@ -233,9 +247,6 @@
<activity
android:name=".activities.LegActivity"
android:exported="false" />
<activity
android:name=".activities.EmailActivity"
android:exported="false" />
<activity
android:name=".activities.HeadActivity"
android:exported="false" />
......
package com.example.thetrek;
//import android.content.Intent;
//import android.database.Cursor;
//import android.os.Bundle;
//import android.view.View;
//import android.widget.Button;
//import android.widget.EditText;
//import android.widget.TextView;
//import android.widget.Toast;
//
//import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
//import com.example.thetrek.Sql.DBHelper;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.thetrek.Sql.DBHelper;
public class Login extends AppCompatActivity {
// EditText email , password;
// Button btnSubmit;
// TextView createAcc;
// DBHelper dbHelper;
//
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// Boolean e=false,p=false;
// setContentView(R.layout.activity_login);
// email=findViewById(R.id.user_name);
// password=findViewById(R.id.text_password);
// btnSubmit = findViewById(R.id.btnSubmit_login);
// dbHelper = new DBHelper(this);
// btnSubmit.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
//
// String emailCheck = email.getText().toString();
// String passCheck = password.getText().toString();
// Cursor cursor = dbHelper.getData();
// if(cursor.getCount() == 0){
// Toast.makeText(Login.this,"No entries Exists",Toast.LENGTH_LONG).show();
// }
// if (loginCheck(cursor,emailCheck,passCheck)) {
// Intent intent = new Intent(Login.this,FinalPage.class);
// intent.putExtra("email",emailCheck);
// email.setText("");
// password.setText("");
// startActivity(intent);
// }else {
// AlertDialog.Builder builder = new AlertDialog.Builder(Login.this);
// builder.setCancelable(true);
// builder.setTitle("Wrong Credential");
// builder.setMessage("Wrong Credential");
// builder.show();
// }
// dbHelper.close();
// }
// });
// createAcc=findViewById(R.id.createAcc);
// createAcc.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Intent intent = new Intent(Login.this,SignUp.class);
// startActivity(intent);
// }
// });
//
// }
// public static boolean loginCheck(Cursor cursor,String emailCheck,String passCheck) {
// while (cursor.moveToNext()){
// if (cursor.getString(0).equals(emailCheck)) {
// if (cursor.getString(2).equals(passCheck)) {
// return true;
// }
// return false;
// }
// }
// return false;
// }
EditText email , password;
Button btnSubmit;
TextView createAcc;
DBHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Boolean e=false,p=false;
setContentView(R.layout.activity_login);
email=findViewById(R.id.editTextTextPersonName2);
password=findViewById(R.id.editTextTextPersonName);
btnSubmit = findViewById(R.id.btnSubmit_login);
dbHelper = new DBHelper(this);
btnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String emailCheck = email.getText().toString();
String passCheck = password.getText().toString();
Cursor cursor = dbHelper.getData();
if(cursor.getCount() == 0){
Toast.makeText(Login.this,"No entries Exists",Toast.LENGTH_LONG).show();
}
if (loginCheck(cursor,emailCheck,passCheck)) {
Intent intent = new Intent(Login.this,HomeActivity.class);
intent.putExtra("email",emailCheck);
email.setText("");
password.setText("");
startActivity(intent);
}else {
AlertDialog.Builder builder = new AlertDialog.Builder(Login.this);
builder.setCancelable(true);
builder.setTitle("Wrong Credential");
builder.setMessage("Wrong Credential");
builder.show();
}
dbHelper.close();
}
});
}
public static boolean loginCheck(Cursor cursor,String emailCheck,String passCheck) {
while (cursor.moveToNext()){
if (cursor.getString(0).equals(emailCheck)) {
if (cursor.getString(2).equals(passCheck)) {
return true;
}
return false;
}
}
return false;
}
}
\ No newline at end of file
......@@ -82,7 +82,7 @@ public class MainActivity extends AppCompatActivity {
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, MainActivityLogin.class);
Intent intent = new Intent(MainActivity.this, Login.class);
startActivity(intent);
}
});
......
......@@ -4,6 +4,8 @@ import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
......@@ -24,7 +26,8 @@ import java.util.Map;
public class SuggestActivity extends AppCompatActivity {
EditText age,gender,weather, Place_change, Time;
EditText age, Time;
RadioGroup genderRadioGroup, weatherRadioGroup, placeChangeRadioGroup;
Button predict;
TextView result;
String url = "https://researchsuggestapp-2056b0768919.herokuapp.com/predict";
......@@ -35,17 +38,27 @@ public class SuggestActivity extends AppCompatActivity {
setContentView(R.layout.activity_suggest);
age = findViewById(R.id.age);
gender = findViewById(R.id.gender);
weather = findViewById(R.id.weather);
Place_change = findViewById(R.id.Place_change);
Time = findViewById(R.id.Time);
predict = findViewById(R.id.predict);
result = findViewById(R.id.result);
genderRadioGroup = findViewById(R.id.genderRadioGroup);
weatherRadioGroup = findViewById(R.id.weatherRadioGroup);
placeChangeRadioGroup = findViewById(R.id.placeChangeRadioGroup);
predict.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// hit the API -> Volley
// Get selected radio button values
int selectedGenderId = genderRadioGroup.getCheckedRadioButtonId();
int selectedWeatherId = weatherRadioGroup.getCheckedRadioButtonId();
int selectedPlaceChangeId = placeChangeRadioGroup.getCheckedRadioButtonId();
RadioButton selectedGender = findViewById(selectedGenderId);
RadioButton selectedWeather = findViewById(selectedWeatherId);
RadioButton selectedPlaceChange = findViewById(selectedPlaceChangeId);
// Hit the API -> Volley
StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
new Response.Listener<String>() {
@Override
......@@ -54,10 +67,10 @@ public class SuggestActivity extends AppCompatActivity {
try {
JSONObject jsonObject = new JSONObject(response);
String data = jsonObject.getString("Suguest");
if(data.equals("1")){
result.setText("\uD83C\uDF1F \"You Need to Move!\" \uD83C\uDF1F");
}else{
result.setText("\uD83C\uDF1F \"No Need to Move.\" \uD83C\uDF1F");
if (data.equals("1")) {
result.setText("\uD83C\uDF1F \"It's Time to Explore Nature!\" \uD83C\uDF1F");
} else {
result.setText("\uD83C\uDF1F \"No Need to Move yet.\" \uD83C\uDF1F");
}
} catch (JSONException e) {
e.printStackTrace();
......@@ -70,16 +83,19 @@ public class SuggestActivity extends AppCompatActivity {
public void onErrorResponse(VolleyError error) {
Toast.makeText(SuggestActivity.this, error.getMessage(), Toast.LENGTH_SHORT).show();
}
}){
}) {
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String,String>();
params.put("age",age.getText().toString());
params.put("gender",gender.getText().toString());
params.put("weather",weather.getText().toString());
params.put("Place_change", Place_change.getText().toString());
params.put("Time",Time.getText().toString());
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<>();
params.put("age", age.getText().toString());
// Add radio button values to params
params.put("gender", selectedGender.getTag().toString());
params.put("weather", selectedWeather.getTag().toString());
params.put("Place_change", selectedPlaceChange.getTag().toString());
params.put("Time", Time.getText().toString());
return params;
}
......
......@@ -97,7 +97,7 @@ public class DetailActivity extends AppCompatActivity {
findViewById(R.id.email_self).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(DetailActivity.this, EmailActivity.class);
Intent intent = new Intent(DetailActivity.this, VedioActivity.class);
startActivity(intent);
}
});
......
package com.example.thetrek.activities;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.thetrek.R;
public class VedioActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vedio);
WebView webView = findViewById(R.id.webView);
String video = "<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/1YTqitVK-Ts?si=KFw3FJtMIkHLMpKZ\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>";
webView.loadData(video, "text/html","utf-8");
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
WebView webView2 = findViewById(R.id.webView2);
String video2 = "<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/b6OvrRbGU68?si=-Ye6L6SqAxlVAntC\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>";
webView2.loadData(video2, "text/html", "utf-8");
webView2.getSettings().setJavaScriptEnabled(true);
webView2.setWebChromeClient(new WebChromeClient());
WebView webView3 = findViewById(R.id.webView3);
String video3 = "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/F-0i2l3sqno?si=ffQSOl5bBEr42oTT\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>";
webView3.loadData(video3, "text/html", "utf-8");
webView3.getSettings().setJavaScriptEnabled(true);
webView3.setWebChromeClient(new WebChromeClient());
WebView webView4 = findViewById(R.id.webView4);
String video4 = "<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/Ldgt7ZYxTcU?si=Ojq_9QpM26c5aK-D\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>";
webView4.loadData(video4, "text/html", "utf-8");
webView4.getSettings().setJavaScriptEnabled(true);
webView4.setWebChromeClient(new WebChromeClient());
WebView webView5 = findViewById(R.id.webView4);
String video5 = "<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/NX7QNWEGcNI?si=gkJWetqxSirHkkW8\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>";
webView4.loadData(video5, "text/html", "utf-8");
webView5.getSettings().setJavaScriptEnabled(true);
webView5.setWebChromeClient(new WebChromeClient());
}
}
\ No newline at end of file
......@@ -121,7 +121,7 @@
android:id="@+id/email_self"
android:layout_width="0dp"
android:layout_height="65dp"
android:text="@string/send_email_to_self"
android:text="Video Guide"
android:textSize="12sp"
android:layout_marginTop="16dp"
android:layout_marginStart="8dp"
......
......@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivityLogin">
tools:context=".Login">
<LinearLayout
android:id="@+id/linearLayout"
......@@ -61,7 +61,7 @@
android:layout_width="match_parent"
android:layout_height="46dp"
android:ems="10"
android:inputType="textPersonName" />
android:inputType="textPassword" />
<Space
android:layout_width="match_parent"
......
......@@ -11,12 +11,12 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Suggession Predictor"
android:text="Suggestion Predictor"
android:textSize="24dp"
android:textAlignment="center"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textColor="@color/cardview_dark_background"></TextView>
android:textColor="@color/cardview_dark_background" />
<TextView
android:layout_width="match_parent"
......@@ -26,7 +26,7 @@
android:textColor="@color/design_default_color_primary"
android:textAlignment="center"
android:layout_marginTop="10dp"
android:textStyle="bold"></TextView>
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -35,47 +35,116 @@
android:textSize="12dp"
android:textAlignment="center"
android:layout_marginTop="10dp"
android:textStyle="bold"></TextView>
android:textStyle="bold" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Age"
android:id="@+id/age"
android:textStyle="bold"
android:layout_marginTop="10dp"
></EditText>
<EditText
android:layout_marginTop="10dp" />
<!-- Gender Radio Group -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Gender (0 – Male, 1 – Female)"
android:id="@+id/gender"
android:text="Gender"
android:textSize="16dp"
android:textStyle="bold"
android:layout_marginTop="10dp"
></EditText>
<EditText
/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Weather (0 – Rainy, 1 – Sunny)"
android:id="@+id/weather"
android:id="@+id/genderRadioGroup"
android:orientation="horizontal">
<RadioButton
android:id="@+id/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:tag="0"
android:checked="true" />
<RadioButton
android:id="@+id/female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female"
android:tag="1" />
</RadioGroup>
<!-- Weather Radio Group -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Weather"
android:textSize="16dp"
android:textStyle="bold"
android:layout_marginTop="10dp"
></EditText>
<EditText
/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Place Change (0- No, 1-Yes)"
android:id="@+id/Place_change"
android:id="@+id/weatherRadioGroup"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rainy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rainy"
android:tag="0"
android:checked="true" />
<RadioButton
android:id="@+id/sunny"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sunny"
android:tag="1" />
</RadioGroup>
<!-- Place Change Radio Group -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Place Change or Not"
android:textSize="16dp"
android:textStyle="bold"
android:layout_marginTop="10dp"
></EditText>
/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/placeChangeRadioGroup"
android:orientation="horizontal">
<RadioButton
android:id="@+id/yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yes"
android:tag="1"
android:checked="true" />
<RadioButton
android:id="@+id/no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No"
android:tag="0" />
</RadioGroup>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Time (Hours)"
android:id="@+id/Time"
android:textStyle="bold"
android:layout_marginTop="10dp"
></EditText>
android:layout_marginTop="10dp" />
<Button
android:layout_width="match_parent"
android:layout_height="65dp"
......@@ -83,7 +152,8 @@
android:layout_marginTop="20dp"
android:textStyle="bold"
android:id="@+id/predict"
android:backgroundTint="#5D71C9"></Button>
android:backgroundTint="#5D71C9" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -93,6 +163,5 @@
android:layout_marginTop="25dp"
android:textStyle="bold"
android:id="@+id/result"
android:textColor="@color/cardview_dark_background"></TextView>
android:textColor="@color/cardview_dark_background" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".activities.VedioActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="🔓🎨 Unlock the Art of Effortless Physical Mastery with Interactive Video Guides! 📽️🏃‍♀️🤸‍♂"
android:textSize="19dp"
android:textAlignment="center"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textColor="@color/cardview_dark_background"></TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Geocaching"
android:textSize="18dp"
android:textAlignment="center"
android:layout_marginTop="80dp"
android:textStyle="bold"
android:textColor="@color/cardview_dark_background"></TextView>
<WebView
android:layout_width="match_parent"
android:layout_height="250sp"
android:id="@+id/webView"
android:layout_marginTop="120dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rock Climbing"
android:textSize="18dp"
android:textAlignment="center"
android:layout_marginTop="380dp"
android:textStyle="bold"
android:textColor="@color/cardview_dark_background"></TextView>
<WebView
android:id="@+id/webView2"
android:layout_width="match_parent"
android:layout_height="250sp"
android:layout_marginTop="420dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hiking"
android:textSize="18dp"
android:textAlignment="center"
android:layout_marginTop="680dp"
android:textStyle="bold"
android:textColor="@color/cardview_dark_background"></TextView>
<WebView
android:id="@+id/webView3"
android:layout_width="match_parent"
android:layout_height="250sp"
android:layout_marginTop="720dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Disk Golf"
android:textSize="18dp"
android:textAlignment="center"
android:layout_marginTop="980dp"
android:textStyle="bold"
android:textColor="@color/cardview_dark_background"></TextView>
<WebView
android:id="@+id/webView4"
android:layout_width="match_parent"
android:layout_height="250sp"
android:layout_marginTop="1020dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Parkour"
android:textSize="18dp"
android:textAlignment="center"
android:layout_marginTop="1240dp"
android:textStyle="bold"
android:textColor="@color/cardview_dark_background"></TextView>
<WebView
android:id="@+id/webView5"
android:layout_width="match_parent"
android:layout_height="250sp"
android:layout_marginTop="1280dp" />
</RelativeLayout>
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