1
0
Fork 0

For #5359 , #5360 - Update ETP Vectors for Android 5+6

master
Emily Kager 2019-09-16 13:52:06 -07:00 committed by Emily Kager
parent 0eca317d03
commit 140da0dd0f
5 changed files with 33 additions and 17 deletions

View File

@ -6,6 +6,7 @@ package org.mozilla.fenix.components.toolbar
import android.content.Context
import android.view.ViewGroup
import androidx.appcompat.content.res.AppCompatResources
import androidx.navigation.NavOptions
import androidx.navigation.Navigation
import com.airbnb.lottie.LottieCompositionFactory
@ -70,9 +71,15 @@ class ToolbarIntegration(
context.settings.shouldUseTrackingProtection && FeatureFlags.etpCategories
toolbar.setTrackingProtectionIcons(
iconOnNoTrackersBlocked = context.getDrawable(R.drawable.ic_tracking_protection_enabled)!!,
iconOnNoTrackersBlocked = AppCompatResources.getDrawable(
context,
R.drawable.ic_tracking_protection_enabled
)!!,
iconOnTrackersBlocked = lottieDrawable,
iconDisabledForSite = context.getDrawable(R.drawable.ic_tracking_protection_disabled)!!
iconDisabledForSite = AppCompatResources.getDrawable(
context,
R.drawable.ic_tracking_protection_disabled
)!!
)
}

View File

@ -8,6 +8,7 @@ import android.app.Activity
import android.content.Context
import android.view.Gravity
import android.view.View
import androidx.appcompat.content.res.AppCompatResources
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.widget.NestedScrollView
import com.airbnb.lottie.LottieCompositionFactory
@ -69,9 +70,15 @@ class CustomTabsIntegration(
toolbar.displaySeparatorView = false
toolbar.setTrackingProtectionIcons(
iconOnNoTrackersBlocked = context.getDrawable(R.drawable.ic_tracking_protection_enabled)!!,
iconOnNoTrackersBlocked = AppCompatResources.getDrawable(
context,
R.drawable.ic_tracking_protection_enabled
)!!,
iconOnTrackersBlocked = lottieDrawable,
iconDisabledForSite = context.getDrawable(R.drawable.ic_tracking_protection_disabled)!!
iconDisabledForSite = AppCompatResources.getDrawable(
context,
R.drawable.ic_tracking_protection_disabled
)!!
)
}
}

View File

@ -7,18 +7,20 @@ package org.mozilla.fenix.trackingprotection
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.appcompat.content.res.AppCompatResources
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.withStyledAttributes
import kotlinx.android.synthetic.main.switch_with_description.view.*
import kotlinx.android.synthetic.main.tracking_protection_category.view.switchItemDescription
import kotlinx.android.synthetic.main.tracking_protection_category.view.switchItemTitle
import mozilla.components.support.ktx.android.view.putCompoundDrawablesRelativeWithIntrinsicBounds
import org.mozilla.fenix.R
class SwitchWithDescription @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs) {
) : ConstraintLayout(context, attrs, defStyleAttr) {
init {
LayoutInflater.from(context).inflate(R.layout.switch_with_description, this, true)
@ -28,19 +30,19 @@ class SwitchWithDescription @JvmOverloads constructor(
R.styleable.SwitchWithDescription_switchIcon,
R.drawable.ic_tracking_protection
)
switch_widget?.setCompoundDrawablesWithIntrinsicBounds(
resources.getDrawable(
id,
context.theme
), null, null, null
switch_widget.putCompoundDrawablesRelativeWithIntrinsicBounds(
start = AppCompatResources.getDrawable(
context,
id
)
)
switchItemTitle?.text = resources.getString(
switchItemTitle.text = resources.getString(
getResourceId(
R.styleable.SwitchWithDescription_switchTitle,
R.string.preference_enhanced_tracking_protection
)
)
switchItemDescription?.text = resources.getString(
switchItemDescription.text = resources.getString(
getResourceId(
R.styleable.SwitchWithDescription_switchDescription,
R.string.preference_enhanced_tracking_protection_explanation

View File

@ -167,7 +167,7 @@
style="@style/QuickSettingsText.Icon"
android:layout_width="match_parent"
android:layout_height="@dimen/tracking_protection_item_height"
android:drawableStart="@drawable/ic_settings"
app:drawableStartCompat="@drawable/ic_settings"
android:paddingEnd="24dp"
android:text="@string/etp_settings"
app:layout_constraintTop_toBottomOf="@id/line_divider" />

View File

@ -14,9 +14,9 @@
android:layout_height="0dp"
android:adjustViewBounds="true"
android:importantForAccessibility="no"
android:src="@drawable/ic_etp_artwork"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_etp_artwork" />
<TextView
android:id="@android:id/title"
@ -69,11 +69,11 @@
android:layout_height="0dp"
android:layout_marginStart="12dp"
android:importantForAccessibility="no"
android:src="@drawable/ic_arrowhead_right"
android:tint="@color/primary_text_dark_theme"
app:layout_constraintBottom_toBottomOf="@id/learn_more"
app:layout_constraintStart_toEndOf="@id/learn_more"
app:layout_constraintTop_toTopOf="@id/learn_more" />
app:layout_constraintTop_toTopOf="@id/learn_more"
app:srcCompat="@drawable/ic_arrowhead_right" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"