Follow API changes.
Change-Id: Ieb1df7fc0708f22aae3d851f74ade1343eb44e08
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user