Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a52858d
fixed colors for dialogs in settings screen
malmstein May 7, 2020
3ce15a2
change app icon dialog styling
malmstein May 7, 2020
903a2f7
changed dialog for report broken site
malmstein May 7, 2020
94e2a2d
fixing edit bookmark dialog theming
malmstein May 7, 2020
2c387cf
no need to set the theme per dialog, it inherits from the theme
malmstein May 7, 2020
e5bdd59
using the new popup menu
malmstein May 7, 2020
0f72ed5
added new popup menu
malmstein May 7, 2020
c5714de
added popup layout
malmstein May 7, 2020
e996e4a
added support for dark theme in fire dialog
malmstein May 7, 2020
7830d75
Merge branch 'develop' into feature/david/dark_theme_dialog
malmstein May 7, 2020
20e2414
Merge branch 'develop' into feature/david/bookmarks_popup_menu
malmstein May 7, 2020
1203c39
Merge branch 'develop' into feature/david/fire_bottom_sheet_dark_theme
malmstein May 7, 2020
dd69615
all dialogs are using the same theme
malmstein May 7, 2020
d379849
using white instead of grayish
malmstein May 8, 2020
3e8d5a7
Merge branch 'develop' into feature/david/dark_theme_dialog
malmstein May 8, 2020
7906331
Merge branch 'feature/david/dark_theme_dialog' into feature/david/con…
malmstein May 8, 2020
b96c37a
changed text and icon colors in light and dark mode
malmstein May 8, 2020
675f91f
adding new colors for contrast
malmstein May 8, 2020
6184c98
Merge branch 'feature/david/fire_bottom_sheet_dark_theme' into featur…
malmstein May 8, 2020
efc01e2
Merge branch 'feature/david/bookmarks_popup_menu' into feature/david/…
malmstein May 8, 2020
6a35ddd
cleaning up bad color
malmstein May 8, 2020
4ea61ca
updated bg color in fire dialog
malmstein May 8, 2020
e19f596
adding colors so we pass the color contrast test
malmstein May 14, 2020
926c086
final tweaks to the toolbar, removing elevation and adding custom shadow
malmstein May 15, 2020
a1e186b
back to it's proper experiment definition
malmstein May 15, 2020
1c9d4c9
Merge branch 'develop' into feature/david/contrast_colors_change
malmstein May 15, 2020
3bc6986
last ui review changes
malmstein May 18, 2020
90663a0
clean up bottom bar background color
malmstein May 20, 2020
bcbd582
fixed version for release
malmstein May 20, 2020
f027138
Merge branch 'develop' into feature/david/contrast_colors_change
malmstein May 25, 2020
a70f5f2
experiment back to original value
malmstein May 25, 2020
f15c94d
applying ktlint
malmstein May 25, 2020
375d0f6
adding text color for the dialogs
malmstein May 27, 2020
52e7233
revert changes to dialogs, they don't belong here
malmstein May 27, 2020
31b62a8
remove unnecessary imports
malmstein May 27, 2020
2d0c50c
more cleanup reveryting changes
malmstein May 27, 2020
5abac58
revert change in bookmarks
malmstein May 27, 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 @@ -16,7 +16,6 @@

package com.duckduckgo.app.bookmarks.ui

import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.net.Uri
Expand All @@ -26,7 +25,7 @@ import android.view.Menu
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.PopupMenu
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SearchView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.RecyclerView.Adapter
Expand All @@ -46,6 +45,15 @@ import com.duckduckgo.app.global.view.show
import kotlinx.android.synthetic.main.content_bookmarks.*
import kotlinx.android.synthetic.main.include_toolbar.*
import kotlinx.android.synthetic.main.view_bookmark_entry.view.*
import kotlinx.android.synthetic.main.content_bookmarks.emptyBookmarks
import kotlinx.android.synthetic.main.content_bookmarks.recycler
import kotlinx.android.synthetic.main.include_toolbar.toolbar
import kotlinx.android.synthetic.main.popup_window_bookmarks_menu.view.deleteBookmark
import kotlinx.android.synthetic.main.popup_window_bookmarks_menu.view.editBookmark
import kotlinx.android.synthetic.main.view_bookmark_entry.view.favicon
import kotlinx.android.synthetic.main.view_bookmark_entry.view.overflowMenu
import kotlinx.android.synthetic.main.view_bookmark_entry.view.title
import kotlinx.android.synthetic.main.view_bookmark_entry.view.url
import timber.log.Timber

class BookmarksActivity : DuckDuckGoActivity() {
Expand All @@ -64,7 +72,7 @@ class BookmarksActivity : DuckDuckGoActivity() {
}

private fun setupBookmarksRecycler() {
adapter = BookmarksAdapter(applicationContext, viewModel)
adapter = BookmarksAdapter(layoutInflater, viewModel)
recycler.adapter = adapter
}

Expand Down Expand Up @@ -126,10 +134,13 @@ class BookmarksActivity : DuckDuckGoActivity() {
deleteDialog = AlertDialog.Builder(this)
.setTitle(title)
.setMessage(message)
.setPositiveButton(android.R.string.yes) { _, _ -> delete(bookmark) }
.setNegativeButton(android.R.string.no) { _, _ -> }
.create()
deleteDialog?.show()
.setPositiveButton(android.R.string.yes) { _, _ ->
delete(bookmark)
}
.setNegativeButton(android.R.string.no) { dialog, _ ->
dialog.dismiss()
}
.show()
}

private fun delete(bookmark: BookmarkEntity) {
Expand All @@ -151,7 +162,7 @@ class BookmarksActivity : DuckDuckGoActivity() {
}

class BookmarksAdapter(
private val context: Context,
private val layoutInflater: LayoutInflater,
private val viewModel: BookmarksViewModel
) : Adapter<BookmarksViewHolder>() {

Expand All @@ -164,7 +175,7 @@ class BookmarksActivity : DuckDuckGoActivity() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BookmarksViewHolder {
val inflater = LayoutInflater.from(parent.context)
val view = inflater.inflate(R.layout.view_bookmark_entry, parent, false)
return BookmarksViewHolder(view, viewModel)
return BookmarksViewHolder(layoutInflater, view, viewModel)
}

override fun onBindViewHolder(holder: BookmarksViewHolder, position: Int) {
Expand All @@ -176,8 +187,7 @@ class BookmarksActivity : DuckDuckGoActivity() {
}
}

class BookmarksViewHolder(itemView: View, private val viewModel: BookmarksViewModel) :
ViewHolder(itemView) {
class BookmarksViewHolder(val layoutInflater: LayoutInflater, itemView: View, private val viewModel: BookmarksViewModel) : ViewHolder(itemView) {

lateinit var bookmark: BookmarkEntity

Expand Down Expand Up @@ -217,23 +227,14 @@ class BookmarksActivity : DuckDuckGoActivity() {
return uri.baseHost ?: return urlString
}

private fun showOverFlowMenu(overflowMenu: ImageView, bookmark: BookmarkEntity) {
val popup = PopupMenu(overflowMenu.context, overflowMenu)
popup.inflate(R.menu.bookmarks_individual_overflow_menu)
popup.setOnMenuItemClickListener {
when (it.itemId) {

R.id.edit -> {
editBookmark(bookmark); true
}
R.id.delete -> {
deleteBookmark(bookmark); true
}
else -> false

}
private fun showOverFlowMenu(anchor: ImageView, bookmark: BookmarkEntity) {
val popupMenu = BookmarksPopupMenu(layoutInflater)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same here, need to change the PopupMenu colors

val view = popupMenu.contentView
popupMenu.apply {
onMenuItemClicked(view.editBookmark) { editBookmark(bookmark) }
onMenuItemClicked(view.deleteBookmark) { deleteBookmark(bookmark) }
}
popup.show()
popupMenu.show(itemView, anchor)
}

private fun editBookmark(bookmark: BookmarkEntity) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2020 DuckDuckGo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.duckduckgo.app.bookmarks.ui

import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Build.VERSION.SDK_INT
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.PopupWindow
import com.duckduckgo.app.browser.R

class BookmarksPopupMenu(layoutInflater: LayoutInflater, view: View = inflate(layoutInflater, R.layout.popup_window_bookmarks_menu)) :
PopupWindow(view, WRAP_CONTENT, WRAP_CONTENT, true) {

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 = ELEVATION
}
animationStyle = android.R.style.Animation_Dialog
}

fun onMenuItemClicked(menuView: View, onClick: () -> Unit) {
menuView.setOnClickListener {
onClick()
dismiss()
}
}

fun show(rootView: View, anchorView: View) {
val anchorLocation = IntArray(2)
anchorView.getLocationOnScreen(anchorLocation)
val x = MARGIN
val y = anchorLocation[1] + MARGIN
showAtLocation(rootView, Gravity.TOP or Gravity.END, x, y)
}

companion object {

private const val MARGIN = 30
private const val ELEVATION = 6f

fun inflate(layoutInflater: LayoutInflater, resourceId: Int): View {
return layoutInflater.inflate(resourceId, null)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.GridLayoutManager
import com.duckduckgo.app.browser.R
import com.duckduckgo.app.global.DuckDuckGoActivity
import kotlinx.android.synthetic.main.content_app_icons.appIconsList
import kotlinx.android.synthetic.main.include_toolbar.toolbar
import kotlinx.android.synthetic.main.content_app_icons.*
import kotlinx.android.synthetic.main.include_toolbar.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/midGray" />
<item android:color="@color/grayish"/>
<item android:color="@color/white"/>
</selector>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/pinkish_grey_two" />
<item android:color="@color/grayishBrown"/>
<item android:color="@color/almostBlackDark"/>
</selector>
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/bottom_navigation_bar_bg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
<item>
<shape android:shape="rectangle">
<padding android:top="1dp"/>
<solid android:color="#50CCCCCC" />
<solid android:color="?attr/toolbarBgBorderColor" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are preliminary changes, https://app.asana.com/0/1157893581871903/1176799629392268 will make sure to update these changes should the experiment move forward

</shape>
</item>
<item>
<shape
android:shape="rectangle">
<solid android:color="?attr/colorPrimary"/>
<solid android:color="?attr/toolbarBgColor"/>
</shape>
</item>
</layer-list>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_cancel_brownish_24dp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/brownishGray"
android:fillColor="?normalTextColor"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
</vector>
35 changes: 35 additions & 0 deletions app/src/main/res/drawable/loading_progress.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 DuckDuckGo
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid
android:color="?toolbarBgColor" />
</shape>
</item>

<item
android:id="@android:id/progress">
<clip>
<shape>
<solid
android:color="?colorAccent" />
</shape>
</clip>
</item>

</layer-list>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/popup_menu_bg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorPrimary"/>
<solid android:color="?attr/dialogBgColor"/>
<corners android:radius="8dp" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_system_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
android:paddingEnd="16dp"
android:paddingBottom="2dp"
android:text="@string/systemSearchDeviceAppLabel"
android:textColor="@color/grayish"
android:textColor="?normalTextColor"
android:textSize="13sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/bottomBarHeight"
android:layout_gravity="bottom"
android:background="@drawable/bottom_navigation_bar_bg"
android:background="?toolbarBgColor"
android:gravity="center"
android:orientation="horizontal"
android:elevation="8dp"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_browser_tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
android:layout_width="match_parent"
android:layout_height="@dimen/bottomBarHeight"
android:layout_gravity="bottom"
android:background="@drawable/bottom_navigation_bar_bg"
android:elevation="8dp"
android:gravity="center"
android:orientation="horizontal"
android:background="?toolbarBgColor"
app:layoutResource="@layout/layout_browser_bottom_navigation_bar"
app:layout_behavior="com.duckduckgo.app.browser.ui.BottomNavigationBehavior" />

Expand Down Expand Up @@ -61,8 +61,8 @@
android:id="@+id/autoCompleteSuggestionsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:backgroundTint="?attr/colorPrimary"
android:background="?toolbarBgColor"
android:backgroundTint="?toolbarBgColor"
android:clipToPadding="false"
android:elevation="4dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/include_cta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:id="@+id/cta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?toolbarBgColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
Expand Down
21 changes: 11 additions & 10 deletions app/src/main/res/layout/include_omnibar_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/OmnibarToolbarTheme">
android:background="?toolbarBgColor">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:background="?attr/toolbarBgColor"
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp"
app:layout_constraintBottom_toBottomOf="parent"
Expand All @@ -48,14 +48,14 @@
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="@style/AppTheme.Dark.PopupOverlay">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/omniBarContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:background="@drawable/omnibar_field_background"
android:paddingStart="6dp"
android:paddingEnd="6dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/omniBarContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:background="@drawable/omnibar_field_background"
android:paddingStart="6dp"
android:paddingEnd="6dp">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/animationContainer"
Expand Down Expand Up @@ -206,6 +206,7 @@
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="4dp"
android:progressDrawable="@drawable/loading_progress"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/include_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/toolbarBgColor"
android:theme="@style/ToolbarTheme"
app:popupTheme="@style/AppTheme.Dark.PopupOverlay" />

Expand Down
Loading