Skip to content

Commit

Permalink
ADS: Share Feedback section (#2670)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/0/1203467500325943/f

**Description**
Migration of share feedback screens to new components

**_Design Review_** in
https://app.asana.com/0/1195897901771673/1203575646431883
  • Loading branch information
nalcalag authored and malmstein committed Jan 9, 2023
1 parent e04f163 commit e2dd724
Show file tree
Hide file tree
Showing 18 changed files with 235 additions and 310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout"
style="@style/FeedbackInputBoxStyle"
style="@style/TextInputBoxStyle"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="25dp"
Expand Down Expand Up @@ -92,7 +92,7 @@

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/appBreakageFormFeedbackContainer"
style="@style/FeedbackInputBoxStyle"
style="@style/TextInputBoxStyle"
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginTop="@dimen/keyline_2"
Expand All @@ -105,7 +105,7 @@

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/appBreakageFormFeedbackInput"
style="@style/FeedbackEditTextInputStyle"
style="@style/TextInputStyle"
android:gravity="top" />

</com.google.android.material.textfield.TextInputLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class BrokenSiteNegativeFeedbackFragment : FeedbackFragment(R.layout.content_fee
override fun configureListeners() {
with(binding) {
submitFeedbackButton.doOnNextLayout {
brokenSiteInput.setOnTouchListener(LayoutScrollingTouchListener(rootScrollView, brokenSiteInputContainer.y.toInt()))
openEndedFeedback.setOnTouchListener(LayoutScrollingTouchListener(rootScrollView, openEndedFeedbackContainer.y.toInt()))
brokenSiteInput.setOnTouchListener(LayoutScrollingTouchListener(rootScrollView, brokenSiteInput.y.toInt()))
openEndedFeedback.setOnTouchListener(LayoutScrollingTouchListener(rootScrollView, openEndedFeedback.y.toInt()))
}

submitFeedbackButton.setOnClickListener {
val feedback = openEndedFeedback.text.toString()
val brokenSite = brokenSiteInput.text.toString()
val feedback = openEndedFeedback.text
val brokenSite = brokenSiteInput.text

viewModel.userSubmittingFeedback(feedback, brokenSite)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.duckduckgo.app.browser.databinding.ItemFeedbackReasonBinding
import com.duckduckgo.app.feedback.ui.negative.FeedbackTypeDisplay.FeedbackTypeMainReasonDisplay
import com.duckduckgo.mobile.android.databinding.RowOneLineListItemBinding

class MainReasonAdapter(private val itemClickListener: (FeedbackTypeMainReasonDisplay) -> Unit) :
ListAdapter<FeedbackTypeMainReasonDisplay, MainReasonAdapter.ViewHolder>(DiffCallback()) {
Expand All @@ -48,7 +48,7 @@ class MainReasonAdapter(private val itemClickListener: (FeedbackTypeMainReasonDi
viewType: Int,
): ViewHolder {
val inflater = LayoutInflater.from(parent.context)
val binding = ItemFeedbackReasonBinding.inflate(inflater, parent, false)
val binding = RowOneLineListItemBinding.inflate(inflater, parent, false)
return ViewHolder(binding)
}

Expand All @@ -59,14 +59,16 @@ class MainReasonAdapter(private val itemClickListener: (FeedbackTypeMainReasonDi
holder.bind(getItem(position), itemClickListener)
}

data class ViewHolder(val binding: ItemFeedbackReasonBinding) : RecyclerView.ViewHolder(binding.root) {
data class ViewHolder(val binding: RowOneLineListItemBinding) : RecyclerView.ViewHolder(binding.root) {

fun bind(
reason: FeedbackTypeMainReasonDisplay,
clickListener: (FeedbackTypeMainReasonDisplay) -> Unit,
) {
binding.reason.text = binding.root.context.getString(reason.listDisplayResId)
binding.root.setOnClickListener { clickListener(reason) }
val listItem = binding.root
listItem.hideLeadingIcon()
listItem.setPrimaryText(binding.root.context.getString(reason.listDisplayResId))
listItem.setOnClickListener { clickListener(reason) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
package com.duckduckgo.app.feedback.ui.negative.mainreason

import android.os.Bundle
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.duckduckgo.anvil.annotations.InjectWith
import com.duckduckgo.app.browser.R
import com.duckduckgo.app.browser.databinding.ContentFeedbackNegativeDisambiguationMainReasonBinding
import com.duckduckgo.app.feedback.ui.common.FeedbackFragment
import com.duckduckgo.app.feedback.ui.common.FeedbackItemDecoration
import com.duckduckgo.app.feedback.ui.negative.FeedbackType.MainReason
import com.duckduckgo.app.feedback.ui.negative.FeedbackTypeDisplay
import com.duckduckgo.app.feedback.ui.negative.FeedbackTypeDisplay.FeedbackTypeMainReasonDisplay
Expand Down Expand Up @@ -58,7 +56,6 @@ class MainReasonNegativeFeedbackFragment : FeedbackFragment(R.layout.content_fee
activity?.let {
binding.recyclerView.layoutManager = LinearLayoutManager(it)
binding.recyclerView.adapter = recyclerAdapter
binding.recyclerView.addItemDecoration(FeedbackItemDecoration(ContextCompat.getDrawable(it, R.drawable.feedback_list_divider)!!))

val listValues = getMainReasonsDisplayText()
recyclerAdapter.submitList(listValues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ShareOpenEndedFeedbackFragment : FeedbackFragment(R.layout.content_feedbac
private fun updateDisplayForPositiveFeedback() {
binding.title.text = getString(R.string.feedbackShareDetails)
binding.subtitle.text = getString(R.string.sharePositiveFeedbackWithTheTeam)
binding.openEndedFeedbackContainer.hint = getString(R.string.whatHaveYouBeenEnjoying)
binding.openEndedFeedback.hint = getString(R.string.whatHaveYouBeenEnjoying)
binding.emoticonImage.setImageResource(R.drawable.ic_happy_face)
}

Expand All @@ -102,7 +102,7 @@ class ShareOpenEndedFeedbackFragment : FeedbackFragment(R.layout.content_feedbac

binding.title.text = getDisplayText(mainReason!!)
binding.subtitle.text = getDisplayText(subReason)
binding.openEndedFeedbackContainer.hint = getInputHintText(mainReason!!)
binding.openEndedFeedback.hint = getInputHintText(mainReason!!)
binding.emoticonImage.setImageResource(R.drawable.ic_sad_face)
}

Expand All @@ -127,7 +127,7 @@ class ShareOpenEndedFeedbackFragment : FeedbackFragment(R.layout.content_feedbac
override fun configureListeners() {
with(binding) {
rootScrollView.doOnNextLayout {
binding.openEndedFeedback.setOnTouchListener(LayoutScrollingTouchListener(rootScrollView, openEndedFeedbackContainer.y.toInt()))
binding.openEndedFeedback.setOnTouchListener(LayoutScrollingTouchListener(rootScrollView, openEndedFeedback.y.toInt()))
}

submitFeedbackButton.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.duckduckgo.app.browser.databinding.ItemFeedbackReasonBinding
import com.duckduckgo.app.feedback.ui.negative.FeedbackTypeDisplay.FeedbackTypeSubReasonDisplay
import com.duckduckgo.mobile.android.databinding.RowOneLineListItemBinding

class SubReasonAdapter(private val itemClickListener: (FeedbackTypeSubReasonDisplay) -> Unit) :
ListAdapter<FeedbackTypeSubReasonDisplay, SubReasonAdapter.ViewHolder>(DiffCallback()) {
Expand All @@ -48,7 +48,7 @@ class SubReasonAdapter(private val itemClickListener: (FeedbackTypeSubReasonDisp
viewType: Int,
): ViewHolder {
val inflater = LayoutInflater.from(parent.context)
val binding = ItemFeedbackReasonBinding.inflate(inflater, parent, false)
val binding = RowOneLineListItemBinding.inflate(inflater, parent, false)
return ViewHolder(binding)
}

Expand All @@ -59,14 +59,16 @@ class SubReasonAdapter(private val itemClickListener: (FeedbackTypeSubReasonDisp
holder.bind(getItem(position), itemClickListener)
}

data class ViewHolder(val binding: ItemFeedbackReasonBinding) : RecyclerView.ViewHolder(binding.root) {
data class ViewHolder(val binding: RowOneLineListItemBinding) : RecyclerView.ViewHolder(binding.root) {

fun bind(
reason: FeedbackTypeSubReasonDisplay,
clickListener: (FeedbackTypeSubReasonDisplay) -> Unit,
) {
binding.reason.text = binding.root.context.getString(reason.listDisplayResId)
binding.root.setOnClickListener { clickListener(reason) }
val listItem = binding.root
listItem.hideLeadingIcon()
listItem.setPrimaryText(binding.root.context.getString(reason.listDisplayResId))
listItem.setOnClickListener { clickListener(reason) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
package com.duckduckgo.app.feedback.ui.negative.subreason

import android.os.Bundle
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.duckduckgo.anvil.annotations.InjectWith
import com.duckduckgo.app.browser.R
import com.duckduckgo.app.browser.databinding.ContentFeedbackNegativeDisambiguationSubReasonBinding
import com.duckduckgo.app.feedback.ui.common.FeedbackFragment
import com.duckduckgo.app.feedback.ui.common.FeedbackItemDecoration
import com.duckduckgo.app.feedback.ui.negative.FeedbackType.*
import com.duckduckgo.app.feedback.ui.negative.FeedbackType.MainReason.*
import com.duckduckgo.app.feedback.ui.negative.FeedbackTypeDisplay
Expand Down Expand Up @@ -94,7 +92,6 @@ class SubReasonNegativeFeedbackFragment : FeedbackFragment(R.layout.content_feed
activity?.let {
binding.recyclerView.layoutManager = LinearLayoutManager(it)
binding.recyclerView.adapter = recyclerAdapter
binding.recyclerView.addItemDecoration(FeedbackItemDecoration(ContextCompat.getDrawable(it, R.drawable.feedback_list_divider)!!))

arguments?.let { args ->

Expand Down
27 changes: 0 additions & 27 deletions app/src/main/res/drawable/feedback_list_divider.xml

This file was deleted.

52 changes: 31 additions & 21 deletions app/src/main/res/layout/content_feedback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,39 @@

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<androidx.constraintlayout.widget.ConstraintLayout style="@style/FeedbackFragmentStyle">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
<com.duckduckgo.mobile.android.ui.view.text.DaxTextView
android:id="@+id/title"
style="@style/FeedbackTitle.FeedbackHappySadDisambiguationTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/keyline_4"
android:text="@string/feedbackInitialDisambiguationTitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="@string/feedbackInitialDisambiguationTitle"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:typography="h1" />

<TextView
<com.duckduckgo.mobile.android.ui.view.text.DaxTextView
android:id="@+id/subtitle"
style="@style/FeedbackTitle.FeedbackSubtitle.FeedbackHappySadDisambiguationSubtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/keyline_5"
android:layout_marginTop="@dimen/keyline_2"
android:layout_marginEnd="@dimen/keyline_5"
android:text="@string/feedbackInitialDisambiguationSubtitle"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title" />
app:layout_constraintTop_toBottomOf="@id/title"
app:typography="body1" />

<ImageView
android:id="@+id/positiveFeedbackButton"
Expand All @@ -50,36 +61,35 @@
android:clickable="true"
android:contentDescription="@string/feedbackInitialDisambiguationHappyButtonContentDescription"
android:focusable="true"
tools:src="@drawable/button_happy_light_theme"
app:layout_constraintEnd_toStartOf="@id/negativeFeedbackButton"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/subtitle" />
app:layout_constraintTop_toBottomOf="@id/subtitle"
tools:src="@drawable/button_happy_light_theme" />

<ImageView
android:id="@+id/negativeFeedbackButton"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginStart="28dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/feedbackInitialDisambiguationSadButtonContentDescription"
tools:src="@drawable/button_sad_light_theme"
android:layout_marginStart="28dp"
app:layout_constraintBottom_toBottomOf="@id/positiveFeedbackButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/positiveFeedbackButton"
app:layout_constraintTop_toTopOf="@id/positiveFeedbackButton" />
app:layout_constraintTop_toTopOf="@id/positiveFeedbackButton"
tools:src="@drawable/button_sad_light_theme" />

<TextView
<com.duckduckgo.mobile.android.ui.view.text.DaxTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="26dp"
android:fontFamily="sans-serif-medium"
android:layout_marginBottom="@dimen/keyline_5"
android:text="@string/feedbackIsImportantToUs"
android:textColor="?attr/feedbackAnonymousFeedbackLabelColor"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:textType="secondary"
app:typography="caption" />

</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

0 comments on commit e2dd724

Please sign in to comment.