Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #6054: Adds toolbar position to core ping
Browse files Browse the repository at this point in the history
  • Loading branch information
sblatz committed Nov 15, 2019
1 parent 6794f28 commit d02a2c7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 57 deletions.
Expand Up @@ -57,7 +57,7 @@ import org.mozilla.fenix.mvi.getManagedEmitter
* Fragment used for browsing the web within the main app.
*/
@ExperimentalCoroutinesApi
@Suppress("TooManyFunctions")
@Suppress("TooManyFunctions", "LargeClass")
class BrowserFragment : BaseBrowserFragment(), BackHandler {

private val windowFeature = ViewBoundFeatureWrapper<WindowFeature>()
Expand Down Expand Up @@ -130,11 +130,10 @@ class BrowserFragment : BaseBrowserFragment(), BackHandler {
super.onStart()
subscribeToTabCollections()
getSessionById()?.register(toolbarSessionObserver, this, autoPause = true)

updateToolbar()
updateEngineBottomMargin()
}

private fun updateToolbar() {
private fun updateEngineBottomMargin() {
val browserEngine = swipeRefresh.layoutParams as CoordinatorLayout.LayoutParams

browserEngine.bottomMargin = if (requireContext().settings().shouldUseBottomToolbar) {
Expand Down Expand Up @@ -332,7 +331,7 @@ class BrowserFragment : BaseBrowserFragment(), BackHandler {

private fun shouldShowTrackingProtectionOnboarding(session: Session) =
context?.settings()?.shouldShowTrackingProtectionOnboarding ?: false &&
session.trackerBlockingEnabled && session.trackersBlocked.isNotEmpty()
session.trackerBlockingEnabled && session.trackersBlocked.isNotEmpty()

companion object {
private const val THREE = 3
Expand Down
Expand Up @@ -7,7 +7,6 @@ package org.mozilla.fenix.browser
import android.animation.ValueAnimator
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.Gravity
import android.view.View
import android.view.View.SCROLL_AXIS_VERTICAL
Expand Down Expand Up @@ -97,8 +96,6 @@ class BrowserToolbarTopBehavior(
override fun layoutDependsOn(parent: CoordinatorLayout, child: BrowserToolbar, dependency: View): Boolean {
if (dependency is Snackbar.SnackbarLayout) {
positionSnackbar(dependency)
} else {
Log.d("Sawyer", "depenedency: $dependency")
}

return super.layoutDependsOn(parent, child, dependency)
Expand Down
Expand Up @@ -6,8 +6,8 @@ package org.mozilla.fenix.components.metrics

import android.content.Context
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import mozilla.components.service.glean.BuildConfig
import mozilla.components.service.glean.Glean
import mozilla.components.service.glean.config.Configuration
Expand Down Expand Up @@ -485,6 +485,7 @@ class GleanMetricsService(private val context: Context) : MetricsService {
mozillaProducts.set(MozillaProductDetector.getInstalledMozillaProducts(context))
adjustCampaign.set(context.settings().adjustCampaignId)
totalUriCount.set(context.settings().totalUriCount.toString())
toolbarPosition.set(context.settings().toolbarSettingString)
}

SearchDefaultEngine.apply {
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion app/src/main/java/org/mozilla/fenix/utils/Settings.kt
Expand Up @@ -201,7 +201,8 @@ class Settings private constructor(

val shouldUseFixedToolbar: Boolean
get() {
val accessibilityManager = appContext.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
val accessibilityManager =
appContext.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
return accessibilityManager?.isTouchExplorationEnabled ?: false
}

Expand Down
3 changes: 2 additions & 1 deletion docs/metrics.md
Expand Up @@ -103,6 +103,7 @@ The following metrics are added to the ping:
| media_state.pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media playback was paused. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-03-01 |
| media_state.play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media started playing. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-03-01 |
| media_state.stop |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media playback has ended. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-03-01 |
| metrics.toolbar_position |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The browser toolbar position |[1](https://github.com/mozilla-mobile/fenix/pull/6608)|<ul><li>position: A string that indicates the new position of the toolbar TOP or BOTTOM</li></ul>|2020-03-01 |
| private_browsing_mode.garbage_icon |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the garbage can icon on the private browsing home page, deleting all private tabs. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-03-01 |
| private_browsing_mode.notification_delete |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the private browsing mode notification's "Delete and Open" button. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-03-01 |
| private_browsing_mode.notification_open |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the private browsing mode notification's "Open" button. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-03-01 |
Expand Down Expand Up @@ -142,7 +143,7 @@ The following metrics are added to the ping:
| sync_auth.sign_up |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |User registered a new Firefox Account, and was signed into it |[1](https://github.com/mozilla-mobile/fenix/pull/4931#issuecomment-529740300)||2020-03-01 |
| tab.media_pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-03-01 |
| tab.media_play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-03-01 |
| toolbar_settings.changed_position |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user selected a new position for the toolbar |[1](https://github.com/mozilla-mobile/fenix/pull/6571)|<ul><li>position: A string that indicates the new position of the toolbar TOP or BOTTOM</li></ul>|2020-03-01 |
| toolbar_settings.changed_position |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user selected a new position for the toolbar |[1](https://github.com/mozilla-mobile/fenix/pull/6608)|<ul><li>position: A string that indicates the new position of the toolbar TOP or BOTTOM</li></ul>|2020-03-01 |
| tracking_protection.etp_setting_changed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user changed their tracking protection level setting to either strict or standard. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)|<ul><li>etp_setting: The new setting for ETP: strict, standard</li></ul>|2020-03-01 |
| tracking_protection.etp_settings |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened tracking protection settings through settings. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)||2020-03-01 |
| tracking_protection.etp_shield |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the tracking protection shield icon in toolbar. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)||2020-03-01 |
Expand Down

0 comments on commit d02a2c7

Please sign in to comment.