Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vogella committed Apr 10, 2012
1 parent bd3ddd6 commit 3f8275d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 65 deletions.
1 change: 0 additions & 1 deletion de.vogella.android.socialapp/AndroidManifest.xml
Expand Up @@ -9,7 +9,6 @@
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:uiOptions="splitActionBarWhenNarrow"
>
<activity
android:label="@string/app_name"
Expand Down
25 changes: 11 additions & 14 deletions de.vogella.android.socialapp/res/layout/main.xml
Expand Up @@ -2,32 +2,29 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/fire"
android:orientation="vertical" >

<LinearLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Show" >
</Button>
android:layout_weight="1"
android:text="Show" />

<Button
android:id="@+id/Button02"
android:layout_width="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Change" />

</LinearLayout>

<CalendarView
android:id="@+id/calendarView1"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>
27 changes: 0 additions & 27 deletions de.vogella.android.socialapp/res/menu/mainmenu.xml
@@ -1,37 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

<item
android:id="@+id/menu_share"
android:actionProviderClass="android.widget.ShareActionProvider"
android:showAsAction="ifRoom"
android:title="Share"/>

<item
android:id="@+id/preferences"
android:showAsAction="ifRoom"
android:title="Prefs">
</item>
<item
android:id="@+id/preferences2"
android:showAsAction="ifRoom"
android:title="More">
</item>
<item
android:id="@+id/preferences3"
android:title="Internet">
</item>
<item
android:id="@+id/preferences4"
android:title="Take Picture">
</item>
<item
android:id="@+id/preferences5"
android:title="Share with others">
</item>
<item
android:id="@+id/preferences6"
android:title="Time">
</item>

</menu>
Expand Up @@ -13,7 +13,6 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ShareActionProvider;
import android.widget.Toast;

public class OverviewActivity extends Activity {
Expand Down Expand Up @@ -74,13 +73,13 @@ private void updatePreferenceValue() {
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mainmenu, menu);
MenuItem item = menu.findItem(R.id.menu_share);
ShareActionProvider provider = (ShareActionProvider) item
.getActionProvider();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_TEXT, "Hello");
provider.setShareIntent(intent);
// MenuItem item = menu.findItem(R.id.menu_share);
// ShareActionProvider provider = (ShareActionProvider) item
// .getActionProvider();
// Intent intent = new Intent(Intent.ACTION_SEND);
// intent.setType("plain/text");
// intent.putExtra(Intent.EXTRA_TEXT, "Hello");
// provider.setShareIntent(intent);
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions de.vogella.xml.jaxb/bookstore-jaxb.xml
Expand Up @@ -3,13 +3,13 @@
<bookList>
<book>
<author>Neil Strauss</author>
<bookName>The Game</bookName>
<title>The Game</title>
<publisher>Harpercollins</publisher>
<isbn>978-0060554736</isbn>
</book>
<book>
<author>Charlotte Roche</author>
<bookName>Feuchtgebiete</bookName>
<title>Feuchtgebiete</title>
<publisher>Dumont Buchverlag</publisher>
<isbn>978-3832180577</isbn>
</book>
Expand Down
Expand Up @@ -17,7 +17,7 @@ public class Book {

// If you like the variable name, e.g. "name", you can easily change this
// name for your XML-Output:
@XmlElement(name = "bookName")
@XmlElement(name = "title")
public String getName() {
return name;
}
Expand Down
17 changes: 5 additions & 12 deletions de.vogella.xml.jaxb/src/test/BookMain.java
@@ -1,9 +1,8 @@
package test;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;

import javax.xml.bind.JAXBContext;
Expand Down Expand Up @@ -47,18 +46,12 @@ public static void main(String[] args) throws JAXBException, IOException {
JAXBContext context = JAXBContext.newInstance(Bookstore.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

// Write to System.out
m.marshal(bookstore, System.out);

Writer w = null;
try {
w = new FileWriter(BOOKSTORE_XML);
m.marshal(bookstore, w);
} finally {
try {
w.close();
} catch (Exception e) {
}
}
// Write to File
m.marshal(bookstore, new File(BOOKSTORE_XML));

// get variables from our xml file, created before
System.out.println();
Expand Down

0 comments on commit 3f8275d

Please sign in to comment.