summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-01-17 20:00:58 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-17 20:00:58 -0800
commit44af4c2b30cd8fbf0a09a3bb340c4ca4ef855aaa (patch)
tree6d510af118add1758f7b3f716ef6d24a93114ac3 /samples
parent80ea3ea8e1ad5e9d5189a1136b380d162999e2a8 (diff)
parent0d11c9c34501a9a9dedee1092fd63af218dc28c8 (diff)
downloadandroid_development-44af4c2b30cd8fbf0a09a3bb340c4ca4ef855aaa.tar.gz
android_development-44af4c2b30cd8fbf0a09a3bb340c4ca4ef855aaa.tar.bz2
android_development-44af4c2b30cd8fbf0a09a3bb340c4ca4ef855aaa.zip
am 0d11c9c3: Follow API changes.
* commit '0d11c9c34501a9a9dedee1092fd63af218dc28c8': Follow API changes.
Diffstat (limited to 'samples')
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentContextMenu.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentDialogOrActivity.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentHideShow.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java8
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentListArray.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentListCursorLoader.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentMenu.java4
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentReceiveResult.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.java4
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentStack.java4
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java21
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/preference/FragmentPreferences.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/DraggableDot.java4
-rw-r--r--samples/NotePad/src/com/example/android/notepad/NoteEditor.java2
-rw-r--r--samples/NotePad/src/com/example/android/notepad/NotesList.java1
17 files changed, 31 insertions, 35 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentContextMenu.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentContextMenu.java
index 185f7a0b7..6bc73e038 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentContextMenu.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentContextMenu.java
@@ -41,7 +41,7 @@ public class FragmentContextMenu extends Activity {
// Create the list fragment and add it as our sole content.
ContextMenuFragment content = new ContextMenuFragment();
- getFragmentManager().openTransaction().add(android.R.id.content, content).commit();
+ getFragmentManager().beginTransaction().add(android.R.id.content, content).commit();
}
public static class ContextMenuFragment extends Fragment {
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java
index bb2ef8b4d..59fc01846 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java
@@ -70,7 +70,7 @@ public class FragmentDialog extends Activity {
// DialogFragment.show() will take care of adding the fragment
// in a transaction. We also want to remove any currently showing
// dialog, so make our own transaction and take care of that here.
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment prev = getFragmentManager().findFragmentByTag("dialog");
if (prev != null) {
ft.remove(prev);
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialogOrActivity.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialogOrActivity.java
index c4d2c0002..2d2be2233 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialogOrActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialogOrActivity.java
@@ -39,7 +39,7 @@ public class FragmentDialogOrActivity extends Activity {
if (savedInstanceState == null) {
// First-time init; create fragment to embed in activity.
//BEGIN_INCLUDE(embed)
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
DialogFragment newFragment = MyDialogFragment.newInstance();
ft.add(R.id.embedded, newFragment);
ft.commit();
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentHideShow.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentHideShow.java
index 19b426098..e5e259968 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentHideShow.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentHideShow.java
@@ -51,7 +51,7 @@ public class FragmentHideShow extends Activity {
final Button button = (Button)findViewById(buttonId);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(android.R.animator.fade_in,
android.R.animator.fade_out);
if (fragment.isHidden()) {
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
index f959d006f..81853a23b 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
@@ -74,7 +74,7 @@ public class FragmentLayout extends Activity {
// During initial setup, plug in the details fragment.
DetailsFragment details = new DetailsFragment();
details.setArguments(getIntent().getExtras());
- getFragmentManager().openTransaction().add(android.R.id.content, details).commit();
+ getFragmentManager().beginTransaction().add(android.R.id.content, details).commit();
}
}
}
@@ -150,11 +150,9 @@ public class FragmentLayout extends Activity {
// Execute a transaction, replacing any existing fragment
// with this one inside the frame.
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.details, df);
- ft.setTransition(index > mCurCheckPosition
- ? FragmentTransaction.TRANSIT_FRAGMENT_NEXT
- : FragmentTransaction.TRANSIT_FRAGMENT_PREV);
+ ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
mShownCheckPosition = index;
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentListArray.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentListArray.java
index d4aafa1c9..cdf6ddc1d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentListArray.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentListArray.java
@@ -39,7 +39,7 @@ public class FragmentListArray extends Activity {
// Create the list fragment and add it as our sole content.
if (getFragmentManager().findFragmentById(android.R.id.content) == null) {
ArrayListFragment list = new ArrayListFragment();
- getFragmentManager().openTransaction().add(android.R.id.content, list).commit();
+ getFragmentManager().beginTransaction().add(android.R.id.content, list).commit();
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentListCursorLoader.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentListCursorLoader.java
index 6c3200e95..9f67dc26e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentListCursorLoader.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentListCursorLoader.java
@@ -52,7 +52,7 @@ public class FragmentListCursorLoader extends Activity {
// Create the list fragment and add it as our sole content.
if (fm.findFragmentById(android.R.id.content) == null) {
CursorLoaderListFragment list = new CursorLoaderListFragment();
- fm.openTransaction().add(android.R.id.content, list).commit();
+ fm.beginTransaction().add(android.R.id.content, list).commit();
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentMenu.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentMenu.java
index 9dc223d2f..fa543598a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentMenu.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentMenu.java
@@ -37,7 +37,7 @@ public class FragmentMenu extends Activity {
// Make sure the two menu fragments are created.
FragmentManager fm = getFragmentManager();
- FragmentTransaction ft = fm.openTransaction();
+ FragmentTransaction ft = fm.beginTransaction();
mFragment1 = fm.findFragmentByTag("f1");
if (mFragment1 == null) {
mFragment1 = new MenuFragment();
@@ -69,7 +69,7 @@ public class FragmentMenu extends Activity {
// Update fragment visibility based on current check box state.
void updateFragmentVisibility() {
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
if (mCheckBox1.isChecked()) ft.show(mFragment1);
else ft.hide(mFragment1);
if (mCheckBox2.isChecked()) ft.show(mFragment2);
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentReceiveResult.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentReceiveResult.java
index d2ef673d1..fad77ff47 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentReceiveResult.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentReceiveResult.java
@@ -31,7 +31,7 @@ public class FragmentReceiveResult extends Activity {
if (savedInstanceState == null) {
// Do first time initialization -- add fragment.
Fragment newFragment = new ReceiveResultFragment();
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.simple_fragment, newFragment).commit();
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.java
index 187909008..e2ddae2bb 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.java
@@ -42,7 +42,7 @@ public class FragmentRetainInstance extends Activity {
// First time init, create the UI.
if (savedInstanceState == null) {
- getFragmentManager().openTransaction().add(android.R.id.content,
+ getFragmentManager().beginTransaction().add(android.R.id.content,
new UiFragment()).commit();
}
}
@@ -84,7 +84,7 @@ public class FragmentRetainInstance extends Activity {
mWorkFragment = new RetainedFragment();
// Tell it who it is working with.
mWorkFragment.setTargetFragment(this, 0);
- fm.openTransaction().add(mWorkFragment, "work").commit();
+ fm.beginTransaction().add(mWorkFragment, "work").commit();
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentStack.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentStack.java
index 6710a2dd7..000cfa56d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentStack.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentStack.java
@@ -48,7 +48,7 @@ public class FragmentStack extends Activity {
if (savedInstanceState == null) {
// Do first time initialization -- add initial fragment.
Fragment newFragment = CountingFragment.newInstance(mStackLevel);
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.simple_fragment, newFragment).commit();
} else {
mStackLevel = savedInstanceState.getInt("level");
@@ -70,7 +70,7 @@ public class FragmentStack extends Activity {
// Add the fragment to the activity, pushing this transaction
// on to the back stack.
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.simple_fragment, newFragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.addToBackStack(null);
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.java b/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.java
index 2139679f8..9e8b64d03 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.java
@@ -376,7 +376,7 @@ public class LoaderThrottle extends Activity {
// Create the list fragment and add it as our sole content.
if (fm.findFragmentById(android.R.id.content) == null) {
ThrottledLoaderListFragment list = new ThrottledLoaderListFragment();
- fm.openTransaction().add(android.R.id.content, list).commit();
+ fm.beginTransaction().add(android.R.id.content, list).commit();
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java b/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java
index 614422480..e9889028d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java
+++ b/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java
@@ -98,21 +98,20 @@ public class ClipboardSample extends Activity {
}
public void pasteStyledText(View button) {
- mClipboard.setPrimaryClip(ClipData.newPlainText("Styled Text", null, mStyledText));
+ mClipboard.setPrimaryClip(ClipData.newPlainText("Styled Text", mStyledText));
}
public void pastePlainText(View button) {
- mClipboard.setPrimaryClip(ClipData.newPlainText("Styled Text", null, mPlainText));
+ mClipboard.setPrimaryClip(ClipData.newPlainText("Styled Text", mPlainText));
}
public void pasteIntent(View button) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.android.com/"));
- mClipboard.setPrimaryClip(ClipData.newIntent("VIEW intent", null, intent));
+ mClipboard.setPrimaryClip(ClipData.newIntent("VIEW intent", intent));
}
public void pasteUri(View button) {
- mClipboard.setPrimaryClip(ClipData.newRawUri("URI", null,
- Uri.parse("http://www.android.com/")));
+ mClipboard.setPrimaryClip(ClipData.newRawUri("URI", Uri.parse("http://www.android.com/")));
}
void updateClipData() {
@@ -128,15 +127,15 @@ public class ClipboardSample extends Activity {
if (clip == null) {
mSpinner.setSelection(0);
mEditText.setText("");
- } else if (clip.getItem(0).getText() != null) {
+ } else if (clip.getItemAt(0).getText() != null) {
mSpinner.setSelection(1);
- mEditText.setText(clip.getItem(0).getText());
- } else if (clip.getItem(0).getIntent() != null) {
+ mEditText.setText(clip.getItemAt(0).getText());
+ } else if (clip.getItemAt(0).getIntent() != null) {
mSpinner.setSelection(2);
- mEditText.setText(clip.getItem(0).getIntent().toUri(0));
- } else if (clip.getItem(0).getUri() != null) {
+ mEditText.setText(clip.getItemAt(0).getIntent().toUri(0));
+ } else if (clip.getItemAt(0).getUri() != null) {
mSpinner.setSelection(3);
- mEditText.setText(clip.getItem(0).getUri().toString());
+ mEditText.setText(clip.getItemAt(0).getUri().toString());
} else {
mSpinner.setSelection(0);
mEditText.setText("Clip containing no data");
diff --git a/samples/ApiDemos/src/com/example/android/apis/preference/FragmentPreferences.java b/samples/ApiDemos/src/com/example/android/apis/preference/FragmentPreferences.java
index b3cc6a3a7..6e9c6147a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/preference/FragmentPreferences.java
+++ b/samples/ApiDemos/src/com/example/android/apis/preference/FragmentPreferences.java
@@ -33,7 +33,7 @@ public class FragmentPreferences extends Activity {
super.onCreate(savedInstanceState);
// Display the fragment as the main content.
- getFragmentManager().openTransaction().replace(android.R.id.content,
+ getFragmentManager().beginTransaction().replace(android.R.id.content,
new PrefsFragment()).commit();
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/DraggableDot.java b/samples/ApiDemos/src/com/example/android/apis/view/DraggableDot.java
index d1adca4d6..5ac4ea5c6 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/DraggableDot.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/DraggableDot.java
@@ -130,7 +130,7 @@ public class DraggableDot extends View {
setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View v) {
- ClipData data = ClipData.newPlainText("dot", null, "Dot : " + v.toString());
+ ClipData data = ClipData.newPlainText("dot", "Dot : " + v.toString());
v.startDrag(data, new ANRShadowBuilder(v, mAnrType == ANR_SHADOW),
(Object)v, 0);
return true;
@@ -247,7 +247,7 @@ public class DraggableDot extends View {
final ClipData data = event.getClipData();
final int N = data.getItemCount();
for (int i = 0; i < N; i++) {
- ClipData.Item item = data.getItem(i);
+ ClipData.Item item = data.getItemAt(i);
Log.i(TAG, "Dropped item " + i + " : " + item);
if (mReportView != null) {
String text = item.coerceToText(getContext()).toString();
diff --git a/samples/NotePad/src/com/example/android/notepad/NoteEditor.java b/samples/NotePad/src/com/example/android/notepad/NoteEditor.java
index a3b8b38f9..59d6f1290 100644
--- a/samples/NotePad/src/com/example/android/notepad/NoteEditor.java
+++ b/samples/NotePad/src/com/example/android/notepad/NoteEditor.java
@@ -470,7 +470,7 @@ public class NoteEditor extends Activity {
String title=null;
// Gets the first item from the clipboard data
- ClipData.Item item = clip.getItem(0);
+ ClipData.Item item = clip.getItemAt(0);
// Tries to get the item's contents as a URI pointing to a note
Uri uri = item.getUri();
diff --git a/samples/NotePad/src/com/example/android/notepad/NotesList.java b/samples/NotePad/src/com/example/android/notepad/NotesList.java
index 8f0b2cb02..7e91f646c 100644
--- a/samples/NotePad/src/com/example/android/notepad/NotesList.java
+++ b/samples/NotePad/src/com/example/android/notepad/NotesList.java
@@ -406,7 +406,6 @@ public class NotesList extends ListActivity {
clipboard.setPrimaryClip(ClipData.newUri( // new clipboard item holding a URI
getContentResolver(), // resolver to retrieve URI info
"Note", // label for the clip
- null, // icon for the clip
noteUri) // the URI
);