diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutboxFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutboxFragment.java index 8b4180a8..9fb805ac 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutboxFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutboxFragment.java @@ -4,6 +4,8 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; import java.util.ArrayList; @@ -13,12 +15,14 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.base.BaseFragment; +import gr.thmmy.mthmmy.editorview.EditorView; +import gr.thmmy.mthmmy.editorview.EmojiKeyboard; import gr.thmmy.mthmmy.model.Shout; import gr.thmmy.mthmmy.utils.CustomRecyclerView; import gr.thmmy.mthmmy.utils.NetworkResultCodes; import me.zhanghai.android.materialprogressbar.MaterialProgressBar; -public class ShoutboxFragment extends BaseFragment { +public class ShoutboxFragment extends BaseFragment implements EmojiKeyboard.EmojiKeyboardOwner { private static final String TAG = "ShoutboxFragment"; @@ -27,6 +31,8 @@ public class ShoutboxFragment extends BaseFragment { private ShoutAdapter shoutAdapter; private SwipeRefreshLayout swipeRefreshLayout; private ArrayList shouts; + private EmojiKeyboard emojiKeyboard; + private EditorView editorView; public static ShoutboxFragment newInstance(int sectionNumber) { ShoutboxFragment fragment = new ShoutboxFragment(); @@ -74,6 +80,27 @@ public class ShoutboxFragment extends BaseFragment { shoutboxTask.execute("https://www.thmmy.gr/smf/index.php?"); }); + emojiKeyboard = rootView.findViewById(R.id.emoji_keyboard); + editorView = rootView.findViewById(R.id.edior_view); + editorView.setEmojiKeyboardOwner(this); + InputConnection ic = editorView.onCreateInputConnection(new EditorInfo()); + setEmojiKeyboardInputConnection(ic); + return rootView; } + + @Override + public void setEmojiKeyboardVisible(boolean visible) { + emojiKeyboard.setVisibility(visible ? View.VISIBLE : View.GONE); + } + + @Override + public boolean isEmojiKeyboardVisible() { + return emojiKeyboard.getVisibility() == View.VISIBLE; + } + + @Override + public void setEmojiKeyboardInputConnection(InputConnection ic) { + emojiKeyboard.setInputConnection(ic); + } } diff --git a/app/src/main/res/layout/fragment_shoutbox.xml b/app/src/main/res/layout/fragment_shoutbox.xml index 04b21df5..1c602602 100644 --- a/app/src/main/res/layout/fragment_shoutbox.xml +++ b/app/src/main/res/layout/fragment_shoutbox.xml @@ -1,17 +1,17 @@ - + android:layout_height="match_parent" + android:orientation="vertical"> + android:layout_height="0dp" + android:layout_weight="1"> - + @@ -34,6 +35,13 @@ android:id="@+id/edior_view" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/swiperefresh"/> + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp"/> - \ No newline at end of file + + + \ No newline at end of file