summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt30
-rw-r--r--android/src/main/res/layout/problem_report.xml14
-rw-r--r--android/src/main/res/values/strings.xml1
3 files changed, 44 insertions, 1 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt
index a8b47307d2..fa389517ea 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt
@@ -38,6 +38,8 @@ class ProblemReportFragment : Fragment() {
private lateinit var responseMessageLabel: TextView
private lateinit var responseEmailLabel: TextView
+ private lateinit var tryAgainButton: Button
+
private var sendReportJob: Job? = null
override fun onAttach(context: Context) {
@@ -74,11 +76,17 @@ class ProblemReportFragment : Fragment() {
responseMessageLabel = view.findViewById<TextView>(R.id.response_message)
responseEmailLabel = view.findViewById<TextView>(R.id.response_email)
+ tryAgainButton = view.findViewById<Button>(R.id.try_again_button)
+
sendButton.setOnClickListener {
sendReportJob?.cancel()
sendReportJob = sendReport()
}
+ tryAgainButton.setOnClickListener {
+ sendReportJob = sendReport()
+ }
+
setSendButtonEnabled(false)
userMessageInput.addTextChangedListener(InputWatcher())
@@ -96,7 +104,7 @@ class ProblemReportFragment : Fragment() {
problemReport.userEmail = userEmail
problemReport.userMessage = userMessageInput.text.toString()
- bodyContainer.showNext()
+ showSendingScreen()
if (problemReport.send().await()) {
showSuccessScreen(userEmail)
@@ -105,6 +113,23 @@ class ProblemReportFragment : Fragment() {
}
}
+ private fun showSendingScreen() {
+ bodyContainer.displayedChild = 1
+
+ sendingSpinner.visibility = View.VISIBLE
+ sentSuccessfullyIcon.visibility = View.GONE
+ failedToSendIcon.visibility = View.GONE
+
+ sendStatusLabel.visibility = View.VISIBLE
+ sendDetailsLabel.visibility = View.GONE
+ responseMessageLabel.visibility = View.GONE
+ responseEmailLabel.visibility = View.GONE
+
+ sendStatusLabel.setText(R.string.sending)
+
+ tryAgainButton.visibility = View.GONE
+ }
+
private fun showSuccessScreen(userEmail: String) {
sendingSpinner.visibility = View.GONE
@@ -119,6 +144,7 @@ class ProblemReportFragment : Fragment() {
}
sendStatusLabel.setText(R.string.sent)
+ sendDetailsLabel.setText(R.string.sent_thanks)
}
private fun showErrorScreen() {
@@ -130,6 +156,8 @@ class ProblemReportFragment : Fragment() {
sendStatusLabel.setText(R.string.failed_to_send)
sendDetailsLabel.setText(R.string.failed_to_send_details)
+
+ tryAgainButton.visibility = View.VISIBLE
}
private fun setSendButtonEnabled(enabled: Boolean) {
diff --git a/android/src/main/res/layout/problem_report.xml b/android/src/main/res/layout/problem_report.xml
index 49ba73ced9..f2955badfe 100644
--- a/android/src/main/res/layout/problem_report.xml
+++ b/android/src/main/res/layout/problem_report.xml
@@ -127,6 +127,7 @@
android:visibility="gone"
/>
</FrameLayout>
+
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -170,6 +171,19 @@
android:textStyle="bold"
android:visibility="gone"
/>
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ />
+
+ <Button android:id="@+id/try_again_button"
+ android:layout_marginVertical="16dp"
+ android:text="@string/try_again"
+ android:visibility="gone"
+ style="@style/GreenButton"
+ />
</LinearLayout>
</ViewSwitcher>
</LinearLayout>
diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml
index 701c8205c5..c2c37738bf 100644
--- a/android/src/main/res/values/strings.xml
+++ b/android/src/main/res/values/strings.xml
@@ -42,6 +42,7 @@
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>
+ <string name="try_again">Try again</string>
<string name="unsecured_connection">Unsecured connection</string>
<string name="creating_secure_connection">Creating secure connection</string>