mirror of https://github.com/ThmmyNoLife/mTHMMY
oogee
6 years ago
6 changed files with 123 additions and 2 deletions
@ -0,0 +1,63 @@ |
|||||
|
package gr.thmmy.mthmmy.activities.create_pm; |
||||
|
|
||||
|
import android.os.Bundle; |
||||
|
import android.text.InputType; |
||||
|
import android.view.View; |
||||
|
import android.view.inputmethod.EditorInfo; |
||||
|
|
||||
|
import com.google.android.material.textfield.TextInputLayout; |
||||
|
|
||||
|
import gr.thmmy.mthmmy.R; |
||||
|
import gr.thmmy.mthmmy.base.BaseActivity; |
||||
|
import gr.thmmy.mthmmy.editorview.EditorView; |
||||
|
import gr.thmmy.mthmmy.editorview.EmojiKeyboard; |
||||
|
import me.zhanghai.android.materialprogressbar.MaterialProgressBar; |
||||
|
|
||||
|
public class CreatePMActivity extends BaseActivity { |
||||
|
|
||||
|
private MaterialProgressBar progressBar; |
||||
|
private EditorView contentEditor; |
||||
|
private TextInputLayout subjectInput; |
||||
|
private EmojiKeyboard emojiKeyboard; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_create_pm); |
||||
|
|
||||
|
//Initialize toolbar
|
||||
|
toolbar = findViewById(R.id.toolbar); |
||||
|
toolbar.setTitle("Create topic"); |
||||
|
setSupportActionBar(toolbar); |
||||
|
if (getSupportActionBar() != null) { |
||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
||||
|
getSupportActionBar().setDisplayShowHomeEnabled(true); |
||||
|
} |
||||
|
|
||||
|
progressBar = findViewById(R.id.progressBar); |
||||
|
|
||||
|
emojiKeyboard = findViewById(R.id.emoji_keyboard); |
||||
|
|
||||
|
subjectInput = findViewById(R.id.subject_input); |
||||
|
subjectInput.getEditText().setRawInputType(InputType.TYPE_CLASS_TEXT); |
||||
|
subjectInput.getEditText().setImeOptions(EditorInfo.IME_ACTION_DONE); |
||||
|
|
||||
|
contentEditor = findViewById(R.id.main_content_editorview); |
||||
|
contentEditor.setEmojiKeyboard(emojiKeyboard); |
||||
|
emojiKeyboard.registerEmojiInputField(contentEditor); |
||||
|
contentEditor.setOnSubmitListener(v -> { |
||||
|
// TODO: send pm
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onBackPressed() { |
||||
|
if (emojiKeyboard.getVisibility() == View.VISIBLE) { |
||||
|
emojiKeyboard.setVisibility(View.GONE); |
||||
|
} else { |
||||
|
super.onBackPressed(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout 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" |
||||
|
android:fitsSystemWindows="true" |
||||
|
tools:context=".activities.create_pm.CreatePMActivity"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent"> |
||||
|
|
||||
|
<com.google.android.material.appbar.AppBarLayout |
||||
|
android:id="@+id/appbar" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:paddingTop="@dimen/appbar_padding_top" |
||||
|
android:theme="@style/ToolbarTheme"> |
||||
|
|
||||
|
<androidx.appcompat.widget.Toolbar |
||||
|
android:id="@+id/toolbar" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="?attr/actionBarSize" |
||||
|
android:background="?attr/colorPrimary" |
||||
|
android:gravity="center" |
||||
|
app:popupTheme="@style/ToolbarTheme"></androidx.appcompat.widget.Toolbar> |
||||
|
</com.google.android.material.appbar.AppBarLayout> |
||||
|
|
||||
|
<include |
||||
|
layout="@layout/full_post_editor" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@id/appbar" /> |
||||
|
|
||||
|
<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> |
||||
|
|
||||
|
<me.zhanghai.android.materialprogressbar.MaterialProgressBar |
||||
|
android:id="@+id/progressBar" |
||||
|
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="@dimen/progress_bar_height" |
||||
|
android:indeterminate="true" |
||||
|
android:visibility="invisible" |
||||
|
app:layout_anchor="@id/appbar" |
||||
|
app:layout_anchorGravity="bottom|center" |
||||
|
app:mpb_indeterminateTint="@color/accent" |
||||
|
app:mpb_progressStyle="horizontal" /> |
||||
|
|
||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
Loading…
Reference in new issue