diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index ea076f1..bdd2be8 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;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listview);
textLog = (TextView) findViewById(R.id.textLog);
+
+ adapterCount = (EditText) findViewById(R.id.adapterCount);
+ list = (ListView) findViewById(R.id.list);
+ adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1, COLORS );
+ list.setAdapter(adapter);
+
+// for (int i = 0; i < COLORS.length; i++) {
+//
+// list.indexOfChild(i).setBackground(COLORS);
+// }
+
}
}
diff --git a/src/main/java/nyc/c4q/NetworkActivity.java b/src/main/java/nyc/c4q/NetworkActivity.java
index 3604cfc..d85581a 100644
--- a/src/main/java/nyc/c4q/NetworkActivity.java
+++ b/src/main/java/nyc/c4q/NetworkActivity.java
@@ -18,6 +18,7 @@
import java.io.BufferedInputStream;
import java.io.DataOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -73,6 +74,9 @@ protected void onCreate(Bundle savedInstanceState) {
https://httpbin.org/post
*/
+ String.format("https://httpbin.org/get?%s", urlParams);
+ httptextlog.setText(urlParams);
+
httpbinget.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -82,12 +86,15 @@ public void onClick(View v) {
httpbingetokhttp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ String replaced = urlParams.replaceAll("\\+"," ");
+ httptextlog.setText(replaced);
}
});
httpbinpost.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+
}
});
@@ -103,5 +110,8 @@ public void onClick(View v) {
httptextlog.setText("cleared HTTP response");
}
});
+
+
+
}
}
diff --git a/src/main/java/nyc/c4q/NotificationActivity.java b/src/main/java/nyc/c4q/NotificationActivity.java
index f1f56ad..162b60a 100644
--- a/src/main/java/nyc/c4q/NotificationActivity.java
+++ b/src/main/java/nyc/c4q/NotificationActivity.java
@@ -1,8 +1,14 @@
package nyc.c4q;
import android.app.Activity;
+import android.app.Notification;
import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Intent;
import android.os.Bundle;
+import android.service.notification.StatusBarNotification;
+import android.support.v4.app.NotificationCompat;
+import android.view.View;
import android.widget.Button;
public class NotificationActivity extends Activity {
@@ -19,11 +25,96 @@ protected void onCreate(Bundle savedInstanceState) {
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
- Button autocancelnotification = (Button) findViewById(R.id.autocancelnotification);
+ final 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);
+ final Button dismisspermanentnotification = (Button) findViewById(R.id.dismisspermanentnotification);
Button buttonnotification = (Button) findViewById(R.id.buttonnotification);
+
+
+ Intent intent = new Intent(this, NotificationActivity.class);
+ final PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
+
+
+ autocancelnotification.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Notification n = new Notification.Builder(getApplicationContext())
+ .setContentTitle("default@c4q.nyc")
+ .setContentText("Touch me to dismiss me!")
+ .setSmallIcon(R.drawable.c4qfavicon)
+ .setContentIntent(pIntent)
+ .setAutoCancel(true)
+ .addAction(R.drawable.c4qfavicon, "And more", pIntent).build();
+ NotificationManager notificationManager =
+ (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+
+ notificationManager.notify(0, n);
+ }
+ });
+
+ swipenotification.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Notification n = new Notification.Builder(getApplicationContext())
+ .setContentTitle("swipe@c4q.nyc")
+ .setContentText("Swipe right if you want to meet me. Otherwise, I'm not going away.")
+ .setSmallIcon(R.drawable.c4qfavicon)
+ .setContentIntent(pIntent)
+ .setAutoCancel(false)
+ .addAction(R.drawable.c4qfavicon, "And more", pIntent).build();
+ NotificationManager notificationManager =
+ (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+
+ notificationManager.notify(1, n);
+ }
+ });
+
+ permanentnotification.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ Notification n = new Notification.Builder(getApplicationContext())
+ .setContentTitle("permanent@c4q.nyc")
+ .setContentText("I'm staying planted right here.")
+ .setSmallIcon(R.drawable.c4qfavicon)
+ .setContentIntent(pIntent).setOngoing(true)
+ .setAutoCancel(false)
+ .addAction(R.drawable.c4qfavicon, "And more", pIntent).build();
+
+
+ NotificationManager notificationManager =
+ (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+ n.flags = Notification.FLAG_ONGOING_EVENT;
+ notificationManager.notify(0, n);
+ }
+ });
+
+ dismisspermanentnotification.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Notification n = new Notification.Builder(getApplicationContext())
+ .setContentTitle("permanent@c4q.nyc")
+ .setContentText("I'm staying planted right here.")
+ .setSmallIcon(R.drawable.c4qfavicon)
+ .setContentIntent(pIntent).setOngoing(false)
+ .setAutoCancel(true)
+ .addAction(R.drawable.c4qfavicon, "And more", pIntent).build();
+
+
+ NotificationManager notificationManager =
+ (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+
+ notificationManager.notify(0, n);
+
+ }
+ });
+
+
+
+
+
+
}
}
diff --git a/src/main/res/drawable/color.xml b/src/main/res/drawable/color.xml
new file mode 100644
index 0000000..af72995
--- /dev/null
+++ b/src/main/res/drawable/color.xml
@@ -0,0 +1,4 @@
+
+
+ #FF6666
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_listview.xml b/src/main/res/layout/activity_listview.xml
index 0d4b9d6..414d886 100644
--- a/src/main/res/layout/activity_listview.xml
+++ b/src/main/res/layout/activity_listview.xml
@@ -9,20 +9,35 @@
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_weight="3.0"
+ android:text="You have not clicked anything." />
+
+
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="9.0"
+ android:background="@drawable/color"/>
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_network.xml b/src/main/res/layout/activity_network.xml
index f375c94..9f27741 100644
--- a/src/main/res/layout/activity_network.xml
+++ b/src/main/res/layout/activity_network.xml
@@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/cleartextlog"
android:layout_alignParentBottom="true"
- android:text="No HTTP response"
+ android:text="urlParams"
android:typeface="monospace" />
diff --git a/src/test/java/nyc/c4q/Part4NotificationActivityTests.java b/src/test/java/nyc/c4q/Part4NotificationActivityTests.java
index 36a7e3b..5c71051 100644
--- a/src/test/java/nyc/c4q/Part4NotificationActivityTests.java
+++ b/src/test/java/nyc/c4q/Part4NotificationActivityTests.java
@@ -42,7 +42,7 @@ public void test21NotificationActivityCreateAutoCancelNotification(){
autocancelnotification.callOnClick();
ShadowNotificationManager snm = Robolectric.shadowOf(notificationManager);
- assertThat(snm.size(), equalTo(1));
+ assertThat(snm.size(), equalTo(1));
ShadowNotification n = Robolectric.shadowOf(snm.getAllNotifications().get(0));
assertThat(n.getContentTitle().toString(), containsString("default@c4q.nyc"));