Anonymous avatar Anonymous committed 23082ae

put in the appropriate vars from db

Comments (0)

Files changed (7)

Add a comment to this file

android/placeUvote/bin/classes.dex

Binary file modified.

Add a comment to this file

android/placeUvote/bin/com/placeuvote/puvandroid/AddLocation.class

Binary file modified.

Add a comment to this file

android/placeUvote/bin/com/placeuvote/puvandroid/EditLocation.class

Binary file modified.

Add a comment to this file

android/placeUvote/bin/placeUvote.apk

Binary file modified.

Add a comment to this file

android/placeUvote/bin/resources.ap_

Binary file modified.

android/placeUvote/src/com/placeuvote/puvandroid/PollDetail.java

 import android.widget.ImageButton;
 import android.widget.TextView;
 
-import com.placeuvote.puvandroid.PUVDatabase.LocationDetailCursor;
+import com.placeuvote.puvandroid.PUVDatabase.PollsCursor;
 
 
 /**
- * MicroLocationsDetail
+ * PollDetail
  */
 public class PollDetail extends Activity {
-
+    private static Integer poll_id;
+    private static TextView txtKey;
+    private static CheckBox chkPrivate;
+    private static CheckBox chkAnonymous;
+    private static CheckBox chkOneChoice;
+    private static TextView numLocations;
+    private static TextView numDates;
+    private static TextView dateCreatedOn;
+    private static TextView txtCreatedBy;
+    private static TextView dateLastVote;
+    private static TextView numTotalVotes;
+    private static TextView txtUser;
+    private static TextView txtEmail;
     private static TextView txtQuestion;
-    private static TextView txtPoll;
-    private static TextView txtEmail;
-    private static TextView txtContact;
-    private static TextView txtPhone;
-    private static ImageButton btnPhone;
-    private static Integer job_id;
     
     PUVDatabase db;
 
-    private LocationDetailCursor job;
-
-    
-    // Create a button click listener for the Dial button.
-    private final Button.OnClickListener btnPhoneOnClick = new Button.OnClickListener() {
-        public void onClick(View v) {
-            try {
-                startActivity(Intent.getIntent("tel:" + job.getColPhone()));
-            }
-            catch (Exception e) {}
-        }
-    };
-
+    private PollsCursor poll;
+    /**
+    final CheckBox chkPrivate = (CheckBox) findViewById(R.id.chkPrivate);
+    chkPrivate.setOnClickListener(new OnClickListener() {
+	    public void onClick(View v) {
+		// Perform action on clicks, depending on whether it's now checked
+		if (((CheckBox) v).isChecked()) {
+		    Toast.makeText(HelloFormStuff.this, "Selected", Toast.LENGTH_SHORT).show();
+		} else {
+		    Toast.makeText(HelloFormStuff.this, "Not selected", Toast.LENGTH_SHORT).show();
+		}
+	    }
+	});
+    */
     /**
      * Called when the activity is first created.
      *
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.puvdetail);
+        txtKey = (TextView) findViewById(R.id.txtKey);
+	chkPrivate = (CheckBox) findViewById(R.id.chkPrivate);
+	chkAnonymous = (CheckBox) findViewById(R.id.chkAnonymous);
+	chkOneChoice = (CheckBox) findViewById(R.id.chkOneChoice);
+        numLocations = (TextView) findViewById(R.id.numLocations);
+        numDates = (TextView) findViewById(R.id.numDates);
+        dateCreatedOn = (TextView) findViewById(R.id.dateCreatedOn);
+        txtCreatedBy = (TextView) findViewById(R.id.txtCreatedBy);
+        dateLastVote = (TextView) findViewById(R.id.dateLastVote);
+        numTotalVotes = (TextView) findViewById(R.id.numTotalVotes);
+        txtUser = (TextView) findViewById(R.id.txtUser);
+        txtEmail = (TextView) findViewById(R.id.txtEmail);
         txtQuestion = (TextView) findViewById(R.id.txtQuestion);
-        txtPoll = (TextView) findViewById(R.id.txtEmployer);
-        txtEmail = (TextView) findViewById(R.id.txtEmail);
-        txtContact = (TextView) findViewById(R.id.txtContact);
-        txtPhone = (TextView) findViewById(R.id.txtPhone);
 
-        // get the job_id for this job from the bundle passed by MicroLocationsList
+        // get the poll_id for this poll from the bundle passed by PollList
         Bundle bIn = this.getIntent().getExtras();
-        job_id = Integer.valueOf(bIn.getInt("_id"));
+        poll_id = Integer.valueOf(bIn.getInt("_id"));
 
         db = new PUVDatabase(this);
-        job = db.getLocationDetails(job_id.longValue());
+        job = db.getLocationDetails(poll_id.longValue());
 
+	public boolean IntToBool(int intValue)
+	{
+	    return (intValue != 0);
+	}
+
+	java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
         // fill in the form and display
-        txtQuestion.setText(job.getColQuestion());
-        txtPoll.setText(job.getColPollName());
-        txtEmail.setText(job.getColEmail());
-        txtContact.setText(job.getColContactName());
-        txtPhone.setText(job.getColPhone());
+	txtKey.setText(poll.getColKey());
+	chkPrivate.setChecked(IntToBool(poll.getColPrivate()));
+	chkAnonymous.setChecked(IntToBool(poll.getColAnonymous()));
+	chkOneChoice.setChecked(IntToBool(poll.getColOneChoice()));
+	numLocations.setText(poll.getLocations());
+	numDates.setText(poll.getColDates());
+	dateCreatedOn.setText("Created: " + dateFormat.format(poll.getColCreatedOn()));
+	txtCreatedBy.setText(poll.getColCreatedBy());
+	dateLastVote.setText(poll.getColLastVote());
+	numTotalVotes.setText(poll.getColTotalVotes());
+        txtUser.setText(poll.getColUser());
+        txtEmail.setText(poll.getColEmail());
+        txtQuestion.setText(poll.getColQuestion());
 
-        // Implement callback for the dial button
-        btnPhone = (ImageButton) findViewById(R.id.btnPhone);
-        btnPhone.setOnClickListener(btnPhoneOnClick);
-        btnPhone.setImageResource(R.drawable.phone);
     }
 
     /**
                 // Go to the employer detail page
                 Intent iEmp = new Intent(PollDetail.this, VoterDetail.class);
                 Bundle bEmp = new Bundle();
-                bEmp.putInt("_id", job_id.intValue());
+                bEmp.putInt("_id", poll_id.intValue());
                 iEmp.putExtras(bEmp);
 
                 startActivity(iEmp);
                     public void handleMessage(Message msg) {
                         switch (msg.what) {
                             case DELETE_JOB:
-                            db.deleteLocation(job_id);
+                            db.deleteLocation(poll_id);
                             startActivity(new Intent(PollDetail.this, PollList.class));
                             break;
                     
             	// Start the Edit Location Activity, passing this job's id
                 Intent iEdit = new Intent(PollDetail.this, EditPoll.class);
                 Bundle bEdit = new Bundle();
-                bEdit.putInt("_id", job_id);
+                bEdit.putInt("_id", poll_id);
                 iEdit.putExtras(bEdit);
                 startActivity(iEdit);            	
             	return true;

android/placeUvote/src/com/placeuvote/puvandroid/VoterDetail.java

     private static Integer poll_id;
     private static Integer choice_id;
     private static Integer datechoice_id;
-    private static Date createdon;
+    private static TextView createdon;
 
     private VoterCursor voter;
     
         // fill in the form and display
         txtVoter.setText(voter.getColCreatedBy());
         txtKey.setText(voter.getColVoterKey());
-        createdon.setText(voter.getColCreatedOn());
-	
+	java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
+	createdon.setText("Created: " + dateFormat.format(voter.getColCreatedOn()));
      }
 
     /**
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.