Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allison Bojarski's assessment #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
android:versionCode="2"
android:versionName="1.0.0-SNAPSHOT">

<uses-permission android:name="android.permission.INTERNET" />


<application android:name=".Unit2AssessmentApplication">
<activity
android:name=".Unit2AssessmentActivity"
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/nyc/c4q/JSONActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,13 @@ public void onClick(View v) {
File file = new File(directory, "zipcodes.json");
}
});

// addjson.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// }
// })
// }
}
}
45 changes: 23 additions & 22 deletions src/main/java/nyc/c4q/NetworkActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,29 @@ protected void onCreate(Bundle savedInstanceState) {
httptextlog = (TextView) findViewById(R.id.httptextlog);
httptextlog.setMovementMethod(new ScrollingMovementMethod());

/*
The goal is to use AsyncTasks here.
Shortcut to create URL in Java:

String.format("https://httpbin.org/get?%s", urlParams);

HTTP GET request we'll be using:

$ curl "https://httpbin.org/get?custname=james+dean&custtel=347-841-6090&custemail=hello%40c4q.nyc&size=small&topping=cheese&delivery=18%3A15&comments=Leave+it+by+the+garage+door.+Don%27t+ask+any+questions."

HTTP POST request we'll be using:

$ curl -X POST \
-d "custname=james dean" \
-d "custtel=347-8431-6090" \
-d "[email protected]" \
-d "size=small" \
-d "topping=cheese" \
-d "delivery=22:15" \
-d "comments=Leave it by the garage door. Don't ask any questions." \
https://httpbin.org/post
*/
// /*
// The goal is to use AsyncTasks here.
// Shortcut to create URL in Java:
//
//
// String.format("https://httpbin.org/get?%s", urlParams);
//
// HTTP GET request we'll be using:
//
// $ curl "https://httpbin.org/get?custname=james+dean&custtel=347-841-6090&custemail=hello%40c4q.nyc&size=small&topping=cheese&delivery=18%3A15&comments=Leave+it+by+the+garage+door.+Don%27t+ask+any+questions."
//
// HTTP POST request we'll be using:
//
// $ curl -X POST \
// -d "custname=james dean" \
// -d "custtel=347-8431-6090" \
// -d "[email protected]" \
// -d "size=small" \
// -d "topping=cheese" \
// -d "delivery=22:15" \
// -d "comments=Leave it by the garage door. Don't ask any questions." \
// https://httpbin.org/post
// */

httpbinget.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
89 changes: 84 additions & 5 deletions src/main/java/nyc/c4q/NotificationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,29 @@
import android.app.Activity;
import android.app.NotificationManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.NotificationCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;

public class NotificationActivity extends Activity {
NotificationManager notificationManager;
private Button autocancelnotification;
private Button swipenotification;
private Button permanentnotification;
private Button dismisspermanentnotification;
private Button buttonnotification;

public static final int ID_AUTOCANCEL_NOTIFICATION = 1;
public static final int ID_SWIPE_NOTIFICATION = 2;
public static final int ID_PERMANENT_NOTIFICATION = 3;
Expand All @@ -17,13 +36,73 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification);

initializeViews();

showNotification();

autoCancelNotification();

// updateNotification();


}

private void initializeViews() {
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);
autocancelnotification = (Button) findViewById(R.id.autocancelnotification);
swipenotification = (Button) findViewById(R.id.swipenotification);
permanentnotification = (Button) findViewById(R.id.permanentnotification);
dismisspermanentnotification = (Button) findViewById(R.id.dismisspermanentnotification);
buttonnotification = (Button) findViewById(R.id.buttonnotification);

}

// autocancelnotification.setOnClickListener(this);
// swipenotification.setOnClickListener(this);
// permanentnotification.setOnClickListener(this);
// dismisspermanentnotification.setOnClickListener(this);
// buttonnotification.setOnClickListener(this);
// }
//
//
//
// View cancelButton = findViewById(R.id.autocancelnotification);
// cancelButton.setOnClickListener(new View.OnClickListener()
// {
// @Override
// public void onClick(View v)
// {
// cancelNotification();
// }
// });



private void showNotification()
{

}

private void updateNotification(String titleText, String contentText)
{
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setAutoCancel(true);
builder.setContentTitle(titleText);
builder.setContentText(contentText);
builder.setSmallIcon(R.drawable.c4qfavicon);
Notification notification = builder.build();
// notificationManager.notify(NOTIFICATION_ID, notification);
}

private void autoCancelNotification()
{
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(ID_AUTOCANCEL_NOTIFICATION);
}




}
5 changes: 5 additions & 0 deletions src/main/java/nyc/c4q/json/Zipcode.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package nyc.c4q.json;

public class Zipcode {

public Zipcode() {
}


}
31 changes: 24 additions & 7 deletions src/main/res/layout/activity_listview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,37 @@

<LinearLayout
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:orientation="horizontal">

<TextView
android:id="@+id/textLog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="9.0"
android:text="Fill this textview" />

</LinearLayout>

<ListView
<ListView>
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3.0"
android:text="You have not clicked anything."

<EditText
android:id="@+id/adapterCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:inputType="phone"/>


</ListView>




</LinearLayout>