1 package com.joshuawise.dumload;
3 import java.io.InputStream;
5 import android.app.Activity;
6 import android.app.Service;
7 import android.content.Intent;
8 import android.net.Uri;
9 import android.os.Bundle;
10 import android.os.IBinder;
11 import android.widget.TextView;
12 import android.widget.Button;
13 import android.view.View;
14 import android.widget.Toast;
15 import android.util.Log;
16 import android.os.Messenger;
17 import android.os.Message;
18 import android.app.AlertDialog;
19 import android.app.Dialog;
20 import android.content.DialogInterface;
22 public class NotifSlave extends Activity {
23 /** Called when the activity is first created. */
25 public void onCreate(Bundle savedInstanceState) {
26 super.onCreate(savedInstanceState);
27 // setContentView(R.layout.main);
28 // TextView tv = (TextView)findViewById(R.id.suckit);
29 // tv.setText("Suck it.");
32 private void say(String s) {
33 Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT).show();
36 private int _nextdialog = 0;
37 private Dialog _hell_ass_balls = null;
40 protected Dialog onCreateDialog(int id)
42 Log.e("DumLoad.NotifSlave", "Create for dialog "+(Integer.toString(id)));
43 if (id != _nextdialog)
45 return _hell_ass_balls;
48 private void showDialog(Dialog d)
52 Log.e("DumLoad.NotifSlave", "Attempting to show dialog "+(Integer.toString(_nextdialog)));
53 showDialog(_nextdialog);
56 public void onStart() {
59 Intent i = getIntent(); /* i *am* not an intent! */
60 final Activity thisact = this;
62 final Messenger m = (Messenger)i.getParcelableExtra("com.joshuawise.dumload.returnmessenger");
63 String reqtype = i.getStringExtra("com.joshuawise.dumload.reqtype");
64 String prompt = i.getStringExtra("com.joshuawise.dumload.prompt");
65 /* If any of these were null, we'll just take the exception. */
67 if (reqtype.equals("yesno")) {
68 AlertDialog.Builder builder = new AlertDialog.Builder(this);
69 builder.setTitle("Dumload");
70 builder.setMessage(prompt);
71 builder.setCancelable(false);
72 builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
73 public void onClick(DialogInterface dialog, int id) {
74 Log.e("Dumload.NotifSlave", "Responding with a 1.");
76 Message me = Message.obtain();
79 } catch (Exception e) {
80 Log.e("Dumload.NotifSlave", "Failed to send a message back to my buddy.");
86 builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
87 public void onClick(DialogInterface dialog, int id) {
88 Log.e("Dumload.NotifSlave", "Responding with a 1.");
90 Message me = Message.obtain();
93 } catch (Exception e) {
94 Log.e("Dumload.NotifSlave", "Failed to send a message back to my buddy.");
100 AlertDialog alert = builder.create();
102 } else if (reqtype.equals("message")) {
103 AlertDialog.Builder builder = new AlertDialog.Builder(this);
104 builder.setTitle("Dumload");
105 builder.setMessage(prompt);
106 builder.setCancelable(false);
107 builder.setNeutralButton("OK", new DialogInterface.OnClickListener() {
108 public void onClick(DialogInterface dialog, int id) {
110 Message me = Message.obtain();
112 } catch (Exception e) {
113 Log.e("Dumload.NotifSlave", "Failed to send a message back to my buddy.");
119 AlertDialog alert = builder.create();
121 } else if (reqtype.equals("password")) {
122 final Dialog d = new Dialog(this);
124 d.setContentView(R.layout.passwd);
125 d.setTitle("Dumload");
126 d.setCancelable(false);
128 TextView text = (TextView) d.findViewById(R.id.prompt);
129 text.setText(prompt);
131 Button ok = (Button) d.findViewById(R.id.ok);
132 ok.setOnClickListener(new View.OnClickListener() {
133 public void onClick(View v) {
135 Message me = Message.obtain();
137 TextView entry = (TextView) d.findViewById(R.id.entry);
138 Bundle b = new Bundle(1);
139 b.putString("response", entry.getText().toString());
142 } catch (Exception e) {
143 Log.e("Dumload.NotifSlave", "Failed to send a message back to my buddy.");
150 Button cancel = (Button) d.findViewById(R.id.cancel);
151 cancel.setOnClickListener(new View.OnClickListener() {
152 public void onClick(View v) {
154 Message me = Message.obtain();
157 } catch (Exception e) {
158 Log.e("Dumload.NotifSlave", "Failed to send a message back to my buddy.");
168 Log.e("Dumload.NotifSlave", "What's a "+reqtype+"?");