diff options
author | DavisLWebb <davislwebb@ymail.com> | 2014-05-07 13:40:22 -0400 |
---|---|---|
committer | DavisLWebb <davislwebb@ymail.com> | 2014-05-07 13:40:22 -0400 |
commit | 91ef12d06d4d033e01047013009b90ecdcdc72df (patch) | |
tree | bc70674226399c475dcaa4127dc64d07eceed257 /src | |
parent | d638ffcc7f9fdf00c82980019957ef36be33421a (diff) | |
parent | a24a00cafbaca1ab46c0458824ee111a55d4cea0 (diff) |
Merge branch 'master' of https://github.com/AndrewMurrell/minak
Diffstat (limited to 'src')
-rw-r--r-- | src/us/minak/SettingsActivity.java | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/src/us/minak/SettingsActivity.java b/src/us/minak/SettingsActivity.java index ecbc397..72274b6 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); |