Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
52a88e3
added simple bottom navigation bar
malmstein Mar 20, 2020
956adea
adding a new behaviour that hides the bottom bar when scrolling down …
malmstein Mar 23, 2020
6df6ff4
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Mar 23, 2020
afa7006
cleaning up the bottombar, proper inheritance
malmstein Mar 23, 2020
9e577a9
added tabswitcher button to bottomnavigationbar
malmstein Mar 23, 2020
d8465a6
enabling buttons in bottom bar based on state
malmstein Mar 23, 2020
59525f8
removing all scrolling layout flags from the xml, we use the OmnibarS…
malmstein Mar 23, 2020
eea2c48
adding snapping behaviour to the bottom bar
malmstein Mar 24, 2020
b45a44b
cleaning up the behaviour
malmstein Mar 25, 2020
8f0d084
added missing menu for browser activity
malmstein Mar 25, 2020
c462716
added experiment decorator that will handle UI for different experiments
malmstein Mar 25, 2020
6e53067
implemented decorator variants as per current designs
malmstein Mar 25, 2020
b77e47d
PopupMenu also knows about the experiment we are running
malmstein Mar 25, 2020
0416259
added swipe to refresh
malmstein Mar 26, 2020
9c37114
using bottom bar for now
malmstein Mar 27, 2020
c2de8ab
cleaning up the code
malmstein Mar 30, 2020
dd2224b
cleaning up
malmstein Mar 30, 2020
62daff0
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Mar 30, 2020
107959b
binding all buttons in bottom bar
malmstein Mar 30, 2020
5e8369a
added popupmenu that anchors to the bottombar
malmstein Mar 30, 2020
5f272b5
we can now decorate the toolbar based on the experiment
malmstein Mar 30, 2020
b5a014d
added experiment variants for the bottom navigation
malmstein Mar 30, 2020
297d9de
always showing the omnibar background
malmstein Mar 30, 2020
71ee2fe
no need for old custom webview, scroll is already properly supported
malmstein Mar 31, 2020
90fd052
removing pull to refresh for now
malmstein Apr 1, 2020
aebcd4d
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 1, 2020
80953f8
using the search experiment by default
malmstein Apr 1, 2020
f1bd2b4
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 2, 2020
af961db
removed the second experiment, binding popup and bottom bar click lis…
malmstein Apr 2, 2020
9c3a5d3
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 2, 2020
ea3022a
added new icons for bottom bar and popup menu
malmstein Apr 3, 2020
03826b0
popup menu now also respect light / dark theme
malmstein Apr 3, 2020
8c624e3
using new color attribute for dark / light theme
malmstein Apr 3, 2020
98df130
ignoring variant tests for now, we are lying
malmstein Apr 3, 2020
67d518e
bottom bar is only visible if the omnibar has no focus
malmstein Apr 6, 2020
8fb731d
the search icon is shown only when the serp has focus, and the privac…
malmstein Apr 6, 2020
fdc05b6
cleaning up the tabs switcher and removing its animation
malmstein Apr 6, 2020
f883116
updating version for internal release
malmstein Apr 6, 2020
fd8ed49
proper padding of items in bottom bar
malmstein Apr 6, 2020
e408e79
remove unused file
malmstein Apr 7, 2020
99f420a
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 8, 2020
4443d19
add new tabs screen
malmstein Apr 8, 2020
01c918b
we have a new activity to show tabs with the experiment
malmstein Apr 8, 2020
6d3dbb1
we only use the new activity if the experiment is on
malmstein Apr 8, 2020
71722c8
more ui work
malmstein Apr 8, 2020
461a753
Merge branch 'feature/david/bottom_navigation_bar' of https://github.…
malmstein Apr 8, 2020
3a6bd90
Update popup_window_browser_bottom_tab_menu.xml
malmstein Apr 9, 2020
89d3d72
all toolbars should be the same
malmstein Apr 9, 2020
1e48c88
ui tweaks with Robert
malmstein Apr 9, 2020
be99ceb
improved elevation for the bottom bar
malmstein Apr 9, 2020
5045e68
ensure keyboard is not shown if the omnibar does not have focus
malmstein Apr 10, 2020
47cc6d5
search icon / privacy grade should be properly updated
malmstein Apr 10, 2020
d4112ec
ensure grade button is hidden
malmstein Apr 13, 2020
9f6ece6
Merge branch 'feature/david/bottom_navigation_bar' of https://github.…
malmstein Apr 13, 2020
00ccf1e
added pixels to track experiment engagement
malmstein Apr 13, 2020
191a3c7
added missing fire icon pixel
malmstein Apr 13, 2020
b5020b0
ensure we also animate the bottom bar after animating the toolbar
malmstein Apr 13, 2020
b4c2e74
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 14, 2020
5785e4d
moving search next to the fire icon
malmstein Apr 14, 2020
1a79863
added proper background for the bottom bar
malmstein Apr 14, 2020
96c0fec
ensure that the widget cta is sitting in top of the bottom navigation…
malmstein Apr 14, 2020
f281572
added delay to keyboard animation so it doesn't look wonky
malmstein Apr 15, 2020
741d8e5
ensure cta container respects the bottom bar height
malmstein Apr 15, 2020
1427152
remove the animation when hiding the keyboard
malmstein Apr 15, 2020
20aacc8
make sure that the first time the container shows we respect the bott…
malmstein Apr 15, 2020
b8f5f23
updated pixel values for the experiment
malmstein Apr 15, 2020
5a51780
swapped order of icons in bottom bar
malmstein Apr 17, 2020
d684a7b
adding tests for the variant manager
malmstein Apr 17, 2020
03a925f
updated version for release
malmstein Apr 17, 2020
4264778
Merge branch 'feature/david/bottom_navigation_bar' of https://github.…
malmstein Apr 17, 2020
2936137
fixed tds hast test
malmstein Apr 17, 2020
a755fd2
Merge branch 'feature/david/bottom_navigation_bar' of github.com:duck…
malmstein Apr 17, 2020
9472a09
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 17, 2020
72d6685
fixed etag test
malmstein Apr 17, 2020
2267e6b
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 20, 2020
b057cb1
enable for now
malmstein Apr 20, 2020
3af4791
improved color selection for api 21
malmstein Apr 20, 2020
8af4da3
fixing vector drawables so they show the proper path
malmstein Apr 20, 2020
3a55b51
these tests should be running
malmstein Apr 20, 2020
cb0ca2c
addressing some PR comments
malmstein Apr 20, 2020
1d9a038
cleaning up double assignation
malmstein Apr 20, 2020
ccd01db
clean up some comments
malmstein Apr 21, 2020
d0377e6
Merge branch 'feature/david/bottom_navigation_bar' of github.com:duck…
malmstein Apr 21, 2020
4915681
more code cleanup
malmstein Apr 21, 2020
dffd00a
swap experiment with feature for readibility
malmstein Apr 21, 2020
3e84290
revert experiments to original values, it's not this PR responsibilit…
malmstein Apr 21, 2020
78515a7
updating experiment names
malmstein Apr 21, 2020
42e747f
proper reference
malmstein Apr 21, 2020
59d6ded
ensure all pixels trigger the variant key
malmstein Apr 21, 2020
3f42965
revert wrong variant change
malmstein Apr 21, 2020
a41a919
cleaning up colors and selectors
malmstein Apr 22, 2020
349d300
no need for this
malmstein Apr 22, 2020
b1ddcb4
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 22, 2020
9b91ae7
cleaning up the toolbar, make sure we show the icons for both experim…
malmstein Apr 22, 2020
890b3cd
returning experiments back to original distibution
malmstein Apr 22, 2020
240c3c0
hide new menu buttons when in bottomnav mode
malmstein Apr 22, 2020
8e488ab
no need for this selector because we use theming now
malmstein Apr 22, 2020
bd3e2bf
ensure the omnibar is using full width
malmstein Apr 23, 2020
75daa9e
ensure widget container is shown properly
malmstein Apr 23, 2020
6120a45
removing the behaviour so the omnibar is properly updated
malmstein Apr 23, 2020
cd6dd49
revert this to what it was
malmstein Apr 23, 2020
f924f80
revert this to fix tests
malmstein Apr 23, 2020
6382a9d
proper style for checkbox
malmstein Apr 24, 2020
49600fa
cleaning up state and visibility of the toolbar
malmstein Apr 27, 2020
b2c2717
updated etag for tests
malmstein Apr 27, 2020
49d3629
revert tdstest changes
malmstein Apr 27, 2020
7f4b276
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 27, 2020
b209a3c
cleanup references
malmstein Apr 27, 2020
74d68e9
Merge branch 'develop' into feature/david/bottom_navigation_bar
malmstein Apr 27, 2020
a81e8ac
Merge branch 'feature/david/bottom_navigation_bar' of github.com:duck…
malmstein Apr 28, 2020
b2c55f6
add missing pixel after opening a new tab
malmstein Apr 28, 2020
5086795
move this to the decorator
malmstein Apr 28, 2020
cbb9470
duplicate call
malmstein Apr 28, 2020
6e47139
better method naming
malmstein Apr 28, 2020
87341a5
remove duplicate call for this method
malmstein Apr 28, 2020
93b8a28
ensure bottombar is visible after opening a new tab
malmstein Apr 28, 2020
f07e7d7
another redundant call
malmstein Apr 28, 2020
e812c2f
renaming bottom bar only icons
malmstein Apr 28, 2020
d3f360f
no longer used
malmstein Apr 28, 2020
d241ecb
proper icon name
malmstein Apr 28, 2020
2cd2d44
removing unnecessary method
malmstein Apr 28, 2020
cc1327e
fix color reference pointing to wrong attribute
malmstein Apr 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -611,16 +611,18 @@ class BrowserTabViewModelTest {
}

@Test
fun whenBrowserNotShownAndOmnibarInputDoesNotHaveFocusThenPrivacyGradeIsNotShown() {
fun whenOmnibarDoesNotHaveFocusThenPrivacyGradeIsShownAndSearchIconIsHidden() {
testee.onOmnibarInputStateChanged(query = "", hasFocus = false, hasQueryChanged = false)
assertFalse(browserViewState().showPrivacyGrade)
assertTrue(browserViewState().showPrivacyGrade)
assertFalse(browserViewState().showSearchIcon)
}

@Test
fun whenBrowserShownAndOmnibarInputDoesNotHaveFocusThenPrivacyGradeIsShown() {
fun whenBrowserShownAndOmnibarInputDoesNotHaveFocusThenPrivacyGradeIsShownAndSearchIconIsHidden() {
testee.onUserSubmittedQuery("foo")
testee.onOmnibarInputStateChanged(query = "", hasFocus = false, hasQueryChanged = false)
assertTrue(browserViewState().showPrivacyGrade)
assertFalse(browserViewState().showSearchIcon)
}

@Test
Expand All @@ -630,10 +632,11 @@ class BrowserTabViewModelTest {
}

@Test
fun whenBrowserShownAndOmnibarInputHasFocusThenPrivacyGradeIsShown() {
fun whenBrowserShownAndOmnibarInputHasFocusThenSearchIconIsShownAndPrivacyGradeIsHidden() {
testee.onUserSubmittedQuery("foo")
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = false)
assertTrue(browserViewState().showPrivacyGrade)
assertFalse(browserViewState().showPrivacyGrade)
assertTrue(browserViewState().showSearchIcon)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ class VariantManagerTest {
assertEquals(0, variant.features.size)
}

// Bottom Bar Navigation Experiment

@Test
fun bottomBarNavigationControlVariantIsActiveAndHasNoFeatures() {
val variant = variants.first { it.key == "mm" }
assertEqualsDouble(1.0, variant.weight)
assertEquals(0, variant.features.size)
}

@Test
fun bottomBarNavigationVariantIsActiveAndHasBottomBarNavigationFeature() {
val variant = variants.first { it.key == "mn" }
assertEqualsDouble(1.0, variant.weight)
assertEquals(1, variant.features.size)
assertTrue(variant.hasFeature(BottomBarNavigation))
}

@Test
fun verifyNoDuplicateVariantNames() {
val existingNames = mutableSetOf<String>()
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@
android:name="com.duckduckgo.app.tabs.ui.TabSwitcherActivity"
android:label="@string/tabActivityTitle" />

<activity
android:name="com.duckduckgo.app.tabs.ui.TabSwitcherBottomBarFeatureActivity"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we create a new Activity here because it's easier to have it this way that change the current Activity. This will be either deleted (if the experiment fails) or become the new Tabs Activity (and remove it's counterpart)

android:label="@string/tabActivityTitle" />

<activity
android:name="com.duckduckgo.app.privacy.ui.PrivacyDashboardActivity"
android:label="@string/privacyDashboardActivityTitle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,14 @@ class AboutDuckDuckGoActivity : DuckDuckGoActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_about_duck_duck_go)
configureActionBar()
setupToolbar(toolbar)

learnMoreLink.setOnClickListener {
startActivity(BrowserActivity.intent(this, Url.ABOUT))
finish()
}
}

private fun configureActionBar() {
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

companion object {
fun intent(context: Context): Intent {
return Intent(context, AboutDuckDuckGoActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BookmarksActivity : DuckDuckGoActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_bookmarks)
setupActionBar()
setupToolbar(toolbar)
setupBookmarksRecycler()
observeViewModel()
}
Expand All @@ -72,11 +72,6 @@ class BookmarksActivity : DuckDuckGoActivity() {
recycler.addItemDecoration(separator)
}

private fun setupActionBar() {
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

private fun observeViewModel() {
viewModel.viewState.observe(this, Observer<BookmarksViewModel.ViewState> { viewState ->
viewState?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import kotlinx.android.synthetic.main.content_broken_sites.*
import kotlinx.android.synthetic.main.include_toolbar.*
import org.jetbrains.anko.longToast


class BrokenSiteActivity : DuckDuckGoActivity() {
private val viewModel: BrokenSiteViewModel by bindViewModel()

Expand All @@ -40,17 +39,12 @@ class BrokenSiteActivity : DuckDuckGoActivity() {
setContentView(R.layout.activity_broken_site)
configureListeners()
configureObservers()
setupActionBar()
setupToolbar(toolbar)
if (savedInstanceState == null) {
consumeIntentExtra()
}
}

private fun setupActionBar() {
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

private fun consumeIntentExtra() {
val url = intent.getStringExtra(URL_EXTRA)
val blockedTrackers = intent.getStringExtra(BLOCKED_TRACKERS_EXTRA)
Expand Down
25 changes: 19 additions & 6 deletions app/src/main/java/com/duckduckgo/app/browser/BrowserPopupMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.PopupWindow
import com.duckduckgo.app.statistics.Variant
import com.duckduckgo.app.statistics.VariantManager

class BrowserPopupMenu : PopupWindow {
class BrowserPopupMenu(layoutInflater: LayoutInflater, variant: Variant, view: View = inflate(layoutInflater, variant)) :
PopupWindow(view, WRAP_CONTENT, WRAP_CONTENT, true) {

constructor(layoutInflater: LayoutInflater, view: View = BrowserPopupMenu.inflate(layoutInflater))
: super(view, WRAP_CONTENT, WRAP_CONTENT, true) {
// popupwindow gets stuck on the screen on API 22 (tested on 23) without a background
// color. Adding it however garbles the elevation so we cannot have elevation here.

init {
if (SDK_INT <= 22) {
// popupwindow gets stuck on the screen on API 22 (tested on 23) without a background
// color. Adding it however garbles the elevation so we cannot have elevation here.
setBackgroundDrawable(ColorDrawable(Color.WHITE))
} else {
elevation = 6.toFloat()
Expand All @@ -59,10 +61,21 @@ class BrowserPopupMenu : PopupWindow {

private const val margin = 30

fun inflate(layoutInflater: LayoutInflater): View {
fun inflate(layoutInflater: LayoutInflater, variant: Variant): View {
return if (variant.hasFeature(VariantManager.VariantFeature.BottomBarNavigation)) {
inflateBottomBarWithSearchFeature(layoutInflater)
} else {
inflateToolbarOnly(layoutInflater)
}
}

private fun inflateToolbarOnly(layoutInflater: LayoutInflater): View {
return layoutInflater.inflate(R.layout.popup_window_browser_menu, null)
}

private fun inflateBottomBarWithSearchFeature(layoutInflater: LayoutInflater): View {
return layoutInflater.inflate(R.layout.popup_window_browser_bottom_tab_menu, null)
}
}
}

Loading