Skip to content

Commit

Permalink
New
Browse files Browse the repository at this point in the history
  • Loading branch information
eslam2010011 committed Sep 1, 2021
1 parent 9cb5fd4 commit 5959ec3
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 3 deletions.
5 changes: 5 additions & 0 deletions FastChat/src/main/java/com/fastchat/Core/UiConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.fastchat.Core;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

Expand Down Expand Up @@ -151,6 +153,9 @@ interface OnChatListener {

void onVoice(User user, BaseMessage baseMessage);


void info(View view);

}


Expand Down
78 changes: 78 additions & 0 deletions FastChat/src/main/java/com/fastchat/Ui/Chat/fragmentChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,52 @@ public void onClick(View v) {
getActivity().finish();
}
});
info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (FastChat.getUiConfig().getOnChatListener() != null) {
FastChat.getUiConfig().getOnChatListener().info(v);
}

}
});
video_call.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Utils.hasPermissions(getActivity(), new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.CAMERA})) {
FastChat.getFastChat().getChatInteract().sendMessageCall(groupId, FastChatConstants.MESSAGE_TYPE_VIDEO, receiverId, userId, new Chat.CallbackListener() {
@Override
public void onSuccess(BaseMessage textMessage) {
MediaUtils.playSendSound(getActivity(), R.raw.outgoing_message);
SendNotification(receiverId, (Call) textMessage);
DatabaseReference databaseReference = FastChat.getFastChat().getChatInteract().getUser(receiverId);
ValueEventListener valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
User user1 = snapshot.getValue(User.class);
if ((user1 != null ? user1.getUserName() : null) != null) {
if (FastChat.getUiConfig().getOnChatListener() != null) {
FastChat.getUiConfig().getOnChatListener().onVideo(user1, (Call) textMessage);
}

}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {

}
};
databaseReference.addListenerForSingleValueEvent(valueEventListener);
}
});


}else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
( getActivity()).requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.CAMERA},
30);
}
}
// FastPermissions.with(getActivity())
// .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA)
// .ifNecessary()
Expand Down Expand Up @@ -250,6 +293,41 @@ public void onClick(View v) {
voice_call.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

if (Utils.hasPermissions(getActivity(), new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE})) {
FastChat.getFastChat().getChatInteract().sendMessageCall(groupId, FastChatConstants.MESSAGE_TYPE_VIDEO, receiverId, userId, new Chat.CallbackListener() {
@Override
public void onSuccess(BaseMessage textMessage) {
MediaUtils.playSendSound(getActivity(), R.raw.outgoing_message);
SendNotification(receiverId, (Call) textMessage);
DatabaseReference databaseReference = FastChat.getFastChat().getChatInteract().getUser(receiverId);
ValueEventListener valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
User user1 = snapshot.getValue(User.class);
if ((user1 != null ? user1.getUserName() : null) != null) {
if (FastChat.getUiConfig().getOnChatListener() != null) {
FastChat.getUiConfig().getOnChatListener().onVoice(user1, (Call) textMessage);
}

}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {

}
};
databaseReference.addListenerForSingleValueEvent(valueEventListener);
}
});


}else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
( getActivity()).requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE},
30);
}
}
// FastPermissions.with(getActivity())
// .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA)
// .ifNecessary()
Expand Down
3 changes: 3 additions & 0 deletions FastChat/src/main/res/layout/conversation_list_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
android:layout_toEndOf="@id/av_user"
android:layout_height="wrap_content"
tools:text="@tools:sample/full_names"
android:textColor="@color/textColorBlack"
android:layout_marginEnd="16dp"
android:textSize="@dimen/name"
android:maxLines="1"
Expand All @@ -57,6 +58,7 @@
android:layout_below="@id/txt_user_name"
android:layout_toEndOf="@id/av_user"
android:maxLines="1"
android:textColor="@color/secondaryTextColor"
android:layout_marginRight="8dp"
android:layout_toStartOf="@+id/messageTime"
tools:text="online"
Expand All @@ -81,6 +83,7 @@
android:textSize="12sp"
android:layout_alignTop="@id/txt_user_name"
tools:text="11:50"
android:textColor="@color/secondaryTextColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.fastchat.widget.BadgeCount
Expand Down
1 change: 1 addition & 0 deletions FastChat/src/main/res/layout/layout_compose_box.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:textColor="@color/textColorBlack"
android:hint="@string/type_a_message"
android:inputType="textMultiLine"
android:maxLines="6"
Expand Down
1 change: 1 addition & 0 deletions FastChat/src/main/res/layout/left_message_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@

<TextView
android:id="@+id/txt_time"
android:textColor="@color/secondaryTextColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/cv_message_container"
Expand Down
1 change: 1 addition & 0 deletions FastChat/src/main/res/layout/left_message_link_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
android:layout_alignBottom="@+id/cv_message_container"
android:layout_gravity="center"
android:layout_marginBottom="8dp"
android:textColor="@color/secondaryTextColor"
android:layout_toRightOf="@id/cv_message_container"
android:textSize="12sp"
android:textStyle="bold"
Expand Down
1 change: 1 addition & 0 deletions FastChat/src/main/res/layout/left_reply_message_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
android:layout_below="@+id/cv_message_container"
android:visibility="gone"
android:id="@+id/txt_time"
android:textColor="@color/secondaryTextColor"
android:layout_marginEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
android:layout_alignBottom="@id/cv_image_message_container"
android:layout_gravity="center"
android:layout_marginBottom="8dp"
tools:drawableStart="@drawable/ic_double_tick" android:textColor="@color/secondaryTextColor"
tools:drawableStart="@drawable/ic_double_tick"
android:textColor="@color/secondaryTextColor"
android:textSize="12sp"
android:textStyle="bold"
android:visibility="gone"
Expand Down
1 change: 1 addition & 0 deletions FastChat/src/main/res/layout/right_message_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:textSize="12sp"
android:textColor="@color/secondaryTextColor"
android:textStyle="bold"
android:visibility="gone"
tools:text="11:00 PM"
Expand Down
1 change: 1 addition & 0 deletions FastChat/src/main/res/layout/right_message_link_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:textSize="12sp"
android:textColor="@color/secondaryTextColor"
android:textStyle="bold"
android:visibility="gone"
tools:text="11:00 PM"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
tools:text="11:00 PM"
android:layout_marginBottom="8dp"
android:textSize="12sp"
android:textColor="@color/secondaryTextColor"
android:layout_alignBottom="@+id/cv_message_container"
android:layout_toLeftOf="@+id/cv_message_container"
android:textStyle="bold"
Expand Down
1 change: 1 addition & 0 deletions FastChat/src/main/res/layout/right_reply_message_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:textSize="12sp"
android:textColor="@color/secondaryTextColor"
android:textStyle="bold"
android:visibility="gone"
tools:text="11:00 PM"
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
api 'com.vanniktech:emoji-twitter:0.7.0'




//RecyclerView
implementation 'androidx.recyclerview:recyclerview:1.1.0'
Expand All @@ -52,7 +52,7 @@ dependencies {
implementation 'com.google.firebase:firebase-database:20.0.1'
implementation 'com.firebaseui:firebase-ui-database:6.3.0'

implementation 'com.github.eslam2010011:FastChat:v2.1'
implementation 'com.github.eslam2010011:FastChat:v2.2'


// implementation 'com.github.bumptech.glide:glide:4.11.0'
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
Expand Down

0 comments on commit 5959ec3

Please sign in to comment.