Skip to content

Add spinner when sending feedback #4384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.firebase.appdistribution.impl;

import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;

import android.graphics.Bitmap;
Expand Down Expand Up @@ -147,13 +146,13 @@ private Bitmap readScreenshot() {
}

public void submitFeedback(View view) {
setSubmittingStateEnabled(true);
if (releaseName == null) {
// Don't actually send feedback in development-mode
Toast.makeText(this, R.string.feedback_no_release, Toast.LENGTH_LONG).show();
finish();
return;
}
setSubmittingStateEnabled(true);
EditText feedbackText = findViewById(R.id.feedbackText);
CheckBox screenshotCheckBox = findViewById(R.id.screenshotCheckBox);
feedbackSender
Expand All @@ -176,7 +175,8 @@ public void submitFeedback(View view) {
}

public void setSubmittingStateEnabled(boolean loading) {
findViewById(R.id.sendButton).setVisibility(loading ? INVISIBLE : VISIBLE);
findViewById(R.id.sendButton).setVisibility(loading ? GONE : VISIBLE);
findViewById(R.id.sendSpinner).setVisibility(loading ? VISIBLE : GONE);
findViewById(R.id.feedbackText).setEnabled(!loading);
findViewById(R.id.feedbackText).setFocusable(!loading);
}
Expand Down
10 changes: 10 additions & 0 deletions firebase-appdistribution/src/main/res/layout/activity_feedback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@
android:minHeight="48dp"
app:srcCompat="@drawable/ic_baseline_send_24" />

<ProgressBar
android:id="@+id/sendSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:minWidth="48dp"
android:minHeight="48dp"
android:visibility="gone"/>

</LinearLayout>

<View
Expand Down
4 changes: 3 additions & 1 deletion firebase-appdistribution/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="FeedbackTheme" parent="Theme.AppCompat.Light.NoActionBar" />
<style name="FeedbackTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorAccent">#000000</item>
</style>
</resources>