2019-09-10 22:29:21 +02:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
package org.mozilla.fenix.trackingprotection
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.util.AttributeSet
|
|
|
|
import android.view.LayoutInflater
|
2020-06-01 17:55:43 +02:00
|
|
|
import androidx.appcompat.content.res.AppCompatResources
|
2019-09-10 22:29:21 +02:00
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
import androidx.core.content.withStyledAttributes
|
|
|
|
import kotlinx.android.synthetic.main.tracking_protection_category.view.*
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
|
|
|
class TrackingProtectionCategoryItem @JvmOverloads constructor(
|
|
|
|
context: Context,
|
|
|
|
attrs: AttributeSet? = null,
|
|
|
|
defStyleAttr: Int = 0
|
|
|
|
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
|
|
|
init {
|
|
|
|
LayoutInflater.from(context).inflate(R.layout.tracking_protection_category, this, true)
|
|
|
|
|
|
|
|
context.withStyledAttributes(
|
|
|
|
attrs,
|
|
|
|
R.styleable.TrackingProtectionCategory,
|
|
|
|
defStyleAttr,
|
|
|
|
0
|
|
|
|
) {
|
|
|
|
val id = getResourceId(
|
|
|
|
R.styleable.TrackingProtectionCategory_categoryItemIcon,
|
|
|
|
R.drawable.ic_cryptominers
|
|
|
|
)
|
2020-06-01 17:55:43 +02:00
|
|
|
trackingProtectionCategoryIcon?.background = AppCompatResources.getDrawable(context, id)
|
2019-12-21 23:14:50 +01:00
|
|
|
trackingProtectionCategoryTitle?.text = resources.getString(
|
2019-09-10 22:29:21 +02:00
|
|
|
getResourceId(
|
|
|
|
R.styleable.TrackingProtectionCategory_categoryItemTitle,
|
|
|
|
R.string.etp_cookies_title
|
|
|
|
)
|
|
|
|
)
|
2019-12-21 23:14:50 +01:00
|
|
|
trackingProtectionCategoryItemDescription?.text = resources.getString(
|
2019-09-10 22:29:21 +02:00
|
|
|
getResourceId(
|
|
|
|
R.styleable.TrackingProtectionCategory_categoryItemDescription,
|
|
|
|
R.string.etp_cookies_description
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|