Files
arcanechat-android/res/layout/conversation_item_sent.xml
T
bjoern 9e70aa7cad webxdc (#2174)
* add new w30 APIs

* create the webview,
disable internet access,
inject deltachat.js

* connect deltachat to the webview

* promisify api

* use msgActionButton to start the w30 apps

* cleanup

- create observers in onCreate() to avoid memory leak,
- derive from WebViewActivity to easier deal with particularities
  and to saves >100 loc
- reorder some methods to reflect lifetimes

* make it more clear, which uri-part is 'domain' and which one is 'path'

* unify logging

* it is 'statusUpdate' not 'stateUpdate'; not sure if promise is needed at the end, we can readd that as needed, simple code for now

* use core implementation for status updates

* disable debugging enabled by default, streamline code

* use same name for InternalJSApi for both, js and java

* getStatusUpdates() always return an array

* call JSON.stringify() on payload

* fix typo, fix equal operator

* use shorter function names in js land

* adapt to new zipped w30 format

* load any file from w30 archives

* add fallback if getMimeTypeFromExtension() fails

* rename w30 to webxdc

* add selfName()

* return selfAddr() if selfName() is empty

* rename deltachat.js to webxdc.js

* observer correct event

* rename getBlobFromArchive() to getWebxdcBlob()

* show webxdc app name in title bar

* swap payload and descr in sendUpdate() (adapt to new core api)

* allow user-defined-texts for webxdc apps, make room for icon+name

* show webxdc icon and name in chats

* render webxdc drafts accordingly

* allow configuring drafts

* do not destroy webxdc-message to be sent out by removing it via setDraft(null)

* fix crash when replying to webxdc messages

* add webxdc messages to profile's document tab

* hide 'search menu' for webxdc apps

* show app summary beside app icon

* remove outdated comment

* add precautious WebView restrictions

* Update src/org/thoughtcrime/securesms/ConversationItem.java

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

* Update src/org/thoughtcrime/securesms/ConversationItem.java

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

* Update src/org/thoughtcrime/securesms/ConversationActivity.java

Co-authored-by: Hocuri <hocuri@gmx.de>

* Webxdc requires at least Android 5 Lollipop

see https://github.com/deltachat/deltachat-android/pull/2174#discussion_r785436874

* recognize .xdc files on android10

based on @Hocuri's findings in #2188

Co-authored-by: Simon Laux <mobile.info@simonlaux.de>
Co-authored-by: adbenitez <asieldbenitez@gmail.com>
Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>
Co-authored-by: Hocuri <hocuri@gmx.de>
2022-01-18 10:52:09 +01:00

218 lines
11 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.ConversationItem
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusable="true"
android:nextFocusLeft="@id/container"
android:nextFocusRight="@id/embedded_text_editor"
android:background="@drawable/conversation_item_background"
android:clipToPadding="false"
android:clipChildren="false">
<RelativeLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/conversation_individual_right_gutter"
android:layout_marginEnd="@dimen/conversation_individual_right_gutter"
android:layout_marginBottom="@dimen/below_bubble"
android:clipToPadding="false"
android:clipChildren="false">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/reply_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignStart="@id/body_bubble"
android:layout_alignTop="@id/body_bubble"
android:layout_alignBottom="@id/body_bubble"
android:alpha="0"
app:srcCompat="?menu_reply_icon"
android:tint="?icon_tint"
android:layout_alignLeft="@id/body_bubble" />
<LinearLayout
android:id="@+id/body_bubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toLeftOf="@+id/indicators_parent"
android:layout_toStartOf="@+id/indicators_parent"
android:layout_alignWithParentIfMissing="true"
android:layout_marginLeft="@dimen/message_bubble_edge_margin"
android:layout_marginStart="@dimen/message_bubble_edge_margin"
android:clipToPadding="false"
android:clipChildren="false"
android:background="@color/white"
tools:backgroundTint="@color/core_light_10">
<LinearLayout
android:id="@+id/group_sender_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/message_bubble_top_padding"
android:layout_marginBottom="2dp"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/group_message_sender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4sp"
android:layout_marginEnd="4sp"
style="@style/Signal.Text.Preview"
android:fontFamily="sans-serif-medium"
android:maxLines="1"
android:ellipsize="end"
tools:visibility="visible"
tools:text="Bob"/>
</LinearLayout>
<org.thoughtcrime.securesms.components.QuoteView
android:id="@+id/quote_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/message_bubble_top_padding"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:visibility="gone"
app:message_type="incoming"
app:quote_colorPrimary="?attr/conversation_item_quote_text_color"
app:quote_colorSecondary="?attr/conversation_item_quote_text_color"
tools:visibility="visible"/>
<ViewStub
android:id="@+id/image_view_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout="@layout/conversation_item_sent_thumbnail" />
<ViewStub
android:id="@+id/sticker_view_stub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/conversation_item_received_sticker" />
<ViewStub
android:id="@+id/audio_view_stub"
android:layout="@layout/conversation_item_sent_audio"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/message_bubble_top_padding"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
<ViewStub
android:id="@+id/document_view_stub"
android:layout="@layout/conversation_item_sent_document"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/message_bubble_top_padding"
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
<ViewStub
android:id="@+id/webxdc_view_stub"
android:layout="@layout/conversation_item_webxdc"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/message_bubble_top_padding"
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/conversation_item_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
style="@style/Signal.Text.Body"
android:paddingTop="@dimen/message_bubble_top_padding"
android:textColor="?conversation_item_outgoing_text_primary_color"
android:textColorLink="?conversation_item_outgoing_text_primary_color"
app:scaleEmojis="true"
tools:text="Mango pickle lorem ipsum"/>
<Button
android:id="@+id/msg_action_button"
android:visibility="gone"
style="@style/Signal.Text.Body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
android:paddingTop="@dimen/message_bubble_showmore_padding"
android:paddingBottom="@dimen/message_bubble_showmore_padding"
android:minHeight="1dp"
android:minWidth="0dp"
android:background="@android:color/transparent"
android:textColor="@color/delta_accent_darker"
android:text="@string/show_full_message"
android:textAllCaps="false"/>
<org.thoughtcrime.securesms.components.ConversationItemFooter
android:id="@+id/conversation_item_footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
android:layout_gravity="end"
android:gravity="end"
android:clipChildren="false"
android:clipToPadding="false"
app:footer_text_color="?attr/conversation_item_outgoing_text_secondary_color"/>
<org.thoughtcrime.securesms.components.ConversationItemFooter
android:id="@+id/conversation_item_sticker_footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
android:layout_marginTop="3dp"
android:paddingTop="@dimen/transparent_footer_padding"
android:paddingBottom="@dimen/transparent_footer_padding"
android:paddingLeft="@dimen/transparent_footer_padding"
android:paddingRight="@dimen/transparent_footer_padding"
android:layout_gravity="end"
android:gravity="end"
android:clipChildren="false"
android:clipToPadding="false"
android:background="@drawable/conversation_item_update_background"
app:footer_text_color="@color/core_dark_05"/>
</LinearLayout>
<!-- the following view is only left because it is used as a reference for positioning above.
removing would require some re-layouting, it's just not done yet.-->
<View
android:visibility="gone"
android:id="@+id/indicators_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</org.thoughtcrime.securesms.ConversationItem>