unique colors for attachments

This commit is contained in:
B. Petersen 2019-05-20 01:49:39 +02:00
parent 72d37f2aa8
commit 31031e0b92
No known key found for this signature in database
GPG key ID: 3B88E92DEA8E9AFC
28 changed files with 20 additions and 84 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -56,9 +56,7 @@
android:paddingBottom="8dp"
android:paddingLeft="@dimen/message_bubble_horizontal_padding"
android:paddingRight="@dimen/message_bubble_horizontal_padding"
android:background="@drawable/message_bubble_background_sent_alone"
app:doc_titleColor="?attr/conversation_item_outgoing_text_primary_color"
app:doc_captionColor="?attr/conversation_item_outgoing_text_secondary_color"/>
android:background="@drawable/message_bubble_background_sent_alone"/>
</org.thoughtcrime.securesms.components.RemovableEditableMediaView>

View file

@ -7,6 +7,4 @@
android:layout_width="210dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:doc_titleColor="?conversation_item_incoming_text_primary_color"
app:doc_captionColor="?conversation_item_incoming_text_secondary_color"
tools:visibility="visible"/>

View file

@ -7,6 +7,4 @@
android:layout_width="210dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:doc_titleColor="?conversation_item_outgoing_text_primary_color"
app:doc_captionColor="?conversation_item_outgoing_text_secondary_color"
tools:visibility="visible"/>

View file

@ -12,52 +12,17 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<org.thoughtcrime.securesms.components.AnimatingToggle
android:id="@+id/control_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:gravity="center">
<FrameLayout
android:id="@+id/icon_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="-4dp"
android:layout_marginStart="-4dp"
android:gravity="center"
android:visibility="visible"
android:clickable="false"
android:focusable="false">
<ImageView
android:id="@+id/icon"
android:layout_width="38dp"
android:layout_height="50dp"
android:src="?attachment_document_icon_large"/>
<TextView android:id="@+id/document"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:clickable="false"
android:visibility="visible"
android:textAlignment="center"
android:scaleType="centerInside"
style="@style/Signal.Text.Caption"
android:textAllCaps="true"
android:textSize="10sp"
android:textColor="@color/core_black"
tools:visibility="visible"
tools:text="PDF" />
</FrameLayout>
</org.thoughtcrime.securesms.components.AnimatingToggle>
<org.thoughtcrime.securesms.components.CircleColorImageView
android:id="@+id/document_button"
android:padding="4dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:src="@drawable/ic_insert_drive_file_white_24dp"
android:scaleType="center"
android:contentDescription="@string/file"
app:circleColor="@color/document_icon"/>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -75,6 +40,7 @@
android:maxLines="1"
android:clickable="false"
android:ellipsize="end"
android:textColor="@color/document_icon_text"
tools:text="The-Anarchist-Tension-by-Alfredo-Bonanno.pdf"/>
<TextView android:id="@+id/file_size"
@ -82,6 +48,7 @@
android:layout_height="wrap_content"
style="@style/Signal.Text.Caption"
android:clickable="false"
android:textColor="@color/document_icon_text"
tools:text="24kb"/>
</LinearLayout>
</LinearLayout>

View file

@ -3,8 +3,6 @@
<attr name="theme_type" format="string"/>
<attr name="attachment_type_selector_background" format="color"/>
<attr name="attachment_document_icon_small" format="reference" />
<attr name="attachment_document_icon_large" format="reference" />
<attr name="conversation_list_item_background" format="reference"/>
<attr name="conversation_list_deaddrop_bg_color" format="reference|color"/>
@ -211,11 +209,6 @@
<attr name="summaryHasRingtone" format="string|reference" />
</declare-styleable>
<declare-styleable name="DocumentView">
<attr name="doc_titleColor" format="color" />
<attr name="doc_captionColor" format="color" />
</declare-styleable>
<declare-styleable name="ConversationItemFooter">
<attr name="footer_text_color" format="color" />
<attr name="footer_icon_color" format="color" />

View file

@ -7,7 +7,7 @@
<color name="audio_icon">#f68751</color>
<color name="audio_icon_text">#ed824e</color>
<color name="document_icon">#34a0f4</color>
<color name="document_icon_text">#3093e0</color>
<color name="document_icon_text">#34a0f4</color>
<color name="contact_icon">#608496</color>
<color name="gallery_icon">#a47ad9</color>
<color name="location_icon">#66BB6A</color>

View file

@ -87,8 +87,6 @@
<!--<item name="android:windowContentOverlay">@drawable/compat_actionbar_shadow_background</item>-->
<item name="attachment_type_selector_background">@color/white</item>
<item name="attachment_document_icon_small">@drawable/ic_document_small_light</item>
<item name="attachment_document_icon_large">@drawable/ic_document_large_light</item>
<item name="conversation_list_item_background">@drawable/conversation_list_item_background</item>
<item name="conversation_list_deaddrop_bg_color">@color/gray20</item>
@ -239,8 +237,6 @@
<item name="android:alertDialogTheme">@style/AppCompatDialogStyleDark</item>
<item name="attachment_type_selector_background">@color/gray95</item>
<item name="attachment_document_icon_small">@drawable/ic_document_small_dark</item>
<item name="attachment_document_icon_large">@drawable/ic_document_large_dark</item>
<item name="conversation_list_item_background">@drawable/conversation_list_item_background_dark</item>
<item name="conversation_list_deaddrop_bg_color">@color/import_export_item_background_dark</item>

View file

@ -23,12 +23,9 @@ public class DocumentView extends FrameLayout {
private static final String TAG = DocumentView.class.getSimpleName();
private final @NonNull AnimatingToggle controlToggle;
private final @NonNull View container;
private final @NonNull ViewGroup iconContainer;
private final @NonNull TextView fileName;
private final @NonNull TextView fileSize;
private final @NonNull TextView document;
private @Nullable SlideClickListener viewListener;
private @Nullable DocumentSlide documentSlide;
@ -46,21 +43,8 @@ public class DocumentView extends FrameLayout {
inflate(context, R.layout.document_view, this);
this.container = findViewById(R.id.document_container);
this.iconContainer = findViewById(R.id.icon_container);
this.controlToggle = findViewById(R.id.control_toggle);
this.fileName = findViewById(R.id.file_name);
this.fileSize = findViewById(R.id.file_size);
this.document = findViewById(R.id.document);
if (attrs != null) {
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.DocumentView, 0, 0);
int titleColor = typedArray.getInt(R.styleable.DocumentView_doc_titleColor, Color.BLACK);
int captionColor = typedArray.getInt(R.styleable.DocumentView_doc_captionColor, Color.BLACK);
typedArray.recycle();
fileName.setTextColor(titleColor);
fileSize.setTextColor(captionColor);
}
}
public void setDocumentClickListener(@Nullable SlideClickListener listener) {
@ -69,13 +53,15 @@ public class DocumentView extends FrameLayout {
public void setDocument(final @NonNull DocumentSlide documentSlide)
{
controlToggle.displayQuick(iconContainer);
this.documentSlide = documentSlide;
this.fileName.setText(documentSlide.getFileName().or(getContext().getString(R.string.unknown)));
this.fileSize.setText(Util.getPrettyFileSize(documentSlide.getFileSize()));
this.document.setText(getFileType(documentSlide.getFileName()));
String fileSize = Util.getPrettyFileSize(documentSlide.getFileSize())
+ " " + getFileType(documentSlide.getFileName()).toUpperCase();
this.fileSize.setText(fileSize);
this.setOnClickListener(new OpenClickedListener(documentSlide));
}