mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-27 00:57:42 +00:00
Added support for link previews.
This commit is contained in:
BIN
res/drawable-hdpi/link_preview_splash.png
Normal file
BIN
res/drawable-hdpi/link_preview_splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 193 KiB |
BIN
res/drawable-mdpi/link_preview_splash.png
Normal file
BIN
res/drawable-mdpi/link_preview_splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
BIN
res/drawable-xhdpi/link_preview_splash.png
Normal file
BIN
res/drawable-xhdpi/link_preview_splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 KiB |
BIN
res/drawable-xxhdpi/link_preview_splash.png
Normal file
BIN
res/drawable-xxhdpi/link_preview_splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 592 KiB |
BIN
res/drawable-xxxhdpi/link_preview_splash.png
Normal file
BIN
res/drawable-xxxhdpi/link_preview_splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 905 KiB |
@@ -45,6 +45,16 @@
|
||||
app:quote_colorSecondary="?attr/conversation_item_sent_text_primary_color"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.LinkPreviewView
|
||||
android:id="@+id/link_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:visibility="gone"
|
||||
app:linkpreview_type="compose" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@@ -128,6 +128,12 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/conversation_item_received_thumbnail" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/link_preview_stub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/conversation_item_received_link_preview" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/audio_view_stub"
|
||||
android:layout="@layout/conversation_item_received_audio"
|
||||
|
11
res/layout/conversation_item_received_link_preview.xml
Normal file
11
res/layout/conversation_item_received_link_preview.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.components.LinkPreviewView
|
||||
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:id="@+id/link_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:linkpreview_type="conversation"
|
||||
tools:visibility="visible" />
|
@@ -65,6 +65,12 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/conversation_item_sent_thumbnail" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/link_preview_stub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/conversation_item_sent_link_preview" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/audio_view_stub"
|
||||
android:layout="@layout/conversation_item_sent_audio"
|
||||
|
11
res/layout/conversation_item_sent_link_preview.xml
Normal file
11
res/layout/conversation_item_sent_link_preview.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.components.LinkPreviewView
|
||||
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:id="@+id/link_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:linkpreview_type="conversation"
|
||||
tools:visibility="visible" />
|
109
res/layout/experience_upgrade_link_previews_fragment.xml
Normal file
109
res/layout/experience_upgrade_link_previews_fragment.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:background="#FF2090ea">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blurb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:text="@string/ExperienceUpgradeActivity_introducing_link_previews"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/white"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="@dimen/onboarding_title_size"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/link_preview_splash"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_max="280dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/blurb"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
app:layout_constraintWidth_max="280dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/experience_ok_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/ExperienceUpgradeActivity_optional_link_previews_are_now_supported"
|
||||
android:textColor="@color/core_white"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="@dimen/onboarding_subtitle_size" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:text="@string/ExperienceUpgradeActivity_you_can_disable_or_enable_this_feature_link_previews"
|
||||
android:textColor="@color/core_white"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="16dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/experience_ok_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="@string/ok"
|
||||
android:textColor="@color/core_blue"
|
||||
app:backgroundTint="@color/core_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
108
res/layout/link_preview.xml
Normal file
108
res/layout/link_preview.xml
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge
|
||||
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.support.constraint.ConstraintLayout
|
||||
android:id="@+id/linkpreview_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:background="?linkpreview_background_color">
|
||||
|
||||
<org.thoughtcrime.securesms.components.OutlinedThumbnailView
|
||||
android:id="@+id/linkpreview_thumbnail"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linkpreview_divider"
|
||||
app:layout_constraintHeight_min="72dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/linkpreview_title"
|
||||
tools:src="@drawable/ic_contact_picture"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/linkpreview_title"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:maxLines="2"
|
||||
android:textColor="?linkpreview_primary_text_color"
|
||||
app:layout_constraintEnd_toStartOf="@+id/linkpreview_close"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/linkpreview_thumbnail"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Wall Crawler Strikes Again!" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/linkpreview_site"
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?linkpreview_secondary_text_color"
|
||||
app:layout_constraintStart_toEndOf="@+id/linkpreview_thumbnail"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkpreview_title"
|
||||
tools:text="dailybugle.com" />
|
||||
|
||||
<View
|
||||
android:id="@+id/linkpreview_divider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="?linkpreview_divider_color"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/linkpreview_thumbnail"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/linkpreview_thumbnail"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkpreview_site"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/linkpreview_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:src="@drawable/ic_close_white_18dp"
|
||||
android:tint="@color/gray70"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.pnikosis.materialishprogress.ProgressWheel
|
||||
android:id="@+id/linkpreview_progress_wheel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:indeterminate="true"
|
||||
android:padding="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linkpreview_divider"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:matProg_barColor="@color/core_blue"
|
||||
app:matProg_progressIndeterminate="true" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
</merge>
|
@@ -179,9 +179,9 @@
|
||||
android:id="@+id/quote_dismiss"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_gravity="top|end"
|
||||
android:background="@drawable/dismiss_background"
|
||||
android:src="@drawable/ic_close_white_18dp"
|
||||
|
@@ -110,6 +110,11 @@
|
||||
|
||||
<attr name="invite_background" format="color"/>
|
||||
|
||||
<attr name="linkpreview_background_color" format="color" />
|
||||
<attr name="linkpreview_primary_text_color" format="color" />
|
||||
<attr name="linkpreview_secondary_text_color" format="color" />
|
||||
<attr name="linkpreview_divider_color" format="color" />
|
||||
|
||||
<attr name="reminder_header_background" format="color"/>
|
||||
|
||||
<attr name="menu_new_conversation_icon" format="reference" />
|
||||
@@ -281,6 +286,13 @@
|
||||
<attr name="contact_footerAlpha" format="float" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="LinkPreviewView">
|
||||
<attr name="linkpreview_type" format="enum">
|
||||
<enum name="conversation" value="0" />
|
||||
<enum name="compose" value="1" />
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="DocumentView">
|
||||
<attr name="doc_titleColor" format="color" />
|
||||
<attr name="doc_captionColor" format="color" />
|
||||
|
@@ -51,6 +51,8 @@
|
||||
|
||||
<dimen name="mediasend_progress_dialog_size">120dp</dimen>
|
||||
|
||||
<dimen name="thumbnail_default_radius">4dp</dimen>
|
||||
|
||||
<dimen name="conversation_compose_height">40dp</dimen>
|
||||
<dimen name="conversation_individual_right_gutter">16dp</dimen>
|
||||
<dimen name="conversation_individual_left_gutter">16dp</dimen>
|
||||
|
@@ -328,6 +328,10 @@
|
||||
<string name="ExperienceUpgradeActivity_turn_on_typing_indicators">Turn on typing indicators</string>
|
||||
<string name="ExperienceUpgradeActivity_no_thanks">No thanks</string>
|
||||
|
||||
<string name="ExperienceUpgradeActivity_introducing_link_previews">Introducing link previews.</string>
|
||||
<string name="ExperienceUpgradeActivity_optional_link_previews_are_now_supported">Optional link previews are now supported for some of the most popular sites on the Internet.</string>
|
||||
<string name="ExperienceUpgradeActivity_you_can_disable_or_enable_this_feature_link_previews">You can disable or enable this feature anytime in your Signal settings (Privacy > Send link previews).</string>
|
||||
|
||||
<!-- GcmBroadcastReceiver -->
|
||||
<string name="GcmBroadcastReceiver_retrieving_a_message">Retrieving a message...</string>
|
||||
|
||||
@@ -1149,6 +1153,8 @@
|
||||
<string name="preferences__use_signal_for_viewing_and_storing_all_incoming_multimedia_messages">Use Signal for all incoming multimedia messages</string>
|
||||
<string name="preferences__pref_enter_sends_title">Enter key sends</string>
|
||||
<string name="preferences__pressing_the_enter_key_will_send_text_messages">Pressing the Enter key will send text messages</string>
|
||||
<string name="preferences__send_link_previews">Send link previews</string>
|
||||
<string name="preferences__previews_are_supported_for">Previews are supported for Imgur, Instagram, Reddit, and YouTube links</string>
|
||||
<string name="preferences__choose_identity">Choose identity</string>
|
||||
<string name="preferences__choose_your_contact_entry_from_the_contacts_list">Choose your contact entry from the contacts list.</string>
|
||||
<string name="preferences__change_passphrase">Change passphrase</string>
|
||||
|
@@ -188,7 +188,6 @@
|
||||
<item name="emoji_category_emoticons">@drawable/emoji_category_emoticons_light</item>
|
||||
<item name="emoji_variation_selector_background">@drawable/emoji_variation_selector_background_light</item>
|
||||
|
||||
|
||||
<item name="conversation_item_bubble_background">@color/core_grey_05</item>
|
||||
<item name="conversation_item_sent_text_primary_color">@color/core_grey_90</item>
|
||||
<item name="conversation_item_sent_text_secondary_color">@color/core_grey_60</item>
|
||||
@@ -223,6 +222,11 @@
|
||||
<item name="import_export_item_background_shadow_color">@color/import_export_item_background_shadow_light</item>
|
||||
<item name="import_export_item_card_background">@drawable/clickable_card_light</item>
|
||||
|
||||
<item name="linkpreview_background_color">@color/core_white</item>
|
||||
<item name="linkpreview_primary_text_color">@color/core_black</item>
|
||||
<item name="linkpreview_secondary_text_color">@color/core_grey_60</item>
|
||||
<item name="linkpreview_divider_color">@color/core_grey_25</item>
|
||||
|
||||
<item name="menu_new_conversation_icon">@drawable/ic_add_white_24dp</item>
|
||||
<item name="menu_group_icon">@drawable/ic_group_white_24dp</item>
|
||||
<item name="menu_search_icon">@drawable/ic_search_white_24dp</item>
|
||||
@@ -373,6 +377,11 @@
|
||||
<item name="emoji_category_emoticons">@drawable/emoji_category_emoticons_dark</item>
|
||||
<item name="emoji_variation_selector_background">@drawable/emoji_variation_selector_background_dark</item>
|
||||
|
||||
<item name="linkpreview_background_color">@color/core_grey_95</item>
|
||||
<item name="linkpreview_primary_text_color">@color/core_white</item>
|
||||
<item name="linkpreview_secondary_text_color">@color/core_grey_25</item>
|
||||
<item name="linkpreview_divider_color">@color/core_grey_60</item>
|
||||
|
||||
<item name="quick_camera_icon">@drawable/quick_camera_dark</item>
|
||||
<item name="quick_mic_icon">@drawable/ic_mic_white_24dp</item>
|
||||
|
||||
|
@@ -69,6 +69,12 @@
|
||||
android:title="@string/preferences__typing_indicators"
|
||||
android:summary="@string/preferences__if_typing_indicators_are_disabled_you_wont_be_able_to_see_typing_indicators"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="pref_link_previews"
|
||||
android:summary="@string/preferences__previews_are_supported_for"
|
||||
android:title="@string/preferences__send_link_previews"/>
|
||||
|
||||
<Preference android:key="preference_category_blocked"
|
||||
android:title="@string/preferences_app_protection__blocked_contacts" />
|
||||
</PreferenceCategory>
|
||||
|
@@ -56,6 +56,7 @@
|
||||
android:key="pref_enter_sends"
|
||||
android:summary="@string/preferences__pressing_the_enter_key_will_send_text_messages"
|
||||
android:title="@string/preferences__pref_enter_sends_title"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:layout="@layout/preference_divider"/>
|
||||
|
Reference in New Issue
Block a user