Commit 2ce6da30 authored by Tanmim Hanifa's avatar Tanmim Hanifa

final edits

parent 911e12f5
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mohamed.travelb">
<uses-permission android:name="android.permission.INTERNET" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegisterActivity" />
<activity android:name=".UserAreaActivity" />
<activity android:name=".SearchActivity" />
<activity android:name=".PlansActivity" />
<activity android:name=".MessageActivity" />
<activity android:name=".ProfilActivity" />
<activity android:name=".RecyclerViewAdapter" />
<activity android:name=".foundSearch" />
<activity android:name=".addplan" />
<activity android:name=".ContactDtails" />
<activity android:name=".Send_message" />
<activity android:name=".send_message" />
<activity android:name=".MessageDtails" />
<activity android:name=".remove" />
<activity android:name=".messageMenu" />
</application>
</manifest>
\ No newline at end of file
package com.example.mohamed.travelb;
import android.util.Log;
/**
* Created by mohamed on 23/04/2017.
*/
public class Contact {
private int image_id;
private String name,username,dob,destination,user_id,plan_id,gender,date;
String my_id;
public Contact(int image_id, String date,String name, String username, String dob, String destination, String user_id, String plan_id, String gender) {
this.image_id = image_id;
this.name = name;
this.username = username;
this.dob = dob;
this.destination = destination;
this.user_id = user_id;
this.plan_id = plan_id;
this.gender = gender;
this.date=date;
}
public Contact(int image_id) {
this.image_id = image_id;
}
public Contact(String id) {
my_id=id;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getImage_id() {
return image_id;
}
public void setImage_id(int image_id) {
this.image_id = image_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getPlan_id() {
return plan_id;
}
public void setPlan_id(String plan_id) {
this.plan_id = plan_id;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
}
package com.example.mohamed.travelb;
/**
* Created by mohamed on 27/04/2017.
*/
public class Message {
private int image_id;
private String User_id,Email,Gender,Name,Dob,Password,Username,Idmess,Content,Sender,Receiver,DateR;
String my_id;
public Message(int image_id, String user_id, String email, String gender, String name, String dob, String password,
String username, String idmess, String content, String sender, String receiver, String my_id,String dateR) {
this.image_id = image_id;
User_id = user_id;
Email = email;
Gender = gender;
Name = name;
Dob = dob;
Password = password;
Username = username;
Idmess = idmess;
Content = content;
Sender = sender;
Receiver = receiver;
DateR=dateR;
this.my_id = my_id;
}
public Message( String my_id) {
this.my_id = my_id;
}
public int getImage_id() {
return image_id;
}
public void setImage_id(int image_id) {
this.image_id = image_id;
}
public String getUser_id() {
return User_id;
}
public void setUser_id(String user_id) {
User_id = user_id;
}
public String getEmail() {
return Email;
}
public void setEmail(String email) {
Email = email;
}
public String getGender() {
return Gender;
}
public void setGender(String gender) {
Gender = gender;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getDob() {
return Dob;
}
public void setDob(String dob) {
Dob = dob;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public String getUsername() {
return Username;
}
public void setUsername(String username) {
Username = username;
}
public String getIdmess() {
return Idmess;
}
public void setIdmess(String idmess) {
Idmess = idmess;
}
public String getContent() {
return Content;
}
public void setContent(String content) {
Content = content;
}
public String getSender() {
return Sender;
}
public void setSender(String sender) {
Sender = sender;
}
public String getReceiver() {
return Receiver;
}
public void setReceiver(String receiver) {
Receiver = receiver;
}
public String getMy_id() {
return my_id;
}
public void setDater(String dateR) {
DateR = dateR;
}
public String getDater() {
return DateR;
}
public void setMy_id(String my_id) {
this.my_id = my_id;
}
}
package com.example.mohamed.travelb;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.jar.Attributes;
public class MessageActivity extends AppCompatActivity {
RecyclerView recyclerView;
RecyclerView.Adapter adapter;
RecyclerView.LayoutManager layoutManager;
ArrayList<Message> list ;
int image_id=R.drawable.a;
String id;
String GET_JSON_DATA_HTTP_URL = "http://travelb.000webhostapp.com/message.php";
String JSON_ID = "user_id";
String JSON_EMAIL = "email";
String JSON_GENDER = "gender";
String JSON_NAME="name";
String JSON_DOB="dob";
String JSON_PASSWORD="password";
String JSON_USERNAME="username";
String JSON_IDMESS="id_mess";
String JSON_CONTENT="content";
String JSON_SENDER="sender";
String JSON_RECEIVER="receiver";
String JSON_DATER="date";
RequestQueue requestQueue ;
String destination ;
Map<String, String> params = new HashMap<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//final TextView mess= (TextView) findViewById(R.id.message);
setContentView(R.layout.activity_found_search);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true);
layoutManager=new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
final Intent intent = getIntent();
list=new ArrayList<>();
destination = intent.getStringExtra("destination");
id = intent.getStringExtra("my_id");
//Log.d("mohamed",destination);
JSON_DATA_WEB_CALL();
for(int i=0; i<list.size();i++){
Log.d("list",list.get(i)+"");
}
}
public void JSON_DATA_WEB_CALL(){
params.put("user_id", id);
StringRequest stringRequest = new StringRequest(Request.Method.POST, GET_JSON_DATA_HTTP_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Display the first 500 characters of the response string.
JSONArray ja = null;
try {
ja = new JSONArray(response);
Log.d( "onResponse: ",ja+"");
} catch (JSONException e) {
e.printStackTrace();
}
JSON_PARSE_DATA_AFTER_WEBCALL(ja);
Log.d("onResponse: ",list.size()+"");
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) { protected Map<String, String> getParams() {
Map<String,String> params = new HashMap<String, String>();
params.put("user_id",id);
return params;
}}
;
requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
public void JSON_PARSE_DATA_AFTER_WEBCALL(JSONArray array){
for(int i = 0; i<array.length(); i++) {
Message contact = new Message(id);
Log.d("JSON_P: ",i+"");
JSONObject json=null ;
try {
json = array.getJSONObject(i);
contact.setUser_id(json.getString(JSON_ID));
contact.setEmail(json.getString(JSON_EMAIL));
contact.setGender(json.getString(JSON_GENDER));
contact.setName(json.getString(JSON_NAME));
contact.setDob(json.getString(JSON_DOB));
contact.setPassword(json.getString(JSON_PASSWORD));
contact.setUsername(json.getString(JSON_USERNAME));
contact.setIdmess(json.getString(JSON_IDMESS));
contact.setContent(json.getString(JSON_CONTENT));
contact.setSender(json.getString(JSON_SENDER));
contact.setReceiver(json.getString(JSON_RECEIVER));
contact.setDater(json.getString(JSON_DATER));
// Log.d("JSON_PHONENUMBER",JSON_PHONE_NUMBER);
String JSON_ID = "user_id";
String JSON_EMAIL = "email";
String JSON_GENDER = "gender";
String JSON_NAME="name";
String JSON_DOB="dob";
String JSON_PASSWORD="password";
String JSON_USERNAME="username";
String JSON_IDMESS="id_mess";