Add basic input edit text

This commit is contained in:
Niels Andriesse 2021-06-15 14:55:57 +10:00
parent bb5f8e007d
commit e06a3271df
5 changed files with 28 additions and 14 deletions

View File

@ -2,16 +2,15 @@ package org.thoughtcrime.securesms.conversation.v2
import android.database.Cursor import android.database.Cursor
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.ActionMode import android.view.ActionMode
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import androidx.loader.app.LoaderManager import androidx.loader.app.LoaderManager
import androidx.loader.content.Loader import androidx.loader.content.Loader
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.activity_conversation_v2.* import kotlinx.android.synthetic.main.activity_conversation_v2.*
import kotlinx.android.synthetic.main.activity_conversation_v2_action_bar.* import kotlinx.android.synthetic.main.activity_conversation_v2_action_bar.*
import kotlinx.android.synthetic.main.view_input_bar.view.*
import network.loki.messenger.R import network.loki.messenger.R
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.conversation.v2.menus.ConversationActionModeCallback import org.thoughtcrime.securesms.conversation.v2.menus.ConversationActionModeCallback
@ -64,7 +63,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
setContentView(R.layout.activity_conversation_v2) setContentView(R.layout.activity_conversation_v2)
threadID = intent.getLongExtra(THREAD_ID, -1) threadID = intent.getLongExtra(THREAD_ID, -1)
setUpRecyclerView() setUpRecyclerView()
setUpToolbar() setUpToolBar()
setUpInputBar()
} }
private fun setUpRecyclerView() { private fun setUpRecyclerView() {
@ -88,7 +88,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
}) })
} }
private fun setUpToolbar() { private fun setUpToolBar() {
val actionBar = supportActionBar!! val actionBar = supportActionBar!!
actionBar.setCustomView(R.layout.activity_conversation_v2_action_bar) actionBar.setCustomView(R.layout.activity_conversation_v2_action_bar)
actionBar.setDisplayShowCustomEnabled(true) actionBar.setDisplayShowCustomEnabled(true)
@ -97,6 +97,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
profilePictureView.update(thread, threadID) profilePictureView.update(thread, threadID)
} }
private fun setUpInputBar() {
inputBar.inputBarEditText.imeOptions = inputBar.inputBarEditText.imeOptions or 16777216 // Always use incognito keyboard
}
override fun onPrepareOptionsMenu(menu: Menu): Boolean { override fun onPrepareOptionsMenu(menu: Menu): Boolean {
ConversationMenuHelper.onPrepareOptionsMenu(menu, menuInflater, thread, this) { onOptionsItemSelected(it) } ConversationMenuHelper.onPrepareOptionsMenu(menu, menuInflater, thread, this) { onOptionsItemSelected(it) }
super.onPrepareOptionsMenu(menu) super.onPrepareOptionsMenu(menu)

View File

@ -34,12 +34,13 @@
style="@style/SessionEditText" style="@style/SessionEditText"
android:id="@+id/displayNameEditText" android:id="@+id/displayNameEditText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:paddingTop="28dp"
android:paddingBottom="28dp"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:gravity="center_vertical"
android:inputType="textCapWords" android:inputType="textCapWords"
android:hint="@string/activity_display_name_edit_text_hint" /> android:hint="@string/activity_display_name_edit_text_hint" />

View File

@ -13,6 +13,7 @@
android:layout_marginBottom="@dimen/input_bar_height" /> android:layout_marginBottom="@dimen/input_bar_height" />
<org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar <org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar
android:id="@+id/inputBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" /> android:layout_alignParentBottom="true" />

View File

@ -34,10 +34,13 @@
style="@style/SmallSessionEditText" style="@style/SmallSessionEditText"
android:id="@+id/displayNameEditText" android:id="@+id/displayNameEditText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:gravity="center_vertical"
android:inputType="textCapWords" android:inputType="textCapWords"
android:hint="@string/activity_display_name_edit_text_hint" /> android:hint="@string/activity_display_name_edit_text_hint" />

View File

@ -22,13 +22,18 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginStart="@dimen/small_spacing" /> android:layout_marginStart="@dimen/small_spacing" />
<TextView <EditText
android:layout_width="wrap_content" android:id="@+id/inputBarEditText"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_marginStart="56dp" android:layout_marginStart="64dp"
android:layout_marginEnd="56dp" android:layout_marginEnd="64dp"
android:background="@color/red" /> android:gravity="center_vertical"
android:textColor="@color/text"
android:textSize="@dimen/small_font_size"
android:background="@null"
android:hint="@string/ConversationActivity_message" />
<RelativeLayout <RelativeLayout
android:id="@+id/microphoneButtonContainer" android:id="@+id/microphoneButtonContainer"