Skip to content

Commit

Permalink
Improve feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
patzly committed Jul 27, 2020
1 parent 9b03ddb commit 6e8132d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 45 deletions.
1 change: 1 addition & 0 deletions app/src/main/assets/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.7.0:
- Swedish translation (thanks contributors!)
- Front camera setting (e.g. for tablets)
- Improve feedback
- Removed shopping list shortcut due to shortcut limit in most launchers
- Bug fixes and improvements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

import androidx.annotation.NonNull;

import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.android.material.textfield.TextInputLayout;

import xyz.zedler.patrick.grocy.R;
import xyz.zedler.patrick.grocy.util.IconUtil;
Expand Down Expand Up @@ -100,21 +98,13 @@ public View onCreateView(
);
});

TextInputLayout textInputLayoutFeedback = view.findViewById(R.id.text_input_feedback);
EditText editText = textInputLayoutFeedback.getEditText();
assert editText != null;
editText.setOnFocusChangeListener((View v, boolean hasFocus) -> {
if(hasFocus) IconUtil.start(view, R.id.image_feedback_box);
});

view.findViewById(R.id.button_feedback_send).setOnClickListener(v -> {
view.findViewById(R.id.linear_feedback_email).setOnClickListener(v -> {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(
Uri.parse(
"mailto:"
+ getString(R.string.app_mail)
+ "?subject=" + Uri.encode("Feedback@Grocy")
+ "&body=" + Uri.encode(editText.getText().toString())
)
);
startActivity(Intent.createChooser(intent, getString(R.string.action_send_feedback)));
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_round_email.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/icon"
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM19.6,8.25l-7.07,4.42c-0.32,0.2 -0.74,0.2 -1.06,0L4.4,8.25c-0.25,-0.16 -0.4,-0.43 -0.4,-0.72 0,-0.67 0.73,-1.07 1.3,-0.72L12,11l6.7,-4.19c0.57,-0.35 1.3,0.05 1.3,0.72 0,0.29 -0.15,0.56 -0.4,0.72z"/>
</vector>
46 changes: 16 additions & 30 deletions app/src/main/res/layout/fragment_bottomsheet_feedback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingBottom="12dp"
android:paddingBottom="8dp"
android:gravity="center_horizontal">

<TextView
Expand Down Expand Up @@ -94,44 +94,30 @@
</LinearLayout>

<LinearLayout
style="@style/Theme.Grocy.ListItem.TwoLine"
android:paddingTop="2dp"
android:paddingBottom="0dp">
android:id="@+id/linear_feedback_email"
style="@style/Theme.Grocy.ListItem.TwoLine.Clickable"
android:background="@drawable/bg_list_item_surface">

<ImageView
android:id="@+id/image_feedback_box"
style="@style/Theme.Grocy.ListItem.Icon.Top"
android:layout_marginTop="24sp"
android:src="@drawable/ic_round_insert_comment_anim"
android:id="@+id/image_feedback_email"
style="@style/Theme.Grocy.ListItem.Icon"
android:src="@drawable/ic_round_email"
tools:ignore="ContentDescription" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_input_feedback"
style="@style/Widget.Grocy.TextInputLayout.FilledBox"
app:boxCornerRadiusTopStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxBackgroundColor="@color/on_surface_secondary"
android:hint="@string/hint_message">
<LinearLayout style="@style/Theme.Grocy.ListItem.TextBox">

<TextView
style="@style/Theme.Grocy.ListItem.Title"
android:text="@string/action_email" />

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textLongMessage|textAutoCorrect|textMultiLine|text|textCapSentences|textAutoComplete"
android:textColor="@color/on_background" />
<TextView
style="@style/Theme.Grocy.ListItem.Description"
android:text="@string/action_email_description" />

</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

</LinearLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/button_feedback_send"
style="@style/Widget.Grocy.Button.UnelevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="16dp"
android:text="@string/action_send" />

</LinearLayout>

</androidx.core.widget.NestedScrollView>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
<string name="action_clear_shopping_list">Einkaufszettel leeren</string>
<string name="action_rate">Auf Google Play bewerten</string>
<string name="action_rate_description">Die Entwicklung unterstützen</string>
<string name="action_email">Email senden</string>
<string name="action_email_description">Entwickler kontaktieren</string>
<string name="action_new_issue">Neues Issue auf GitHub öffnen</string>
<string name="action_new_issue_description">Bugs melden oder einen Vorschlag machen</string>
<string name="action_get_started">Loslegen</string>
Expand Down Expand Up @@ -378,7 +380,6 @@

<string name="hint_server">Server URL</string>
<string name="hint_key">Gültiger API Schlüssel</string>
<string name="hint_message">Email schreiben</string>

<string name="setting_dark_mode">Dunkles Theme erzwingen</string>
<string name="setting_dark_mode_description">Aus für Systemabhängigkeit</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@

<string name="hint_server">URL du serveur</string>
<string name="hint_key">Clé API valide</string>
<string name="hint_message">Écrire un email</string>

<string name="setting_dark_mode">Forcer le mode sombre</string>
<string name="setting_dark_mode_description">Désactivé pour la dépendance système</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-sv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@

<string name="hint_server">Server URL</string>
<string name="hint_key">Giltig API-nyckel</string>
<string name="hint_message">Skriv e-post</string>

<string name="setting_dark_mode">Tvinga mörkt läge</string>
<string name="setting_dark_mode_description">Av för att använda systemets inställning</string>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
<string name="action_clear_shopping_list">Clear shopping list</string>
<string name="action_rate">Rate on Google Play</string>
<string name="action_rate_description">Support the development</string>
<string name="action_email">Send email</string>
<string name="action_email_description">Contact the developers</string>
<string name="action_new_issue">Open new issue on GitHub</string>
<string name="action_new_issue_description">Report bugs or request a feature</string>
<string name="action_get_started">Get started</string>
Expand Down Expand Up @@ -384,7 +386,6 @@

<string name="hint_server">Server URL</string>
<string name="hint_key">Valid API key</string>
<string name="hint_message">Write email</string>

<string name="setting_dark_mode">Force dark mode</string>
<string name="setting_dark_mode_description">Off for system dependency</string>
Expand Down

0 comments on commit 6e8132d

Please sign in to comment.