List of usage examples for android.app FragmentTransaction hide
public abstract FragmentTransaction hide(Fragment fragment);
From source file:com.telestax.restcomm_olympus.CallActivity.java
@Override public void onFragmentInteraction(String action) { if (action.equals("cancel")) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.hide(keypadFragment); ft.commit();/*from w ww .j a va2 s . c o m*/ } }
From source file:de.lespace.apprtc.CallActivity.java
public void toggleCallControlFragmentVisibility() { if (!iceConnected || !callFragment.isAdded()) { return;/*www .ja va2 s. com*/ } // Show/hide call control fragment callControlFragmentVisible = !callControlFragmentVisible; FragmentTransaction ft = getFragmentManager().beginTransaction(); if (callControlFragmentVisible) { ft.show(callFragment); ft.show(hudFragment); } else { ft.hide(callFragment); ft.hide(hudFragment); } ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); }
From source file:com.vst.functionframework.ui.SupportActivity.java
/** * Fragment?/*from www.j ava 2 s . com*/ * * @param resView ?? * @param targetFragment ??Fragment */ public void changeFragment(int resView, VstFragment targetFragment) { if (targetFragment.equals(currentKJFragment)) { return; } FragmentTransaction transaction = getFragmentManager().beginTransaction(); if (!targetFragment.isAdded()) { transaction.add(resView, targetFragment, targetFragment.getClass().getName()); } if (targetFragment.isHidden()) { transaction.show(targetFragment); targetFragment.onChange(); } if (currentKJFragment != null && currentKJFragment.isVisible()) { transaction.hide(currentKJFragment); } currentKJFragment = targetFragment; transaction.commit(); }
From source file:com.mediatek.engineermode.EngineerMode.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);// ww w . j a v a 2 s. c o m final FragmentManager fragmentManager = getFragmentManager(); final FragmentTransaction transaction = fragmentManager.beginTransaction(); if (isWifiOnly()) { TAB_TITLE_IDS = TAB_TITLE_IDS_WIFIONLY; TAB_COUNT = TAB_COUNT_WIFIONLY; } Log.v("@M_" + TAG, "new fregments"); for (int i = 0; i < TAB_COUNT; i++) { mTabs[i] = new PrefsFragment(); mTabs[i].setResource(i); transaction.add(R.id.viewpager, mTabs[i], String.valueOf(i)); transaction.hide(mTabs[i]); } ViewPager viewPager; PagerTabStrip pagerTabStrip; viewPager = (ViewPager) findViewById(R.id.viewpager); pagerTabStrip = (PagerTabStrip) findViewById(R.id.pagertitle); pagerTabStrip.setTabIndicatorColorResource(android.R.color.holo_blue_light); transaction.commitAllowingStateLoss(); // fragmentManager.executePendingTransactions(); mPagerAdapter = new MyPagerAdapter(); viewPager.setAdapter(mPagerAdapter); viewPager.setCurrentItem(0); }
From source file:com.hufeiya.SignIn.activity.QuizActivity.java
public void switchContent(Fragment from, Fragment to) { if (mContent != to) { mContent = to;//from w w w. j ava 2s . c o m FragmentTransaction transaction = getFragmentManager().beginTransaction(); //.setCustomAnimations(android.R.anim.fade_in, android.R.anim.slide_out_right); if (!to.isAdded()) { // ?add transaction.hide(from).add(R.id.content, to).commit(); // ???fragmentaddActivity } else { transaction.hide(from).show(to).commit(); // ???fragment } } }
From source file:com.vst.functionframework.ui.SupportActivity.java
/** * Fragment?//ww w . ja v a2s . com * * @param resView ?? * @param targetFragment ??Fragment */ public void changeFragment(int resView, SupportFragment targetFragment) { if (targetFragment.equals(currentSupportFragment)) { return; } android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (!targetFragment.isAdded()) { transaction.add(resView, targetFragment, targetFragment.getClass().getName()); } if (targetFragment.isHidden()) { transaction.show(targetFragment); targetFragment.onChange(); } if (currentSupportFragment != null && currentSupportFragment.isVisible()) { transaction.hide(currentSupportFragment); } currentSupportFragment = targetFragment; transaction.commit(); }
From source file:com.github.chenxiaolong.dualbootpatcher.MainActivity.java
private void hideFragments(boolean animate) { FragmentManager fm = getFragmentManager(); Fragment prevRoms = fm.findFragmentByTag(SwitcherListFragment.TAG); Fragment prevPatchFile = fm.findFragmentByTag(PatchFileFragment.TAG); Fragment prevFreeSpace = fm.findFragmentByTag(FreeSpaceFragment.TAG); Fragment prevAbout = fm.findFragmentByTag(AboutFragment.TAG); FragmentTransaction ft = fm.beginTransaction(); if (animate) { ft.setCustomAnimations(0, R.animator.fragment_out); }//from w w w . j ava 2 s .com if (prevRoms != null) { ft.hide(prevRoms); } if (prevPatchFile != null) { ft.hide(prevPatchFile); } if (prevFreeSpace != null) { ft.hide(prevFreeSpace); } if (prevAbout != null) { ft.hide(prevAbout); } ft.commit(); fm.executePendingTransactions(); }
From source file:org.jp.liteframe.LiteActivity.java
/** * Fragment?/* w w w. j a v a 2 s. co m*/ * * @param resView ?? * @param targetFragment ??Fragment */ public void changeFragment(int resView, LiteFragment targetFragment) { if (targetFragment.equals(mCurrentLiteFragment)) { return; } FragmentTransaction transaction = getFragmentManager().beginTransaction(); if (!targetFragment.isAdded()) { transaction.add(resView, targetFragment, targetFragment.getClass().getName()); } if (targetFragment.isHidden()) { transaction.show(targetFragment); targetFragment.onChange(); } if (mCurrentLiteFragment != null && mCurrentLiteFragment.isVisible()) { transaction.hide(mCurrentLiteFragment); } mCurrentLiteFragment = targetFragment; transaction.commit(); }
From source file:com.telestax.restcomm_olympus.CallActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set window styles for fullscreen-window size. Needs to be done before // adding content. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); setContentView(R.layout.activity_call); // Initialize UI btnHangup = (ImageButton) findViewById(R.id.button_hangup); btnHangup.setOnClickListener(this); btnAnswer = (ImageButton) findViewById(R.id.button_answer); btnAnswer.setOnClickListener(this); btnAnswerAudio = (ImageButton) findViewById(R.id.button_answer_audio); btnAnswerAudio.setOnClickListener(this); btnMuteAudio = (ImageButton) findViewById(R.id.button_mute_audio); btnMuteAudio.setOnClickListener(this); btnMuteVideo = (ImageButton) findViewById(R.id.button_mute_video); btnMuteVideo.setOnClickListener(this); btnKeypad = (ImageButton) findViewById(R.id.button_keypad); btnKeypad.setOnClickListener(this); lblCall = (TextView) findViewById(R.id.label_call); lblStatus = (TextView) findViewById(R.id.label_status); lblTimer = (TextView) findViewById(R.id.label_timer); alertDialog = new AlertDialog.Builder(CallActivity.this).create(); device = RCClient.listDevices().get(0); PreferenceManager.setDefaultValues(this, "preferences.xml", MODE_PRIVATE, R.xml.preferences, false); prefs = PreferenceManager.getDefaultSharedPreferences(this); // Get Intent parameters. final Intent intent = getIntent(); if (intent.getAction().equals(RCDevice.OUTGOING_CALL)) { btnAnswer.setVisibility(View.INVISIBLE); btnAnswerAudio.setVisibility(View.INVISIBLE); } else {//from ww w. ja v a 2 s . c o m btnAnswer.setVisibility(View.VISIBLE); btnAnswerAudio.setVisibility(View.VISIBLE); } keypadFragment = new KeypadFragment(); lblTimer.setVisibility(View.INVISIBLE); // these might need to be moved to Resume() btnMuteAudio.setVisibility(View.INVISIBLE); btnMuteVideo.setVisibility(View.INVISIBLE); btnKeypad.setVisibility(View.INVISIBLE); activityVisible = true; // open keypad FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(R.id.keypad_fragment_container, keypadFragment); ft.hide(keypadFragment); ft.commit(); //handleCall(intent); }
From source file:com.evandroid.musica.MainLyricActivity.java
public void updateLyricsFragment(int outAnim, String... params) { // Should only be called from SearchFragment or IdDecoder String artist = params[0];/* w w w .j a v a 2s . c o m*/ String song = params[1]; String url = null; if (params.length > 2) url = params[2]; LyricsViewFragment lyricsViewFragment = (LyricsViewFragment) getFragmentManager() .findFragmentByTag(LYRICS_FRAGMENT_TAG); if (lyricsViewFragment != null) lyricsViewFragment.fetchLyrics(artist, song, url); else { Lyrics lyrics = new Lyrics(Lyrics.SEARCH_ITEM); lyrics.setArtist(artist); lyrics.setTitle(song); lyrics.setURL(url); Bundle lyricsBundle = new Bundle(); try { if (artist != null && song != null) lyricsBundle.putByteArray("lyrics", lyrics.toBytes()); } catch (IOException e) { e.printStackTrace(); } lyricsViewFragment = new LyricsViewFragment(); lyricsViewFragment.setArguments(lyricsBundle); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); Fragment activeFragment = getDisplayedFragment(getActiveFragments()); if (activeFragment != null) { prepareAnimations(activeFragment); fragmentTransaction.hide(activeFragment); } fragmentTransaction.add(R.id.main_fragment_container, lyricsViewFragment, LYRICS_FRAGMENT_TAG); lyricsViewFragment.isActiveFragment = true; fragmentTransaction.commit(); } }