當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。