send emails
This commit is contained in:
1 parent
0231051138
commit
3fe1c590ca
5 files changed
+24
-7
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
@@ -8,10 +9,8 @@ import android.widget.Toast;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -61,7 +60,8 @@ public class Action
|
||||
sendTextMessage,
|
||||
takeScreenshot,
|
||||
setSystemSetting,
|
||||
sendEmail;
|
||||
sendEmail,
|
||||
stopService;
|
||||
|
||||
public String getFullName(Context context)
|
||||
{
|
||||
@@ -137,6 +137,8 @@ public class Action
|
||||
return context.getResources().getString(R.string.setSystemSettingCapital);
|
||||
case sendEmail:
|
||||
return context.getResources().getString(R.string.sendEmail);
|
||||
case stopService:
|
||||
return context.getResources().getString(R.string.stopService);
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
@@ -326,6 +328,9 @@ public class Action
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case stopService:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.stopService));
|
||||
break;
|
||||
default:
|
||||
returnString.append(action.toString());
|
||||
}
|
||||
@@ -649,6 +654,9 @@ public class Action
|
||||
case sendEmail:
|
||||
Actions.sendEmailFromAction(this);
|
||||
break;
|
||||
case stopService:
|
||||
Intent myServiceIntent = new Intent(Miscellaneous.getAnyContext(), AutomationService.class);
|
||||
Miscellaneous.getAnyContext().stopService(myServiceIntent);
|
||||
default:
|
||||
Miscellaneous.logEvent("w", "Action", context.getResources().getString(R.string.unknownActionSpecified), 3);
|
||||
break;
|
||||
|
||||
@@ -2380,6 +2380,8 @@ public class ActivityManageRule extends Activity
|
||||
}
|
||||
else if(types[i].toString().equals(Action_Enum.setSystemSetting.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.gears_small));
|
||||
else if(types[i].toString().equals(Action_Enum.stopService.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.stop_service));
|
||||
else
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.placeholder));
|
||||
}
|
||||
@@ -2630,6 +2632,12 @@ public class ActivityManageRule extends Activity
|
||||
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionSendEmail.class);
|
||||
startActivityForResult(intent, requestCodeActionSendEmailAdd);
|
||||
}
|
||||
else if(actionTypes[which].toString().equals(Action_Enum.stopService.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.stopService);
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
refreshActionList();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2078,7 +2078,7 @@ public class Miscellaneous extends Service
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Miscellaneous.logEvent("e", "unzip()", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2115,7 +2115,7 @@ public class Miscellaneous extends Service
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e);
|
||||
Miscellaneous.logEvent("e", "unzip()", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2128,9 +2128,8 @@ public class Miscellaneous extends Service
|
||||
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{targetAddress});
|
||||
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
|
||||
if (fileAttachment != null)
|
||||
{
|
||||
emailIntent.putExtra(Intent.EXTRA_STREAM, fileAttachment);
|
||||
}
|
||||
|
||||
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
|
||||
context.startActivity(Intent.createChooser(emailIntent, "Sending email..."));
|
||||
}
|
||||
|
||||
@@ -1001,4 +1001,5 @@
|
||||
<string name="emailSubject">Subject</string>
|
||||
<string name="enterAllValues">Enter all values.</string>
|
||||
<string name="emailConfigurationNotice">Remember to configure an SMTP server in settings.</string>
|
||||
<string name="stopService">Stop service</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user