import android.widget.TextView;
import android.widget.Toast;
+import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.StringRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class FormFragment extends Fragment {
private HashMap<FormElement, View> mFormElementsViewMapping;
private File mCurrentPhoto;
private Button mPhotoButton;
- private long mLat = -1;
- private long mLon = -1;
public static @NonNull FormFragment newInstance(@NonNull Notule notule, @NonNull String collectivityId) {
FormFragment fragment = new FormFragment();
// Building mail content
- // Sending Intent
-
Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setType("text/plain");
+ intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{Notule.getCollectivityFromId(mNotule, mCollectivityId).getMail()});
intent.putExtra(Intent.EXTRA_SUBJECT, "[AMIES] [" + mNotule.getName() + "] - RĂ©ponse au formulaire");
intent.putExtra(Intent.EXTRA_TEXT, getMailData(mFormElements));
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(mCurrentPhoto));
try {
- startActivity(Intent.createChooser(intent, "Envoi du mail..."));
+ startActivity(Intent.createChooser(intent, "Choisissez votre client mail..."));
sendStatRequest();
}
catch (android.content.ActivityNotFoundException ex) {
Log.v("Adrien", "Stat request : " + url);
// Request a string response from the provided URL.
- StringRequest stringRequest = new StringRequest(Request.Method.POST, url, null, null);
+ StringRequest stringRequest = new StringRequest(Request.Method.POST, url, null, null) {
+
+ @Override protected Map<String, String> getParams() throws AuthFailureError {
+ HashMap<String, String> params = new HashMap<>();
+ params.put("notuleId", mNotule.getId());
+ return params;
+ }
+ };
// Add the request to the RequestQueue.
queue.add(stringRequest);