diff --git a/res/layout/conversation_input_panel.xml b/res/layout/conversation_input_panel.xml index 041b19e1fd..5e156c49cf 100644 --- a/res/layout/conversation_input_panel.xml +++ b/res/layout/conversation_input_panel.xml @@ -54,30 +54,32 @@ + + - - - - - - - - - - + android:src="?quick_camera_icon" + android:paddingLeft="6dp" + android:paddingRight="6dp" + android:background="?selectableItemBackgroundBorderless" + android:contentDescription="@string/conversation_activity__quick_attachment_drawer_toggle_camera_description" /> + + + + + + + + + + + + + + + + + + @@ -198,8 +227,8 @@ - - diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 85e89a63b0..9bab467c4a 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -30,6 +30,7 @@ + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index ab206463d5..833b858da3 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -34,6 +34,7 @@ 100dp 320dp + 40dp 16dp 16dp 52dp diff --git a/res/values/themes.xml b/res/values/themes.xml index 66cced2f93..d1115fec57 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -148,6 +148,7 @@ #22000000 #ff111111 @drawable/compose_background_light + @color/core_light_60 @drawable/ic_send_sms_insecure @drawable/ic_send_push @color/white @@ -321,6 +322,7 @@ #22ffffff #ffeeeeee @drawable/compose_background_dark + @color/core_dark_05 @drawable/ic_send_sms_insecure_dark @drawable/ic_send_push @color/black diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index e61ca6521b..a064b45efa 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -250,6 +250,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity private BroadcastReceiver securityUpdateReceiver; private Stub emojiDrawerStub; protected HidingLinearLayout quickAttachmentToggle; + protected HidingLinearLayout inlineAttachmentToggle; private QuickAttachmentDrawer quickAttachmentDrawer; private InputPanel inputPanel; @@ -566,7 +567,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity switch (item.getItemId()) { case R.id.menu_call_secure: case R.id.menu_call_insecure: handleDial(getRecipient()); return true; - case R.id.menu_add_attachment: handleAddAttachment(); return true; case R.id.menu_view_media: handleViewMedia(); return true; case R.id.menu_add_to_contacts: handleAddToContacts(); return true; case R.id.menu_reset_secure_session: handleResetSecureSession(); return true; @@ -1265,26 +1265,28 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar == null) throw new AssertionError(); - titleView = (ConversationTitleView) supportActionBar.getCustomView(); - buttonToggle = ViewUtil.findById(this, R.id.button_toggle); - sendButton = ViewUtil.findById(this, R.id.send_button); - attachButton = ViewUtil.findById(this, R.id.attach_button); - composeText = ViewUtil.findById(this, R.id.embedded_text_editor); - charactersLeft = ViewUtil.findById(this, R.id.space_left); - emojiDrawerStub = ViewUtil.findStubById(this, R.id.emoji_drawer_stub); - unblockButton = ViewUtil.findById(this, R.id.unblock_button); - makeDefaultSmsButton = ViewUtil.findById(this, R.id.make_default_sms_button); - registerButton = ViewUtil.findById(this, R.id.register_button); - composePanel = ViewUtil.findById(this, R.id.bottom_panel); - container = ViewUtil.findById(this, R.id.layout_container); - reminderView = ViewUtil.findStubById(this, R.id.reminder_stub); - unverifiedBannerView = ViewUtil.findStubById(this, R.id.unverified_banner_stub); - groupShareProfileView = ViewUtil.findStubById(this, R.id.group_share_profile_view_stub); - quickAttachmentDrawer = ViewUtil.findById(this, R.id.quick_attachment_drawer); - quickAttachmentToggle = ViewUtil.findById(this, R.id.quick_attachment_toggle); - inputPanel = ViewUtil.findById(this, R.id.bottom_panel); - - ImageButton quickCameraToggle = ViewUtil.findById(this, R.id.quick_camera_toggle); + titleView = (ConversationTitleView) supportActionBar.getCustomView(); + buttonToggle = ViewUtil.findById(this, R.id.button_toggle); + sendButton = ViewUtil.findById(this, R.id.send_button); + attachButton = ViewUtil.findById(this, R.id.attach_button); + composeText = ViewUtil.findById(this, R.id.embedded_text_editor); + charactersLeft = ViewUtil.findById(this, R.id.space_left); + emojiDrawerStub = ViewUtil.findStubById(this, R.id.emoji_drawer_stub); + unblockButton = ViewUtil.findById(this, R.id.unblock_button); + makeDefaultSmsButton = ViewUtil.findById(this, R.id.make_default_sms_button); + registerButton = ViewUtil.findById(this, R.id.register_button); + composePanel = ViewUtil.findById(this, R.id.bottom_panel); + container = ViewUtil.findById(this, R.id.layout_container); + reminderView = ViewUtil.findStubById(this, R.id.reminder_stub); + unverifiedBannerView = ViewUtil.findStubById(this, R.id.unverified_banner_stub); + groupShareProfileView = ViewUtil.findStubById(this, R.id.group_share_profile_view_stub); + quickAttachmentDrawer = ViewUtil.findById(this, R.id.quick_attachment_drawer); + quickAttachmentToggle = ViewUtil.findById(this, R.id.quick_attachment_toggle); + inlineAttachmentToggle = ViewUtil.findById(this, R.id.inline_attachment_container); + inputPanel = ViewUtil.findById(this, R.id.bottom_panel); + + ImageButton quickCameraToggle = ViewUtil.findById(this, R.id.quick_camera_toggle); + ImageButton inlineAttachmentButton = ViewUtil.findById(this, R.id.inline_attachment_button); container.addOnKeyboardShownListener(this); inputPanel.setListener(this); @@ -1330,6 +1332,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity quickCameraToggle.setVisibility(View.GONE); quickCameraToggle.setEnabled(false); } + + inlineAttachmentButton.setOnClickListener(v -> handleAddAttachment()); } protected void initializeActionBar() { @@ -1844,9 +1848,11 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity if (composeText.getText().length() == 0 && !attachmentManager.isAttachmentPresent()) { buttonToggle.display(attachButton); quickAttachmentToggle.show(); + inlineAttachmentToggle.hide(); } else { buttonToggle.display(sendButton); quickAttachmentToggle.hide(); + inlineAttachmentToggle.show(); } } diff --git a/src/org/thoughtcrime/securesms/components/HidingLinearLayout.java b/src/org/thoughtcrime/securesms/components/HidingLinearLayout.java index 22d103c83a..c0918dbdf3 100644 --- a/src/org/thoughtcrime/securesms/components/HidingLinearLayout.java +++ b/src/org/thoughtcrime/securesms/components/HidingLinearLayout.java @@ -35,7 +35,7 @@ public class HidingLinearLayout extends LinearLayout { if (!isEnabled() || getVisibility() == GONE) return; AnimationSet animation = new AnimationSet(true); - animation.addAnimation(new ScaleAnimation(1, 0, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f)); + animation.addAnimation(new ScaleAnimation(1, 0.5f, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f)); animation.addAnimation(new AlphaAnimation(1, 0)); animation.setDuration(100); @@ -63,7 +63,7 @@ public class HidingLinearLayout extends LinearLayout { setVisibility(VISIBLE); AnimationSet animation = new AnimationSet(true); - animation.addAnimation(new ScaleAnimation(0, 1, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f)); + animation.addAnimation(new ScaleAnimation(0.5f, 1, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f)); animation.addAnimation(new AlphaAnimation(0, 1)); animation.setDuration(100);