Skip to content

Commit

Permalink
Update widget example
Browse files Browse the repository at this point in the history
  • Loading branch information
vogella committed Jun 21, 2011
1 parent 823ae43 commit 9b5b641
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
10 changes: 10 additions & 0 deletions de.vogella.android.widget.example/res/drawable-mdpi/myshape.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="2dp" android:color="#FFFFFFFF" />
<gradient android:startColor="#DD000000" android:endColor="#DD2ECCFA"
android:angle="225"/>

<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
10 changes: 6 additions & 4 deletions de.vogella.android.widget.example/res/layout/widget_layout.xml
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@color/black">
<TextView android:text="Static Text" android:id="@+id/TextView01"
android:layout_width="fill_parent" android:layout_height="fill_parent"></TextView>
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="@drawable/myshape" android:layout_margin="8dip">
<TextView android:layout_margin="4dip" android:text="Static Text"
android:id="@+id/TextView01" android:layout_width="match_parent"
android:layout_height="match_parent" style="@android:style/TextAppearance.Medium"
android:layout_gravity="center"></TextView>
</LinearLayout>
5 changes: 3 additions & 2 deletions de.vogella.android.widget.example/res/xml/widget_info.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:updatePeriodMillis="30000" android:initialLayout="@layout/widget_layout"
android:minHeight="72dp" android:minWidth="300dp">
android:updatePeriodMillis="180000"
android:initialLayout="@layout/widget_layout"
android:minHeight="72dp" android:minWidth="146dp">
</appwidget-provider>
Expand Up @@ -12,7 +12,7 @@ public class MyWidgetProvider extends AppWidgetProvider {
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
// Get some useful info from the web
String fakeUpdate = "Updating the text...";
String fakeUpdate = "Random: ";
Random random = new Random();
int nextInt = random.nextInt(100);
fakeUpdate += String.valueOf(nextInt);
Expand Down
Expand Up @@ -44,8 +44,7 @@ public void setUp() throws Exception {
person.setFirstName("Jim_" + i);
person.setLastName("Knopf_" + i);
em.persist(person);
// First we have to persists the job
// Now persists the new person
// Now persists the family person relationship
family.getMembers().add(person);
em.persist(person);
em.persist(family);
Expand Down

0 comments on commit 9b5b641

Please sign in to comment.