Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/Chat
This commit is contained in:
@@ -273,10 +273,8 @@ abstract class BaseChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
viewHolder.timeTextView.setText(String.format(Locale.getDefault(), "%s | %s", isLeft ? message.senderName : viewHolder.timeTextView.getContext().getString(R.string.chat_you_name), DateUtils.toHourFormatHour(message.createdAt)));
|
||||
|
||||
if (TextUtils.isEmpty(message.senderAvatar)) {
|
||||
//noinspection ConstantConditions
|
||||
viewHolder.contactImageView.setImageResource(R.drawable.avatar);
|
||||
} else {
|
||||
//noinspection ConstantConditions
|
||||
Glide.with(viewHolder.contactImageView.getContext())
|
||||
.load(message.senderAvatar)
|
||||
.placeholder(R.drawable.avatar)
|
||||
@@ -288,7 +286,6 @@ abstract class BaseChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(message.filePath)) {
|
||||
|
||||
viewHolder.messageTextView.setVisibility(View.GONE);
|
||||
|
||||
if (mDownloadProgressMap.containsKey(position)) {
|
||||
@@ -297,13 +294,13 @@ abstract class BaseChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
viewHolder.donutProgress.setProgress(mDownloadProgressMap.get(position));
|
||||
viewHolder.donutProgress.setText(String.format(Locale.getDefault(), "%d %%", mDownloadProgressMap.get(position)));
|
||||
|
||||
if (!message.filePath.endsWith(".png") && !message.filePath.endsWith(".jpg") && !message.filePath.endsWith(".JPG")) {
|
||||
if (!message.filePath.toLowerCase().endsWith(".png") && !message.filePath.toLowerCase().endsWith(".jpg")) {
|
||||
viewHolder.filenameTextView.setVisibility(View.VISIBLE);
|
||||
viewHolder.filenameTextView.setText(message.originalFilename);
|
||||
} else {
|
||||
viewHolder.filenameTextView.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (message.filePath.endsWith(".png") || message.filePath.endsWith(".jpg") || message.filePath.endsWith(".JPG")) {
|
||||
} else if (message.filePath.toLowerCase().endsWith(".png") || message.filePath.toLowerCase().endsWith(".jpg")) {
|
||||
viewHolder.donutProgress.setVisibility(View.GONE);
|
||||
viewHolder.fileImageView.setVisibility(View.VISIBLE);
|
||||
viewHolder.filenameTextView.setVisibility(View.GONE);
|
||||
@@ -338,7 +335,6 @@ abstract class BaseChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
}
|
||||
|
||||
static class DateViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@BindView(R.id.chat_item_date)
|
||||
TextView dateTextView;
|
||||
|
||||
@@ -392,15 +388,17 @@ abstract class BaseChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
if (mIsRetrying) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsRetrying = true;
|
||||
int currentPosition = getAdapterPosition();
|
||||
|
||||
Message messageToResend = mMessages.get(currentPosition - mPositionOffset.get(currentPosition));
|
||||
//noinspection ConstantConditions
|
||||
|
||||
statusProgressBar.setVisibility(View.VISIBLE);
|
||||
ViewUtils.setProgressBarColorToOrange(statusProgressBar);
|
||||
//noinspection ConstantConditions
|
||||
ViewUtils.setProgressBarColor(statusProgressBar, R.color.colorWhite);
|
||||
|
||||
statusImageView.setVisibility(View.GONE);
|
||||
//noinspection ConstantConditions
|
||||
|
||||
sendingFailedTextView.setVisibility(View.GONE);
|
||||
mMessageClickListener.resendMessage(messageToResend);
|
||||
}
|
||||
@@ -410,20 +408,22 @@ abstract class BaseChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
void fileClicked() {
|
||||
int currentPosition = getAdapterPosition();
|
||||
Message message = mMessages.get(currentPosition - mPositionOffset.get(currentPosition));
|
||||
|
||||
if (message.status != Message.Status.DELIVERED) {
|
||||
mMessageClickListener.localFileClicked(Uri.parse(message.uri));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDownloadProgressMap.containsKey(currentPosition)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mDownloadProgressMap.put(currentPosition, 0);
|
||||
mMessageClickListener.fileClicked(message, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
static class ProgressViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
ProgressViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements Cha
|
||||
String groupIdString = String.valueOf(mGroupId);
|
||||
RequestBody groupIdBody = RequestBody.create(okhttp3.MultipartBody.FORM, groupIdString);
|
||||
|
||||
RequestBody textBody = RequestBody.create(MultipartBody.FORM, message.message);
|
||||
RequestBody textBody = RequestBody.create(MultipartBody.FORM, message.message == null ? "" : message.message);
|
||||
|
||||
mChatService.sendFile(groupIdBody, body, textBody)
|
||||
.compose(RxUtils.provideDefaultTransformer())
|
||||
|
||||
@@ -35,12 +35,11 @@ class GroupChatAdapter extends BaseChatAdapter {
|
||||
return new DateViewHolder(view);
|
||||
}
|
||||
ProgressBar progressBar = new ProgressBar(parent.getContext());
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
params.gravity = Gravity.CENTER;
|
||||
params.setMargins(0, (int) parent.getContext().getResources().getDimension(R.dimen.messages_progress_top_margin), 0, 0);
|
||||
progressBar.setLayoutParams(params);
|
||||
ViewUtils.setProgressBarColorToOrange(progressBar);
|
||||
ViewUtils.setProgressBarColor(progressBar, R.color.colorWhite);
|
||||
return new ProgressViewHolder(progressBar);
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ class GroupChatAdapter extends BaseChatAdapter {
|
||||
rightMessageViewHolder.statusImageView.setImageResource(R.drawable.failed);
|
||||
rightMessageViewHolder.sendingFailedTextView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ViewUtils.setProgressBarColorToOrange(rightMessageViewHolder.statusProgressBar);
|
||||
ViewUtils.setProgressBarColor(rightMessageViewHolder.statusProgressBar, R.color.colorWhite);
|
||||
rightMessageViewHolder.statusProgressBar.setVisibility(View.VISIBLE);
|
||||
rightMessageViewHolder.sendingFailedTextView.setVisibility(View.GONE);
|
||||
rightMessageViewHolder.statusImageView.setVisibility(View.GONE);
|
||||
|
||||
@@ -40,7 +40,7 @@ class SingleChatAdapter extends BaseChatAdapter {
|
||||
params.gravity = Gravity.CENTER;
|
||||
params.setMargins(0, (int) parent.getContext().getResources().getDimension(R.dimen.messages_progress_top_margin), 0, 0);
|
||||
progressBar.setLayoutParams(params);
|
||||
ViewUtils.setProgressBarColorToOrange(progressBar);
|
||||
ViewUtils.setProgressBarColor(progressBar, R.color.colorWhite);
|
||||
return new ProgressViewHolder(progressBar);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class SingleChatAdapter extends BaseChatAdapter {
|
||||
rightChatHolder.statusImageView.setImageResource(R.drawable.failed);
|
||||
rightChatHolder.sendingFailedTextView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ViewUtils.setProgressBarColorToOrange(rightChatHolder.statusProgressBar);
|
||||
ViewUtils.setProgressBarColor(rightChatHolder.statusProgressBar, R.color.colorWhite);
|
||||
rightChatHolder.statusProgressBar.setVisibility(View.VISIBLE);
|
||||
rightChatHolder.sendingFailedTextView.setVisibility(View.GONE);
|
||||
rightChatHolder.statusImageView.setVisibility(View.GONE);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 MiB |
@@ -74,7 +74,7 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:visibility="gone"
|
||||
custom:donut_finished_color="@color/colorDefault"
|
||||
custom:donut_finished_color="@color/colorWhite"
|
||||
custom:donut_text_color="@color/colorBlack" />
|
||||
|
||||
<hani.momanii.supernova_emoji_library.Helper.EmojiconTextView
|
||||
|
||||
@@ -54,10 +54,10 @@
|
||||
android:layout_height="15dp"
|
||||
android:layout_alignBottom="@+id/chat_item_time"
|
||||
android:layout_alignTop="@+id/chat_item_time"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_toLeftOf="@+id/chat_item_time"
|
||||
android:layout_toStartOf="@+id/chat_item_time"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@+id/chat_item_time"
|
||||
android:layout_toRightOf="@+id/chat_item_time"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
@@ -122,10 +122,9 @@
|
||||
android:layout_below="@id/chat_item_time"
|
||||
android:layout_marginTop="4dp"
|
||||
android:visibility="gone"
|
||||
custom:donut_finished_color="@color/colorDefault"
|
||||
custom:donut_text_color="@color/colorBlack" />
|
||||
custom:donut_finished_color="@color/colorWhite"
|
||||
custom:donut_text_color="@color/colorWhite" />
|
||||
|
||||
<!-- TODO: change link color! -> in styles->BaseChatItemText -->
|
||||
<hani.momanii.supernova_emoji_library.Helper.EmojiconTextView
|
||||
android:id="@+id/chat_item_message"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
android:layout_below="@id/chat_item_time"
|
||||
android:layout_marginTop="4dp"
|
||||
android:visibility="gone"
|
||||
custom:donut_finished_color="@color/colorDefault"
|
||||
custom:donut_finished_color="@color/colorWhite"
|
||||
custom:donut_text_color="@color/colorBlack" />
|
||||
|
||||
<hani.momanii.supernova_emoji_library.Helper.EmojiconTextView
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone"
|
||||
tools:ignore="SmallSp"
|
||||
tools:visibility="gone" />
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/chat_item_message_status_progress_bar"
|
||||
@@ -42,11 +42,12 @@
|
||||
android:layout_height="15dp"
|
||||
android:layout_alignBottom="@+id/chat_item_time"
|
||||
android:layout_alignTop="@+id/chat_item_time"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_toLeftOf="@+id/chat_item_time"
|
||||
android:layout_toStartOf="@+id/chat_item_time"
|
||||
android:visibility="gone" />
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@+id/chat_item_time"
|
||||
android:layout_toRightOf="@+id/chat_item_time"
|
||||
android:visibility="visible"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chat_item_message_status"
|
||||
@@ -61,7 +62,7 @@
|
||||
android:layout_toEndOf="@+id/chat_item_time"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -99,8 +100,9 @@
|
||||
android:layout_below="@id/chat_item_time"
|
||||
android:layout_marginTop="4dp"
|
||||
android:visibility="gone"
|
||||
custom:donut_finished_color="@color/colorDefault"
|
||||
custom:donut_text_color="@color/colorBlack" />
|
||||
custom:donut_finished_color="@color/colorWhite"
|
||||
custom:donut_text_color="@color/colorWhite"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chat_item_file_name"
|
||||
@@ -111,7 +113,8 @@
|
||||
android:layout_below="@+id/chat_item_time"
|
||||
android:layout_marginTop="95dp"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<hani.momanii.supernova_emoji_library.Helper.EmojiconTextView
|
||||
android:id="@+id/chat_item_message"
|
||||
@@ -125,7 +128,7 @@
|
||||
style="@style/BaseChatItemText"
|
||||
android:textColor="@color/colorWhite"
|
||||
tools:text="Meine Freundin, die Maschine. Als sie mein Herz für sich gewann. Mit ihren ganzen kleinen Geschwistern, mit denen man alles machen kann."
|
||||
tools:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<resources>
|
||||
<color name="colorPrimary">#ffffff</color>
|
||||
<color name="colorPrimaryDark">#E0E0E0</color>
|
||||
<color name="colorAccent">#FFFFFF</color>
|
||||
<color name="colorAccent">#ffffff</color>
|
||||
<color name="colorBackground">#F3F3F3</color>
|
||||
<color name="colorBlack">#000000</color>
|
||||
<color name="colorWhite">#FFFFFF</color>
|
||||
<color name="colorWhite">#ffffff</color>
|
||||
<color name="colorDefault">#FFFF5E00</color>
|
||||
<color name="colorDefaultBright">#B3FF5E00</color>
|
||||
<color name="colorDivider">#4D000000</color>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<!-- Chat -->
|
||||
<string name="chat_type_your_message">Nachricht eingeben</string>
|
||||
<string name="chat_item_sending_failed">Fehler, bitte erneut versuchen</string>
|
||||
<string name="chat_item_sending_failed">Fehler, hier tippen für erneuten Versuch</string>
|
||||
<string name="chat_select_file">Datei auswählen</string>
|
||||
<string name="chat_no_messages">Keine Nachricht empfangen oder gesendet.</string>
|
||||
<string name="chat_me">Ich | %s</string>
|
||||
|
||||
@@ -74,11 +74,12 @@
|
||||
<item name="colorControlHighlight">@color/colorImpressum</item>
|
||||
</style>
|
||||
|
||||
<!-- List title style --><style name="AppTheme.ListTitle">
|
||||
<item name="android:textSize">@dimen/item_contact_title_text_size</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">@color/colorBlack</item>
|
||||
</style>
|
||||
<!-- List title style -->
|
||||
<style name="AppTheme.ListTitle">
|
||||
<item name="android:textSize">@dimen/item_contact_title_text_size</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">@color/colorBlack</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.ListSubtitle">
|
||||
<item name="android:textSize">@dimen/item_contact_subtitle_text_size</item>
|
||||
|
||||
Reference in New Issue
Block a user