From fd41917ec049cd01148428c42bcbaf1f7c7a8189 Mon Sep 17 00:00:00 2001 From: oogee Date: Mon, 21 Jan 2019 22:30:19 +0200 Subject: [PATCH] init pm activity --- app/build.gradle | 3 +- app/src/main/AndroidManifest.xml | 1 + .../create_pm/CreatePMActivity.java | 63 +++++++++++++++++++ .../create_topic/CreateTopicActivity.java | 2 +- .../main/res/layout/activity_create_pm.xml | 56 +++++++++++++++++ ..._content.xml => activity_create_topic.xml} | 0 6 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java create mode 100644 app/src/main/res/layout/activity_create_pm.xml rename app/src/main/res/layout/{activity_create_content.xml => activity_create_topic.xml} (100%) diff --git a/app/build.gradle b/app/build.gradle index 12853e57..f5dd36bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -89,7 +89,8 @@ dependencies { implementation 'ru.noties:markwon:2.0.0' implementation 'net.gotev:uploadservice:3.4.2' implementation 'net.gotev:uploadservice-okhttp:3.4.2' - implementation 'com.itkacher.okhttpprofiler:okhttpprofiler:1.0.4' //Plugin: https://plugins.jetbrains.com/plugin/11249-okhttp-profiler + implementation 'com.itkacher.okhttpprofiler:okhttpprofiler:1.0.4' + //Plugin: https://plugins.jetbrains.com/plugin/11249-okhttp-profiler } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1640d0d2..28662173 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -173,6 +173,7 @@ android:name="android.support.PARENT_ACTIVITY" android:value=".activities.main.MainActivity" /> + \ No newline at end of file diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java new file mode 100644 index 00000000..54eec9ea --- /dev/null +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java @@ -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(); + } + } + + +} diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java index 4bc6efe3..ec661962 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java @@ -33,7 +33,7 @@ public class CreateTopicActivity extends BaseActivity implements NewTopicTask.Ne @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_create_content); + setContentView(R.layout.activity_create_topic); //Initialize toolbar toolbar = findViewById(R.id.toolbar); diff --git a/app/src/main/res/layout/activity_create_pm.xml b/app/src/main/res/layout/activity_create_pm.xml new file mode 100644 index 00000000..f0405463 --- /dev/null +++ b/app/src/main/res/layout/activity_create_pm.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_create_content.xml b/app/src/main/res/layout/activity_create_topic.xml similarity index 100% rename from app/src/main/res/layout/activity_create_content.xml rename to app/src/main/res/layout/activity_create_topic.xml