[tor-commits] [Git][tpo/applications/fenix][tor-browser-86.0.0b2-10.5-1] Bug 40138: Add feedback survey card
Matthew Finkel
gitlab at torproject.org
Wed Feb 17 16:11:20 UTC 2021
Matthew Finkel pushed to branch tor-browser-86.0.0b2-10.5-1 at The Tor Project / Applications / fenix
Commits:
4cda0a0b by Matthew Finkel at 2021-02-11T16:31:48+00:00
Bug 40138: Add feedback survey card
- - - - -
11 changed files:
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlAdapter.kt
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlView.kt
- + app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TorFeedbackSurveyViewHolder.kt
- app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
- + app/src/main/res/drawable/feedback_survey_padded_background.xml
- + app/src/main/res/drawable/tor_survey_icon_3x.png
- app/src/main/res/layout/fragment_home.xml
- + app/src/main/res/layout/tor_feedback_survey.xml
- app/src/main/res/values/colors.xml
Changes:
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlAdapter.kt
=====================================
@@ -23,6 +23,7 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.CollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.NoCollectionsMessageViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.PrivateBrowsingDescriptionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TorBootstrapPagerViewHolder
+import org.mozilla.fenix.home.sessioncontrol.viewholders.TorFeedbackSurveyViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabInCollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSitePagerViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingAutomaticSignInViewHolder
@@ -80,6 +81,7 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
}
object PrivateBrowsingDescription : AdapterItem(PrivateBrowsingDescriptionViewHolder.LAYOUT_ID)
+ object TorFeedbackSurvey : AdapterItem(TorFeedbackSurveyViewHolder.LAYOUT_ID)
object NoCollectionsMessage : AdapterItem(NoCollectionsMessageViewHolder.LAYOUT_ID)
object TorBootstrap : AdapterItem(TorBootstrapPagerViewHolder.LAYOUT_ID)
@@ -179,6 +181,10 @@ class SessionControlAdapter(
view,
interactor
)
+ TorFeedbackSurveyViewHolder.LAYOUT_ID -> TorFeedbackSurveyViewHolder(
+ view,
+ interactor
+ )
TorBootstrapPagerViewHolder.LAYOUT_ID -> TorBootstrapPagerViewHolder(
view,
components,
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt
=====================================
@@ -90,6 +90,11 @@ interface SessionControlController {
*/
fun handlePrivateBrowsingLearnMoreClicked()
+ /**
+ * @see [TabSessionInteractor.onTorFeedbackSurveyLaunchClicked]
+ */
+ fun handleTorFeedbackSurveyLaunchClicked()
+
/**
* @see [TopSiteInteractor.onRenameTopSiteClicked]
*/
@@ -593,4 +598,12 @@ class DefaultSessionControlController(
override fun handleTorNetworkSettingsClicked() {
openTorNetworkSettings()
}
+
+ override fun handleTorFeedbackSurveyLaunchClicked() {
+ activity.openToBrowserAndLoad(
+ searchTermOrURL = SupportUtils.TOR_FEEDBACK_SURVEY_URL,
+ newTab = true,
+ from = BrowserDirection.FromHome
+ )
+ }
}
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt
=====================================
@@ -18,6 +18,12 @@ interface TabSessionInteractor {
* "Common myths about private browsing" link in private mode.
*/
fun onPrivateBrowsingLearnMoreClicked()
+
+ /**
+ * Shows the Feedback Survey web page in a new tab. Called when a user clicks on the
+ * "Launch the Survey" button.
+ */
+ fun onTorFeedbackSurveyLaunchClicked()
}
/**
@@ -361,4 +367,8 @@ class SessionControlInteractor(
override fun onTorBootstrapNetworkSettingsClicked() {
controller.handleTorNetworkSettingsClicked()
}
+
+ override fun onTorFeedbackSurveyLaunchClicked() {
+ controller.handleTorFeedbackSurveyLaunchClicked()
+ }
}
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlView.kt
=====================================
@@ -66,7 +66,7 @@ private fun showCollections(
}
}
-private fun privateModeAdapterItems() = listOf(AdapterItem.PrivateBrowsingDescription)
+private fun privateModeAdapterItems() = listOf(AdapterItem.TorFeedbackSurvey)
private fun bootstrapAdapterItems() = listOf(AdapterItem.TorBootstrap)
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TorFeedbackSurveyViewHolder.kt
=====================================
@@ -0,0 +1,34 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.fenix.home.sessioncontrol.viewholders
+
+import android.view.View
+import androidx.recyclerview.widget.RecyclerView
+import kotlinx.android.synthetic.main.tor_feedback_survey.view.*
+import org.mozilla.fenix.R
+import org.mozilla.fenix.home.sessioncontrol.TabSessionInteractor
+
+class TorFeedbackSurveyViewHolder(
+ view: View,
+ private val interactor: TabSessionInteractor
+) : RecyclerView.ViewHolder(view) {
+
+ init {
+ // val resources = view.resources
+ // val appName = resources.getString(R.string.app_name)
+ // view.private_session_description.text = resources.getString(
+ // R.string.private_browsing_placeholder_description_2, appName
+ // )
+ with(view.feedback_survey_launch_button) {
+ setOnClickListener {
+ interactor.onTorFeedbackSurveyLaunchClicked()
+ }
+ }
+ }
+
+ companion object {
+ const val LAYOUT_ID = R.layout.tor_feedback_survey
+ }
+}
=====================================
app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
=====================================
@@ -37,6 +37,7 @@ object SupportUtils {
const val DONATE_URL = "https://donate.torproject.org/"
const val TB_MANUAL_URL = "https://tb-manual.torproject.org/mobile-tor"
const val TOR_RELEASES = "https://www.torproject.org/releases/"
+ const val TOR_FEEDBACK_SURVEY_URL = "https://survey.torproject.org/index.php/217469"
enum class SumoTopic(internal val topicStr: String) {
FENIX_MOVING("sync-delist"),
=====================================
app/src/main/res/drawable/feedback_survey_padded_background.xml
=====================================
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/feedback_survey_padded_background_color">
+ <item
+ android:bottom="6dp"
+ android:top="6dp">
+ <shape android:shape="rectangle">
+ <corners android:radius="4dp" />
+ </shape>
+ </item>
+</ripple>
=====================================
app/src/main/res/drawable/tor_survey_icon_3x.png
=====================================
Binary files /dev/null and b/app/src/main/res/drawable/tor_survey_icon_3x.png differ
=====================================
app/src/main/res/layout/fragment_home.xml
=====================================
@@ -94,7 +94,8 @@
android:textColor="#DEFFFFFF"
android:textSize="40sp"
android:lineSpacingMultiplier="1.1"
- app:layout_scrollFlags="scroll" />
+ app:layout_scrollFlags="scroll"
+ android:visibility="gone" />
</com.google.android.material.appbar.AppBarLayout>
=====================================
app/src/main/res/layout/tor_feedback_survey.xml
=====================================
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/feedback_survey_wrapper"
+ style="@style/OnboardingCardLightWithPadding"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"
+ android:clipToPadding="false">
+
+ <LinearLayout
+ android:id="@+id/feedback_survey_header_wrapper"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ android:importantForAccessibility="no">
+
+ <ImageView
+ android:id="@+id/tor_feedback_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="32dp"
+ android:layout_marginEnd="10dp"
+ android:adjustViewBounds="true"
+ android:clickable="false"
+ android:focusable="false"
+ android:importantForAccessibility="no"
+ app:srcCompat="@drawable/tor_survey_icon_3x"/>
+
+ <TextView
+ android:id="@+id/feedback_survey_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ellipsize="none"
+ android:lineSpacingExtra="6dp"
+ android:paddingHorizontal="4dp"
+ android:paddingTop="4dp"
+ android:scrollHorizontally="false"
+ android:textAlignment="viewStart"
+ android:textColor="?primaryText"
+ android:textSize="20sp"
+ android:text="We’d love your feedback" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/feedback_survey_description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ellipsize="none"
+ android:lineSpacingExtra="6dp"
+ android:paddingHorizontal="4dp"
+ android:paddingTop="4dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/feedback_survey_header_wrapper"
+ android:scrollHorizontally="false"
+ android:textAlignment="viewStart"
+ android:textColor="?primaryText"
+ android:textSize="16sp"
+ android:text="We put our users at the center of our development process. You can help us improve Tor Browser by completing this short survey about your experience:" />
+
+ <Button
+ style="@style/PositiveButton"
+ android:id="@+id/feedback_survey_launch_button"
+ android:text="Launch the Survey"
+ android:layout_marginTop="16dp"
+ android:textSize="18dp"
+ android:textColor="@android:color/black"
+ android:background="@drawable/feedback_survey_padded_background"
+ android:fontFamily="Roboto-Medium"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/feedback_survey_description" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
=====================================
app/src/main/res/values/colors.xml
=====================================
@@ -419,4 +419,7 @@
<!-- Tab Counter colors -->
<color name="mozac_ui_tabcounter_default_tint">@color/primary_text_light_theme</color>
<color name="mozac_ui_tabcounter_default_text">@color/primary_text_light_theme</color>
+
+ <!-- Tor -->
+ <color name="feedback_survey_padded_background_color">#A76FFA</color>
</resources>
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/commit/4cda0a0b1b7836cc888af800dee573104183eee7
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/commit/4cda0a0b1b7836cc888af800dee573104183eee7
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-commits/attachments/20210217/22a59a24/attachment-0001.htm>
More information about the tor-commits
mailing list