mirror of https://github.com/ThmmyNoLife/mTHMMY
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
package gr.thmmy.mthmmy.activities;
|
|
|
|
import android.os.Bundle;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.view.View;
|
|
import android.view.inputmethod.InputConnection;
|
|
|
|
import gr.thmmy.mthmmy.R;
|
|
import gr.thmmy.mthmmy.utils.EditorView;
|
|
import gr.thmmy.mthmmy.utils.EmojiKeyboard;
|
|
|
|
public class TestEditView extends AppCompatActivity implements EmojiKeyboard.EmojiKeyboardOwner {
|
|
EmojiKeyboard emojiKeyboard;
|
|
EditorView editorView;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_test_edit_view);
|
|
|
|
editorView = findViewById(R.id.editor_view);
|
|
emojiKeyboard = findViewById(R.id.emoji_keyboard);
|
|
|
|
InputConnection ic = editorView.getInputConnection();
|
|
setEmojiKeyboardInputConnection(ic);
|
|
editorView.setEmojiKeyboardOwner(this);
|
|
}
|
|
|
|
@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);
|
|
}
|
|
|
|
@Override
|
|
public void onBackPressed() {
|
|
if (emojiKeyboard.getVisibility() == View.VISIBLE) {
|
|
emojiKeyboard.setVisibility(View.GONE);
|
|
editorView.updateEmojiKeyboardVisibility();
|
|
} else {
|
|
super.onBackPressed();
|
|
}
|
|
}
|
|
}
|
|
|