Browse Source

fix

pull/61/merge
Thodoris1999 6 years ago
parent
commit
7d517fd8ed
  1. 25
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java
  2. 1
      app/src/main/res/layout/activity_downloads.xml

25
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java

@ -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);
}
} }

1
app/src/main/res/layout/activity_downloads.xml

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"

Loading…
Cancel
Save