mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/7181 - Adjust ETP onboarding for toolbar positions
This commit is contained in:
parent
81a1efb92d
commit
54176609f8
@ -13,6 +13,8 @@ import android.view.View.MeasureSpec
|
||||
import android.view.WindowManager
|
||||
import android.widget.ImageView
|
||||
import android.widget.PopupWindow
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.*
|
||||
import mozilla.components.browser.session.Session
|
||||
import org.mozilla.fenix.R
|
||||
@ -44,8 +46,14 @@ class TrackingProtectionOverlay(
|
||||
private fun showTrackingProtectionOnboarding() {
|
||||
val layout = LayoutInflater.from(context)
|
||||
.inflate(R.layout.tracking_protection_onboarding_popup, null)
|
||||
val isBottomToolbar = Settings.getInstance(context).shouldUseBottomToolbar
|
||||
layout.drop_down_triangle.isGone = isBottomToolbar
|
||||
layout.pop_up_triangle.isVisible = isBottomToolbar
|
||||
layout.onboarding_message.text =
|
||||
context.getString(R.string.etp_onboarding_message_2, context.getString(R.string.app_name))
|
||||
context.getString(
|
||||
R.string.etp_onboarding_message_2,
|
||||
context.getString(R.string.app_name)
|
||||
)
|
||||
|
||||
val res = context.resources
|
||||
val trackingOnboarding = PopupWindow(
|
||||
@ -81,13 +89,18 @@ class TrackingProtectionOverlay(
|
||||
val xOffset = res.getDimensionPixelSize(R.dimen.tp_onboarding_x_offset)
|
||||
|
||||
// Positioning the popup above the tp anchor.
|
||||
val yOffset = -containerHeight - (toolbar.height / 3 * 2) + triangleHeight
|
||||
val yOffset = if (isBottomToolbar) {
|
||||
-containerHeight - (toolbar.height / 3 * 2) + triangleHeight
|
||||
} else {
|
||||
CFR_Y_OFFSET
|
||||
}
|
||||
|
||||
trackingOnboarding.showAsDropDown(trackingProtectionIcon, xOffset, yOffset)
|
||||
settings.incrementTrackingProtectionOnboardingCount()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val CFR_Y_OFFSET = -24
|
||||
private const val BUTTON_INCREASE_DPS = 12
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/drop_down_triangle"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="@dimen/tp_onboarding_triangle_height"
|
||||
android:layout_marginStart="16dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:rotation="0"
|
||||
app:srcCompat="@drawable/ic_triangle"
|
||||
android:layout_gravity="start" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/message"
|
||||
android:layout_width="@dimen/etp_onboarding_popup_width"
|
||||
@ -46,6 +57,7 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pop_up_triangle"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="@dimen/tp_onboarding_triangle_height"
|
||||
android:layout_marginStart="16dp"
|
||||
|
@ -37,7 +37,7 @@
|
||||
<dimen name="context_menu_height">48dp</dimen>
|
||||
<dimen name="context_menu_x_offset">8dp</dimen>
|
||||
<dimen name="tp_onboarding_width">256dp</dimen>
|
||||
<dimen name="tp_onboarding_x_offset">0dp</dimen>
|
||||
<dimen name="tp_onboarding_x_offset">-4dp</dimen>
|
||||
<dimen name="tp_onboarding_triangle_height">16dp</dimen>
|
||||
|
||||
<!--Quick Settings-->
|
||||
|
Loading…
Reference in New Issue
Block a user