diff options
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ProblemReportFragment.kt | 35 | ||||
| -rw-r--r-- | android/src/main/res/layout/problem_report.xml | 7 | ||||
| -rw-r--r-- | android/src/main/res/values/strings.xml | 2 |
3 files changed, 28 insertions, 16 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ProblemReportFragment.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ProblemReportFragment.kt index 69da3542c5..ec4b4fde1d 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ProblemReportFragment.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ProblemReportFragment.kt @@ -1,10 +1,15 @@ package net.mullvad.mullvadvpn.ui import android.content.Context +import android.graphics.Typeface import android.os.Bundle import android.support.v4.app.Fragment import android.text.Editable +import android.text.Spannable +import android.text.SpannableStringBuilder import android.text.TextWatcher +import android.text.style.ForegroundColorSpan +import android.text.style.StyleSpan import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -47,7 +52,6 @@ class ProblemReportFragment : Fragment() { private lateinit var sendStatusLabel: TextView private lateinit var sendDetailsLabel: TextView private lateinit var responseMessageLabel: TextView - private lateinit var responseEmailLabel: TextView private lateinit var editMessageButton: Button private lateinit var tryAgainButton: Button @@ -87,7 +91,6 @@ class ProblemReportFragment : Fragment() { sendStatusLabel = view.findViewById<TextView>(R.id.send_status) sendDetailsLabel = view.findViewById<TextView>(R.id.send_details) responseMessageLabel = view.findViewById<TextView>(R.id.response_message) - responseEmailLabel = view.findViewById<TextView>(R.id.response_email) editMessageButton = view.findViewById<Button>(R.id.edit_message_button) tryAgainButton = view.findViewById<Button>(R.id.try_again_button) @@ -193,7 +196,6 @@ class ProblemReportFragment : Fragment() { sendStatusLabel.visibility = View.VISIBLE sendDetailsLabel.visibility = View.GONE responseMessageLabel.visibility = View.GONE - responseEmailLabel.visibility = View.GONE sendStatusLabel.setText(R.string.sending) @@ -209,11 +211,7 @@ class ProblemReportFragment : Fragment() { sendDetailsLabel.visibility = View.VISIBLE if (!userEmail.isEmpty()) { - responseMessageLabel.visibility = View.VISIBLE - responseEmailLabel.visibility = View.VISIBLE - responseEmailLabel.text = userEmail - - showingEmail = true + showResponseMessage(userEmail) } sendStatusLabel.setText(R.string.sent) @@ -222,6 +220,27 @@ class ProblemReportFragment : Fragment() { scrollArea.scrollTo(0, titleController.fullCollapseScrollOffset.toInt()) } + private fun showResponseMessage(userEmail: String) { + val responseMessageTemplate = parentActivity.getString(R.string.sent_contact) + val responseMessage = parentActivity.getString(R.string.sent_contact, userEmail) + + val emailStart = responseMessageTemplate.indexOf('%') + val emailEndFromStringEnd = responseMessageTemplate.length - (emailStart + 4) + val emailEnd = responseMessage.length - emailEndFromStringEnd + + val boldStyle = StyleSpan(Typeface.BOLD) + val colorStyle = ForegroundColorSpan(parentActivity.getColor(R.color.white)) + + responseMessageLabel.text = SpannableStringBuilder(responseMessage).apply { + setSpan(boldStyle, emailStart, emailEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) + setSpan(colorStyle, emailStart, emailEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) + } + + responseMessageLabel.visibility = View.VISIBLE + + showingEmail = true + } + private fun showErrorScreen() { sendingSpinner.visibility = View.GONE diff --git a/android/src/main/res/layout/problem_report.xml b/android/src/main/res/layout/problem_report.xml index d0259a2bfc..2da886968b 100644 --- a/android/src/main/res/layout/problem_report.xml +++ b/android/src/main/res/layout/problem_report.xml @@ -142,13 +142,6 @@ android:textSize="13sp" android:text="@string/sent_contact" android:visibility="gone" /> - <TextView android:id="@+id/response_email" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/white" - android:textSize="13sp" - android:textStyle="bold" - android:visibility="gone" /> <Space android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml index f25e782df6..19ed11e341 100644 --- a/android/src/main/res/values/strings.xml +++ b/android/src/main/res/values/strings.xml @@ -87,7 +87,7 @@ <string name="send_anyway">Send anyway</string> <string name="back">Back</string> <string name="sent_thanks">Thanks! We will look into this.</string> - <string name="sent_contact">If needed we will contact you on</string> + <string name="sent_contact">If needed we will contact you on %1$s</string> <string name="failed_to_send_details">You may need to go back to the app\'s main screen and click Disconnect before trying again. Don\'t worry, the information you entered will remain in the form.</string> |
