Attempts at fixing things

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-06 22:31:23 +02:00
parent df8439fe34
commit 5914ecb099
3 changed files with 23 additions and 22 deletions

View file

@ -126,11 +126,11 @@ public class ChatController extends BaseController implements MessagesListAdapte
@Inject
Cache cache;
@BindView(R.id.messagesList)
MessagesList messagesList;
@BindView(R.id.nc_message_input)
MessageInput messageInput;
@BindView(R.id.nc_popup_bubble)
@BindView(R.id.messagesListView)
MessagesList messagesListView;
@BindView(R.id.messageInputView)
MessageInput messageInputView;
@BindView(R.id.popupBubbleView)
PopupBubble popupBubble;
private List<Disposable> disposableList = new ArrayList<>();
private String conversationName;
@ -297,14 +297,14 @@ public class ChatController extends BaseController implements MessagesListAdapte
}
messagesList.setAdapter(adapter);
messagesListView.setAdapter(adapter);
adapter.setLoadMoreListener(this);
adapter.setDateHeadersFormatter(this::format);
adapter.setOnMessageLongClickListener(this);
layoutManager = (LinearLayoutManager) messagesList.getLayoutManager();
layoutManager = (LinearLayoutManager) messagesListView.getLayoutManager();
popupBubble.setRecyclerView(messagesList);
popupBubble.setRecyclerView(messagesListView);
popupBubble.setPopupBubbleListener(context -> {
if (newMessagesCount != 0) {
@ -314,11 +314,11 @@ public class ChatController extends BaseController implements MessagesListAdapte
} else {
scrollPosition = newMessagesCount - 1;
}
new Handler().postDelayed(() -> messagesList.smoothScrollToPosition(scrollPosition), 200);
new Handler().postDelayed(() -> messagesListView.smoothScrollToPosition(scrollPosition), 200);
}
});
messagesList.addOnScrollListener(new RecyclerView.OnScrollListener() {
messagesListView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
@ -338,8 +338,8 @@ public class ChatController extends BaseController implements MessagesListAdapte
});
messageInput.getInputEditText().setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
messageInput.setInputListener(input -> {
messageInputView.getInputEditText().setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
messageInputView.setInputListener(input -> {
sendMessage(input.toString(), 1);
return true;
});
@ -359,8 +359,8 @@ public class ChatController extends BaseController implements MessagesListAdapte
AutocompletePresenter<Mention> presenter = new MentionAutocompletePresenter(getApplicationContext(), roomToken);
AutocompleteCallback<Mention> callback = new MentionAutocompleteCallback();
if (messageInput != null && messageInput.getInputEditText() != null) {
mentionAutocomplete = Autocomplete.<Mention>on(messageInput.getInputEditText())
if (messageInputView != null && messageInputView.getInputEditText() != null) {
mentionAutocomplete = Autocomplete.<Mention>on(messageInputView.getInputEditText())
.with(elevation)
.with(backgroundDrawable)
.with(new CharPolicy('@'))
@ -543,8 +543,8 @@ public class ChatController extends BaseController implements MessagesListAdapte
popupBubble.hide();
}
if (messagesList != null) {
messagesList.smoothScrollToPosition(0);
if (messagesListView != null) {
messagesListView.smoothScrollToPosition(0);
}
}
@ -559,7 +559,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
popupBubble.hide();
}
messagesList.smoothScrollToPosition(0);
messagesListView.smoothScrollToPosition(0);
} else {
sendMessage(message, attempt + 1);
}

View file

@ -25,10 +25,10 @@
android:layout_height="match_parent">
<com.stfalcon.chatkit.messages.MessagesList
android:id="@+id/messagesList"
android:id="@+id/messagesListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/nc_message_input"
android:layout_above="@+id/messageInputView"
app:incomingDefaultBubbleColor="@color/white_two"
app:incomingDefaultBubblePressedColor="@color/white_two"
app:incomingDefaultBubbleSelectedColor="@color/colorPrimaryDark"
@ -47,7 +47,7 @@
app:textAutoLink="all"/>
<com.webianks.library.PopupBubble
android:id="@+id/nc_popup_bubble"
android:id="@+id/popupBubbleView"
android:layout_margin="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -63,13 +63,13 @@
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="@+id/nc_message_input"
android:layout_above="@+id/messageInputView"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/nc_light_grey"/>
<com.stfalcon.chatkit.messages.MessageInput
android:id="@+id/nc_message_input"
android:id="@+id/messageInputView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"

View file

@ -12,6 +12,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files