diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 0d15693..663459a 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -3,18 +3,9 @@
-
diff --git a/app/src/main/java/com/example/dateyoureve/CreateEvent.java b/app/src/main/java/com/example/dateyoureve/CreateEvent.java
index 6894119..43a275b 100644
--- a/app/src/main/java/com/example/dateyoureve/CreateEvent.java
+++ b/app/src/main/java/com/example/dateyoureve/CreateEvent.java
@@ -60,7 +60,11 @@ public class CreateEvent extends AppCompatActivity {
// request code
private final int PICK_IMAGE_REQUEST = 22;
Button btnSelectImage,cancel,create,btnTimePicker;
- TextInputLayout titleEvent,decriptionEvent,timeInputEvent,notes;
+ TextInputLayout titleEvent;
+ TextInputLayout decriptionEvent;
+ TextInputLayout timeInputEvent;
+ TextInputLayout notes;
+ String venue;
RadioGroup radioGroupOnOffMode;
FirebaseDatabase mDatabase;
DatabaseReference databaseReference;
@@ -113,7 +117,8 @@ protected void onCreate(Bundle savedInstanceState) {
note = notes.getEditText().getText().toString();
time = timeInputEvent.getEditText().getText().toString();
dateEvent = textView.getText().toString();
- if(!title.isEmpty() && !description.isEmpty() && !note.isEmpty())
+ venue = selectvenue.getText().toString();
+ if(!title.isEmpty() && !description.isEmpty() && !note.isEmpty() && !time.isEmpty() && !dateEvent.isEmpty() && !venue.isEmpty())
{
progressDialog.show();
uploadImage();
@@ -154,6 +159,7 @@ public void onTimeSet(TimePicker view, int hourOfDay,
DatePickerDialog datePickerDialog =new DatePickerDialog(CreateEvent.this, android.R.style.Theme_DeviceDefault_Dialog, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int date) {
+
if((date>cdate && month == cmonth && year==cyear) || (date == cdate && month > cmonth && year==cyear) ||(date == cdate && month == cmonth && year > cyear))
textView.setText(date+"/"+month+1+"/"+year);
else
@@ -203,7 +209,8 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
if ((requestCode == PLACE_PICKER_REQUEST)) {
if(data != null) {
PlaceParcelable place = YandexPlacePicker.getPlace(data);
- location = place.getAddress();
+ location =place.getName()+ place.getAddress();
+ selectvenue.setText(place.getName()+place.getAddress());
Toast.makeText(this, "You selected: " + place.getClass(), Toast.LENGTH_SHORT).show();
}
}
@@ -255,7 +262,7 @@ public void onSuccess(Uri uri) {
String uploadId = databaseReference.push().getKey();
DatabaseReference userData = FirebaseDatabase.getInstance().getReference("users");
EventIdObj eventIdObj = new EventIdObj(uploadId);
- userData.child(user.getUid()).child("createdEvents").child(title).setValue(eventIdObj);
+ userData.child(user.getUid()).child("createdEvents").child(uploadId).setValue(eventIdObj);
userData.child(user.getUid()).child("phone").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
diff --git a/app/src/main/java/com/example/dateyoureve/EventDetailsSetter.java b/app/src/main/java/com/example/dateyoureve/EventDetailsSetter.java
index 4e5b14c..06da17c 100644
--- a/app/src/main/java/com/example/dateyoureve/EventDetailsSetter.java
+++ b/app/src/main/java/com/example/dateyoureve/EventDetailsSetter.java
@@ -1,8 +1,13 @@
package com.example.dateyoureve;
+import com.google.firebase.database.IgnoreExtraProperties;
+
+@IgnoreExtraProperties
public class EventDetailsSetter {
String title,description,notes,mode,date,image,time,userId,venue,eventId,phone;
+ public EventDetailsSetter(){
+ }
public EventDetailsSetter(String title, String description, String notes, String mode, String paid, String image, String date, String time,String venue, String userId, String eventId, String phone) {
this.title = title;
diff --git a/app/src/main/java/com/example/dateyoureve/InterestedUsersList.java b/app/src/main/java/com/example/dateyoureve/InterestedUsersList.java
index 9ff33d5..f0e8699 100644
--- a/app/src/main/java/com/example/dateyoureve/InterestedUsersList.java
+++ b/app/src/main/java/com/example/dateyoureve/InterestedUsersList.java
@@ -1,10 +1,22 @@
package com.example.dateyoureve;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
+import android.util.Log;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.database.ChildEventListener;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
@@ -12,6 +24,9 @@
public class InterestedUsersList extends AppCompatActivity {
InterestedUsersAdapter myAdapter;
private List interestedUsersData;
+ DatabaseReference databaseReferenceFav,databaseReferenceEve;
+ FirebaseUser mAuth;
+ String path;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -20,10 +35,43 @@ protected void onCreate(Bundle savedInstanceState) {
RecyclerView recyclerView = findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
+
interestedUsersData = new ArrayList();
- interestedUsersData.add(new User("hema","10/01/2020","9461172491"));
- interestedUsersData.add(new User("amit","20/65/1523","7240770955"));
- interestedUsersData.add(new User("muskan","32/12/2021","9856478235"));
+ mAuth = FirebaseAuth.getInstance().getCurrentUser();
+ path = "Events/" + getIntent().getStringExtra("eventId") +"/InterestedPeoples";
+ databaseReferenceFav = FirebaseDatabase.getInstance().getReference(path);
+ databaseReferenceFav.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot snapshot) {
+ for(DataSnapshot dataFav : snapshot.getChildren())
+ {
+ Log.i("first snapshot",dataFav.getValue().toString());
+ String path = "users/" + dataFav.getValue().toString();
+ databaseReferenceEve = FirebaseDatabase.getInstance().getReference("users");
+ databaseReferenceEve.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot snapshotsecond) {
+ Log.i("test",snapshotsecond.getValue().toString());
+ interestedUsersData.add(snapshotsecond.getValue(User.class));
+ myAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+
+ }
+ });
+ myAdapter.notifyDataSetChanged();
+ Log.i("test",dataFav.getValue().toString());
+ }
+
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+
+ }
+ });
myAdapter = new InterestedUsersAdapter(interestedUsersData,InterestedUsersList.this);
recyclerView.setAdapter(myAdapter);
}
diff --git a/app/src/main/java/com/example/dateyoureve/PastEventData.java b/app/src/main/java/com/example/dateyoureve/PastEventData.java
index 57d3b03..480e899 100644
--- a/app/src/main/java/com/example/dateyoureve/PastEventData.java
+++ b/app/src/main/java/com/example/dateyoureve/PastEventData.java
@@ -1,10 +1,27 @@
package com.example.dateyoureve;
+import com.google.firebase.database.IgnoreExtraProperties;
+
+@IgnoreExtraProperties
public class PastEventData {
- public PastEventData(String title, String date, String interested_count) {
+
+ public String getEventId() {
+ return eventId;
+ }
+
+ public void setEventId(String eventId) {
+ this.eventId = eventId;
+ }
+
+ public PastEventData(){
+
+ }
+ public PastEventData(String title, String date, long interested_count,String eventId) {
this.title = title;
this.date = date;
this.interested_count = interested_count;
+ this.eventId=eventId;
+
}
public String getTitle() {
@@ -15,12 +32,12 @@ public String getDate() {
return date;
}
- public String getInterested_count() {
+ public long getInterested_count() {
return interested_count;
}
- String title,date;
- String interested_count;
+ String title,date,eventId;
+ long interested_count;
public void setTitle(String title) {
this.title = title;
@@ -30,7 +47,7 @@ public void setDate(String date) {
this.date = date;
}
- public void setInterested_count(String interested_count) {
+ public void setInterested_count(long interested_count) {
this.interested_count = interested_count;
}
}
diff --git a/app/src/main/java/com/example/dateyoureve/PastEventDataAdapter.java b/app/src/main/java/com/example/dateyoureve/PastEventDataAdapter.java
index f540887..7583c10 100644
--- a/app/src/main/java/com/example/dateyoureve/PastEventDataAdapter.java
+++ b/app/src/main/java/com/example/dateyoureve/PastEventDataAdapter.java
@@ -36,11 +36,12 @@ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
final PastEventData pastEventDataList = pastEventData.get(position);
holder.titleView.setText(pastEventDataList.getTitle());
holder.date.setText(pastEventDataList.getDate());
- holder.interested.setText(pastEventDataList.getInterested_count());
+ holder.interested.setText(String.valueOf(pastEventDataList.getInterested_count()));
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context,InterestedUsersList.class);
+ intent.putExtra("eventId",pastEventDataList.getEventId());
context.startActivity(intent);
}
});
diff --git a/app/src/main/java/com/example/dateyoureve/PastEventsList.java b/app/src/main/java/com/example/dateyoureve/PastEventsList.java
index 7fcb18b..fd0a9c6 100644
--- a/app/src/main/java/com/example/dateyoureve/PastEventsList.java
+++ b/app/src/main/java/com/example/dateyoureve/PastEventsList.java
@@ -42,6 +42,26 @@ protected void onCreate(Bundle savedInstanceState) {
databaseReferenceCreated.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
+ for(DataSnapshot dataSnapshot : snapshot.getChildren())
+ {
+ String path = "Events/" + dataSnapshot.getValue().toString();
+ databaseReferenceEve = FirebaseDatabase.getInstance().getReference(path);
+ databaseReferenceEve.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot snapshot) {
+
+ pastEventData.add(snapshot.getValue(PastEventData.class));
+ myAdapter.notifyDataSetChanged();
+
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+
+ }
+ });
+ }
+
}
@Override
@@ -64,9 +84,6 @@ public void onCancelled(@NonNull DatabaseError error) {
}
});
- pastEventData.add(new PastEventData("mid terms","10/01/2020","10"));
- pastEventData.add(new PastEventData("Projects","20/65/1523","20"));
- pastEventData.add(new PastEventData("Office Works","32/12/2021","40"));
myAdapter = new PastEventDataAdapter(pastEventData,PastEventsList.this);
recyclerView.setAdapter(myAdapter);
}
diff --git a/app/src/main/java/com/example/dateyoureve/ui/FavouriteFragment.java b/app/src/main/java/com/example/dateyoureve/ui/FavouriteFragment.java
index 5b992d3..5bc8daf 100644
--- a/app/src/main/java/com/example/dateyoureve/ui/FavouriteFragment.java
+++ b/app/src/main/java/com/example/dateyoureve/ui/FavouriteFragment.java
@@ -44,30 +44,30 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
myHomeData = new ArrayList();
mAuth = FirebaseAuth.getInstance().getCurrentUser();
- path = "users/" + mAuth.getUid() + "/FavEvents";
- databaseReferenceFav = FirebaseDatabase.getInstance().getReference(path);
- databaseReferenceFav.addChildEventListener(new ChildEventListener() {
- @Override
- public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
- for(DataSnapshot dataFav : snapshot.getChildren())
- {
- String path = "Events/" + dataFav.getValue().toString();
- databaseReferenceEve = FirebaseDatabase.getInstance().getReference(path);
- databaseReferenceEve.addValueEventListener(new ValueEventListener() {
- @Override
- public void onDataChange(@NonNull DataSnapshot snapshot) {
- myHomeData.add(snapshot.getValue(MyHomeData.class));
+ path = "users/" + mAuth.getUid() + "/FavEvents";
+ databaseReferenceFav = FirebaseDatabase.getInstance().getReference(path);
+ databaseReferenceFav.addChildEventListener(new ChildEventListener() {
+ @Override
+ public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
+ for(DataSnapshot dataFav : snapshot.getChildren())
+ {
+ String path = "Events/" + dataFav.getValue().toString();
+ databaseReferenceEve = FirebaseDatabase.getInstance().getReference(path);
+ databaseReferenceEve.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot snapshot) {
+ myHomeData.add(snapshot.getValue(MyHomeData.class));
+ myHomeAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+
+ }
+ });
myHomeAdapter.notifyDataSetChanged();
+ Log.i("test",dataFav.getValue().toString());
}
-
- @Override
- public void onCancelled(@NonNull DatabaseError error) {
-
- }
- });
- myHomeAdapter.notifyDataSetChanged();
- Log.i("test",dataFav.getValue().toString());
- }
}
@Override
diff --git a/app/src/main/res/layout/my_home_ui.xml b/app/src/main/res/layout/my_home_ui.xml
index 833bcd3..5ded48b 100644
--- a/app/src/main/res/layout/my_home_ui.xml
+++ b/app/src/main/res/layout/my_home_ui.xml
@@ -82,12 +82,13 @@