Skip to content

Commit

Permalink
Pull request #254: CHAT-1624 - fix multiline logic
Browse files Browse the repository at this point in the history
Merge in MML/infobip-mobile-messaging-android from CHAT-1624-fix-multiline-logic to master

Squashed commit of the following:

commit f8dae0eba4e538f88af9544904cbf74c5ee5f94e
Author: Dmitry Ilin <[email protected]>
Date:   Fri Nov 19 11:26:48 2021 +0300

    CHAT-1624 - fix layout on survey pop-up

commit bb8f0a369ba935c00888734625d981ce2b0434cf
Author: Dmitry Ilin <[email protected]>
Date:   Fri Nov 19 11:10:41 2021 +0300

    CHAT-1624 - fix onResume/onPause event handling

commit 48a82b6208494586fe7610319edebe1c46d443b5
Author: Dmitry Ilin <[email protected]>
Date:   Fri Nov 19 09:28:18 2021 +0300

    CHAT-1624 - fix multiline logic
  • Loading branch information
Dmitry Ilin authored and Dmitry Ilin committed Nov 22, 2021
1 parent 9a5a9eb commit 20bba2f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
Expand Down Expand Up @@ -94,7 +95,7 @@ public class InAppChatFragment extends Fragment implements InAppChatWebViewManag
private ImageView sendAttachmentButton;
private ProgressBar spinner;
private Toolbar toolbar;
private RelativeLayout msgInputWrapper;
private LinearLayout msgInputWrapper;
private RelativeLayout mainWindow;
private TextView errorToast;

Expand All @@ -114,6 +115,7 @@ public class InAppChatFragment extends Fragment implements InAppChatWebViewManag
private boolean fragmentCouldBeResumed = true;
private boolean isToolbarHidden = false;
private boolean isInputControlsVisible = true;
private boolean fragmentHidden = false;

/**
* Implement InAppChatActionBarProvider in your Activity, where InAppChatWebViewFragment will be added.
Expand Down Expand Up @@ -165,13 +167,17 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
@Override
public void onPause() {
super.onPause();
fragmentPaused();
if (!fragmentHidden) {
fragmentPaused();
}
}

@Override
public void onResume() {
super.onResume();
fragmentResumed();
if (!fragmentHidden) {
fragmentResumed();
}
}

@Override
Expand All @@ -185,6 +191,7 @@ public void onDestroy() {

@Override
public void onHiddenChanged(boolean hidden) {
fragmentHidden = hidden;
if (!hidden) {
initToolbar();
updateViews();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
android:id="@+id/ib_lc_rl_main_window"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="@android:color/white"
android:orientation="vertical"
android:paddingBottom="10dp"
android:animateLayoutChanges="true"
tools:context=".view.InAppChatFragment">

<android.support.design.widget.AppBarLayout
Expand Down Expand Up @@ -41,80 +41,85 @@
android:layout_below="@+id/appBarLayout"
android:visibility="invisible" />

<RelativeLayout
<LinearLayout
android:id="@+id/ib_lc_rl_msg_input_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_height="40dp"
android:layout_width="wrap_content">
android:minHeight="40dp"
android:orientation="vertical">

<ImageView
android:id="@+id/ib_lc_iv_input_top_border"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentTop="true"
android:contentDescription="@string/ib_iv_input_border_desc"
android:src="@drawable/light_top_border" />

<ImageView
android:id="@+id/ib_lc_iv_send_attachment_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:contentDescription="@string/ib_iv_btn_send_attachment_desc"
android:enabled="false"
android:src="@drawable/ib_chat_attachment_btn_icon" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@+id/ib_lc_iv_send_btn"
android:layout_toLeftOf="@+id/ib_lc_iv_send_btn"
android:layout_toEndOf="@+id/ib_lc_iv_send_attachment_btn"
android:layout_toRightOf="@+id/ib_lc_iv_send_attachment_btn"
android:minHeight="30dp"
android:orientation="horizontal"
android:paddingTop="10dp"
app:layout_anchorGravity="center">
android:layout_height="wrap_content">

<ImageView
android:id="@+id/ib_lc_iv_send_attachment_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignBottom="@id/ib_lc_rl_edit_text_wrapper"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:contentDescription="@string/ib_iv_btn_send_attachment_desc"
android:enabled="false"
android:src="@drawable/ib_chat_attachment_btn_icon" />

<EditText
android:id="@+id/ib_lc_et_msg_input"
<ImageView
android:id="@+id/ib_lc_iv_send_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignBottom="@id/ib_lc_rl_edit_text_wrapper"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:contentDescription="@string/ib_iv_btn_send_desc"
android:enabled="false"
android:src="@drawable/ib_chat_send_btn_icon" />

<RelativeLayout
android:id="@+id/ib_lc_rl_edit_text_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:background="@null"
android:enabled="false"
android:hint="@string/ib_chat_message_hint"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:maxLines="5"
android:layout_toStartOf="@+id/ib_lc_iv_send_btn"
android:layout_toLeftOf="@+id/ib_lc_iv_send_btn"
android:layout_toEndOf="@id/ib_lc_iv_send_attachment_btn"
android:layout_toRightOf="@id/ib_lc_iv_send_attachment_btn"
android:minHeight="30dp"
android:scrollbars="vertical"
android:textSize="16sp" />

</RelativeLayout>
android:orientation="horizontal"
android:paddingTop="10dp"
app:layout_anchorGravity="center">

<ImageView
android:id="@+id/ib_lc_iv_send_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:contentDescription="@string/ib_iv_btn_send_desc"
android:enabled="false"
android:src="@drawable/ib_chat_send_btn_icon" />
<EditText
android:id="@+id/ib_lc_et_msg_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:background="@null"
android:enabled="false"
android:hint="@string/ib_chat_message_hint"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:maxLines="5"
android:minHeight="30dp"
android:scrollbars="vertical"
android:textSize="16sp" />

</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

<TextView
android:id="@+id/ib_lc_tv_error_toast"
Expand All @@ -127,4 +132,5 @@
android:textColor="@android:color/black"
android:textSize="16sp"
android:visibility="invisible" />

</RelativeLayout>

0 comments on commit 20bba2f

Please sign in to comment.