Skip to content

Commit

Permalink
ADS: Downloads screen migration (#2610)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/0/1203411647299663/f

### Description
Migrate Downloads screen to new components

### Steps to test this PR

- Install from this branch
- Go to Downloads
- [ ] Check everything looks as expected

### UI changes
| Before  | After |
| ------ | ----- |

![Screenshot_20221207_140218_DuckDuckGo](https://user-images.githubusercontent.com/20798495/206199425-9fbdb8a9-3b6e-4796-975d-ed1d0ed603bf.jpg)|![Screenshot_20221207_132951_DuckDuckGo](https://user-images.githubusercontent.com/20798495/206198560-ce6a6c45-16f2-4fb0-9f20-aed5c9e219ce.jpg)|
  • Loading branch information
nalcalag authored and malmstein committed Jan 19, 2023
1 parent 27b46e8 commit f74efe2
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class DownloadsAdapter @Inject constructor(
RecyclerView.ViewHolder(binding.root) {

fun bind(item: Header) {
binding.downloadsHeaderTextView.text = item.text
binding.downloadsHeaderTextView.primaryText = item.text
}
}

Expand Down Expand Up @@ -131,7 +131,7 @@ class DownloadsAdapter @Inject constructor(
else -> context.getString(R.string.downloadsStateInProgress)
}
twoListItem.setSecondaryText(subtitle)
twoListItem.setLeadingIcon(R.drawable.ic_file)
twoListItem.setLeadingIcon(R.drawable.ic_document_24)

twoListItem.setClickListener {
if (item.downloadItem.contentLength > 0) {
Expand Down
25 changes: 25 additions & 0 deletions app/src/main/res/drawable/ic_document_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright (c) 2022 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16,22L8,22c-2.21,0 -4,-1.79 -4,-4L4,6c0,-2.21 1.79,-4 4,-4h4.343c1.061,0 2.078,0.421 2.829,1.172l3.656,3.656c0.75,0.75 1.172,1.768 1.172,2.829L20,18c0,2.21 -1.79,4 -4,4zM6,18c0,1.105 0.895,2 2,2h8c1.105,0 2,-0.895 2,-2v-8h-2c-2.21,0 -4,-1.79 -4,-4L12,4L8,4c-1.105,0 -2,0.895 -2,2v12zM14,4.828L14,6c0,1.105 0.895,2 2,2h1.172L14,4.828z"
android:fillColor="?attr/daxColorPrimaryIcon"
android:fillType="evenOdd"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_download_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<item android:drawable="@drawable/list_item_image_circular_background"/>
<item
android:bottom="10dp"
android:drawable="@drawable/ic_file"
android:drawable="@drawable/ic_document_24"
android:left="@dimen/keyline_3"
android:right="@dimen/keyline_3"
android:top="10dp"/>
Expand Down
26 changes: 0 additions & 26 deletions app/src/main/res/drawable/ic_file.xml

This file was deleted.

26 changes: 17 additions & 9 deletions app/src/main/res/layout/view_item_downloads_empty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@
~ limitations under the License.
-->

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/downloads_empty_text_view"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingStart="24dp"
android:paddingTop="48dp"
android:paddingEnd="24dp"
android:textColor="?attr/secondaryTextColor"
android:textAppearance="@style/TextAppearance.DuckDuckGo.Body1"
android:text="@string/downloadsActivityNoItemsDescription" />
android:paddingStart="@dimen/keyline_4"
android:paddingTop="@dimen/keyline_5"
android:paddingEnd="@dimen/keyline_4"
android:paddingBottom="@dimen/keyline_5">

<com.duckduckgo.mobile.android.ui.view.text.DaxTextView
android:id="@+id/downloads_empty_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/downloadsActivityNoItemsDescription"
app:textType="secondary"
app:typography="body2" />

</FrameLayout>
7 changes: 2 additions & 5 deletions app/src/main/res/layout/view_item_downloads_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
~ limitations under the License.
-->

<com.duckduckgo.mobile.android.ui.view.text.SectionHeaderTextView
<com.duckduckgo.mobile.android.ui.view.listitem.SectionHeaderListItem
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/downloads_header_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
tools:text="TODAY"/>
android:layout_height="wrap_content" />

0 comments on commit f74efe2

Please sign in to comment.