diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index ea076f1..5d3830c 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -4,6 +4,8 @@ android:versionCode="2" android:versionName="1.0.0-SNAPSHOT"> + + adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, COLORS); + listView.setAdapter(adapter); + + for (int i = 0; i <= listView.getLastVisiblePosition() - listView.getFirstVisiblePosition(); i++) { + View v = listView.getChildAt(i); + //for (int i = 0; i < ListViewActivity.COLORS.length; i++) { + //View v = adapter.getView(i, null, list); + + for (String color : COLORS){ + Log.d("|||", color); + //int colorInt = Integer.parseInt(color); + v.setVisibility(View.VISIBLE); + v.setBackgroundColor(Color.parseColor(color)); + //v.setBackgroundColor(); + } + + } } } + + diff --git a/src/main/java/nyc/c4q/NetworkActivity.java b/src/main/java/nyc/c4q/NetworkActivity.java index 3604cfc..ad31938 100644 --- a/src/main/java/nyc/c4q/NetworkActivity.java +++ b/src/main/java/nyc/c4q/NetworkActivity.java @@ -1,29 +1,12 @@ package nyc.c4q; import android.app.Activity; -import android.os.AsyncTask; import android.os.Bundle; import android.text.method.ScrollingMovementMethod; -import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; -import com.squareup.okhttp.FormEncodingBuilder; -import com.squareup.okhttp.HttpUrl; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.RequestBody; -import com.squareup.okhttp.Response; - -import java.io.BufferedInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; - public class NetworkActivity extends Activity { // Fields =========================== @@ -50,6 +33,10 @@ protected void onCreate(Bundle savedInstanceState) { httptextlog = (TextView) findViewById(R.id.httptextlog); httptextlog.setMovementMethod(new ScrollingMovementMethod()); + httptextlog.setText(urlParams); + + final String replaced = urlParams.replaceAll("\\+"," "); + /* The goal is to use AsyncTasks here. Shortcut to create URL in Java: @@ -82,6 +69,7 @@ public void onClick(View v) { httpbingetokhttp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + httptextlog.setText(replaced); } }); diff --git a/src/main/java/nyc/c4q/NotificationActivity.java b/src/main/java/nyc/c4q/NotificationActivity.java index f1f56ad..588183f 100644 --- a/src/main/java/nyc/c4q/NotificationActivity.java +++ b/src/main/java/nyc/c4q/NotificationActivity.java @@ -1,8 +1,10 @@ package nyc.c4q; import android.app.Activity; +import android.app.Notification; import android.app.NotificationManager; import android.os.Bundle; +import android.view.View; import android.widget.Button; public class NotificationActivity extends Activity { @@ -17,13 +19,55 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notification); - notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - Button autocancelnotification = (Button) findViewById(R.id.autocancelnotification); Button swipenotification = (Button) findViewById(R.id.swipenotification); Button permanentnotification = (Button) findViewById(R.id.permanentnotification); Button dismisspermanentnotification = (Button) findViewById(R.id.dismisspermanentnotification); Button buttonnotification = (Button) findViewById(R.id.buttonnotification); + notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + + } + + public void sn (View v){ + // notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + Notification.Builder builder0 = new Notification.Builder(NotificationActivity.this); + builder0.setContentTitle("swipe@c4q.nyc"); + builder0.setContentText("Swipe right if you want to meet me. Otherwise, I'm not going away."); + builder0.setSmallIcon(R.drawable.c4qfavicon); + + + + Notification notification0 = builder0.build(); + notificationManager.notify(1, notification0); + } + + public void pn (View v){ + // notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + Notification.Builder builder1 = new Notification.Builder(NotificationActivity.this); + builder1.setContentTitle("permanent@c4q.nyc"); + builder1.setContentText("I'm staying planted right here."); + builder1.setSmallIcon(R.drawable.c4qfavicon); + builder1.setOngoing(true); + + Notification notification1 = builder1.build(); + notificationManager.notify(1, notification1); + + } + public void dp (View v){ + //notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + notificationManager.cancelAll(); + } + public void ac (View v){ + //notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + Notification.Builder builder2 = new Notification.Builder(NotificationActivity.this); + builder2.setContentTitle("default@c4q.nyc"); + builder2.setContentText("Touch me to dismiss me!"); + builder2.setSmallIcon(R.drawable.c4qfavicon); + builder2.setAutoCancel(true); + + Notification notification2 = builder2.build(); + notificationManager.notify(1, notification2); + } } diff --git a/src/main/java/nyc/c4q/json/Zipcode.java b/src/main/java/nyc/c4q/json/Zipcode.java index 6d4761f..228fe68 100644 --- a/src/main/java/nyc/c4q/json/Zipcode.java +++ b/src/main/java/nyc/c4q/json/Zipcode.java @@ -1,4 +1,6 @@ package nyc.c4q.json; public class Zipcode { + + } diff --git a/src/main/res/layout/activity_listview.xml b/src/main/res/layout/activity_listview.xml index 0d4b9d6..8477634 100644 --- a/src/main/res/layout/activity_listview.xml +++ b/src/main/res/layout/activity_listview.xml @@ -9,20 +9,30 @@ + android:layout_width="0dp" + android:layout_height="match_parent" + android:text="You have not clicked anything." + android:layout_weight="3"/> + + + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="9"/> \ No newline at end of file diff --git a/src/main/res/layout/activity_notification.xml b/src/main/res/layout/activity_notification.xml index 42b7d61..2184673 100644 --- a/src/main/res/layout/activity_notification.xml +++ b/src/main/res/layout/activity_notification.xml @@ -8,25 +8,29 @@ android:id="@+id/autocancelnotification" android:text="Default Notification" android:layout_width="wrap_content" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:onClick="ac"/>