summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-05-07 13:39:42 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-05-07 13:39:42 -0400
commita24a00cafbaca1ab46c0458824ee111a55d4cea0 (patch)
tree2e39cde0eff9b6c9f9962873ba40815cf3f07ec8 /src
parent58aa0ea407aedde32cbde69b2dbb6cf4ae9e31a5 (diff)
added uploadGesture
Diffstat (limited to 'src')
-rw-r--r--src/us/minak/SettingsActivity.java63
1 files changed, 45 insertions, 18 deletions
diff --git a/src/us/minak/SettingsActivity.java b/src/us/minak/SettingsActivity.java
index a3dea5c..ef949a1 100644
--- a/src/us/minak/SettingsActivity.java
+++ b/src/us/minak/SettingsActivity.java
@@ -16,32 +16,40 @@
package us.minak;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.FileEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+
import android.app.ListActivity;
-import android.os.Bundle;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.gesture.Gesture;
+import android.gesture.GestureLibrary;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
+import android.os.Bundle;
import android.os.Environment;
-import android.view.View;
import android.view.ContextMenu;
-import android.view.MenuItem;
import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
import android.view.ViewGroup;
-import android.gesture.Gesture;
-import android.gesture.GestureLibrary;
-import android.widget.TextView;
import android.widget.AdapterView;
-import android.widget.Toast;
import android.widget.ArrayAdapter;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.BitmapDrawable;
-
-import java.util.Map;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Comparator;
+import android.widget.TextView;
+import android.widget.Toast;
public class SettingsActivity extends ListActivity {
private static final int STATUS_SUCCESS = 0;
@@ -82,6 +90,25 @@ public class SettingsActivity extends ListActivity {
mTask = (GesturesLoadTask) new GesturesLoadTask().execute();
}
+ public void uploadGesture() {
+ // Create a new HttpClient and Post Header
+ HttpClient httpclient = new DefaultHttpClient();
+ HttpPost httppost = new HttpPost("https://lukeshu.com/minak-server");
+
+ try {
+ //FileInputStream stream = new FileInputStream(SettingsUtil.getGestureFile(this));
+ httppost.setEntity(new FileEntity(SettingsUtil.getGestureFile(this), "application/octet-stream"));
+ HttpResponse response = httpclient.execute(httppost);
+
+ Toast toast = Toast.makeText(this, response.toString(), Toast.LENGTH_LONG);
+ toast.show();
+ } catch (ClientProtocolException e) {
+ // TODO Auto-generated catch block
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ }
+
private void checkForEmpty() {
if (mAdapter.getCount() == 0) {
mEmptyMessageView.setText(R.string.gestures_empty);