本文整理匯總了Java中android.support.v4.app.FragmentTransaction.setTransitionStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java FragmentTransaction.setTransitionStyle方法的具體用法?Java FragmentTransaction.setTransitionStyle怎麽用?Java FragmentTransaction.setTransitionStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.app.FragmentTransaction
的用法示例。
在下文中一共展示了FragmentTransaction.setTransitionStyle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onOptionsItemSelected
import android.support.v4.app.FragmentTransaction; //導入方法依賴的package包/類
public boolean onOptionsItemSelected(MenuItem item) {
EditFragment editFragment = new EditFragment();
int index = getIntent().getIntExtra("INDEX", -1);
switch (item.getItemId()) {
case R.id.EditEntered:
Bundle bundle = new Bundle();
bundle.putInt("INDEX", getIntent().getIntExtra("INDEX", -1));
editFragment.setArguments(bundle);
FragmentTransaction FragmentTR = getSupportFragmentManager().beginTransaction();
FragmentTR.replace(R.id.FragmentContainer, editFragment, "FRAGMENTEDIT");
FragmentTR.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
FragmentTR.commit();
((GlobalValues) getApplication()).current_editing = ((GlobalValues) getApplication()).
GetCompleteList().get(getIntent().getIntExtra("INDEX", -1));
ActionMenu.findItem(R.id.EditEntered).setVisible(false);
ActionMenu.findItem(R.id.OrderChange).setVisible(false);
ActionMenu.findItem(R.id.DeleteCreated).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
ActionMenu.findItem(R.id.DeleteCreated).setTitle(R.string.Delete2);
ActionMenu.findItem(R.id.ConfirmChanges).setVisible(true);
ActionMenu.findItem(R.id.RevertChanges).setVisible(true);
return true;
case R.id.DeleteCreated:
if (index != (-1)) {
((GlobalValues) getApplication()).GetCompleteList().remove(index);
((GlobalValues) getApplication()).matrixAdapter.notifyDataSetChanged();
Toast.makeText(getApplicationContext(), R.string.Deleted, Toast.LENGTH_SHORT).show();
finish();
}
return true;
case R.id.OrderChange:
Intent intent4 = new Intent(getApplicationContext(), OrderChanger.class);
intent4.putExtra("INDEX_OF_SELECTED_MATRIX", index);
startActivityForResult(intent4, ChangedOrder);
return true;
case R.id.Rename:
Intent intent = new Intent(getApplicationContext(), RenameCreated.class);
intent.putExtra("TITLE_OF_THIS_FORMATION", ((GlobalValues) getApplication()).GetCompleteList().get(index).GetName());
startActivityForResult(intent, 100);
return true;
case R.id.RevertChanges:
EditFragment editFragment1 = ((EditFragment) getSupportFragmentManager().findFragmentByTag("FRAGMENTEDIT"));
editFragment1.RevertChanges();
Toast.makeText(getApplicationContext(), R.string.RevertSuccess, Toast.LENGTH_SHORT).show();
finish();
return true;
case R.id.ConfirmChanges:
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.detach(editFragment);
transaction.commit();
finish();
Toast.makeText(getApplicationContext(), R.string.ConfirmSuccess, Toast.LENGTH_SHORT).show();
return true;
}
return super.onOptionsItemSelected(item);
}