Example usage for android.app FragmentTransaction TRANSIT_FRAGMENT_FADE

List of usage examples for android.app FragmentTransaction TRANSIT_FRAGMENT_FADE

Introduction

In this page you can find the example usage for android.app FragmentTransaction TRANSIT_FRAGMENT_FADE.

Prototype

int TRANSIT_FRAGMENT_FADE

To view the source code for android.app FragmentTransaction TRANSIT_FRAGMENT_FADE.

Click Source Link

Document

Fragment should simply fade in or out; that is, no strong navigation associated with it except that it is appearing or disappearing for some reason.

Usage

From source file:com.ternup.caddisfly.fragment.DetailsFragment.java

private void goBack() {
    FragmentManager fm = getFragmentManager();
    try {/*w w w  . j  a  v a  2 s  .  co m*/
        if (fm.getBackStackEntryCount() > 0) {
            fm.popBackStack();
            fm.executePendingTransactions();
        } else {
            Fragment fragment = new HomeFragment();
            FragmentManager fragmentManager = getFragmentManager();
            FragmentTransaction ft = fragmentManager.beginTransaction();
            ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            ft.replace(R.id.container, fragment, "0");
            ft.addToBackStack(null);
            ft.commit();
            fm.executePendingTransactions();
            ListView drawerList = (ListView) getActivity().findViewById(R.id.navigation_drawer);
            drawerList.setItemChecked(0, true);
            drawerList.setSelection(0);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.chen.mail.ui.OnePaneController.java

@Override
public void showConversationList(ConversationListContext listContext) {
    super.showConversationList(listContext);
    enableCabMode();//from  ww  w. j ava 2  s  .  c  o m
    mConversationListVisible = true;
    if (ConversationListContext.isSearchResult(listContext)) {
        mViewMode.enterSearchResultsListMode();
    } else {
        mViewMode.enterConversationListMode();
    }
    final int transition = mConversationListNeverShown ? FragmentTransaction.TRANSIT_FRAGMENT_FADE
            : FragmentTransaction.TRANSIT_FRAGMENT_OPEN;
    final Fragment conversationListFragment = ConversationListFragment.newInstance(listContext);

    if (!inInbox(mAccount, listContext)) {
        // Maintain fragment transaction history so we can get back to the
        // fragment used to launch this list.
        mLastConversationListTransactionId = replaceFragment(conversationListFragment, transition,
                TAG_CONVERSATION_LIST, R.id.content_pane);
    } else {
        // If going to the inbox, clear the folder list transaction history.
        mInbox = listContext.folder;
        replaceFragment(conversationListFragment, transition, TAG_CONVERSATION_LIST, R.id.content_pane);

        // If we ever to to the inbox, we want to unset the transation id for any other
        // non-inbox folder.
        mLastConversationListTransactionId = INVALID_ID;
    }

    mActivity.getFragmentManager().executePendingTransactions();

    onConversationVisibilityChanged(false);
    onConversationListVisibilityChanged(true);
    mConversationListNeverShown = false;
}

From source file:cz.zcu.kiv.eeg.mobile.base.ui.NavigationActivity.java

public boolean openSection(int itemPosition) {
    Intent intent;/* ww  w  .j av a 2 s  . c  o  m*/

    if (itemPosition != previousFragment) {
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        switch (itemPosition) {
        // dashboard
        case 0:
            DashboardFragment dashboardFrag;
            dashboardFrag = new DashboardFragment();
            fragmentTransaction.replace(R.id.content, dashboardFrag, DashboardFragment.TAG);
            fragmentTransaction.commit();
            previousFragment = itemPosition;
            break;

        // scenarios
        case 1:
            intent = new Intent();
            intent.setClass(this, ScenarioActivity.class);
            startActivity(intent);
            break;

        // experiments
        case 2:
            intent = new Intent();
            intent.setClass(this, ExperimentActivity.class);
            startActivity(intent);
            break;

        // datafile upload
        case 3:
            DataFileUploadFragment dataFileFrag;
            dataFileFrag = new DataFileUploadFragment();

            fragmentTransaction.replace(R.id.content, dataFileFrag, DataFileUploadFragment.TAG);
            fragmentTransaction.commit();
            previousFragment = itemPosition;
            break;

        // reservations
        case 4:
            ReservationFragment agendaFrag;
            agendaFrag = new ReservationFragment();

            fragmentTransaction.replace(R.id.content, agendaFrag, ReservationFragment.TAG);
            fragmentTransaction.commit();
            previousFragment = itemPosition;
            break;

        // application settings
        case 5:
            intent = new Intent();
            intent.setClass(this, SettingsActivity.class);
            startActivity(intent);
            break;
        default:
            return false;
        }
    }
    drawerLayout.closeDrawer(drawerList);
    return true;
}

From source file:de.NeonSoft.neopowermenu.Preferences.PreferencesPartFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO: Implement this method
    MainActivity.visibleFragment = "Main";

    mContext = getActivity();/*  w w  w.  j ava  2  s .  c  om*/

    ActiveStyle = MainActivity.preferences.getString("DialogTheme", "Material");
    hideicon = MainActivity.preferences.getBoolean("HideLauncherIcon", false);
    DeepXposedLogging = MainActivity.preferences.getBoolean("DeepXposedLogging", false);

    InflatedView = inflater.inflate(R.layout.activity_preferences, container, false);

    TextView_ModuleStateTitle = (TextView) InflatedView
            .findViewById(R.id.activitypreferencesTextView_ModuleStateTitle);
    TextView_ModuleStateDesc = (TextView) InflatedView
            .findViewById(R.id.activitypreferencesTextView_ModuleStateDesc);

    LinearLayout_Style = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Style);
    TextView_StyleTitle = (TextView) InflatedView.findViewById(R.id.activitypreferencesTextView_StyleTitle);
    TextView_StyleDesc = (TextView) InflatedView.findViewById(R.id.activitypreferencesTextView_StyleDesc);
    TextView_StyleDesc.setText(getString(R.string.preferencesDesc_Style).replace("[STYLENAME]", ActiveStyle));

    LinearLayout_Theme = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Theme);

    LinearLayout_VisibilityOrder = (LinearLayout) InflatedView
            .findViewById(R.id.activitypreferencesLinearLayout_VisibilityOrder);

    LinearLayout_Advanced = (LinearLayout) InflatedView
            .findViewById(R.id.activitypreferencesLinearLayout_Advanced);

    LinearLayout_HideLauncherIcon = (LinearLayout) InflatedView
            .findViewById(R.id.activitypreferencesLinearLayout_HideLauncherIcon);
    Switch_HideLauncherIcon = (Switch) InflatedView
            .findViewById(R.id.activitypreferencesSwitch_HideLauncherIcon);
    Switch_HideLauncherIcon.setChecked(hideicon);
    Switch_HideLauncherIcon.setClickable(false);
    Switch_HideLauncherIcon.setFocusable(false);

    LinearLayout_DeepXposedLogging = (LinearLayout) InflatedView
            .findViewById(R.id.activitypreferencesLinearLayout_DeepXposedLogging);
    Switch_DeepXposedLogging = (Switch) InflatedView
            .findViewById(R.id.activitypreferencesSwitch_DeepXposedLogging);
    Switch_DeepXposedLogging.setChecked(DeepXposedLogging);
    Switch_DeepXposedLogging.setClickable(false);
    Switch_DeepXposedLogging.setFocusable(false);

    LinearLayout_Source = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Source);
    LinearLayout_OrigSource = (LinearLayout) InflatedView
            .findViewById(R.id.activitypreferencesLinearLayout_OrigSource);

    LinearLayout_Share = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Share);

    LinearLayout_Translator = (LinearLayout) InflatedView
            .findViewById(R.id.activitypreferencesLinearLayout_Translator);

    LinearLayout_About = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_About);

    LinearLayout_Style.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            // TODO: Implement this method
            AlertDialog.Builder alertdb = new AlertDialog.Builder(getActivity());
            alertdb.setTitle(R.string.preferencesTitle_Style);
            String[] styleList = new String[1];
            styleList[0] = "Material";
            for (int i = 0; i < styleList.length; i++) {
                if (styleList[i].equalsIgnoreCase(ActiveStyle)) {
                    ActiveStyleId = i;
                    //presetsList[i] = "(Active) "+ presetsFiles[i].getName().split(".nps")[0];
                }
            }
            alertdb.setSingleChoiceItems(styleList, ActiveStyleId, null);
            alertdb.setNegativeButton(R.string.Dialog_Cancel, new AlertDialog.OnClickListener() {

                @Override
                public void onClick(DialogInterface p1, int p2) {
                    // TODO: Implement this method
                }
            });
            alertdb.setPositiveButton(R.string.Dialog_Ok, new AlertDialog.OnClickListener() {

                @Override
                public void onClick(DialogInterface p1, int p2) {
                    // TODO: Implement this method
                    try {
                        int selectedPosition = (ad).getListView().getCheckedItemPosition();
                        String selectedName = (ad).getListView().getItemAtPosition(selectedPosition).toString();
                        MainActivity.preferences.edit().putString("DialogTheme", selectedName).commit();
                        ActiveStyle = selectedName;
                        TextView_StyleDesc.setText(
                                getString(R.string.preferencesDesc_Style).replace("[STYLENAME]", ActiveStyle));
                    } catch (Throwable t) {
                    }
                }
            });
            ad = alertdb.create();
            ad.show();
        }
    });

    LinearLayout_Theme.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            MainActivity.fragmentManager.beginTransaction()
                    .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
                    .replace(R.id.pref_container, new PreferencesColorFragment()).commit();
        }
    });

    LinearLayout_VisibilityOrder.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            MainActivity.fragmentManager.beginTransaction()
                    .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
                    .replace(R.id.pref_container, new PreferencesVisibilityOrderFragment()).commit();
        }
    });

    LinearLayout_Advanced.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            MainActivity.fragmentManager.beginTransaction()
                    .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
                    .replace(R.id.pref_container, new PreferencesAdvancedFragment()).commit();
        }
    });

    LinearLayout_HideLauncherIcon.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            hideicon = !hideicon;
            String packageName = getActivity().getPackageName();
            ComponentName componentSettings = new ComponentName(packageName, packageName + ".SettingsActivity");
            if (hideicon) {
                getActivity().getPackageManager().setComponentEnabledSetting(componentSettings,
                        PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
            } else {
                getActivity().getPackageManager().setComponentEnabledSetting(componentSettings,
                        PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
            }
            Switch_HideLauncherIcon.setChecked(hideicon);
            MainActivity.preferences.edit().putBoolean("HideLauncherIcon", hideicon).commit();
        }
    });

    LinearLayout_DeepXposedLogging.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            DeepXposedLogging = !DeepXposedLogging;
            Switch_DeepXposedLogging.setChecked(DeepXposedLogging);
            MainActivity.preferences.edit().putBoolean("DeepXposedLogging", DeepXposedLogging).commit();
        }
    });

    LinearLayout_Source.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            // TODO: Implement this method
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(Urlgithub));
            startActivity(i);
        }
    });

    LinearLayout_OrigSource.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            // TODO: Implement this method
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(Urloriggithub));
            startActivity(i);
        }
    });

    LinearLayout_Share.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            // TODO: Implement this method
            Intent i = new Intent(Intent.ACTION_SEND);
            i.setType("text/plain");
            i.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
            String sAux = getString(R.string.ShareMessage);
            sAux = sAux + "repo.xposed.info/module/de.NeonSoft.neopowermenu \n\n";
            i.putExtra(Intent.EXTRA_TEXT, sAux);
            startActivity(Intent.createChooser(i, getString(R.string.preferencesTitle_Share)));
        }
    });

    LinearLayout_About.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View p1) {
            // TODO: Implement this method
            adb = new AlertDialog.Builder(getActivity());
            adb.setTitle("About");

            adb.setMessage("NeoPowerMenu by Neon-Soft / DrAcHe981\n"
                    + "based on a Source from Naman Dwivedi (naman14)\n\n" + "< Used Librarys >\n"
                    + "> HoloColorPicker from Lars Werkman\n"
                    + "An Android Holo themed colorpicker designed by Marie Schweiz\n\n"
                    + "Licensed under the Apache License, Version 2.0\n\n" + "> DragSortListView from Bauerca\n"
                    + "DragSortListView (DSLV) is an extension of the Android ListView that enables drag-and-drop reordering of list items.\n\n"
                    + "Licensed under the Apache License, Version 2.0\n\n"
                    + "> libsuperuser from Chainfire / ChainsDD\n\n"
                    + "Licensed under the Apache License, Version 2.0\n\n" + "");

            adb.setPositiveButton(R.string.Dialog_Ok, null);

            ad = adb.create();
            ad.show();
        }
    });

    checkState();
    if (!MainActivity.RootAvailable) {
        pd = new ProgressDialog(getActivity());
        pd.setMessage(getString(R.string.Dialog_WaitForRoot));
        pd.setIndeterminate(true);
        pd.setCancelable(false);
        pd.setCanceledOnTouchOutside(false);
        pd.setButton(pd.BUTTON_NEGATIVE, getString(R.string.Dialog_Cancel),
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface p1, int p2) {
                        pd.dismiss();
                        getActivity().finish();
                    }
                });
        pd.setButton(pd.BUTTON_NEUTRAL, getString(R.string.Dialog_Ignore),
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface p1, int p2) {
                        pd.dismiss();
                    }
                });
        pd.show();
    } else if (MainActivity.RootAvailable) {
        rootAvailable();
    }

    getPermissions();
    return InflatedView;
}

From source file:com.tct.mail.ui.OnePaneController.java

@Override
public void showConversationList(ConversationListContext listContext) {
    super.showConversationList(listContext);
    // TS: tao.gan 2015-09-21 EMAIL FEATURE-559893 ADD_S
    //we change from ConversationViewFramgent to ConversationListFragment, should let the toolbar show
    animateShow(null);//from   w w  w . j  a  v a2  s.  c  om
    // TS: tao.gan 2015-09-21 EMAIL FEATURE-559893 ADD_E
    enableCabMode();
    mConversationListVisible = true;
    if (ConversationListContext.isSearchResult(listContext)) {
        mViewMode.enterSearchResultsListMode();
    } else {
        mViewMode.enterConversationListMode();
    }
    final int transition = mConversationListNeverShown ? FragmentTransaction.TRANSIT_FRAGMENT_FADE
            : FragmentTransaction.TRANSIT_FRAGMENT_OPEN;
    final Fragment conversationListFragment = ConversationListFragment.newInstance(listContext);

    if (!inInbox(mAccount, listContext)) {
        // Maintain fragment transaction history so we can get back to the
        // fragment used to launch this list.
        // AM: Kexue.Geng 2015-03-23 EMAIL BUGFIX_953177 MOD_S
        // mLastConversationListTransactionId = replaceFragment(conversationListFragment,
        //         transition, TAG_CONVERSATION_LIST, R.id.content_pane);
        try {
            mLastConversationListTransactionId = replaceFragment(conversationListFragment, transition,
                    TAG_CONVERSATION_LIST, R.id.content_pane);
        } catch (IllegalStateException e) {
            e.printStackTrace();
            mLastConversationListTransactionId = INVALID_ID;
        }
        // AM: Kexue.Geng 2015-03-23 EMAIL BUGFIX_953177 MOD_E
    } else {
        // If going to the inbox, clear the folder list transaction history.
        mInbox = listContext.folder;
        // TS: zhaotianyong 2015-05-21 EMAIL BUGFIX_1008675 MOD_S
        try {
            replaceFragment(conversationListFragment, transition, TAG_CONVERSATION_LIST, R.id.content_pane);
        } catch (IllegalStateException e) {
            LogUtils.e(LogUtils.TAG, e, "showConversationList error"); //TS: zheng.zou 2015-07-01 EMAIL BUGFIX-1033368 MOD
        }
        // TS: zhaotianyong 2015-05-21 EMAIL BUGFIX_1008675 MOD_E

        // If we ever to to the inbox, we want to unset the transation id for any other
        // non-inbox folder.
        mLastConversationListTransactionId = INVALID_ID;
    }
    //TS: zheng.zou 2015-07-01 EMAIL BUGFIX-1033368 MOD_S
    if (!mActivity.isDestroyed()) {
        try {
            mActivity.getFragmentManager().executePendingTransactions();
        } catch (IllegalStateException e) {
            LogUtils.e(LogUtils.TAG, e, "showConversationList error");
        }
    } else {
        LogUtils.w(LOG_TAG, "showConversationList activity is destroyed");
    }
    //TS: zheng.zou 2015-07-01 EMAIL BUGFIX-1033368 MOD_E

    onConversationVisibilityChanged(false);
    onConversationListVisibilityChanged(true);
    mConversationListNeverShown = false;
}

From source file:com.example.android.cloudnotes.ui.HomeActivity.java

/**
 * Callback from child fragment/*from  ww w.jav  a2  s .co m*/
 */
public void onNoteDeleted() {
    // remove the NoteEditFragment after a deletion
    FragmentManager fm = getFragmentManager();
    NoteEditFragment edit = (NoteEditFragment) fm.findFragmentByTag(NOTE_EDIT_TAG);
    if (edit != null) {
        FragmentTransaction ft = fm.beginTransaction();
        ft.remove(edit);
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        ft.commit();
    }
}

From source file:com.android.mail.ui.OnePaneController.java

@Override
protected void showConversationList(ConversationListContext listContext) {
    enableCabMode();//from   w w  w .  j av a2  s  . c  o  m
    mConversationListVisible = true;
    if (ConversationListContext.isSearchResult(listContext)) {
        mViewMode.enterSearchResultsListMode();
    } else {
        mViewMode.enterConversationListMode();
    }
    final int transition = mConversationListNeverShown ? FragmentTransaction.TRANSIT_FRAGMENT_FADE
            : FragmentTransaction.TRANSIT_FRAGMENT_OPEN;
    final Fragment conversationListFragment = ConversationListFragment.newInstance(listContext);

    if (!inInbox(mAccount, listContext)) {
        // Maintain fragment transaction history so we can get back to the
        // fragment used to launch this list.
        mLastConversationListTransactionId = replaceFragment(conversationListFragment, transition,
                TAG_CONVERSATION_LIST, R.id.content_pane);
    } else {
        // If going to the inbox, clear the folder list transaction history.
        mInbox = listContext.folder;
        replaceFragment(conversationListFragment, transition, TAG_CONVERSATION_LIST, R.id.content_pane);

        // If we ever to to the inbox, we want to unset the transation id for any other
        // non-inbox folder.
        mLastConversationListTransactionId = INVALID_ID;
    }

    mActivity.getFragmentManager().executePendingTransactions();

    onConversationVisibilityChanged(false);
    onConversationListVisibilityChanged(true);
    mConversationListNeverShown = false;
}

From source file:org.akvo.caddisfly.ui.activity.MainActivity.java

void displayView(int position, boolean addToBackStack) {
    int index = getCurrentFragmentIndex();

    if (index == position) {
        // requested fragment is already showing
        return;/*ww w  . ja  v  a  2s .c  o m*/
    }

    MainApp mainApp = (MainApp) getApplicationContext();

    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Config.FLOW_ACTION_EXTERNAL_SOURCE.equals(action) && type != null) {
        if ("text/plain".equals(type)) { //NON-NLS
            external = true;
            //mQuestionId = getIntent().getStringExtra("questionId");
            mQuestionTitle = getIntent().getStringExtra("questionTitle");

            String code = mQuestionTitle.substring(Math.max(0, mQuestionTitle.length() - 5));

            mainApp.setSwatches(code);
        }
    }

    if (mainApp.currentTestInfo == null) {
        mainApp.currentTestInfo = new TestInfo("", "", "");
    }

    Fragment fragment;

    switch (position) {
    case Config.HOME_SCREEN_INDEX:
        mStartFragment = StartFragment.newInstance(external, mainApp.currentTestInfo.getCode());
        fragment = mStartFragment;
        break;
    case Config.CALIBRATE_SCREEN_INDEX:
        mCalibrateFragment = new CalibrateFragment();
        fragment = mCalibrateFragment;
        setupActionBarSpinner();

        break;
    case Config.SETTINGS_SCREEN_INDEX:
        if (mSettingsFragment == null) {
            mSettingsFragment = new SettingsFragment();
        }
        fragment = mSettingsFragment;
        break;
    default:
        return;
    }
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction ft = fragmentManager.beginTransaction();
    ft.replace(R.id.container, fragment, String.valueOf(position));
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    if (addToBackStack) {
        ft.addToBackStack(null);
    }
    ft.commit();

    invalidateOptionsMenu();
    updateActionBarNavigation(position);
}

From source file:com.cdhxqh.inventorymovement.ui.MainActivity.java

/**
 * *//from w w  w .j a  va 2  s.co m
 */
private void defaultShowItem() {
    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
    fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    if (newItemFragment == null) {
        newItemFragment = new ItemFragment();
        Bundle bundle = new Bundle();
        bundle.putString("text", adapter.getTitle(0));
        newItemFragment.setArguments(bundle);
    }
    fragmentTransaction.replace(R.id.content_frame, newItemFragment).commit();
    drawer.closeDrawer(mDrawerList);
}

From source file:org.eyeseetea.malariacare.DashboardActivity.java

@NonNull
private FragmentTransaction getFragmentTransaction() {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    if (isMoveToLeft) {
        isMoveToLeft = false;/*from   ww w .  j  a  va2  s  .co m*/
        ft.setCustomAnimations(R.animator.anim_slide_in_right, R.animator.anim_slide_out_right);
    } else {
        ft.setCustomAnimations(R.animator.anim_slide_in_left, R.animator.anim_slide_out_left);
    }
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    return ft;
}