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


Java OnBackStackChangedListener类代码示例

本文整理汇总了Java中android.app.FragmentManager.OnBackStackChangedListener的典型用法代码示例。如果您正苦于以下问题:Java OnBackStackChangedListener类的具体用法?Java OnBackStackChangedListener怎么用?Java OnBackStackChangedListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OnBackStackChangedListener类属于android.app.FragmentManager包,在下文中一共展示了OnBackStackChangedListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runAfterSideFragmentsAreClosed

import android.app.FragmentManager.OnBackStackChangedListener; //导入依赖的package包/类
private void runAfterSideFragmentsAreClosed(final Runnable runnable) {
    if (mSideFragmentManager.isSidePanelVisible()) {
        // When the side panel is closing, it closes all the fragments, so the new fragment
        // should be opened after the side fragment becomes invisible.
        final FragmentManager manager = mMainActivity.getFragmentManager();
        mOnBackStackChangedListener = new OnBackStackChangedListener() {
            @Override
            public void onBackStackChanged() {
                if (manager.getBackStackEntryCount() == 0) {
                    manager.removeOnBackStackChangedListener(this);
                    mOnBackStackChangedListener = null;
                    runnable.run();
                }
            }
        };
        manager.addOnBackStackChangedListener(mOnBackStackChangedListener);
    } else {
        runnable.run();
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:21,代码来源:TvOverlayManager.java

示例2: onCreate

import android.app.FragmentManager.OnBackStackChangedListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {		
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_edit_profile);
	if (getIntent().hasExtra("persona")) {
		mPersona = (Persona)getIntent().getSerializableExtra("persona");
	} else {
		mPersona = Persona.BOTH;
	}
	setupViews();
	getFragmentManager().addOnBackStackChangedListener(new OnBackStackChangedListener() {
		@Override
		public void onBackStackChanged() {
			updateTitle();
		}
	});
	this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
	setupKeyboardVisibilityListener();
}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:20,代码来源:EditProfileActivity.java

示例3: onCreate

import android.app.FragmentManager.OnBackStackChangedListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.activity_playing_ground);
	
	flTopLeft = (FrameLayout) findViewById(R.id.FrameLayoutTopLeft);
	flBottom = (LinearLayout) findViewById(R.id.LinearLayoutBottom);
	sentences = new SentenciasSQLitePlayingGround(this);
	fm = getFragmentManager();
	fssp = new FragmentSelectStartingPlayers();
	ffe = new FragmentFinishEvent();
	ft = fm.beginTransaction();
	ft.add(flTopLeft.getId(), fssp);
	ft.add(flBottom.getId(), ffe);
	ft.commit();
	fm.addOnBackStackChangedListener(new OnBackStackChangedListener() {
		
		@Override
		public void onBackStackChanged() {
			// Si BACKSTACK esta vacio entonces boton seleccionado de jugador sin pintar y 'Entered' false.
			if(fm.getBackStackEntryCount() == 0){
				Log.d("onBackStackChanged", "HA LLEGADO A 0");
				entered = false;
				lastPlayerID = -1;
			}
			
		}
	});

}
 
开发者ID:DAM2-GOW,项目名称:FCM,代码行数:32,代码来源:PlayingGround.java

示例4: onCreate

import android.app.FragmentManager.OnBackStackChangedListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {
        if (getApplication() instanceof ChromeApplication) {
            ((ChromeApplication) getApplication())
                    .startBrowserProcessesAndLoadLibrariesSync(true);
        }
    } catch (ProcessInitException e) {
        Log.e(TAG, "Unable to load native library.", e);
        ChromeApplication.reportStartupErrorAndExit(e);
        return;
    }
    if (!DeviceFormFactor.isTablet(this)) {
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
                | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    }

    if (savedInstanceState == null) {
        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
        fragmentTransaction.add(
                android.R.id.content, generateBaseFragment(), BASE_ADD_EDIT_FRAGMENT_TAG);
        fragmentTransaction.commit();
    } else {
        initializeFragmentState();
    }

    // When adding or removing fragments, ensure the keyboard is hidden if visible as the
    // editing fields are no longer on the screen.
    getFragmentManager().addOnBackStackChangedListener(new OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
            UiUtils.hideKeyboard(findViewById(android.R.id.content));
        }
    });
    if (checkPermission(Manifest.permission.NFC, Process.myPid(), Process.myUid())
            == PackageManager.PERMISSION_GRANTED) {
        NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
        if (nfcAdapter != null) nfcAdapter.setNdefPushMessage(null, this);
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:42,代码来源:ManageBookmarkActivity.java

示例5: onCreate

import android.app.FragmentManager.OnBackStackChangedListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	
	setContentView(R.layout.activity_dynamic_layout);
	
	// Get a reference to the detail frame layout.
	_detailFrameLayout = (FrameLayout) findViewById(R.id.frameDetail);
	
	// Get a reference to the Fragment Manager to be used for
	// dynamically adding fragments to this hosting Activity.
	_fragmentManager = getFragmentManager();
	
	if (savedInstanceState == null)
	{
		// New instance, so create fragments and add to the activity.
		_listFragment = new FragmentList();
		_detailFragment = new FragmentDetail();
		
		// Add fragments to the appropriate frame layout containers.
		_fragmentManager.beginTransaction()
						.add(R.id.frameList, _listFragment)
						.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
						.commit();
	}
	else
	{	
		// Fragments have already been added, just find them.
		_listFragment = (FragmentList) _fragmentManager.findFragmentById(R.id.frameList);
		_detailFragment = (FragmentDetail) _fragmentManager.findFragmentById(R.id.frameDetail);
		
		if (_detailFragment == null)
		{
			_detailFragment = new FragmentDetail();
		}
		
		setLayout();
	}
	
	_fragmentManager.addOnBackStackChangedListener(new OnBackStackChangedListener()
	{
		@Override
		public void onBackStackChanged()
		{	
			// Register for the back button and reset the layout
			// by removing the detail fragment.
			setLayout();
			
			if (_detailFragment.isAdded() == false)
			{
				_listFragment.getListView().clearChoices();
			}
		}
	});
}
 
开发者ID:SDSMT-CSC,项目名称:CS492-FA13,代码行数:57,代码来源:ActivityDynamicLayout.java

示例6: onCreate

import android.app.FragmentManager.OnBackStackChangedListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	
	setContentView(R.layout.activity_dynamic_layout);
	
	// Get a reference to the Fragment Manager to be used for
	// dynamically adding fragments to this hosting Activity.
	_fragmentManager = getFragmentManager();
	
	// Get references to the frame layouts in order to set appropriate
	// layout_weight parameter.
	_listFrameLayout = (FrameLayout) findViewById(R.id.frameList);
	_detailFrameLayout = (FrameLayout) findViewById(R.id.frameDetail);
	
	// Do we have any saved state, i.e. selectedClassID?
	if (savedInstanceState == null)
	{
		_listFragment = new FragmentList();
		_detailFragment = new FragmentDetail();
	}
	else
	{
		// Retrieve the saved ClassID index that was selected in the list.
		_selectedClassID = savedInstanceState.getInt(SELECTED_CLASS_ID);
		
		// Primarily used when rotating from portrait detail fragment visible
		// to landscape to simply apply the correct fragment to the frame layout.
		// The detail fragment was used to replace the list fragment in the list
		// frame layout for purposes of demonstrating the back stack.
		_fragmentManager.popBackStackImmediate();
		
		_listFragment = (FragmentList) _fragmentManager.findFragmentById(R.id.frameList);
		_detailFragment = (FragmentDetail) _fragmentManager.findFragmentById(R.id.frameDetail);
		
		if (_detailFragment == null)
		{
			_detailFragment = new FragmentDetail();
		}
	}
		
	// Determine orientation of the device to display single pane vs. dual pane layout.
	if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
	{
		_fragmentManager.beginTransaction()
						.replace(R.id.frameList, _listFragment)
						.replace(R.id.frameDetail, _detailFragment)
						.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
						.commit();
	}
	else
	{
		_fragmentManager.beginTransaction()
						.replace(R.id.frameList, _listFragment)
						.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
						.commit();
	}
	
	// Set layout_weight for the given orientation.
	setLayout();
	
	_fragmentManager.addOnBackStackChangedListener(new OnBackStackChangedListener()
	{
		@Override
		public void onBackStackChanged()
		{
			if (_listFragment.isAdded() == true)
			{
				_listFragment.getListView().clearChoices();
			}
		}
	});
}
 
开发者ID:SDSMT-CSC,项目名称:CS492-FA13,代码行数:75,代码来源:ActivityConfigChangeDynamicLayout.java


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