diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-05-21 00:22:28 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-05-21 00:22:28 -0400 |
commit | e2e36ac5a816e4736f7776f178b2b6bae46f1dbd (patch) | |
tree | fd0360fe891e4df1916a172eb4c54d19cee35bba | |
parent | 3270f8a28ba180f06076fbf244a6fb31dbdfdbed (diff) |
-rw-r--r-- | AndroidManifest.xml | 3 | ||||
-rw-r--r-- | res/layout/gestures_list.xml | 10 | ||||
-rw-r--r-- | src/us/minak/SettingsActivity.java | 121 |
3 files changed, 21 insertions, 113 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2cbcc00..05ee7c0 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -3,7 +3,7 @@ package="us.minak" android:versionCode="1" android:versionName="1.0" > - <uses-permission android:name="android.permission.INTERNET" /> + <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="19" /> @@ -42,4 +42,5 @@ android:name="SettingsCreateGestureActivity" android:label="@string/label_create_gesture" /> </application> + </manifest> diff --git a/res/layout/gestures_list.xml b/res/layout/gestures_list.xml index a75c3e1..bdbe1f5 100644 --- a/res/layout/gestures_list.xml +++ b/res/layout/gestures_list.xml @@ -66,16 +66,6 @@ android:layout_height="wrap_content" android:layout_weight="1" style="?android:attr/buttonBarButtonStyle" /> - - - <Button - android:id="@+id/uploadButton" - android:onClick="uploadGestures" - android:text="@string/button_upload" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - style="?android:attr/buttonBarButtonStyle" /> </LinearLayout> diff --git a/src/us/minak/SettingsActivity.java b/src/us/minak/SettingsActivity.java index b333002..a3dea5c 100644 --- a/src/us/minak/SettingsActivity.java +++ b/src/us/minak/SettingsActivity.java @@ -16,43 +16,32 @@ 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.Header; -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.Activity; import android.app.ListActivity; -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.AsyncTask; import android.os.Environment; -import android.util.Log; +import android.view.View; import android.view.ContextMenu; -import android.view.LayoutInflater; import android.view.MenuItem; -import android.view.View; +import android.view.LayoutInflater; import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; +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; public class SettingsActivity extends ListActivity { private static final int STATUS_SUCCESS = 0; @@ -93,17 +82,6 @@ public class SettingsActivity extends ListActivity { mTask = (GesturesLoadTask) new GesturesLoadTask().execute(); } - public void uploadGestures() { - // Create a new HttpClient and Post Header - PostTask task = new PostTask(); - task.setActivity(this); - task.execute("https://lukeshu.com/minak-server"); - } - - public void uploadGestures(View view) { - uploadGestures(); - } - private void checkForEmpty() { if (mAdapter.getCount() == 0) { mEmptyMessageView.setText(R.string.gestures_empty); @@ -111,7 +89,7 @@ public class SettingsActivity extends ListActivity { } // Basic life-cycle /////////////////////////////////////////////////////// - + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -332,65 +310,4 @@ public class SettingsActivity extends ListActivity { return convertView; } } - - class PostTask extends AsyncTask<String, String, String>{ - - private SettingsActivity mThis; - - @Override - protected String doInBackground(String... uri) { - - Log.w(NOTIFICATION_SERVICE, "Begin request"); - - HttpClient httpclient = new DefaultHttpClient(); - HttpPost httppost = new HttpPost("http://lukeshu.com/minak-server"); - if (!httppost.containsHeader("Host")) { - httppost.addHeader("Host", "lukeshu.com"); - Log.w(NOTIFICATION_SERVICE, "added host header"); - }else{ - Log.w(NOTIFICATION_SERVICE, "did not add host header"); - } - for (Header header : httppost.getAllHeaders()) { - Log.d("header", header.toString()); - } - - HttpResponse response = null; - try { - httppost.setEntity(new FileEntity(SettingsUtil.getGestureFile(mThis), "application/octet-stream")); - Log.d("postdata", httppost.getEntity().getContent().toString()); - response = httpclient.execute(httppost); - Log.w(NOTIFICATION_SERVICE, "Extend"); - - Toast toast = Toast.makeText(mThis, response.toString(), Toast.LENGTH_LONG); - toast.show(); - - } catch (ClientProtocolException e) { - Log.w(NOTIFICATION_SERVICE, "fil"); - // TODO Auto-generated catch block - } catch (IOException e) { - Log.w(NOTIFICATION_SERVICE, e.getMessage()); - e.printStackTrace(); - // TODO Auto-generated catch block - }catch (Exception e){ - Log.w(NOTIFICATION_SERVICE, e.getMessage()); - } - - if (response != null){ - return response.toString(); - } else { - return ""; - } - } - - @Override - protected void onPostExecute(String result) { - //Do anything with response.. - ; - } - - public void setActivity(Activity ack) { - mThis = (SettingsActivity) ack; - } - - } } |