|
@ -8,7 +8,6 @@ import android.view.MenuInflater; |
|
|
import android.view.MenuItem; |
|
|
import android.view.MenuItem; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.inputmethod.InputConnection; |
|
|
|
|
|
import android.view.inputmethod.InputMethodManager; |
|
|
import android.view.inputmethod.InputMethodManager; |
|
|
import android.widget.Toast; |
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
@ -29,7 +28,7 @@ import gr.thmmy.mthmmy.viewmodel.ShoutboxViewModel; |
|
|
import me.zhanghai.android.materialprogressbar.MaterialProgressBar; |
|
|
import me.zhanghai.android.materialprogressbar.MaterialProgressBar; |
|
|
import timber.log.Timber; |
|
|
import timber.log.Timber; |
|
|
|
|
|
|
|
|
public class ShoutboxFragment extends Fragment implements EmojiKeyboard.EmojiKeyboardOwner { |
|
|
public class ShoutboxFragment extends Fragment { |
|
|
|
|
|
|
|
|
private MaterialProgressBar progressBar; |
|
|
private MaterialProgressBar progressBar; |
|
|
private ShoutboxTask shoutboxTask; |
|
|
private ShoutboxTask shoutboxTask; |
|
@ -66,9 +65,8 @@ public class ShoutboxFragment extends Fragment implements EmojiKeyboard.EmojiKey |
|
|
|
|
|
|
|
|
emojiKeyboard = rootView.findViewById(R.id.emoji_keyboard); |
|
|
emojiKeyboard = rootView.findViewById(R.id.emoji_keyboard); |
|
|
editorView = rootView.findViewById(R.id.edior_view); |
|
|
editorView = rootView.findViewById(R.id.edior_view); |
|
|
editorView.setEmojiKeyboardOwner(this); |
|
|
editorView.setEmojiKeyboard(emojiKeyboard); |
|
|
InputConnection ic = editorView.getInputConnection(); |
|
|
emojiKeyboard.registerEmojiInputField(editorView); |
|
|
setEmojiKeyboardInputConnection(ic); |
|
|
|
|
|
editorView.setOnSubmitListener(view -> { |
|
|
editorView.setOnSubmitListener(view -> { |
|
|
if (shoutboxViewModel.getShoutboxMutableLiveData().getValue() == null) return; |
|
|
if (shoutboxViewModel.getShoutboxMutableLiveData().getValue() == null) return; |
|
|
if (editorView.getText().toString().isEmpty()) { |
|
|
if (editorView.getText().toString().isEmpty()) { |
|
@ -131,7 +129,7 @@ public class ShoutboxFragment extends Fragment implements EmojiKeyboard.EmojiKey |
|
|
Timber.i("Start sending a shout..."); |
|
|
Timber.i("Start sending a shout..."); |
|
|
editorView.setAlpha(0.5f); |
|
|
editorView.setAlpha(0.5f); |
|
|
editorView.setEnabled(false); |
|
|
editorView.setEnabled(false); |
|
|
setEmojiKeyboardVisible(false); |
|
|
emojiKeyboard.setVisibility(View.VISIBLE); |
|
|
progressBar.setVisibility(View.VISIBLE); |
|
|
progressBar.setVisibility(View.VISIBLE); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -164,19 +162,4 @@ public class ShoutboxFragment extends Fragment implements EmojiKeyboard.EmojiKey |
|
|
Toast.makeText(getContext(), "Failed to retrieve shoutbox, please contact mthmmy developer team", Toast.LENGTH_LONG).show(); |
|
|
Toast.makeText(getContext(), "Failed to retrieve shoutbox, please contact mthmmy developer team", Toast.LENGTH_LONG).show(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|