Commits

Anonymous committed 82859c1

refactoring down to mainly R.java errors only

Comments (0)

Files changed (7)

android/placeUvote/bin/classes.dex

Binary file modified.

android/placeUvote/bin/placeUvote.apk

Binary file modified.

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

-package com.placeuvote.puvandroid;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.placeuvote.puvandroid.PUVDatabase.PollsCursor;
-
-
-/**
- * AddLocation
- */
-public class AddLocation extends Activity {
-    private static Button btnAddLocation;
-    private static Spinner spnPoll;
-    private static TextView txtTitle;
-    private static TextView txtDescription;
-    private PUVDatabase db;
-
-    private class Poll {
-    	public String PollName;
-    	public long id;
-    	Poll( long id, String PollName){
-    		this.id = id;
-    		this.PollName = PollName;
-    	}
-    	@Override
-    	public String toString() {
-    		return this.PollName;
-    	}
-    }
-
-    // Create a button click listener for the AddLocation button.
-    private final Button.OnClickListener btnAddLocationOnClick = new Button.OnClickListener() {
-        public void onClick(View v) {
-        	Poll Poll = (Poll)spnPoll.getSelectedItem();
-//        	Toast.makeText(
-//    			AddLocation.this, 
-//    			String.format(
-//					"Poll: %s (%d)\nTitle: %s\nDesc: %s", 
-//					Poll.PollName, 
-//					Poll.id,
-//					txtTitle.getText(),
-//					txtDescription.getText()
-//				), 
-//    			Toast.LENGTH_SHORT
-//			).show();
-        	if (Poll.id<0 || txtTitle.getText().length()==0 || txtDescription.getText().length()==0){
-	        	Toast.makeText(AddLocation.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
-        	} else {
-	        	db.addLocation(Poll.id, txtTitle.getText().toString(), txtDescription.getText().toString());
-	        	Toast.makeText(AddLocation.this, "Location added", Toast.LENGTH_SHORT).show();
-	        	//spnPoll.setSelection(0); // select "choose an Poll"
-	        	txtTitle.setText("");
-	        	txtDescription.setText("");
-        	}
-    	}
-    };
-
-
-    /** Called when the activity is first created. */
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        db = new PUVDatabase(this);
-        setContentView(R.layout.addlocation);
-
-        // Find the controls
-        btnAddLocation = (Button) findViewById(R.id.btnAddLocation);
-        spnPoll = (Spinner) findViewById(R.id.spnPoll);
-        txtTitle = (TextView) findViewById(R.id.txtTitle);
-        txtDescription = (TextView) findViewById(R.id.txtDescription);
-
-        // btnAddLocation
-        btnAddLocation.setOnClickListener(btnAddLocationOnClick);
-
-        // spnPoll
-        List<Poll> PollsList = new ArrayList<Poll>();
-        PollsList.add(new Poll(-1, "Choose an Poll"));
-        PollsCursor c = db.getPolls();
-        for(int i=0; i<c.getCount(); i++){
-        	c.moveToPosition(i);
-        	PollsList.add(new Poll(c.getColId(),c.getColPollName()));
-        }
-        
-        ArrayAdapter<Poll> aspnPolls = new ArrayAdapter<Poll>(
-        		this, android.R.layout.simple_spinner_item, PollsList);
-        aspnPolls.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
-        spnPoll.setAdapter(aspnPolls);
-    }
-
-    /**
-     * @see android.app.Activity#onResume()
-     */
-    @Override
-    public void onResume() {
-        super.onResume();
-    }
-
-    /**
-     * @param icicle
-     */
-    public void onPause(Bundle icicle) {
-        super.onPause();
-    }
-
-}

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

+package com.placeuvote.puvandroid;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.placeuvote.puvandroid.PUVDatabase.PollsCursor;
+
+
+/**
+ * AddLocation
+ */
+public class AddPoll extends Activity {
+    private static Button btnAddLocation;
+    private static Spinner spnPoll;
+    private static TextView txtQuestion;
+    private static TextView txtEmail;
+    private PUVDatabase db;
+
+    private class Poll {
+    	public String PollName;
+    	public long id;
+    	Poll( long id, String PollName){
+    		this.id = id;
+    		this.PollName = PollName;
+    	}
+    	@Override
+    	public String toString() {
+    		return this.PollName;
+    	}
+    }
+
+    // Create a button click listener for the AddLocation button.
+    private final Button.OnClickListener btnAddLocationOnClick = new Button.OnClickListener() {
+        public void onClick(View v) {
+        	Poll Poll = (Poll)spnPoll.getSelectedItem();
+//        	Toast.makeText(
+//    			AddLocation.this, 
+//    			String.format(
+//					"Poll: %s (%d)\nTitle: %s\nDesc: %s", 
+//					Poll.PollName, 
+//					Poll.id,
+//					txtTitle.getText(),
+//					txtDescription.getText()
+//				), 
+//    			Toast.LENGTH_SHORT
+//			).show();
+        	if (Poll.id<0 || txtQuestion.getText().length()==0 || txtEmail.getText().length()==0){
+	        	Toast.makeText(AddPoll.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
+        	} else {
+	        	db.addPoll(Poll.id, txtQuestion.getText().toString(), txtEmail.getText().toString());
+	        	Toast.makeText(AddPoll.this, "Location added", Toast.LENGTH_SHORT).show();
+	        	//spnPoll.setSelection(0); // select "choose an Poll"
+	        	txtQuestion.setText("");
+	        	txtEmail.setText("");
+        	}
+    	}
+    };
+
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        db = new PUVDatabase(this);
+        setContentView(R.layout.addpoll);
+
+        // Find the controls
+        btnAddLocation = (Button) findViewById(R.id.btnAddLocation);
+        spnPoll = (Spinner) findViewById(R.id.spnPoll);
+        txtQuestion = (TextView) findViewById(R.id.txtQuestion);
+        txtEmail = (TextView) findViewById(R.id.txtEmail);
+
+        // btnAddLocation
+        btnAddLocation.setOnClickListener(btnAddLocationOnClick);
+
+        // spnPoll
+        List<Poll> PollsList = new ArrayList<Poll>();
+        PollsList.add(new Poll(-1, "Choose an Poll"));
+        PollsCursor c = db.getPolls(null);
+        for(int i=0; i<c.getCount(); i++){
+        	c.moveToPosition(i);
+        	PollsList.add(new Poll(c.getColPollId(),c.getColQuestion()));
+        }
+        
+        ArrayAdapter<Poll> aspnPolls = new ArrayAdapter<Poll>(
+        		this, android.R.layout.simple_spinner_item, PollsList);
+        aspnPolls.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        spnPoll.setAdapter(aspnPolls);
+    }
+
+    /**
+     * @see android.app.Activity#onResume()
+     */
+    @Override
+    public void onResume() {
+        super.onResume();
+    }
+
+    /**
+     * @param icicle
+     */
+    public void onPause(Bundle icicle) {
+        super.onPause();
+    }
+
+}

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

-package com.placeuvote.puvandroid;	
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.ListActivity;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.placeuvote.puvandroid.PUVDatabase.PollsCursor;
-import com.placeuvote.puvandroid.PUVDatabase.LocationsCursor;
-
-
-/**
- * EditLocation
- */
-public class EditLocation extends ListActivity {
-    private static Spinner spnPoll;
-    private static TextView txtQuestion;
-    private static Integer poll_id;
-    private static Button btnUpdate, btnCancel;
-    private PUVDatabase db;
-    private PollsCursor poll;
-    private LocationsCursor locations;
-    
-    private class Poll {
-    	public String Question;
-    	public long id;
-    	Poll( long id, String Question){
-    		this.id = id;
-    		this.Question = Question;
-    	}
-    	@Override
-    	public String toString() {
-    		return this.Question;
-    	}
-    }
-
-    
-    // Create a button click listener for the Update button.
-    private final Button.OnClickListener btnUpdateOnClick = new Button.OnClickListener() {
-        public void onClick(View v) {
-        	Poll poll = (Poll)spnPoll.getSelectedItem();
-//        	Toast.makeText(
-//        			EditLocation.this, 
-//        			String.format(
-//        					"Location: %d\nPoll: %s (%d)\nTitle: %s\nDesc: %s", 
-//        					poll_id,
-//        					employer.Question, 
-//        					employer.id,
-//        					txtTitle.getText(),
-//        					txtDescription.getText()
-//        			), 
-//        			Toast.LENGTH_SHORT
-//        	).show();
-        	if (txtQuestion.getText().length()==0 || txtDescription.getText().length()==0){
-	        	Toast.makeText(EditLocation.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
-        	} else {
-	        	db.editLocation((long)poll_id, poll.id, txtTitle.getText().toString(), txtDescription.getText().toString());
-	        	Toast.makeText(EditLocation.this, "Location updated", Toast.LENGTH_SHORT).show();
-	        	finish();
-        	}
-        }
-    };
-
-    // Create a button click listener for the Cancel button.
-    private final Button.OnClickListener btnCancelOnClick = new Button.OnClickListener() {
-        public void onClick(View v) {
-        		finish();
-        	}
-    };
-
-    /** Called when the activity is first created. */
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.editlocation);
-        txtQuestion = (TextView) findViewById(R.id.txtQuestion);
-        spnPoll = (Spinner) findViewById(R.id.spnPoll);
-
-        // get the poll_id for this poll from the bundle passed by MicroLocationsDetail
-        Bundle bIn = this.getIntent().getExtras();
-        poll_id = Integer.valueOf(bIn.getInt("_id"));
-
-        db = new PUVDatabase(this);
-        poll = db.getPollDetails(poll_id.longValue());
-        
-        txtQuestion.setText(poll.getColQuestion());
-
-        btnUpdate = (Button) findViewById(R.id.btnUpdate);
-        btnUpdate.setOnClickListener(btnUpdateOnClick);
-        btnCancel = (Button) findViewById(R.id.btnCancel);
-        btnCancel.setOnClickListener(btnCancelOnClick);
-
-        // spnPoll
-        List<Poll> pollsList = new ArrayList<Poll>();
-        PollsCursor c = db.getPolls();
-        int position=0;
-        for(int i=0; i<c.getCount(); i++){
-        	c.moveToPosition(i);
-        	pollsList.add(new Poll(c.getPollId(),c.getColQuestion()));
-        	if (c.getColId()==poll.getColPollId())
-        		position=i;
-        }
-        
-        ArrayAdapter<Poll> aspnPolls = new ArrayAdapter<Poll>(
-        		this, android.R.layout.simple_spinner_item, pollsList);
-        aspnPolls.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
-        spnPoll.setAdapter(aspnPolls);
-        spnPoll.setSelection(position);
-    }
-}

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

+package com.placeuvote.puvandroid;	
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.ListActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.placeuvote.puvandroid.PUVDatabase.PollsCursor;
+import com.placeuvote.puvandroid.PUVDatabase.LocationsCursor;
+
+
+/**
+ * EditLocation
+ */
+public class EditPoll extends ListActivity {
+    private static Spinner spnPoll;
+    private static TextView txtQuestion;
+    private static TextView txtEmail;
+    private static Integer poll_id;
+    private static Button btnUpdate, btnCancel;
+    private PUVDatabase db;
+    private PollsCursor poll;
+    private LocationsCursor locations;
+    
+    private class Poll {
+    	public String Question;
+    	public long id;
+    	Poll( long id, String Question){
+    		this.id = id;
+    		this.Question = Question;
+    	}
+    	@Override
+    	public String toString() {
+    		return this.Question;
+    	}
+    }
+
+    
+    // Create a button click listener for the Update button.
+    private final Button.OnClickListener btnUpdateOnClick = new Button.OnClickListener() {
+        public void onClick(View v) {
+        	Poll poll = (Poll)spnPoll.getSelectedItem();
+//        	Toast.makeText(
+//        			EditLocation.this, 
+//        			String.format(
+//        					"Location: %d\nPoll: %s (%d)\nTitle: %s\nDesc: %s", 
+//        					poll_id,
+//        					employer.Question, 
+//        					employer.id,
+//        					txtQuestion.getText(),
+//        					txtEmail.getText()
+//        			), 
+//        			Toast.LENGTH_SHORT
+//        	).show();
+        	if (txtQuestion.getText().length()==0 || txtEmail.getText().length()==0){
+	        	Toast.makeText(EditPoll.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
+        	} else {
+	        	db.editPoll((long)poll_id, txtQuestion.getText().toString(), txtEmail.getText().toString());
+	        	Toast.makeText(EditPoll.this, "Location updated", Toast.LENGTH_SHORT).show();
+	        	finish();
+        	}
+        }
+    };
+
+    // Create a button click listener for the Cancel button.
+    private final Button.OnClickListener btnCancelOnClick = new Button.OnClickListener() {
+        public void onClick(View v) {
+        		finish();
+        	}
+    };
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.editpoll);
+        txtQuestion = (TextView) findViewById(R.id.txtQuestion);
+        spnPoll = (Spinner) findViewById(R.id.spnPoll);
+
+        // get the poll_id for this poll from the bundle passed by MicroLocationsDetail
+        Bundle bIn = this.getIntent().getExtras();
+        poll_id = Integer.valueOf(bIn.getInt("_id"));
+
+        db = new PUVDatabase(this);
+        poll = db.getPollDetails(poll_id.longValue());
+        
+        txtQuestion.setText(poll.getColQuestion());
+
+        btnUpdate = (Button) findViewById(R.id.btnUpdate);
+        btnUpdate.setOnClickListener(btnUpdateOnClick);
+        btnCancel = (Button) findViewById(R.id.btnCancel);
+        btnCancel.setOnClickListener(btnCancelOnClick);
+
+        // spnPoll
+        List<Poll> pollsList = new ArrayList<Poll>();
+        PollsCursor c = db.getPolls(null);
+        int position=0;
+        for(int i=0; i<c.getCount(); i++){
+        	c.moveToPosition(i);
+        	pollsList.add(new Poll(c.getColPollId(),c.getColQuestion()));
+        	if (c.getColPollId()==poll.getColPollId())
+        		position=i;
+        }
+        
+        ArrayAdapter<Poll> aspnPolls = new ArrayAdapter<Poll>(
+        		this, android.R.layout.simple_spinner_item, pollsList);
+        aspnPolls.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        spnPoll.setAdapter(aspnPolls);
+        spnPoll.setSelection(position);
+    }
+}

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

                 return true;
             case 3:
             	// Add a new location
-                Intent i = new Intent(PollList.this, AddLocation.class);
+                Intent i = new Intent(PollList.this, AddPoll.class);
                 startActivity(i);
                  	return true;
         }