当前位置: 首页>>代码示例>>Java>>正文


Java FragmentTransaction.setTransitionStyle方法代码示例

本文整理汇总了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);
}
 
开发者ID:coder3101,项目名称:Matrix-Calculator-for-Android,代码行数:57,代码来源:ViewCreatedMatrix.java


注:本文中的android.support.v4.app.FragmentTransaction.setTransitionStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。