Skip to content

Commit 118a49a

Browse files
Tab Switcher Animation: Add real tracker count (#5723)
Task/Issue URL: https://app.asana.com/0/488551667048375/1209368500700765 Replaced random tracker count with actual tracker data from the past 7 days in the tab switcher animation tile. The tracker count is now fetched from the WebTrackersBlockedAppRepository instead of generating random numbers. _Tab Switcher Tracker Count_ - [x] Open the tab switcher - [x] Verify the tracker count shown matches the actual number of trackers blocked in the last 7 days - [x] Verify the tracker animation tile displays correctly in both grid and list views (Tablet omitted as only count has changed) https://github.com/user-attachments/assets/044501d7-a61f-478c-b0ea-19e59ac35049 --------- Co-authored-by: Dax The Translator <[email protected]>
1 parent 0ed80a0 commit 118a49a

File tree

52 files changed

+712
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+712
-65
lines changed

app/src/androidTest/java/com/duckduckgo/app/global/view/ClearPersonalDataActionTest.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import com.duckduckgo.app.fire.UnsentForgetAllPixelStore
2727
import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteEntity
2828
import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteRepository
2929
import com.duckduckgo.app.settings.db.SettingsDataStore
30+
import com.duckduckgo.app.tabs.TabSwitcherAnimationFeature
3031
import com.duckduckgo.app.tabs.model.TabRepository
32+
import com.duckduckgo.app.tabs.store.TabSwitcherDataStore
3133
import com.duckduckgo.cookies.api.DuckDuckGoCookieManager
3234
import com.duckduckgo.history.api.NavigationHistory
3335
import com.duckduckgo.privacyprotectionspopup.api.PrivacyProtectionsPopupDataClearer
@@ -38,6 +40,7 @@ import kotlinx.coroutines.test.runTest
3840
import org.junit.Before
3941
import org.junit.Test
4042
import org.mockito.kotlin.any
43+
import org.mockito.kotlin.doReturn
4144
import org.mockito.kotlin.mock
4245
import org.mockito.kotlin.never
4346
import org.mockito.kotlin.verify
@@ -63,6 +66,10 @@ class ClearPersonalDataActionTest {
6366
private val mockSitePermissionsManager: SitePermissionsManager = mock()
6467
private val mockPrivacyProtectionsPopupDataClearer: PrivacyProtectionsPopupDataClearer = mock()
6568
private val mockNavigationHistory: NavigationHistory = mock()
69+
private val mockTabSwitcherAnimationFeature: TabSwitcherAnimationFeature = mock {
70+
on { self() } doReturn mock()
71+
}
72+
private val mockTabSwitcherDataStore: TabSwitcherDataStore = mock()
6673

6774
private val fireproofWebsites: LiveData<List<FireproofWebsiteEntity>> = MutableLiveData()
6875

@@ -84,6 +91,8 @@ class ClearPersonalDataActionTest {
8491
privacyProtectionsPopupDataClearer = mockPrivacyProtectionsPopupDataClearer,
8592
sitePermissionsManager = mockSitePermissionsManager,
8693
navigationHistory = mockNavigationHistory,
94+
tabSwitcherAnimationFeature = mockTabSwitcherAnimationFeature,
95+
tabSwitcherDataStore = mockTabSwitcherDataStore,
8796
)
8897
whenever(mockFireproofWebsiteRepository.getFireproofWebsites()).thenReturn(fireproofWebsites)
8998
whenever(mockDeviceSyncState.isUserSignedInOnDevice()).thenReturn(true)
@@ -155,4 +164,21 @@ class ClearPersonalDataActionTest {
155164
testee.clearTabsAndAllDataAsync(appInForeground = false, shouldFireDataClearPixel = false)
156165
verify(mockPrivacyProtectionsPopupDataClearer).clearPersonalData()
157166
}
167+
168+
@Test
169+
fun whenClearCalledAndAnimationTileEnabledThenAnimationTileIsReset() = runTest {
170+
whenever(mockTabSwitcherAnimationFeature.self().isEnabled(any())).thenReturn(true)
171+
172+
testee.clearTabsAndAllDataAsync(appInForeground = false, shouldFireDataClearPixel = false)
173+
verify(mockTabSwitcherDataStore, never()).setIsAnimationTileDismissed(false)
174+
verify(mockTabSwitcherDataStore).setAnimationTileSeen(false)
175+
}
176+
177+
@Test
178+
fun whenClearCalledAndAnimationTileDisabledThenAnimationTileIsNotReset() = runTest {
179+
whenever(mockTabSwitcherAnimationFeature.self().isEnabled(any())).thenReturn(false)
180+
181+
testee.clearTabsAndAllDataAsync(appInForeground = false, shouldFireDataClearPixel = false)
182+
verifyNoInteractions(mockTabSwitcherDataStore)
183+
}
158184
}

app/src/internal/java/com/duckduckgo/app/dev/settings/DevSettingsActivity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class DevSettingsActivity : DuckDuckGoActivity() {
109109
binding.customTabs.setOnClickListener { viewModel.customTabsClicked() }
110110
binding.notifications.setOnClickListener { viewModel.notificationsClicked() }
111111
binding.tabs.setOnClickListener { viewModel.tabsClicked() }
112+
binding.showTabSwitcherAnimatedTile.setOnClickListener { viewModel.showAnimatedTileClicked() }
112113
}
113114

114115
private fun observeViewModel() {
@@ -139,6 +140,7 @@ class DevSettingsActivity : DuckDuckGoActivity() {
139140
is CustomTabs -> showCustomTabs()
140141
Notifications -> showNotifications()
141142
Tabs -> showTabs()
143+
is Command.Toast -> showToast(it.message)
142144
}
143145
}
144146

@@ -187,6 +189,10 @@ class DevSettingsActivity : DuckDuckGoActivity() {
187189
startActivity(DevTabsActivity.intent(this))
188190
}
189191

192+
private fun showToast(message: String) {
193+
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
194+
}
195+
190196
companion object {
191197
fun intent(context: Context): Intent {
192198
return Intent(context, DevSettingsActivity::class.java)

app/src/internal/java/com/duckduckgo/app/dev/settings/DevSettingsViewModel.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.duckduckgo.anvil.annotations.ContributesViewModel
2222
import com.duckduckgo.app.dev.settings.db.DevSettingsDataStore
2323
import com.duckduckgo.app.dev.settings.db.UAOverride
2424
import com.duckduckgo.app.survey.api.SurveyEndpointDataStore
25+
import com.duckduckgo.app.tabs.store.TabSwitcherPrefsDataStore
2526
import com.duckduckgo.common.utils.DispatcherProvider
2627
import com.duckduckgo.di.scopes.ActivityScope
2728
import com.duckduckgo.savedsites.api.SavedSitesRepository
@@ -45,6 +46,7 @@ class DevSettingsViewModel @Inject constructor(
4546
private val savedSitesRepository: SavedSitesRepository,
4647
private val dispatcherProvider: DispatcherProvider,
4748
private val surveyEndpointDataStore: SurveyEndpointDataStore,
49+
private val tabSwitcherPrefsDataStore: TabSwitcherPrefsDataStore,
4850
) : ViewModel() {
4951

5052
data class ViewState(
@@ -62,6 +64,7 @@ class DevSettingsViewModel @Inject constructor(
6264
object CustomTabs : Command()
6365
data object Notifications : Command()
6466
data object Tabs : Command()
67+
data class Toast(val message: String) : Command()
6568
}
6669

6770
private val viewState = MutableStateFlow(ViewState())
@@ -147,4 +150,12 @@ class DevSettingsViewModel @Inject constructor(
147150
fun tabsClicked() {
148151
viewModelScope.launch { command.send(Command.Tabs) }
149152
}
153+
154+
fun showAnimatedTileClicked() {
155+
viewModelScope.launch {
156+
tabSwitcherPrefsDataStore.setIsAnimationTileDismissed(isDismissed = false)
157+
tabSwitcherPrefsDataStore.setAnimationTileSeen(isSeen = false)
158+
command.send(Command.Toast("Animated tile dismissal has been reset"))
159+
}
160+
}
150161
}

app/src/internal/res/layout/activity_dev_settings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@
102102
app:primaryText="@string/devSettingsScreenTabs"
103103
app:secondaryText="@string/devSettingsScreenTabsSubtitle" />
104104

105+
<com.duckduckgo.common.ui.view.listitem.TwoLineListItem
106+
android:id="@+id/showTabSwitcherAnimatedTile"
107+
android:layout_width="match_parent"
108+
android:layout_height="wrap_content"
109+
app:primaryText="@string/devSettingsShowTabSwitcherAnimatedTile"
110+
app:secondaryText="@string/devSettingsShowTabSwitcherAnimatedSubtitle" />
111+
105112
<com.duckduckgo.common.ui.view.listitem.SectionHeaderListItem
106113
android:id="@+id/privacyTitle"
107114
android:layout_width="wrap_content"

app/src/internal/res/values/donottranslate.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
<string name="devSettingsScreenUserAgentFirefox">Firefox</string>
4747
<string name="devSettingsScreenUserAgentDefault">Default</string>
4848
<string name="devSettingsScreenUserAgentWebView">UA WebView</string>
49+
<string name="devSettingsShowTabSwitcherAnimatedTile">Reset TabSwitcher Animated Tile</string>
50+
<string name="devSettingsShowTabSwitcherAnimatedSubtitle">Click here to reset the animated tile if you have previously dismissed it</string>
4951

5052
<!-- Tabs -->
5153
<string name="devSettingsScreenTabs">Tabs</string>

app/src/main/java/com/duckduckgo/app/browser/tabs/adapter/TabSwitcherItemDiffCallback.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package com.duckduckgo.app.browser.tabs.adapter
1919
import android.os.Bundle
2020
import androidx.recyclerview.widget.DiffUtil
2121
import com.duckduckgo.app.tabs.ui.TabSwitcherItem
22-
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.ANIMATED_TILE_DEFAULT_ALPHA
23-
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.ANIMATED_TILE_NO_REPLACE_ALPHA
22+
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.Companion.ANIMATED_TILE_DEFAULT_ALPHA
23+
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.Companion.ANIMATED_TILE_NO_REPLACE_ALPHA
2424

2525
class TabSwitcherItemDiffCallback(
2626
old: List<TabSwitcherItem>,

app/src/main/java/com/duckduckgo/app/di/PrivacyModule.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ import com.duckduckgo.app.location.data.LocationPermissionsDao
3636
import com.duckduckgo.app.location.data.LocationPermissionsRepository
3737
import com.duckduckgo.app.location.data.LocationPermissionsRepositoryImpl
3838
import com.duckduckgo.app.settings.db.SettingsDataStore
39+
import com.duckduckgo.app.tabs.TabSwitcherAnimationFeature
3940
import com.duckduckgo.app.tabs.model.TabRepository
41+
import com.duckduckgo.app.tabs.store.TabSwitcherPrefsDataStore
4042
import com.duckduckgo.app.trackerdetection.EntityLookup
4143
import com.duckduckgo.app.trackerdetection.TdsEntityLookup
4244
import com.duckduckgo.app.trackerdetection.db.TdsDomainEntityDao
@@ -84,6 +86,8 @@ object PrivacyModule {
8486
privacyProtectionsPopupDataClearer: PrivacyProtectionsPopupDataClearer,
8587
navigationHistory: NavigationHistory,
8688
dispatcherProvider: DispatcherProvider,
89+
tabSwitcherAnimationFeature: TabSwitcherAnimationFeature,
90+
tabSwitcherPrefsDataStore: TabSwitcherPrefsDataStore,
8791
): ClearDataAction {
8892
return ClearPersonalDataAction(
8993
context,
@@ -102,6 +106,8 @@ object PrivacyModule {
102106
privacyProtectionsPopupDataClearer,
103107
navigationHistory,
104108
dispatcherProvider,
109+
tabSwitcherAnimationFeature,
110+
tabSwitcherPrefsDataStore,
105111
)
106112
}
107113

app/src/main/java/com/duckduckgo/app/global/view/ClearPersonalDataAction.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ import com.duckduckgo.app.fire.FireActivity
2929
import com.duckduckgo.app.fire.UnsentForgetAllPixelStore
3030
import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteRepository
3131
import com.duckduckgo.app.settings.db.SettingsDataStore
32+
import com.duckduckgo.app.tabs.TabSwitcherAnimationFeature
3233
import com.duckduckgo.app.tabs.model.TabRepository
34+
import com.duckduckgo.app.tabs.store.TabSwitcherDataStore
3335
import com.duckduckgo.common.utils.DefaultDispatcherProvider
3436
import com.duckduckgo.common.utils.DispatcherProvider
3537
import com.duckduckgo.cookies.api.DuckDuckGoCookieManager
@@ -73,6 +75,8 @@ class ClearPersonalDataAction(
7375
private val privacyProtectionsPopupDataClearer: PrivacyProtectionsPopupDataClearer,
7476
private val navigationHistory: NavigationHistory,
7577
private val dispatchers: DispatcherProvider = DefaultDispatcherProvider(),
78+
private val tabSwitcherAnimationFeature: TabSwitcherAnimationFeature,
79+
private val tabSwitcherDataStore: TabSwitcherDataStore,
7680
) : ClearDataAction {
7781

7882
override fun killAndRestartProcess(notifyDataCleared: Boolean, enableTransitionAnimation: Boolean) {
@@ -121,6 +125,9 @@ class ClearPersonalDataAction(
121125
dataManager.clearWebViewSessions()
122126
tabRepository.deleteAll()
123127
adClickManager.clearAll()
128+
if (tabSwitcherAnimationFeature.self().isEnabled()) {
129+
tabSwitcherDataStore.setAnimationTileSeen(isSeen = false)
130+
}
124131
setAppUsedSinceLastClearFlag(appInForeground)
125132
Timber.d("Finished clearing tabs")
126133
}

app/src/main/java/com/duckduckgo/app/tabs/store/TabSwitcherDataStore.kt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package com.duckduckgo.app.tabs.store
1818

1919
import androidx.datastore.core.DataStore
2020
import androidx.datastore.preferences.core.Preferences
21+
import androidx.datastore.preferences.core.booleanPreferencesKey
2122
import androidx.datastore.preferences.core.edit
2223
import androidx.datastore.preferences.core.stringPreferencesKey
2324
import com.duckduckgo.app.tabs.model.TabSwitcherData
@@ -34,6 +35,10 @@ interface TabSwitcherDataStore {
3435

3536
suspend fun setUserState(userState: UserState)
3637
suspend fun setTabLayoutType(layoutType: LayoutType)
38+
fun isAnimationTileDismissed(): Flow<Boolean>
39+
suspend fun setIsAnimationTileDismissed(isDismissed: Boolean)
40+
fun hasAnimationTileBeenSeen(): Flow<Boolean>
41+
suspend fun setAnimationTileSeen(isSeen: Boolean)
3742
}
3843

3944
@ContributesBinding(AppScope::class)
@@ -43,6 +48,8 @@ class TabSwitcherPrefsDataStore @Inject constructor(
4348
companion object {
4449
const val KEY_USER_STATE = "KEY_USER_STATE"
4550
const val KEY_LAYOUT_TYPE = "KEY_LAYOUT_TYPE"
51+
const val KEY_IS_ANIMATION_TILE_DISMISSED = "KEY_IS_ANIMATION_TILE_DISMISSED"
52+
const val KEY_HAS_ANIMATION_TILE_BEEN_SEEN = "KEY_HAS_ANIMATION_TILE_BEEN_SEEN"
4653
}
4754

4855
override val data: Flow<TabSwitcherData> = store.data.map { preferences ->
@@ -63,4 +70,28 @@ class TabSwitcherPrefsDataStore @Inject constructor(
6370
preferences[stringPreferencesKey(KEY_LAYOUT_TYPE)] = layoutType.name
6471
}
6572
}
73+
74+
override fun isAnimationTileDismissed(): Flow<Boolean> {
75+
return store.data.map { preferences ->
76+
preferences[booleanPreferencesKey(KEY_IS_ANIMATION_TILE_DISMISSED)] ?: false
77+
}
78+
}
79+
80+
override suspend fun setIsAnimationTileDismissed(isDismissed: Boolean) {
81+
store.edit { preferences ->
82+
preferences[booleanPreferencesKey(KEY_IS_ANIMATION_TILE_DISMISSED)] = isDismissed
83+
}
84+
}
85+
86+
override fun hasAnimationTileBeenSeen(): Flow<Boolean> {
87+
return store.data.map { preferences ->
88+
preferences[booleanPreferencesKey(KEY_HAS_ANIMATION_TILE_BEEN_SEEN)] ?: false
89+
}
90+
}
91+
92+
override suspend fun setAnimationTileSeen(isSeen: Boolean) {
93+
store.edit { preferences ->
94+
preferences[booleanPreferencesKey(KEY_HAS_ANIMATION_TILE_BEEN_SEEN)] = isSeen
95+
}
96+
}
6697
}

app/src/main/java/com/duckduckgo/app/tabs/ui/TabItemDecorator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TabItemDecorator(
6060
drawSelectedTabDecoration(child, canvas)
6161
}
6262
}
63-
TabSwitcherItem.TrackerAnimationTile -> Unit // No border for animation tile
63+
is TabSwitcherItem.TrackerAnimationTile -> Unit // No border for animation tile
6464
}
6565
}
6666
}

app/src/main/java/com/duckduckgo/app/tabs/ui/TabSwitcherActivity.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ class TabSwitcherActivity : DuckDuckGoActivity(), TabSwitcherListener, Coroutine
156156

157157
firstTimeLoadingTabsList = savedInstanceState?.getBoolean(KEY_FIRST_TIME_LOADING) ?: true
158158

159+
if (tabSwitcherAnimationFeature.self().isEnabled()) {
160+
tabsAdapter.setAnimationTileCloseClickListener {
161+
viewModel.onTrackerAnimationTileCloseClicked()
162+
}
163+
}
164+
159165
extractIntentExtras()
160166
configureViewReferences()
161167
setupToolbar(toolbar)
@@ -424,7 +430,7 @@ class TabSwitcherActivity : DuckDuckGoActivity(), TabSwitcherListener, Coroutine
424430
)
425431
}
426432
}
427-
TabSwitcherItem.TrackerAnimationTile -> Unit // TODO delete from list
433+
is TabSwitcherItem.TrackerAnimationTile -> Unit // TODO delete from list
428434
}
429435
}
430436
}

app/src/main/java/com/duckduckgo/app/tabs/ui/TabSwitcherAdapter.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ import com.duckduckgo.app.tabs.ui.TabSwitcherAdapter.TabSwitcherViewHolder.Compa
5757
import com.duckduckgo.app.tabs.ui.TabSwitcherAdapter.TabSwitcherViewHolder.Companion.LIST_TAB
5858
import com.duckduckgo.app.tabs.ui.TabSwitcherAdapter.TabSwitcherViewHolder.Companion.LIST_TRACKER_ANIMATION_TILE
5959
import com.duckduckgo.app.tabs.ui.TabSwitcherAdapter.TabSwitcherViewHolder.TabViewHolder
60-
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.ANIMATED_TILE_DEFAULT_ALPHA
61-
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.ANIMATED_TILE_NO_REPLACE_ALPHA
60+
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.Companion.ANIMATED_TILE_DEFAULT_ALPHA
61+
import com.duckduckgo.app.tabs.ui.TabSwitcherItem.TrackerAnimationTile.Companion.ANIMATED_TILE_NO_REPLACE_ALPHA
6262
import com.duckduckgo.common.ui.view.show
6363
import com.duckduckgo.common.ui.view.toPx
6464
import com.duckduckgo.common.utils.DispatcherProvider
@@ -67,7 +67,6 @@ import com.duckduckgo.mobile.android.R as AndroidR
6767
import java.io.File
6868
import java.security.MessageDigest
6969
import kotlin.Int
70-
import kotlin.random.Random
7170
import kotlinx.coroutines.launch
7271
import kotlinx.coroutines.withContext
7372
import timber.log.Timber
@@ -86,6 +85,7 @@ class TabSwitcherAdapter(
8685
private val list = mutableListOf<TabSwitcherItem>()
8786
private var isDragging: Boolean = false
8887
private var layoutType: LayoutType = LayoutType.GRID
88+
private var onAnimationTileCloseClickListener: (() -> Unit)? = null
8989

9090
init {
9191
setHasStableIds(true)
@@ -147,31 +147,29 @@ class TabSwitcherAdapter(
147147
bindListTab(holder, tab)
148148
}
149149
is TabSwitcherViewHolder.GridTrackerAnimationTileViewHolder -> {
150+
val trackerAnimationTile = list[position] as TabSwitcherItem.TrackerAnimationTile
151+
150152
trackerCountAnimator.animateTrackersBlockedCountView(
151153
context = holder.binding.root.context,
152154
stringRes = R.string.trackersBlockedInTheLast7days,
153-
totalTrackerCount = when (Random.Default.nextInt(10)) {
154-
in 0..6 -> Random.Default.nextInt(10, 1000)
155-
else -> Random.Default.nextInt(1000, 10000)
156-
},
155+
totalTrackerCount = trackerAnimationTile.trackerCount,
157156
trackerTextView = holder.binding.text,
158157
)
159158
holder.binding.close.setOnClickListener {
160-
// TODO delete
159+
onAnimationTileCloseClickListener?.invoke()
161160
}
162161
}
163162
is TabSwitcherViewHolder.ListTrackerAnimationTileViewHolder -> {
163+
val trackerAnimationTile = list[position] as TabSwitcherItem.TrackerAnimationTile
164+
164165
trackerCountAnimator.animateTrackersBlockedCountView(
165166
context = holder.binding.root.context,
166167
stringRes = R.string.trackersBlocked,
167-
totalTrackerCount = when (Random.Default.nextInt(10)) {
168-
in 0..6 -> Random.Default.nextInt(10, 1000)
169-
else -> Random.Default.nextInt(1000, 10000)
170-
},
168+
totalTrackerCount = trackerAnimationTile.trackerCount,
171169
trackerTextView = holder.binding.title,
172170
)
173171
holder.binding.close.setOnClickListener {
174-
// TODO delete
172+
onAnimationTileCloseClickListener?.invoke()
175173
}
176174
}
177175
else -> throw IllegalArgumentException("Unknown ViewHolder type: $holder")
@@ -425,6 +423,10 @@ class TabSwitcherAdapter(
425423
notifyDataSetChanged()
426424
}
427425

426+
fun setAnimationTileCloseClickListener(onClick: () -> Unit) {
427+
onAnimationTileCloseClickListener = onClick
428+
}
429+
428430
companion object {
429431
private const val DUCKDUCKGO_TITLE_SUFFIX = "at DuckDuckGo"
430432
}

app/src/main/java/com/duckduckgo/app/tabs/ui/TabSwitcherItem.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ import com.duckduckgo.app.tabs.model.TabEntity
2121
sealed class TabSwitcherItem(val id: String) {
2222

2323
data class Tab(val tabEntity: TabEntity) : TabSwitcherItem(tabEntity.tabId)
24-
data object TrackerAnimationTile : TabSwitcherItem("TrackerAnimationTile") {
24+
data class TrackerAnimationTile(val trackerCount: Int) : TabSwitcherItem("TrackerAnimationTile") {
2525

26-
const val ANIMATED_TILE_NO_REPLACE_ALPHA = 0.4f
27-
const val ANIMATED_TILE_DEFAULT_ALPHA = 1f
26+
companion object {
27+
const val ANIMATED_TILE_NO_REPLACE_ALPHA = 0.4f
28+
const val ANIMATED_TILE_DEFAULT_ALPHA = 1f
29+
}
2830
}
2931
}

0 commit comments

Comments
 (0)