Skip to content

Commit adb0222

Browse files
committed
Remove a bunch of tabs
1 parent eae2e52 commit adb0222

File tree

5 files changed

+327
-327
lines changed

5 files changed

+327
-327
lines changed

10/MicroJobs/src/com/oreilly/demo/pa/ch10/AddJob.java

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,44 @@ public class AddJob extends Activity {
2727
MicroJobsDatabase db;
2828

2929
private class Employer {
30-
public String employerName;
31-
public long id;
32-
Employer( long id, String employerName){
33-
this.id = id;
34-
this.employerName = employerName;
35-
}
36-
@Override
37-
public String toString() {
38-
return this.employerName;
39-
}
30+
public String employerName;
31+
public long id;
32+
Employer( long id, String employerName){
33+
this.id = id;
34+
this.employerName = employerName;
35+
}
36+
@Override
37+
public String toString() {
38+
return this.employerName;
39+
}
4040
}
4141

4242
// Create a button click listener for the AddJob button.
4343
private final Button.OnClickListener btnAddJobOnClick = new Button.OnClickListener() {
4444
@Override
4545
public void onClick(View v) {
46-
Employer employer = (Employer)spnEmployer.getSelectedItem();
47-
// Toast.makeText(
48-
// AddJob.this,
49-
// String.format(
50-
// "Employer: %s (%d)\nTitle: %s\nDesc: %s",
51-
// employer.employerName,
52-
// employer.id,
53-
// txtTitle.getText(),
54-
// txtDescription.getText()
55-
// ),
56-
// Toast.LENGTH_SHORT
57-
// ).show();
58-
if ((employer.id<0) || (txtTitle.getText().length()==0) || (txtDescription.getText().length()==0)){
59-
Toast.makeText(AddJob.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
60-
} else {
61-
db.addJob(employer.id, txtTitle.getText().toString(), txtDescription.getText().toString());
62-
Toast.makeText(AddJob.this, "Job added", Toast.LENGTH_SHORT).show();
63-
//spnEmployer.setSelection(0); // select "choose an employer"
64-
txtTitle.setText("");
65-
txtDescription.setText("");
66-
}
67-
}
46+
Employer employer = (Employer)spnEmployer.getSelectedItem();
47+
// Toast.makeText(
48+
// AddJob.this,
49+
// String.format(
50+
// "Employer: %s (%d)\nTitle: %s\nDesc: %s",
51+
// employer.employerName,
52+
// employer.id,
53+
// txtTitle.getText(),
54+
// txtDescription.getText()
55+
// ),
56+
// Toast.LENGTH_SHORT
57+
// ).show();
58+
if ((employer.id<0) || (txtTitle.getText().length()==0) || (txtDescription.getText().length()==0)){
59+
Toast.makeText(AddJob.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
60+
} else {
61+
db.addJob(employer.id, txtTitle.getText().toString(), txtDescription.getText().toString());
62+
Toast.makeText(AddJob.this, "Job added", Toast.LENGTH_SHORT).show();
63+
//spnEmployer.setSelection(0); // select "choose an employer"
64+
txtTitle.setText("");
65+
txtDescription.setText("");
66+
}
67+
}
6868
};
6969

7070

@@ -91,12 +91,12 @@ public void onCreate(Bundle savedInstanceState) {
9191
startManagingCursor(c);
9292

9393
for(int i=0; i<c.getCount(); i++){
94-
c.moveToPosition(i);
95-
employersList.add(new Employer(c.getColId(),c.getColEmployerName()));
94+
c.moveToPosition(i);
95+
employersList.add(new Employer(c.getColId(),c.getColEmployerName()));
9696
}
9797

9898
ArrayAdapter<Employer> aspnEmployers = new ArrayAdapter<Employer>(
99-
this, android.R.layout.simple_spinner_item, employersList);
99+
this, android.R.layout.simple_spinner_item, employersList);
100100
aspnEmployers.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
101101
spnEmployer.setAdapter(aspnEmployers);
102102
}

10/MicroJobs/src/com/oreilly/demo/pa/ch10/EditJob.java

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,52 +29,52 @@ public class EditJob extends ListActivity {
2929
MicroJobsDatabase db;
3030

3131
private class Employer {
32-
public String employerName;
33-
public long id;
34-
Employer( long id, String employerName){
35-
this.id = id;
36-
this.employerName = employerName;
37-
}
38-
@Override
39-
public String toString() {
40-
return this.employerName;
41-
}
32+
public String employerName;
33+
public long id;
34+
Employer( long id, String employerName){
35+
this.id = id;
36+
this.employerName = employerName;
37+
}
38+
@Override
39+
public String toString() {
40+
return this.employerName;
41+
}
4242
}
4343

4444

4545
// Create a button click listener for the Update button.
4646
private final Button.OnClickListener btnUpdateOnClick = new Button.OnClickListener() {
4747
@Override
4848
public void onClick(View v) {
49-
Employer employer = (Employer)spnEmployer.getSelectedItem();
50-
// Toast.makeText(
51-
// EditJob.this,
52-
// String.format(
53-
// "Job: %d\nEmployer: %s (%d)\nTitle: %s\nDesc: %s",
54-
// job_id,
55-
// employer.employerName,
56-
// employer.id,
57-
// txtTitle.getText(),
58-
// txtDescription.getText()
59-
// ),
60-
// Toast.LENGTH_SHORT
61-
// ).show();
62-
if ((txtTitle.getText().length()==0) || (txtDescription.getText().length()==0)){
63-
Toast.makeText(EditJob.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
64-
} else {
65-
db.editJob(job_id.longValue(), employer.id, txtTitle.getText().toString(), txtDescription.getText().toString());
66-
Toast.makeText(EditJob.this, "Job updated", Toast.LENGTH_SHORT).show();
67-
finish();
68-
}
49+
Employer employer = (Employer)spnEmployer.getSelectedItem();
50+
// Toast.makeText(
51+
// EditJob.this,
52+
// String.format(
53+
// "Job: %d\nEmployer: %s (%d)\nTitle: %s\nDesc: %s",
54+
// job_id,
55+
// employer.employerName,
56+
// employer.id,
57+
// txtTitle.getText(),
58+
// txtDescription.getText()
59+
// ),
60+
// Toast.LENGTH_SHORT
61+
// ).show();
62+
if ((txtTitle.getText().length()==0) || (txtDescription.getText().length()==0)){
63+
Toast.makeText(EditJob.this, "Fill out the form completely first.", Toast.LENGTH_LONG).show();
64+
} else {
65+
db.editJob(job_id.longValue(), employer.id, txtTitle.getText().toString(), txtDescription.getText().toString());
66+
Toast.makeText(EditJob.this, "Job updated", Toast.LENGTH_SHORT).show();
67+
finish();
68+
}
6969
}
7070
};
7171

7272
// Create a button click listener for the Cancel button.
7373
private final Button.OnClickListener btnCancelOnClick = new Button.OnClickListener() {
7474
@Override
7575
public void onClick(View v) {
76-
finish();
77-
}
76+
finish();
77+
}
7878
};
7979

8080
/** Called when the activity is first created. */
@@ -107,15 +107,15 @@ public void onCreate(Bundle savedInstanceState) {
107107
startManagingCursor(c);
108108
int position=0;
109109
for(int i=0; i<c.getCount(); i++){
110-
c.moveToPosition(i);
111-
employersList.add(new Employer(c.getColId(),c.getColEmployerName()));
112-
if (c.getColId()==job.getColEmployersId()) {
110+
c.moveToPosition(i);
111+
employersList.add(new Employer(c.getColId(),c.getColEmployerName()));
112+
if (c.getColId()==job.getColEmployersId()) {
113113
position=i;
114114
}
115115
}
116116

117117
ArrayAdapter<Employer> aspnEmployers = new ArrayAdapter<Employer>(
118-
this, android.R.layout.simple_spinner_item, employersList);
118+
this, android.R.layout.simple_spinner_item, employersList);
119119
aspnEmployers.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
120120
spnEmployer.setAdapter(aspnEmployers);
121121
spnEmployer.setSelection(position);

0 commit comments

Comments
 (0)