Skip to content

Commit

Permalink
Removed email sender, as it is broken.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDab committed Dec 8, 2018
1 parent be52e4d commit 8362eaf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 58 deletions.
56 changes: 1 addition & 55 deletions app/src/main/java/trc3543/trcscoutingapp/AddCompetitions.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,36 +324,6 @@ else if (id == R.id.action_transmitresults)
startActivity(intent);
return true;
}
else if (id == R.id.action_mailcsv)
{
// mail the CSV
try
{
final String filename = DataStore.firstName +"_"+DataStore.lastName +"_results.csv";
final String[] recipient = {""};
final EditText txtUrl = new EditText(this);
new AlertDialog.Builder(this)
.setTitle("Mail results")
.setMessage("Please enter the recipient's email.")
.setView(txtUrl)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
recipient[0] = txtUrl.getText().toString();
sendEmailWithCSV(filename, recipient[0]);
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.show();
}
catch (Exception arg0)
{
// TODO Auto-generated catch block
arg0.printStackTrace();
}
}
else if (id == R.id.action_ac)
{
// clear the screen
Expand Down Expand Up @@ -513,31 +483,7 @@ public void openCompNamePrompt(boolean modifyingExisting, int option)
}
startActivity(intent);
}
public void sendEmailWithCSV(String filename0, String target)
{
try
{
File writeDirectory = new File(Environment.getExternalStorageDirectory(), DataStore.DATA_FOLDER_NAME);
if (!writeDirectory.exists())
{
writeDirectory.mkdir();
}
File filelocation = new File(writeDirectory, filename0);
Uri path = Uri.fromFile(filelocation);
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("vnd.android.cursor.dir/email");
String to[] = {target};
emailIntent.putExtra(Intent.EXTRA_EMAIL, to);
emailIntent.putExtra(Intent.EXTRA_STREAM, path);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Robotics Scouting Results");
startActivity(Intent.createChooser(emailIntent, "Send email..."));
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}

private static final int REQUEST_EXTERNAL_STORAGE = 1;
private static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/menu/menu_add_competitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
<item
android:id="@+id/action_transmitresults"
android:title="Send to server..." />
<item
android:id="@+id/action_mailcsv"
android:title="Email results..." />
<item
android:id="@+id/action_about"
android:icon="@android:drawable/ic_menu_info_details"
Expand Down

0 comments on commit 8362eaf

Please sign in to comment.