Skip to content

Commit

Permalink
Delete Message Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mukul2428 committed Mar 7, 2021
1 parent 98a7b3b commit f55c25d
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 1,083 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ public void onChildChanged(DataSnapshot dataSnapshot, String s)
@Override
public void onChildRemoved(DataSnapshot dataSnapshot)
{

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class GroupChatActivity extends AppCompatActivity {
StorageTask uploadTask;

final List<Messages> messagesList = new ArrayList<>();
GroupMessageAdapter messageAdapter;
MessageAdapter messageAdapter;
RecyclerView userMessagesList;
LinearLayoutManager linearLayoutManager;

Expand Down Expand Up @@ -437,48 +437,6 @@ else if(checker.equals("image"))
}
}

// @Override
// protected void onStart() {
// super.onStart();
//
// GroupNameRef.addChildEventListener(new ChildEventListener() {
// @Override
// public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
//
// if(dataSnapshot.exists())
// {
// DisplayMessages(dataSnapshot);
// }
//
// }
//
// @Override
// public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
//
// if(dataSnapshot.exists())
// {
// DisplayMessages(dataSnapshot);
// }
// }
//
// @Override
// public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {
//
// }
//
// @Override
// public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
//
// }
//
// @Override
// public void onCancelled(@NonNull DatabaseError databaseError) {
//
// }
// });
//
// }


private void InitialiseFields()
{
Expand All @@ -503,19 +461,19 @@ private void InitialiseFields()
SendGroupFilesBtn = findViewById(R.id.send_group_files_btn);
UserMessageInput=findViewById(R.id.input_group_message);

messageAdapter = new GroupMessageAdapter(messagesList);
messageAdapter = new MessageAdapter(messagesList);
userMessagesList = findViewById(R.id.Group_chat_list);
linearLayoutManager = new LinearLayoutManager(this);
userMessagesList.setLayoutManager(linearLayoutManager);
userMessagesList.setAdapter(messageAdapter);

Calendar calDate = Calendar.getInstance();
SimpleDateFormat currentDateFormat = new SimpleDateFormat("MMM dd, yyyy");
currentDate = currentDateFormat.format(calDate.getTime());
Calendar calendar = Calendar.getInstance();

SimpleDateFormat CurrentDate = new SimpleDateFormat("dd-MMM-yyyy");
currentDate = CurrentDate.format(calendar.getTime());

Calendar calTime = Calendar.getInstance();
SimpleDateFormat currentTimeFormat = new SimpleDateFormat("hh:mm a");
currentTime = currentTimeFormat.format(calTime.getTime());
SimpleDateFormat CurrentTime = new SimpleDateFormat("hh:mm a");
currentTime = CurrentTime.format(calendar.getTime());

}

Expand Down Expand Up @@ -552,10 +510,6 @@ private void SendMessageInfoToDatabase()
}
else
{
//
// HashMap<String, Object> groupMessageKey = new HashMap<>();
// GroupNameRef.updateChildren(groupMessageKey);

GroupMessageKeyRef = GroupNameRef.child(messageKey);
//using GroupMessageKeyRef we will store our message to database

Expand All @@ -574,20 +528,4 @@ private void SendMessageInfoToDatabase()
}
}

// private void DisplayMessages(DataSnapshot dataSnapshot)
// {
//
// Iterator iterator = dataSnapshot.getChildren().iterator();
//
// while(iterator.hasNext())
// {
//
// String chatDate = (String) ((DataSnapshot)iterator.next()).getValue();
// String chatMessage = (String) ((DataSnapshot)iterator.next()).getValue();
// String chatName = (String) ((DataSnapshot)iterator.next()).getValue();
// String chatTime = (String) ((DataSnapshot)iterator.next()).getValue();
//
// DisplayTextMessages.append(chatName + " :\n" + chatMessage + "\n" + chatTime + " " + chatDate + "\n\n\n");
// }
// }
}
Loading

0 comments on commit f55c25d

Please sign in to comment.