mirror of https://github.com/ThmmyNoLife/mTHMMY
Thodoris1999
6 years ago
4 changed files with 114 additions and 28 deletions
@ -0,0 +1,56 @@ |
|||||
|
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.editorview.EditorView; |
||||
|
import gr.thmmy.mthmmy.editorview.EmojiKeyboard; |
||||
|
|
||||
|
public class CreateContentActivity extends AppCompatActivity implements EmojiKeyboard.EmojiKeyboardOwner { |
||||
|
|
||||
|
EditorView contentEditor; |
||||
|
EmojiKeyboard emojiKeyboard; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_create_content); |
||||
|
|
||||
|
emojiKeyboard = findViewById(R.id.emoji_keyboard); |
||||
|
|
||||
|
contentEditor = findViewById(R.id.main_content_editorview); |
||||
|
setEmojiKeyboardInputConnection(contentEditor.getInputConnection()); |
||||
|
contentEditor.setEmojiKeyboardOwner(this); |
||||
|
contentEditor.setOnSubmitListener(v -> { |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@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); |
||||
|
contentEditor.updateEmojiKeyboardVisibility(); |
||||
|
} else { |
||||
|
super.onBackPressed(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RelativeLayout |
||||
|
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
tools:context=".activities.CreateContentActivity"> |
||||
|
|
||||
|
<android.support.design.widget.TextInputLayout |
||||
|
android:id="@+id/subject_input" |
||||
|
android:layout_width="240dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:hint="@string/subject"> |
||||
|
<android.support.design.widget.TextInputEditText |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" /> |
||||
|
</android.support.design.widget.TextInputLayout> |
||||
|
|
||||
|
<gr.thmmy.mthmmy.editorview.EditorView |
||||
|
android:id="@+id/main_content_editorview" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@id/subject_input"/> |
||||
|
|
||||
|
<gr.thmmy.mthmmy.editorview.EmojiKeyboard |
||||
|
android:id="@+id/emoji_keyboard" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_alignParentBottom="true" |
||||
|
android:visibility="gone"/> |
||||
|
|
||||
|
</RelativeLayout> |
Loading…
Reference in new issue