From 3fde7dbba936742c0b6e78eef59ee5d3c8b60117 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Thu, 28 Feb 2019 21:55:44 +0100 Subject: [PATCH] Remove emoji buttons --- Habitica/res/layout/activity_task_form.xml | 32 +---- .../res/layout/tavern_chat_new_entry_item.xml | 11 -- .../ui/activities/TaskFormActivity.kt | 122 +----------------- .../habitica/ui/views/social/ChatBarView.kt | 71 ---------- fastlane/changelog.txt | 4 +- 5 files changed, 6 insertions(+), 234 deletions(-) diff --git a/Habitica/res/layout/activity_task_form.xml b/Habitica/res/layout/activity_task_form.xml index 3906a5c99..39cc75d2d 100644 --- a/Habitica/res/layout/activity_task_form.xml +++ b/Habitica/res/layout/activity_task_form.xml @@ -18,26 +18,12 @@ android:layout_marginTop="@dimen/abc_action_bar_content_inset_material" android:orientation="vertical"> - - - - - - - - - - - (R.id.emoji_toggle_btn2) as? ImageButton - } else { - emojiToggle0 - } - - // if showChecklist is inactive the wrapper is wrapper, so the reference can't be found - if (emojiToggle2 == null) { - emojiToggle2 = emojiToggle0 - } - - popup?.setSizeForSoftKeyboard() - popup?.setOnDismissListener { changeEmojiKeyboardIcon(false) } - popup?.setOnSoftKeyboardOpenCloseListener(object : EmojiPopup.OnSoftKeyboardOpenCloseListener { - - override fun onKeyboardOpen(keyBoardHeight: Int) { - - } - - override fun onKeyboardClose() { - if (popup?.isShowing == true) { - popup?.dismiss() - } - } - }) - - popup?.setOnEmojiconClickedListener { emojicon -> - if (currentFocus == null || !isEmojiEditText(currentFocus) || emojicon == null) { - return@setOnEmojiconClickedListener - } - val emojiEditText = currentFocus as? EmojiEditText - val start = emojiEditText?.selectionStart ?: 0 - val end = emojiEditText?.selectionEnd ?: 0 - if (start < 0) { - emojiEditText?.append(emojicon.emoji) - } else { - emojiEditText?.text?.replace(Math.min(start, end), - Math.max(start, end), emojicon.emoji, 0, - emojicon.emoji.length) - } - } - - popup?.setOnEmojiconBackspaceClickedListener { - if (isEmojiEditText(currentFocus)) { - val event = KeyEvent( - 0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL) - currentFocus?.dispatchKeyEvent(event) - } - } - - emojiToggle0.setOnClickListener(EmojiClickListener(taskText)) - emojiToggle1.setOnClickListener(EmojiClickListener(taskNotes)) - if (isTodo) { - emojiToggle2?.setOnClickListener(EmojiClickListener(newCheckListEditText)) - } enableRepeatables() @@ -573,22 +498,6 @@ class TaskFormActivity : BaseActivity() { frequencyPicker.value = 1 } - private fun isEmojiEditText(view: View?): Boolean { - return view is EmojiEditText - } - - private fun changeEmojiKeyboardIcon(keyboardOpened: Boolean) { - if (keyboardOpened) { - emojiToggle0.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_keyboard_grey600_24dp)) - emojiToggle1.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_keyboard_grey600_24dp)) - emojiToggle2?.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_keyboard_grey600_24dp)) - } else { - emojiToggle0.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_emoticon_grey600_24dp)) - emojiToggle1.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_emoticon_grey600_24dp)) - emojiToggle2?.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_emoticon_grey600_24dp)) - } - } - private fun createCheckListRecyclerView() { checklistAdapter = CheckListAdapter() @@ -1020,8 +929,6 @@ class TaskFormActivity : BaseActivity() { if (currentFocus != null) { imm?.hideSoftInputFromWindow(currentFocus.windowToken, 0) } - popup?.dismiss() - popup = null } private inner class DateEditTextListener internal constructor(internal var datePickerText: EditText) : View.OnClickListener, DatePickerDialog.OnDateSetListener { @@ -1080,29 +987,6 @@ class TaskFormActivity : BaseActivity() { } } - private inner class EmojiClickListener internal constructor(internal var view: EmojiEditText) : View.OnClickListener { - - override fun onClick(v: View) { - if (popup?.isShowing == false) { - - if (popup?.isKeyBoardOpen == true) { - popup?.showAtBottom() - changeEmojiKeyboardIcon(true) - } else { - view.isFocusableInTouchMode = true - view.requestFocus() - popup?.showAtBottomPending() - val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager - inputMethodManager?.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT) - changeEmojiKeyboardIcon(true) - } - } else { - popup?.dismiss() - changeEmojiKeyboardIcon(false) - } - } - } - companion object { const val TASK_ID_KEY = "taskId" const val USER_ID_KEY = "userId" diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt index 66e6062e6..44a6628ab 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt @@ -5,10 +5,8 @@ import android.os.Build import android.text.Editable import android.text.TextWatcher import android.util.AttributeSet -import android.view.KeyEvent import android.view.LayoutInflater import android.view.View -import android.view.inputmethod.InputMethodManager import android.widget.* import androidx.core.content.ContextCompat import androidx.core.view.updateLayoutParams @@ -19,7 +17,6 @@ import com.habitrpg.android.habitica.ui.helpers.AutocompleteAdapter import com.habitrpg.android.habitica.ui.helpers.ChatInputTokenizer import com.habitrpg.android.habitica.ui.helpers.NavbarUtils import com.habitrpg.android.habitica.ui.helpers.bindView -import net.pherth.android.emoji_library.EmojiPopup import javax.inject.Inject @@ -32,11 +29,7 @@ class ChatBarView : FrameLayout { private val chatEditText: MultiAutoCompleteTextView by bindView(R.id.chatEditText) private val textIndicator: TextView by bindView(R.id.text_indicator) private val indicatorSpacing: View by bindView(R.id.indicator_spacing) - private val emojiButton: ImageButton by bindView(R.id.emojiButton) private val spacing: Space by bindView(R.id.spacing) - private val popup: EmojiPopup by lazy { - EmojiPopup(emojiButton.rootView, context, ContextCompat.getColor(context, R.color.brand)) - } private var navBarAccountedHeightCalculated = false internal var maxChatLength = 3000 @@ -83,40 +76,6 @@ class ChatBarView : FrameLayout { sendButton.setOnClickListener { sendButtonPressed() } - emojiButton.setOnClickListener(EmojiClickListener(chatEditText)) - - popup.setSizeForSoftKeyboard() - popup.setOnDismissListener { changeEmojiKeyboardIcon(false) } - popup.setOnSoftKeyboardOpenCloseListener(object : EmojiPopup.OnSoftKeyboardOpenCloseListener { - - override fun onKeyboardOpen(keyBoardHeight: Int) { - - } - - override fun onKeyboardClose() { - if (popup.isShowing) { - popup.dismiss() - } - } - }) - - popup.setOnEmojiconClickedListener { emojicon -> - val start = chatEditText.selectionStart - val end = chatEditText.selectionEnd - if (start < 0) { - chatEditText.append(emojicon.emoji) - } else { - chatEditText.text?.replace(Math.min(start, end), - Math.max(start, end), emojicon.emoji, 0, - emojicon.emoji.length) - } - } - - popup.setOnEmojiconBackspaceClickedListener { - val event = KeyEvent( - 0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL) - chatEditText.dispatchKeyEvent(event) - } resizeForDrawingUnderNavbar() autocompleteAdapter = AutocompleteAdapter(context, socialRepository, autocompleteContext, groupID) @@ -183,34 +142,4 @@ class ChatBarView : FrameLayout { sendAction?.invoke(chatText) } } - - private fun changeEmojiKeyboardIcon(keyboardOpened: Boolean) { - if (keyboardOpened) { - emojiButton.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_keyboard_grey600_24dp)) - } else { - emojiButton.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_emoticon_grey600_24dp)) - } - } - - private inner class EmojiClickListener internal constructor(internal var view: MultiAutoCompleteTextView) : View.OnClickListener { - - override fun onClick(v: View) { - if (!popup.isShowing) { - if (popup.isKeyBoardOpen == true) { - popup.showAtBottom() - changeEmojiKeyboardIcon(true) - } else { - view.isFocusableInTouchMode = true - view.requestFocus() - popup.showAtBottomPending() - val inputMethodManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager - inputMethodManager?.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT) - changeEmojiKeyboardIcon(true) - } - } else { - popup.dismiss() - changeEmojiKeyboardIcon(false) - } - } - } } diff --git a/fastlane/changelog.txt b/fastlane/changelog.txt index 18903d2bc..63c742acd 100644 --- a/fastlane/changelog.txt +++ b/fastlane/changelog.txt @@ -1,3 +1 @@ -This update brings a new navigation architecture, which is the groundwork for additional features like in-app linking and deep links. If there are any views that do not open correctly anymore or any new issues that seem releated to navigation, please let us know. - -This update also has a new way to load challenge data, so please test that the challenge list still displays. +This update brings username and emoji autocomplete, deep linking (open https://habitica.com urls from anywhere on your device with the app), bigger emojis and bugfixes.