Browse Source

adjust create content activity

pull/61/merge
Thodoris1999 6 years ago
parent
commit
67d53dca46
  1. 11
      app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java

11
app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java

@ -6,6 +6,7 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.TextInputLayout; import android.support.design.widget.TextInputLayout;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.Toast; import android.widget.Toast;
@ -55,14 +56,24 @@ public class CreateContentActivity extends BaseActivity implements NewTopicTask.
contentEditor = findViewById(R.id.main_content_editorview); contentEditor = findViewById(R.id.main_content_editorview);
contentEditor.setEmojiKeyboard(emojiKeyboard); contentEditor.setEmojiKeyboard(emojiKeyboard);
emojiKeyboard.registerEmojiInputField(contentEditor);
contentEditor.setOnSubmitListener(v -> { contentEditor.setOnSubmitListener(v -> {
if (newTopicUrl != null) { if (newTopicUrl != null) {
if (TextUtils.isEmpty(subjectInput.getEditText().getText())) {
subjectInput.setError("Required");
return;
}
if (TextUtils.isEmpty(contentEditor.getText())) {
contentEditor.setError("Required");
return;
}
boolean includeAppSignature = true; boolean includeAppSignature = true;
SessionManager sessionManager = BaseActivity.getSessionManager(); SessionManager sessionManager = BaseActivity.getSessionManager();
if (sessionManager.isLoggedIn()) { if (sessionManager.isLoggedIn()) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
includeAppSignature = prefs.getBoolean(SettingsActivity.POSTING_APP_SIGNATURE_ENABLE_KEY, true); includeAppSignature = prefs.getBoolean(SettingsActivity.POSTING_APP_SIGNATURE_ENABLE_KEY, true);
} }
emojiKeyboard.setVisibility(View.GONE);
new NewTopicTask(this, includeAppSignature).execute(newTopicUrl, subjectInput.getEditText().getText().toString(), new NewTopicTask(this, includeAppSignature).execute(newTopicUrl, subjectInput.getEditText().getText().toString(),
contentEditor.getText().toString()); contentEditor.getText().toString());

Loading…
Cancel
Save