Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load all vector drawables with AppCompat for consistency #4411

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.text.Spanned;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -21,10 +22,10 @@
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.TooltipCompat;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
Expand Down Expand Up @@ -535,7 +536,8 @@ protected void setMediaPreviews(

final Attachment.Type type = attachment.getType();
if (showingContent && (type == Attachment.Type.VIDEO || type == Attachment.Type.GIFV)) {
imageView.setForeground(ContextCompat.getDrawable(itemView.getContext(), R.drawable.play_indicator_overlay));
imageView.setForegroundGravity(Gravity.CENTER);
imageView.setForeground(AppCompatResources.getDrawable(itemView.getContext(), R.drawable.ic_play_indicator));
} else {
imageView.setForeground(null);
}
Expand Down Expand Up @@ -611,7 +613,7 @@ protected void setMediaLabel(@NonNull List<Attachment> attachments, boolean sens

// Set the icon next to the label.
int drawableId = getLabelIcon(attachments.get(0).getType());
mediaLabel.setCompoundDrawablesWithIntrinsicBounds(drawableId, 0, 0, 0);
mediaLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(drawableId, 0, 0, 0);

setAttachmentClickListener(mediaLabel, listener, i, mediaDescriptions[i], false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.content.res.AppCompatResources
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.google.android.material.datepicker.CalendarConstraints
import com.google.android.material.datepicker.DateValidatorPointForward
import com.google.android.material.datepicker.MaterialDatePicker
Expand Down Expand Up @@ -89,10 +89,10 @@ class ComposeScheduleView
}

private fun setEditIcons() {
val icon = ContextCompat.getDrawable(context, R.drawable.ic_create_24dp) ?: return
val icon = AppCompatResources.getDrawable(context, R.drawable.ic_create_24dp) ?: return
val size = binding.scheduledDateTime.lineHeight
icon.setBounds(0, 0, size, size)
binding.scheduledDateTime.setCompoundDrawables(null, null, icon, null)
binding.scheduledDateTime.setCompoundDrawablesRelative(null, null, icon, null)
}

fun setResetOnClickListener(listener: OnClickListener?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import android.text.style.StyleSpan
import android.view.View
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.text.toSpannable
import androidx.recyclerview.widget.RecyclerView
import at.connyduck.sparkbutton.helpers.Utils
Expand Down Expand Up @@ -173,7 +173,7 @@ internal class StatusNotificationViewHolder(
@DrawableRes drawable: Int,
@ColorRes color: Int
): Drawable? {
val icon = ContextCompat.getDrawable(context, drawable)
val icon = AppCompatResources.getDrawable(context, drawable)
icon?.setTint(context.getColor(color))
return icon
}
Expand Down Expand Up @@ -247,7 +247,7 @@ internal class StatusNotificationViewHolder(
format = context.getString(R.string.notification_favourite_format)
}
}
binding.notificationTopText.setCompoundDrawablesWithIntrinsicBounds(
binding.notificationTopText.setCompoundDrawablesRelativeWithIntrinsicBounds(
icon,
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class StatusViewHelper(private val itemView: View) {

// Set the icon next to the label.
val drawableId = getLabelIcon(attachments[0].type)
mediaLabel.setCompoundDrawablesWithIntrinsicBounds(drawableId, 0, 0, 0)
mediaLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(drawableId, 0, 0, 0)

mediaLabel.setOnClickListener { listener.onViewMedia(null, 0) }
}
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/drawable/background_circle.xml

This file was deleted.

11 changes: 0 additions & 11 deletions app/src/main/res/drawable/ic_arrow_back.xml

This file was deleted.

25 changes: 13 additions & 12 deletions app/src/main/res/drawable/ic_arrow_back_with_background.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/background_circle" android:width="32dp" android:height="32dp"/>

<item android:drawable="@drawable/ic_arrow_back"
android:top="4dp"
android:bottom="4dp"
android:left="4dp"
android:right="4dp"/>

</layer-list>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:autoMirrored="true"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:fillColor="@color/toolbar_icon_background"
android:pathData="M16 0C7.152 0 0 7.152 0 16s7.152 16 16 16 16-7.152 16-16S24.848 0 16 0z" />
<path
android:fillColor="?attr/colorControlNormal"
android:pathData="M24 15H11.83l5.59-5.59L16 8l-8 8 8 8 1.41-1.41L11.83 17H24v-2z" />
</vector>
10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_more.xml

This file was deleted.

24 changes: 12 additions & 12 deletions app/src/main/res/drawable/ic_more_with_background.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/background_circle" android:width="32dp" android:height="32dp"/>

<item android:drawable="@drawable/ic_more"
android:top="4dp"
android:bottom="4dp"
android:left="4dp"
android:right="4dp"/>

</layer-list>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:fillColor="@color/toolbar_icon_background"
android:pathData="M16 0C7.152 0 0 7.152 0 16s7.152 16 16 16 16-7.152 16-16S24.848 0 16 0z" />
<path
android:fillColor="?attr/colorControlNormal"
android:pathData="M16 12c1.1 0 2-0.9 2-2s-0.9-2-2-2-2 0.9-2 2 0.9 2 2 2zm0 2c-1.1 0-2 0.9-2 2s0.9 2 2 2 2-0.9 2-2-0.9-2-2-2zm0 6c-1.1 0-2 0.9-2 2s0.9 2 2 2 2-0.9 2-2-0.9-2-2-2z" />
</vector>
6 changes: 0 additions & 6 deletions app/src/main/res/drawable/play_indicator_overlay.xml

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/main/res/layout-land/fragment_report_done.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_check_24dp"
app:layout_constraintBottom_toBottomOf="@id/checkMark"
app:layout_constraintEnd_toEndOf="@id/checkMark"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.25"
app:layout_constraintStart_toStartOf="@id/checkMark"
app:layout_constraintTop_toTopOf="@id/checkMark"
app:layout_constraintHeight_default="percent"
app:srcCompat="@drawable/ic_check_24dp"
tools:ignore="ContentDescription" />

<TextView
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_filters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:contentDescription="@string/filter_addition_title"
android:src="@drawable/ic_plus_24dp"
app:layout_anchor="@id/filtersList"
app:layout_anchorGravity="bottom|end" />
app:layout_anchorGravity="bottom|end"
app:srcCompat="@drawable/ic_plus_24dp" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_tab_preference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:contentDescription="@string/action_add_tab"
android:src="@drawable/ic_plus_24dp" />
app:srcCompat="@drawable/ic_plus_24dp" />

<com.google.android.material.card.MaterialCardView
android:id="@+id/sheet"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_report_done.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_check_24dp"
app:layout_constraintBottom_toBottomOf="@id/checkMark"
app:srcCompat="@drawable/ic_check_24dp"
app:layout_constraintEnd_toEndOf="@id/checkMark"
app:layout_constraintHeight_percent="0.3"
app:layout_constraintStart_toStartOf="@id/checkMark"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
android:layout_height="24dp"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:src="@drawable/bot_badge"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/account_avatar"
app:layout_constraintEnd_toEndOf="@id/account_avatar"
app:srcCompat="@drawable/bot_badge"
tools:src="#000"
tools:visibility="visible" />

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/item_add_poll_option.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

Expand All @@ -21,12 +22,12 @@
<ImageButton
android:id="@+id/deleteButton"
style="@style/TuskyImageButton"
android:layout_marginStart="8dp"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/action_remove"
android:layout_gravity="bottom"
android:layout_marginStart="8dp"
android:layout_marginBottom="8dp"
android:src="@drawable/ic_clear_24dp" />
android:contentDescription="@string/action_remove"
app:srcCompat="@drawable/ic_clear_24dp" />

</LinearLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_autocomplete_account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/profile_badge_bot_text"
android:src="@drawable/bot_badge"
app:layout_constraintBottom_toBottomOf="@id/avatar"
app:layout_constraintEnd_toEndOf="@id/avatar" />
app:layout_constraintEnd_toEndOf="@id/avatar"
app:srcCompat="@drawable/bot_badge" />

<TextView
android:id="@+id/displayName"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_blocked_user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/profile_badge_bot_text"
android:src="@drawable/bot_badge"
app:layout_constraintBottom_toBottomOf="@id/blocked_user_avatar"
app:layout_constraintEnd_toEndOf="@id/blocked_user_avatar" />
app:layout_constraintEnd_toEndOf="@id/blocked_user_avatar"
app:srcCompat="@drawable/bot_badge" />

<TextView
android:id="@+id/blocked_user_display_name"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_follow_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/profile_badge_bot_text"
android:src="@drawable/bot_badge"
app:layout_constraintBottom_toBottomOf="@id/avatar"
app:layout_constraintEnd_toEndOf="@id/avatar" />
app:layout_constraintEnd_toEndOf="@id/avatar"
app:srcCompat="@drawable/bot_badge" />

<TextView
android:id="@+id/displayNameTextView"
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/layout/item_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,34 @@

<ImageButton
android:id="@+id/more_button"
android:visibility="gone"
style="@style/TuskyImageButton"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/action_more"
android:layout_marginLeft="8dp"
android:src="@drawable/ic_more_horiz_24dp" />
android:visibility="gone"
app:srcCompat="@drawable/ic_more_horiz_24dp" />

<ImageButton
android:id="@+id/add_button"
android:visibility="gone"
style="@style/TuskyImageButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_add_to_list"
android:layout_marginLeft="8dp"
android:src="@drawable/ic_plus_24dp" />
android:visibility="gone"
app:srcCompat="@drawable/ic_plus_24dp" />

<ImageButton
android:id="@+id/remove_button"
android:visibility="gone"
style="@style/TuskyImageButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_remove_from_list"
android:layout_marginLeft="8dp"
android:src="@drawable/ic_clear_24dp" />
android:visibility="gone"
app:srcCompat="@drawable/ic_clear_24dp" />
</LinearLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_muted_user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/profile_badge_bot_text"
android:src="@drawable/bot_badge"
app:layout_constraintBottom_toBottomOf="@id/muted_user_avatar"
app:layout_constraintEnd_toEndOf="@id/muted_user_avatar" />
app:layout_constraintEnd_toEndOf="@id/muted_user_avatar"
app:srcCompat="@drawable/bot_badge" />

<TextView
android:id="@+id/muted_user_display_name"
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/layout/item_tab_preference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
android:layout_gravity="end"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:src="@drawable/ic_drag_indicator_24dp"
tools:ignore="ContentDescription"
app:layout_constraintBottom_toBottomOf="@id/textView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/textView"/>
app:srcCompat="@drawable/ic_drag_indicator_24dp"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/textView"
Expand Down Expand Up @@ -52,9 +52,9 @@
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_delete"
android:src="@drawable/ic_clear_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_clear_24dp" />

<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
Expand Down