From e06a3271df267323a51efff9ea49f61396eba4dc Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Tue, 15 Jun 2021 14:55:57 +1000 Subject: [PATCH] Add basic input edit text --- .../conversation/v2/ConversationActivityV2.kt | 12 ++++++++---- .../layout-sw400dp/activity_display_name.xml | 7 ++++--- .../res/layout/activity_conversation_v2.xml | 1 + .../main/res/layout/activity_display_name.xml | 5 ++++- app/src/main/res/layout/view_input_bar.xml | 17 +++++++++++------ 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index fed8ac1be8..4afbc053f4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -2,16 +2,15 @@ package org.thoughtcrime.securesms.conversation.v2 import android.database.Cursor import android.os.Bundle -import android.util.Log import android.view.ActionMode import android.view.Menu import android.view.MenuItem import androidx.loader.app.LoaderManager import androidx.loader.content.Loader -import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.LinearLayoutManager import kotlinx.android.synthetic.main.activity_conversation_v2.* 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 org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.conversation.v2.menus.ConversationActionModeCallback @@ -64,7 +63,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { setContentView(R.layout.activity_conversation_v2) threadID = intent.getLongExtra(THREAD_ID, -1) setUpRecyclerView() - setUpToolbar() + setUpToolBar() + setUpInputBar() } private fun setUpRecyclerView() { @@ -88,7 +88,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { }) } - private fun setUpToolbar() { + private fun setUpToolBar() { val actionBar = supportActionBar!! actionBar.setCustomView(R.layout.activity_conversation_v2_action_bar) actionBar.setDisplayShowCustomEnabled(true) @@ -97,6 +97,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { 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 { ConversationMenuHelper.onPrepareOptionsMenu(menu, menuInflater, thread, this) { onOptionsItemSelected(it) } super.onPrepareOptionsMenu(menu) diff --git a/app/src/main/res/layout-sw400dp/activity_display_name.xml b/app/src/main/res/layout-sw400dp/activity_display_name.xml index ecb0a35967..fe00d541a2 100644 --- a/app/src/main/res/layout-sw400dp/activity_display_name.xml +++ b/app/src/main/res/layout-sw400dp/activity_display_name.xml @@ -34,12 +34,13 @@ style="@style/SessionEditText" android:id="@+id/displayNameEditText" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="28dp" - android:paddingBottom="28dp" + android:layout_height="64dp" android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginTop="12dp" android:layout_marginRight="@dimen/very_large_spacing" + android:paddingTop="0dp" + android:paddingBottom="0dp" + android:gravity="center_vertical" android:inputType="textCapWords" android:hint="@string/activity_display_name_edit_text_hint" /> diff --git a/app/src/main/res/layout/activity_conversation_v2.xml b/app/src/main/res/layout/activity_conversation_v2.xml index f59cacf377..bc483643b8 100644 --- a/app/src/main/res/layout/activity_conversation_v2.xml +++ b/app/src/main/res/layout/activity_conversation_v2.xml @@ -13,6 +13,7 @@ android:layout_marginBottom="@dimen/input_bar_height" /> diff --git a/app/src/main/res/layout/activity_display_name.xml b/app/src/main/res/layout/activity_display_name.xml index 6cf78f9aba..60a6580cef 100644 --- a/app/src/main/res/layout/activity_display_name.xml +++ b/app/src/main/res/layout/activity_display_name.xml @@ -34,10 +34,13 @@ style="@style/SmallSessionEditText" android:id="@+id/displayNameEditText" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="64dp" android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginTop="10dp" android:layout_marginRight="@dimen/very_large_spacing" + android:paddingTop="0dp" + android:paddingBottom="0dp" + android:gravity="center_vertical" android:inputType="textCapWords" android:hint="@string/activity_display_name_edit_text_hint" /> diff --git a/app/src/main/res/layout/view_input_bar.xml b/app/src/main/res/layout/view_input_bar.xml index 997122f190..bee4245666 100644 --- a/app/src/main/res/layout/view_input_bar.xml +++ b/app/src/main/res/layout/view_input_bar.xml @@ -22,13 +22,18 @@ android:layout_centerVertical="true" android:layout_marginStart="@dimen/small_spacing" /> - + android:layout_marginStart="64dp" + android:layout_marginEnd="64dp" + android:gravity="center_vertical" + android:textColor="@color/text" + android:textSize="@dimen/small_font_size" + android:background="@null" + android:hint="@string/ConversationActivity_message" />