Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-09-03 10:11:40 +02:00
parent 6bd36e408c
commit 4e76a5e83e
2 changed files with 62 additions and 1 deletions

View File

@ -22,6 +22,7 @@ package com.nextcloud.talk.controllers.bottomsheet;
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
@ -32,6 +33,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import autodagger.AutoInjector;
import butterknife.BindView;
@ -49,6 +52,13 @@ import com.nextcloud.talk.utils.ShareUtils;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.database.user.UserUtils;
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder;
import com.vanniktech.emoji.EmojiImageView;
import com.vanniktech.emoji.EmojiPopup;
import com.vanniktech.emoji.emoji.Emoji;
import com.vanniktech.emoji.listeners.OnEmojiClickListener;
import com.vanniktech.emoji.listeners.OnEmojiPopupDismissListener;
import com.vanniktech.emoji.listeners.OnEmojiPopupShownListener;
import org.greenrobot.eventbus.EventBus;
import org.parceler.Parcels;
@ -66,6 +76,9 @@ public class EntryMenuController extends BaseController {
@BindView(R.id.text_input_layout)
TextInputLayout textInputLayout;
@BindView(R.id.smileyButton)
ImageView smileyButton;
@Inject
EventBus eventBus;
@ -79,6 +92,9 @@ public class EntryMenuController extends BaseController {
private String name;
private String callUrl;
private EmojiPopup emojiPopup;
private Bundle originalBundle;
public EntryMenuController(Bundle args) {
@ -104,6 +120,11 @@ public class EntryMenuController extends BaseController {
return inflater.inflate(R.layout.controller_entry_menu, container, false);
}
@OnClick(R.id.smileyButton)
void onSmileyClick() {
emojiPopup.toggle();
}
@Override
protected void onAttach(@NonNull View view) {
super.onAttach(view);
@ -260,6 +281,30 @@ public class EntryMenuController extends BaseController {
case 2:
labelText = getResources().getString(R.string.nc_call_name);
editText.setInputType(InputType.TYPE_CLASS_TEXT);
smileyButton.setVisibility(View.VISIBLE);
emojiPopup = EmojiPopup.Builder.fromRootView(view).setOnEmojiPopupShownListener(new OnEmojiPopupShownListener() {
@Override
public void onEmojiPopupShown() {
if (getResources() != null) {
smileyButton.setColorFilter(getResources().getColor(R.color.colorPrimary),
PorterDuff.Mode.SRC_IN);
}
}
}).setOnEmojiPopupDismissListener(new OnEmojiPopupDismissListener() {
@Override
public void onEmojiPopupDismiss() {
if (smileyButton != null) {
smileyButton.setColorFilter(getResources().getColor(R.color.emoji_icons),
PorterDuff.Mode.SRC_IN);
}
}
}).setOnEmojiClickListener(new OnEmojiClickListener() {
@Override
public void onEmojiClick(@NonNull EmojiImageView emoji, @NonNull Emoji imageView) {
editText.getEditableText().append(" ");
}
}).build(editText);
break;
case 4:
labelText = getResources().getString(R.string.nc_new_password);

View File

@ -44,7 +44,11 @@
android:id="@+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginEnd="8dp"
android:layout_toStartOf="@id/smileyButton"
app:errorTextAppearance="@style/ErrorAppearance"
app:helperText=""
app:passwordToggleDrawable="@drawable/asl_password_visibility"
@ -61,4 +65,16 @@
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/smileyButton"
android:layout_width="36dp"
android:visibility="gone"
android:layout_height="36dp"
android:layout_marginEnd="8dp"
android:layout_alignBottom="@id/text_input_layout"
android:layout_alignParentEnd="true"
android:background="@color/transparent"
android:src="@drawable/ic_insert_emoticon_black_24dp"
android:tint="@color/emoji_icons" />
</RelativeLayout>