Unverified Commit 300d8317 authored by kglazko's avatar kglazko Committed by GitHub
Browse files

Issue 5366 Vector Drawable Compat (#6904)

parent 2225b715
......@@ -9,8 +9,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.appcompat.content.res.AppCompatResources
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import androidx.core.widget.TextViewCompat
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.snackbar.ContentViewCallback
......@@ -32,9 +32,9 @@ class FenixSnackbar private constructor(
view.background = null
view.snackbar_layout.background = if (isError) {
ContextCompat.getDrawable(context, R.drawable.fenix_snackbar_error_background)
AppCompatResources.getDrawable(context, R.drawable.fenix_snackbar_error_background)
} else {
ContextCompat.getDrawable(context, R.drawable.fenix_snackbar_background)
AppCompatResources.getDrawable(context, R.drawable.fenix_snackbar_background)
}
content.snackbar_btn.increaseTapArea(actionButtonIncreaseDps)
......
......@@ -7,7 +7,7 @@ package org.mozilla.fenix.home.sessioncontrol
import android.content.res.Resources
import android.graphics.Canvas
import android.graphics.drawable.Drawable
import androidx.core.content.ContextCompat
import androidx.appcompat.content.res.AppCompatResources
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
import org.mozilla.fenix.R
......@@ -46,7 +46,7 @@ class SwipeToDeleteCallback(
isCurrentlyActive: Boolean
) {
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
val icon = ContextCompat.getDrawable(recyclerView.context, R.drawable.ic_delete)
val icon = AppCompatResources.getDrawable(recyclerView.context, R.drawable.ic_delete)
icon?.setTint(recyclerView.context.getColorFromAttr(R.attr.destructive))
val backgroundDrawable = when {
......@@ -59,7 +59,7 @@ class SwipeToDeleteCallback(
else -> R.drawable.session_background
}
val background = ContextCompat.getDrawable(recyclerView.context, backgroundDrawable)
val background = AppCompatResources.getDrawable(recyclerView.context, backgroundDrawable)
background?.let {
icon?.let {
val itemView = viewHolder.itemView
......
......@@ -7,7 +7,7 @@ package org.mozilla.fenix.home.sessioncontrol.viewholders
import android.graphics.Outline
import android.view.View
import android.view.ViewOutlineProvider
import androidx.core.content.ContextCompat
import androidx.appcompat.content.res.AppCompatResources
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.tab_in_collection.*
......@@ -74,7 +74,7 @@ class TabInCollectionViewHolder(
// If I'm the last one...
if (isLastTab) {
view.background = ContextCompat.getDrawable(view.context, R.drawable.rounded_bottom_corners)
view.background = AppCompatResources.getDrawable(view.context, R.drawable.rounded_bottom_corners)
divider_line.visibility = View.GONE
} else {
view.backgroundColor = view.context.getColorFromAttr(R.attr.above)
......
......@@ -10,6 +10,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.appcompat.content.res.AppCompatResources
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import com.google.android.material.appbar.AppBarLayout
......@@ -109,7 +110,7 @@ class ToolbarView(
)
edit.setUrlBackground(
ContextCompat.getDrawable(container.context, R.drawable.search_url_background))
AppCompatResources.getDrawable(container.context, R.drawable.search_url_background))
private = isPrivate
......
......@@ -24,7 +24,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:importantForAccessibility="no"
android:src="@drawable/ic_tab_collection"
app:srcCompat="@drawable/ic_tab_collection"
android:tint="@null"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -83,7 +83,7 @@
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/share_button_content_description"
android:src="@drawable/ic_hollow_share"
app:srcCompat="@drawable/ic_hollow_share"
app:layout_constraintBottom_toBottomOf="@id/collection_icon"
app:layout_constraintEnd_toStartOf="@id/collection_overflow_button"
app:layout_constraintTop_toTopOf="@id/collection_icon" />
......@@ -94,7 +94,7 @@
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/collection_menu_button_content_description"
android:src="@drawable/ic_menu"
app:srcCompat="@drawable/ic_menu"
app:layout_constraintBottom_toBottomOf="@id/collection_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/collection_icon" />
......
......@@ -28,7 +28,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAccessibility="no"
android:src="@drawable/ic_tab_collection"
app:srcCompat="@drawable/ic_tab_collection"
android:tint="@null"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......
......@@ -16,7 +16,7 @@
android:layout_height="0dp"
android:layout_margin="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:drawableStart="@drawable/mozac_ic_back"
app:drawableStartCompat="@drawable/mozac_ic_back"
android:drawablePadding="8dp"
app:drawableTint="@color/neutral_text"
android:gravity="start|center_vertical"
......@@ -142,7 +142,7 @@
android:layout_margin="16dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/create_collection_close"
android:src="@drawable/mozac_ic_close"
app:srcCompat="@drawable/mozac_ic_close"
android:tint="?neutral"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
......@@ -16,7 +16,7 @@
android:layout_height="0dp"
android:layout_margin="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:drawableStart="@drawable/mozac_ic_back"
app:drawableStartCompat="@drawable/mozac_ic_back"
android:drawablePadding="8dp"
app:drawableTint="@color/neutral_text"
android:gravity="start|center_vertical"
......@@ -121,7 +121,7 @@
android:layout_margin="16dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/create_collection_close"
android:src="@drawable/mozac_ic_close"
app:srcCompat="@drawable/mozac_ic_close"
android:tint="?neutral"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
......@@ -16,7 +16,7 @@
android:layout_height="0dp"
android:layout_margin="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:drawableStart="@drawable/mozac_ic_back"
app:drawableStartCompat="@drawable/mozac_ic_back"
android:drawablePadding="8dp"
android:gravity="start|center_vertical"
app:drawableTint="@color/neutral_text"
......@@ -124,7 +124,7 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_new"
app:srcCompat="@drawable/ic_new"
android:tint="?neutral"
android:importantForAccessibility="no"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -54,7 +54,7 @@
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_close"
app:srcCompat="@drawable/ic_close"
android:contentDescription="@string/history_delete_item"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -20,7 +20,7 @@
android:layout_width="0dp"
android:layout_height="80dp"
android:contentDescription="@string/app_name"
android:src="?fenixLogo"
app:srcCompat="?fenixLogo"
app:layout_constraintWidth_percent="0.75"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -43,7 +43,7 @@
<TextView
android:id="@+id/errorSummary"
android:drawableStart="@drawable/ic_info"
app:drawableStartCompat="@drawable/ic_info"
android:text="@string/sync_add_new_device_message"
android:drawablePadding="8dp"
app:drawableTint="@color/sync_error_text_color"
......
......@@ -15,7 +15,7 @@
android:layout_width="0dp"
android:layout_height="120dp"
android:layout_marginTop="40dp"
android:src="@drawable/fenix_error_1"
app:srcCompat="@drawable/fenix_error_1"
android:importantForAccessibility="no"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintWidth_percent="0.8"
......
......@@ -80,7 +80,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="8dp"
android:drawableStart="@drawable/ic_folder_icon"
app:drawableStartCompat="@drawable/ic_folder_icon"
android:drawablePadding="10dp"
android:textColor="?secondaryText"
android:textSize="16sp"
......
......@@ -24,7 +24,7 @@
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/content_description_private_browsing_button"
android:src="@drawable/private_browsing_button"
app:srcCompat="@drawable/private_browsing_button"
app:layout_constraintBottom_toTopOf="@+id/wordmark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -41,7 +41,7 @@
android:contentDescription="@string/app_name"
android:focusable="false"
android:importantForAccessibility="no"
android:src="?fenixLogo"
app:srcCompat="?fenixLogo"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -120,7 +120,7 @@
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/add_tab"
android:src="@drawable/ic_new"
app:srcCompat="@drawable/ic_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/menuButton"
app:layout_constraintStart_toEndOf="@id/toolbar_wrapper"
......@@ -132,7 +132,7 @@
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/content_description_menu"
android:src="@drawable/ic_menu"
app:srcCompat="@drawable/ic_menu"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
......
......@@ -4,7 +4,8 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
......@@ -24,7 +25,7 @@
android:textAppearance="?android:attr/textAppearanceListItem"
android:background="?android:attr/selectableItemBackground"
android:button="@null"
android:drawableStart="?android:attr/listChoiceIndicatorSingle"
app:drawableStartCompat="?android:attr/listChoiceIndicatorSingle"
android:drawablePadding="@dimen/radio_button_preference_drawable_padding"
android:paddingTop="@dimen/radio_button_preference_vertical"
android:paddingStart="@dimen/radio_button_preference_horizontal"
......@@ -39,7 +40,7 @@
android:textAppearance="?android:attr/textAppearanceListItem"
android:background="?android:attr/selectableItemBackground"
android:button="@null"
android:drawableStart="?android:attr/listChoiceIndicatorSingle"
app:drawableStartCompat="?android:attr/listChoiceIndicatorSingle"
android:drawablePadding="@dimen/radio_button_preference_drawable_padding"
android:paddingTop="@dimen/radio_button_preference_vertical"
android:paddingStart="@dimen/radio_button_preference_horizontal"
......
......@@ -76,7 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="?primaryText"
android:src="@drawable/ic_link"
app:srcCompat="@drawable/ic_link"
android:importantForAccessibility="no"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......@@ -164,14 +164,14 @@
android:id="@+id/searchScanButton"
style="@style/search_pill"
android:layout_marginEnd="@dimen/search_fragment_scan_button_margin_end"
android:drawableStart="@drawable/ic_qr"
app:drawableStartCompat="@drawable/ic_qr"
android:textOff="@string/search_scan_button"
android:textOn="@string/search_scan_button" />
<ToggleButton
android:id="@+id/searchShortcutsButton"
style="@style/search_pill"
android:drawableStart="@drawable/ic_search"
app:drawableStartCompat="@drawable/ic_search"
android:textOff="@string/search_shortcuts_button"
android:textOn="@string/search_shortcuts_button" />
</LinearLayout>
......
......@@ -15,7 +15,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableStart="@drawable/ic_info"
app:drawableStartCompat="@drawable/ic_info"
android:text="@string/sign_out_confirmation_message"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
......
......@@ -2,15 +2,15 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/site_permissions_exceptions_item_height"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="24dp"
android:paddingEnd="24dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/site_permissions_exceptions_item_height"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="24dp"
android:paddingEnd="24dp">
<ImageView
android:id="@+id/exception_icon"
......@@ -18,7 +18,7 @@
android:layout_height="24dp"
android:importantForAccessibility="no"
android:scaleType="fitCenter"
android:drawableStart="@drawable/ic_internet"/>
app:drawableStartCompat="@drawable/ic_internet"/>
<TextView
android:id="@+id/exception_text"
......
......@@ -35,7 +35,7 @@
android:padding="10dp"
android:background="@drawable/favicon_background"
android:backgroundTint="?accentHighContrast"
android:src="@drawable/mozac_ic_check" />
app:srcCompat="@drawable/mozac_ic_check" />
</ImageSwitcher>
<TextView
......@@ -77,7 +77,7 @@
android:layout_height="@dimen/glyph_button_height"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/content_description_menu"
android:src="@drawable/ic_menu"
app:srcCompat="@drawable/ic_menu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment