Skip to content

Commit 0ab1392

Browse files
committed
updated
1 parent 1333f3b commit 0ab1392

9 files changed

Lines changed: 69 additions & 61 deletions

File tree

‎de.vogella.android.c2dm.simpleclient/src/de/vogella/android/c2dm/simpleclient/C2DMMessageReceiver.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void onReceive(Context context, Intent intent) {
1818
Log.w("C2DM", "Received message");
1919
final String payload = intent.getStringExtra("payload");
2020
Log.d("C2DM", "dmControl: payload = " + payload);
21-
// TODO Send this to my application server to get the real data
21+
// Note: Send this to my application server to get the real data
2222
// Lets make something visible to show that we received the message
2323
createNotification(context, payload);
2424

‎de.vogella.android.listactivity/src/de/vogella/android/listactivity/MyListActivity.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
import android.app.ListActivity;
44
import android.os.Bundle;
5-
import android.widget.ArrayAdapter;
65

76
public class MyListActivity extends ListActivity {
87
public void onCreate(Bundle icicle) {
98
super.onCreate(icicle);
109
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
1110
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
1211
"Linux", "OS/2" };
13-
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
14-
R.layout.rowlayout, R.id.label, values);
15-
setListAdapter(adapter);
12+
setListAdapter(new MyPerformanceArrayAdapter(this, values));
1613
}
1714

1815
}

de.vogella.android.listactivity/src/de/vogella/android/listactivity/MyArrayAdapter.java renamed to de.vogella.android.listactivity/src/de/vogella/android/listactivity/MyPerformanceArrayAdapter.java

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
package de.vogella.android.listactivity;
2-
3-
import android.app.Activity;
4-
import android.view.LayoutInflater;
5-
import android.view.View;
6-
import android.view.ViewGroup;
7-
import android.widget.ArrayAdapter;
8-
import android.widget.ImageView;
9-
import android.widget.TextView;
10-
11-
public class MyArrayAdapter extends ArrayAdapter<String> {
12-
private final Activity context;
13-
private final String[] names;
14-
15-
public MyArrayAdapter(Activity context, String[] names) {
16-
super(context, R.layout.rowlayout, names);
17-
this.context = context;
18-
this.names = names;
19-
}
20-
21-
@Override
22-
public View getView(int position, View convertView, ViewGroup parent) {
23-
LayoutInflater inflater = context.getLayoutInflater();
24-
View rowView = inflater.inflate(R.layout.rowlayout, null, true);
25-
TextView textView = (TextView) rowView.findViewById(R.id.label);
26-
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
27-
String s = names[position];
28-
textView.setText(s);
29-
if (s.startsWith("Windows7") || s.startsWith("iPhone")
30-
|| s.startsWith("Solaris")) {
31-
32-
imageView.setImageResource(R.drawable.no);
33-
} else {
34-
imageView.setImageResource(R.drawable.ok);
35-
}
36-
37-
return rowView;
38-
}
39-
}
1+
package de.vogella.android.listactivity;
2+
3+
import android.app.Activity;
4+
import android.view.LayoutInflater;
5+
import android.view.View;
6+
import android.view.ViewGroup;
7+
import android.widget.ArrayAdapter;
8+
import android.widget.ImageView;
9+
import android.widget.TextView;
10+
11+
public class MyPerformanceArrayAdapter extends ArrayAdapter<String> {
12+
private final Activity context;
13+
private final String[] names;
14+
15+
public MyPerformanceArrayAdapter(Activity context, String[] names) {
16+
super(context, R.layout.rowlayout, names);
17+
this.context = context;
18+
this.names = names;
19+
}
20+
21+
@Override
22+
public View getView(int position, View convertView, ViewGroup parent) {
23+
LayoutInflater inflater = context.getLayoutInflater();
24+
View rowView = inflater.inflate(R.layout.rowlayout, null, true);
25+
TextView textView = (TextView) rowView.findViewById(R.id.label);
26+
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
27+
String s = names[position];
28+
textView.setText(s);
29+
if (s.startsWith("Windows7") || s.startsWith("iPhone")
30+
|| s.startsWith("Solaris")) {
31+
32+
imageView.setImageResource(R.drawable.no);
33+
} else {
34+
imageView.setImageResource(R.drawable.ok);
35+
}
36+
37+
return rowView;
38+
}
39+
}

‎de.vogella.android.sensor/src/de/vogella/android/sensor/SensorTest.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
public class SensorTest extends Activity implements SensorEventListener {
1616
private SensorManager sensorManager;
17-
private boolean color = false;
17+
private boolean color = false;
1818
private View view;
1919
private long lastUpdate;
2020

@@ -23,8 +23,8 @@ public class SensorTest extends Activity implements SensorEventListener {
2323
public void onCreate(Bundle savedInstanceState) {
2424
requestWindowFeature(Window.FEATURE_NO_TITLE);
2525
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
26-
WindowManager.LayoutParams.FLAG_FULLSCREEN);
27-
26+
WindowManager.LayoutParams.FLAG_FULLSCREEN);
27+
2828
super.onCreate(savedInstanceState);
2929
setContentView(R.layout.main);
3030
view = findViewById(R.id.textView);
@@ -59,7 +59,7 @@ public void onSensorChanged(SensorEvent event) {
5959
.show();
6060
if (color) {
6161
view.setBackgroundColor(Color.GREEN);
62-
62+
6363
} else {
6464
view.setBackgroundColor(Color.RED);
6565
}
@@ -72,7 +72,6 @@ public void onSensorChanged(SensorEvent event) {
7272

7373
@Override
7474
public void onAccuracyChanged(Sensor sensor, int accuracy) {
75-
// TODO Auto-generated method stub
7675

7776
}
7877

‎de.vogella.eclipse.ide.first/src/de/vogella/eclipse/ide/first/MainTest.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
public class MainTest {
44

5+
private static boolean myBoolean;
6+
57
/**
68
* @param args
79
*/
810
public static void main(String[] args) {
9-
11+
myBoolean = true;
1012
}
1113

1214
}

‎de.vogella.eclipse.ide.first/src/de/vogella/eclipse/ide/first/MyFirstClass.java‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22

33
public class MyFirstClass {
44

5+
private static final String HELLO = "Hello Eclipse!";
6+
57
public static void main(String[] args) {
6-
System.out.println("Hello Eclipse!");
8+
// TODO Provide user interface
9+
System.out.println(HELLO);
10+
int sum = 0;
11+
sum = calculateSum(sum);
12+
System.out.println(sum);
713
}
814

15+
private static int calculateSum(int sum) {
16+
for (int i = 0; i <= 100; i++) {
17+
sum += i;
18+
}
19+
return sum;
20+
}
921
}

‎de.vogella.eclipse.ide.first/src/de/vogella/eclipse/ide/first/Person.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ public class Person {
44
private String firstName;
55
private String lastName;
66

7+
public Person(String firstName, String lastName) {
8+
super();
9+
this.firstName = firstName;
10+
this.lastName = lastName;
11+
}
12+
713
public String getFirstName() {
814
return firstName;
915
}
@@ -20,12 +26,6 @@ public void setLastName(String lastName) {
2026
this.lastName = lastName;
2127
}
2228

23-
public Person(String firstName, String lastName) {
24-
super();
25-
this.firstName = firstName;
26-
this.lastName = lastName;
27-
}
28-
2929
@Override
3030
public String toString() {
3131
return "Person [firstName=" + firstName + ", lastName=" + lastName

‎de.vogella.junit.first/test/de/vogella/junit/first/MyClassTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class MyClassTest {
88

9-
@Test
9+
@Test(expected = IllegalArgumentException.class)
1010
public void testMultiply() {
1111
MyClass tester = new MyClass();
1212
assertEquals("Result", 50, tester.multiply(10, 5));

‎de.vogella.plugin.filterpackageexplorer/src/de/vogella/plugin/filterpackageexplorer/FilterPackageExplorer.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void focusLost(FocusEvent e) {
113113
}
114114

115115
private void updateTree() {
116-
fcp.setFilter("*"+ filtertext.getText());
116+
fcp.setFilter("*" + filtertext.getText());
117117
getTreeViewer().refresh();
118118
}
119119

@@ -181,13 +181,11 @@ public PackageExplorerContentProvider createContentProvider() {
181181

182182
@Override
183183
public void selectAndReveal(Object element) {
184-
// TODO Auto-generated method stub
185184
super.selectAndReveal(element);
186185
}
187186

188187
@Override
189188
public void selectReveal(ISelection selection) {
190-
// TODO Auto-generated method stub
191189
super.selectReveal(selection);
192190
}
193191
}

0 commit comments

Comments
 (0)