Commit 1d764766 authored by Tanmim Hanifa's avatar Tanmim Hanifa

Some design changes

parent 29543ef4
......@@ -26,10 +26,11 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:design:25.1.0'
testCompile 'junit:junit:4.12'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.android.support.constraint:constraint-layout:+'
testCompile 'junit:junit:4.12'
}
......@@ -17,18 +17,30 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegisterActivity" />
<activity android:name=".UserAreaActivity" />
<activity android:name=".RegisterActivity"
android:label="Register"
/>
<activity android:name=".UserAreaActivity"
android:label="Profile"
/>
<activity android:name=".MainMenuActivity">
android:exported="true"
</activity>
<activity android:name=".SearchActivity" />
<activity android:name=".MyPlanActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity android:name=".SearchActivity"
android:label="Search"
/>
<activity android:name=".MyPlanActivity"
android:label="Create a Plan">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MessageActivity"></activity>
<activity android:name=".MessageActivity"
android:label="Messages"
/>
<activity android:name=".SearchResultActivity"
android:label="Search results">
></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -9,5 +9,8 @@ public class MessageActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
setTitle("Messages");
}
}
......@@ -3,6 +3,7 @@ package travelpals.travelpals;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.Button;
......@@ -35,13 +36,18 @@ public class MyPlanActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_plan);
destination = (EditText) findViewById(R.id.destination);
setTitle("Create a Plan");
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
destination = (EditText) findViewById(R.id.destination);
startDate = (EditText) findViewById(R.id.startDate);
endDate = (EditText) findViewById(R.id.endDate);
description =(EditText) findViewById(R.id.description);
......
package travelpals.travelpals;
import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
......@@ -8,6 +9,7 @@ import android.text.Html;
import android.text.Spanned;
import android.text.format.DateFormat;
import android.text.method.LinkMovementMethod;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
......@@ -36,6 +38,7 @@ public class RegisterActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
setTitle("Register");
final EditText etDob = (EditText) findViewById(R.id.etDob);
......
package travelpals.travelpals;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
public class SearchActivity extends AppCompatActivity {
......@@ -9,5 +22,63 @@ public class SearchActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
setTitle("Search");
final EditText etDestination = (EditText) findViewById(R.id.etDestination);
final EditText etStartDate = (EditText) findViewById(R.id.etStartDate);
final EditText etEndDate = (EditText) findViewById(R.id.etEndDate);
final Button btSearch = (Button) findViewById(R.id.btSearch);
btSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String destination = etDestination.getText().toString();
final String startDate = etStartDate.getText().toString();
final String endDate = etEndDate.getText().toString();
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonResponse = new JSONObject(response);
boolean success = jsonResponse.getBoolean("success");
if(success){
String destination = jsonResponse.getString("destination");
String startDate = jsonResponse.getString("startDate");
String endDate = jsonResponse.getString("endDate");
Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class);
intent.putExtra("destination", destination);
intent.putExtra("startDate", startDate);
intent.putExtra("endDate", endDate);
SearchActivity.this.startActivity(intent);
}else{
AlertDialog.Builder builder = new AlertDialog.Builder(SearchActivity.this);
builder.setMessage("Search failed")
.setNegativeButton("Try again", null)
.create()
.show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
};
SearchRequest searchRequest = new SearchRequest(destination, startDate, endDate, responseListener);
RequestQueue queue = Volley.newRequestQueue(SearchActivity.this);
queue.add(searchRequest);
}
});
}
}
package travelpals.travelpals;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Tanmimh on 21/03/2017.
*/
public class SearchRequest extends StringRequest {
private static final String LOGIN_REQUEST_URL = "http://doc.gold.ac.uk/~thani001/travelpals/Search.php";
private Map<String, String> params;
public SearchRequest(String destination, String startDate, String endDate, Response.Listener<String> listener){
super(Request.Method.POST, LOGIN_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put("destination", destination);
params.put("startDate", startDate);
params.put("endDate", endDate);
}
public Map<String, String> getParas(){
return params;
}
}
package travelpals.travelpals;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;
public class SearchResultActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_result);
setTitle("Results");
final EditText etDestination = (EditText) findViewById(R.id.etDestination);
final EditText etStartDate = (EditText) findViewById(R.id.etStartDate);
final EditText etEndDate = (EditText) findViewById(R.id.etEndDate);
Intent intent = getIntent();
final String destination = intent.getStringExtra("destination");
final String startDate = intent.getStringExtra("startDate");
final String endDate = intent.getStringExtra("endDate");
etDestination.setText(destination);
etStartDate.setText(startDate);
etEndDate.setText(endDate);
}
}
......@@ -3,6 +3,7 @@ package travelpals.travelpals;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.EditText;
public class UserAreaActivity extends AppCompatActivity {
......@@ -12,6 +13,11 @@ public class UserAreaActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_area);
setTitle("Profile");
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
final EditText etUsername = (EditText) findViewById(R.id.etUsername);
final EditText etDob = (EditText) findViewById(R.id.etDob);
final EditText etName = (EditText) findViewById(R.id.etName);
......
......@@ -5,6 +5,7 @@ import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
......@@ -23,6 +24,9 @@ public class loginActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
final EditText etUsername = (EditText) findViewById(R.id.etUsername);
final EditText etPassword = (EditText) findViewById(R.id.etPassword);
......
......@@ -14,22 +14,25 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:ems="12"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="95dp"
android:id="@+id/etUsername"
android:hint="Username" />
android:hint="Username"
android:layout_alignStart="@+id/tvLinktoRegister"
android:layout_alignEnd="@+id/tvLinktoRegister" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:ems="12"
android:layout_marginTop="18dp"
android:id="@+id/etPassword"
android:layout_below="@+id/etUsername"
android:layout_alignStart="@+id/etUsername"
android:hint="Password" />
android:hint="Password"
android:layout_alignEnd="@+id/etUsername" />
<Button
android:text="LOG IN"
......
......@@ -15,8 +15,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text"
android:text="destination"
android:ems="10"
android:hint="Destination"
android:ems="12"
android:layout_marginTop="20dp"
android:id="@+id/destination"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
......@@ -26,54 +27,63 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:layout_marginTop="3dp"
android:layout_below="@+id/description"
android:layout_centerHorizontal="true" />
android:layout_alignStart="@+id/description"
android:layout_alignEnd="@+id/description" />
<Button
android:text="show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button3"
android:layout_below="@+id/button"
android:layout_alignEnd="@+id/button"
android:id="@+id/button3" />
android:layout_marginTop="15dp"
android:layout_alignStart="@+id/button" />
<TextView
android:text="result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="37dp"
android:layout_marginTop="5dp"
android:id="@+id/result"
android:layout_below="@+id/button3"
android:layout_alignStart="@+id/button3" />
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:ems="10"
android:ems="12"
android:id="@+id/startDate"
android:text="startDate"
android:hint="Start Date: YYYY-MM-DD"
android:layout_below="@+id/destination"
android:layout_alignStart="@+id/destination" />
android:layout_alignStart="@+id/destination"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:ems="10"
android:ems="12"
android:id="@+id/endDate"
android:text="endDate"
android:hint="End Date: YYYY-MM-DD"
android:layout_marginTop="10dp"
android:layout_below="@+id/startDate"
android:layout_alignStart="@+id/startDate" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text"
android:text="description"
android:ems="10"
android:inputType="textMultiLine"
android:isScrollContainer="true"
android:minHeight="100dp"
android:hint="Description"
android:ems="12"
android:id="@+id/description"
android:layout_below="@+id/endDate"
android:layout_alignStart="@+id/endDate" />
android:layout_alignStart="@+id/endDate"
android:layout_marginTop="10dp" />
</RelativeLayout>
......@@ -14,7 +14,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:ems="12"
android:id="@+id/etName"
android:hint="Full name"
android:layout_centerHorizontal="true"
......@@ -25,7 +25,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:ems="10"
android:ems="12"
android:id="@+id/etDob"
android:hint="YYYY-MM-DD"
android:layout_marginBottom="10dp"
......@@ -35,7 +35,7 @@
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:ems="12"
android:layout_marginBottom="10dp"
android:layout_alignStart="@+id/etDob"
android:entries="@array/gender"
......@@ -48,7 +48,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:ems="12"
android:id="@+id/etEmail"
android:hint="Email Address"
android:layout_marginBottom="10dp"
......@@ -59,7 +59,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:ems="12"
android:id="@+id/etUsername"
android:hint="Username"
android:layout_below="@id/etEmail"
......@@ -70,17 +70,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:ems="12"
android:id="@+id/etPassword"
android:hint="Password"
android:layout_marginBottom="10dp"
android:layout_below="@+id/etUsername"
android:layout_alignStart="@+id/etUsername" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:ems="12"
android:id="@+id/etPasswordAgain"
android:layout_marginBottom="10dp"
android:hint="Re-enter password"
......@@ -96,8 +97,6 @@
android:layout_marginBottom="20dp"
android:layout_alignStart="@+id/etPasswordAgain" />
<TextView
android:id="@+id/tvTerms"
android:layout_width="wrap_content"
......@@ -107,19 +106,23 @@
android:padding="20px"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_below="@+id/etPasswordAgain"
android:layout_alignStart="@+id/btnRegister"
android:layout_alignEnd="@+id/etPasswordAgain" />
android:layout_alignEnd="@+id/etPasswordAgain"
android:layout_toEndOf="@+id/cbTerms" />
<Button
android:text="REGISTER"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:id="@+id/btnRegister"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
android:layout_below="@+id/tvTerms"
android:layout_alignStart="@+id/cbTerms"
android:layout_alignEnd="@+id/etPasswordAgain" />
</RelativeLayout>
......@@ -10,4 +10,44 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="travelpals.travelpals.SearchActivity">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/etDestination"
android:ems="12"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_marginTop="25dp"
android:hint="Destination" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/etStartDate"
android:layout_alignStart="@+id/etDestination"
android:layout_alignEnd="@+id/etDestination"
android:layout_below="@+id/etDestination"
android:hint="Start date: YYYY-MM-DD"
android:layout_marginBottom="25dp"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/etEndDate"
android:layout_alignStart="@+id/etStartDate"
android:layout_alignEnd="@+id/etStartDate"
android:layout_below="@+id/etStartDate"
android:hint="End date: YYYY-MM-DD"
android:layout_marginBottom="35dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btSearch"
android:layout_alignStart="@+id/etEndDate"
android:layout_alignEnd="@+id/etEndDate"
android:layout_below="@+id/etEndDate"
android:text="SEARCH"/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="travelpals.travelpals.loginActivity">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/etDestination"
android:ems="10"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/etStartDate"
android:layout_below="@+id/etDestination"
android:ems="10"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/etEndDate"
android:layout_below="@+id/etStartDate"
android:ems="10"/>
</RelativeLayout>
......@@ -24,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:ems="12"