mirror of
https://github.com/SoPat712/TrackCovid19.git
synced 2025-08-21 18:28:46 -04:00
created a way to send feedback
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
16
.idea/navEditor.xml
generated
16
.idea/navEditor.xml
generated
@@ -8,6 +8,18 @@
|
|||||||
<LayoutPositions>
|
<LayoutPositions>
|
||||||
<option name="myPositions">
|
<option name="myPositions">
|
||||||
<map>
|
<map>
|
||||||
|
<entry key="nav_sed">
|
||||||
|
<value>
|
||||||
|
<LayoutPositions>
|
||||||
|
<option name="myPosition">
|
||||||
|
<Point>
|
||||||
|
<option name="x" value="12" />
|
||||||
|
<option name="y" value="12" />
|
||||||
|
</Point>
|
||||||
|
</option>
|
||||||
|
</LayoutPositions>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
<entry key="nav_yourcountry">
|
<entry key="nav_yourcountry">
|
||||||
<value>
|
<value>
|
||||||
<LayoutPositions>
|
<LayoutPositions>
|
||||||
@@ -37,8 +49,8 @@
|
|||||||
<LayoutPositions>
|
<LayoutPositions>
|
||||||
<option name="myPosition">
|
<option name="myPosition">
|
||||||
<Point>
|
<Point>
|
||||||
<option name="x" value="256" />
|
<option name="x" value="12" />
|
||||||
<option name="y" value="368" />
|
<option name="y" value="12" />
|
||||||
</Point>
|
</Point>
|
||||||
</option>
|
</option>
|
||||||
</LayoutPositions>
|
</LayoutPositions>
|
||||||
|
@@ -0,0 +1,156 @@
|
|||||||
|
package com.josh.trackcovid19v2;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.InflateException;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Use the {@link SendFeedbackFragment#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class SendFeedbackFragment extends Fragment {
|
||||||
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
|
private static final String ARG_PARAM1 = "param1";
|
||||||
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
|
// TODO: Rename and change types of parameters
|
||||||
|
private String mParam1;
|
||||||
|
private String mParam2;
|
||||||
|
|
||||||
|
public SendFeedbackFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this factory method to create a new instance of
|
||||||
|
* this fragment using the provided parameters.
|
||||||
|
*
|
||||||
|
* @param param1 Parameter 1.
|
||||||
|
* @param param2 Parameter 2.
|
||||||
|
* @return A new instance of fragment SendFeedbackFragment.
|
||||||
|
*/
|
||||||
|
// TODO: Rename and change types and number of parameters
|
||||||
|
public static SendFeedbackFragment newInstance(String param1, String param2) {
|
||||||
|
SendFeedbackFragment fragment = new SendFeedbackFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_PARAM1, param1);
|
||||||
|
args.putString(ARG_PARAM2, param2);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (getArguments() != null) {
|
||||||
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
View view = inflater.inflate(R.layout.fragment_send_feedback, container, false);
|
||||||
|
final TextView to = (TextView) view.findViewById(R.id.sendTo);
|
||||||
|
final EditText message = (EditText) view.findViewById(R.id.EmailText);
|
||||||
|
final EditText subject = (EditText) view.findViewById(R.id.subject);
|
||||||
|
|
||||||
|
Button sendE = (Button) view.findViewById(R.id.sendEmail);
|
||||||
|
sendE.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(android.view.View v) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
|
||||||
|
builder.setTitle("Data");
|
||||||
|
builder.setMessage("We will need to take some data from your device to fix the report. Is this okay with you?");
|
||||||
|
|
||||||
|
builder.setPositiveButton("YES", new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
String toS = "joshpatra12@protonmail.com";
|
||||||
|
String subS = subject.getText().toString();
|
||||||
|
String mesS = message.getText().toString();
|
||||||
|
String system = System.getProperty("os.version");
|
||||||
|
Integer API = Build.VERSION.SDK_INT;
|
||||||
|
String device = Build.DEVICE;
|
||||||
|
String model = Build.MODEL;
|
||||||
|
String product = Build.PRODUCT;
|
||||||
|
String display = Build.DISPLAY;
|
||||||
|
String type = Build.TYPE;
|
||||||
|
String user = Build.USER;
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
((Activity) getContext()).getWindowManager()
|
||||||
|
.getDefaultDisplay()
|
||||||
|
.getMetrics(displayMetrics);
|
||||||
|
int height = displayMetrics.heightPixels + getNavigationBarHeight();
|
||||||
|
int width = displayMetrics.widthPixels;
|
||||||
|
Intent email = new Intent(Intent.ACTION_SEND);
|
||||||
|
|
||||||
|
email.putExtra(Intent.EXTRA_EMAIL , new String [] {toS});
|
||||||
|
email.putExtra(Intent.EXTRA_SUBJECT , subS);
|
||||||
|
email.putExtra(Intent.EXTRA_TEXT , mesS + "\n\n\n\n\n\n" + "\nAPI: " + API + "\nDevice: "
|
||||||
|
+ device + "\nModel: "+ model +"\nType:" + type +"\nUser:" + user +
|
||||||
|
"\nDisplay height: " + height + "\nDisplay width: " + width);
|
||||||
|
|
||||||
|
email.setType("message/rfc822");
|
||||||
|
startActivity(Intent.createChooser(email, "Choose an app to send the email with"));
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
Toast.makeText(getActivity(), "Canceled", Toast.LENGTH_SHORT).show();
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
private int getNavigationBarHeight() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
DisplayMetrics metrics = new DisplayMetrics();
|
||||||
|
((Activity) getContext()).getWindowManager()
|
||||||
|
.getDefaultDisplay()
|
||||||
|
.getMetrics(metrics);
|
||||||
|
int usableHeight = metrics.heightPixels;
|
||||||
|
((Activity) getContext()).getWindowManager()
|
||||||
|
.getDefaultDisplay()
|
||||||
|
.getRealMetrics(metrics);
|
||||||
|
int realHeight = metrics.heightPixels;
|
||||||
|
if (realHeight > usableHeight)
|
||||||
|
return realHeight - usableHeight;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
67
app/src/main/res/layout/fragment_send_feedback.xml
Normal file
67
app/src/main/res/layout/fragment_send_feedback.xml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".SendFeedbackFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sendTo"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textEmailAddress"
|
||||||
|
android:text="joshpatra12@protonmail.com"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.122"
|
||||||
|
app:layout_constraintWidth_percent=".7" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/subject"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Enter a subject for the email here"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.284"
|
||||||
|
app:layout_constraintWidth_percent=".90" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/EmailText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:gravity="start|top"
|
||||||
|
android:hint="Please highlight what the bug was."
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.6"
|
||||||
|
app:layout_constraintWidth_percent=".95" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/sendEmail"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Send"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias=".9" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -5,10 +5,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="com.josh.trackcovid19v2.SettingsFragment">
|
tools:context="com.josh.trackcovid19v2.SettingsFragment">
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="@string/hello_blank_fragment" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
@@ -27,11 +27,12 @@
|
|||||||
<group
|
<group
|
||||||
android:id="@+id/menu_bottom"
|
android:id="@+id/menu_bottom"
|
||||||
android:checkableBehavior="none">
|
android:checkableBehavior="none">
|
||||||
|
<!--
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_yoursettings"
|
android:id="@+id/nav_yoursettings"
|
||||||
android:icon="@drawable/ic_action_name"
|
android:icon="@drawable/ic_action_name"
|
||||||
android:title="@string/item" />
|
android:title="@string/item" />
|
||||||
|
-->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_sendFeedback"
|
android:id="@+id/nav_sendFeedback"
|
||||||
android:icon="@drawable/ic_action_name2"
|
android:icon="@drawable/ic_action_name2"
|
||||||
|
@@ -30,4 +30,9 @@
|
|||||||
android:name="com.josh.trackcovid19v2.SettingsActivity$SettingsFragment"
|
android:name="com.josh.trackcovid19v2.SettingsActivity$SettingsFragment"
|
||||||
android:label="@string/menu_yoursettings"
|
android:label="@string/menu_yoursettings"
|
||||||
tools:layout="@layout/fragment_settings" />
|
tools:layout="@layout/fragment_settings" />
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/nav_sendFeedback"
|
||||||
|
android:name="com.josh.trackcovid19v2.SendFeedbackFragment"
|
||||||
|
android:label="@string/send_feedback"
|
||||||
|
tools:layout="@layout/fragment_send_feedback" />
|
||||||
</navigation>
|
</navigation>
|
Reference in New Issue
Block a user