Android Open Source - AURHelperDroid Local Activity Manager Fragment






From Project

Back to project page AURHelperDroid.

License

The source code is released under:

Apache License

If you think the Android project AURHelperDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2011 Ievgenii Nazaruk/*from   w  w  w.  java2  s .c o  m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.stomachion.aurhelperdroid.fallbacksupport;

import android.app.LocalActivityManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;

/**
 * This is a fragment that will be used during transition from activities to fragments.
 */
@SuppressWarnings("deprecation")
public class LocalActivityManagerFragment extends Fragment {
    private static final String TAG = LocalActivityManagerFragment.class.getSimpleName();
    private static final boolean DEBUG = false;

    private static final String KEY_STATE_BUNDLE = "localActivityManagerState";

    private LocalActivityManager mLocalActivityManager;


    protected LocalActivityManager getLocalActivityManager() {
        return mLocalActivityManager;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (DEBUG)
            Log.d(TAG, "onCreate(): " + getClass().getSimpleName());

        Bundle state = null;
        if (savedInstanceState != null) {
            state = savedInstanceState.getBundle(KEY_STATE_BUNDLE);
        }

        mLocalActivityManager = new LocalActivityManager(getActivity(), true);
        mLocalActivityManager.dispatchCreate(state);
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putBundle(KEY_STATE_BUNDLE, mLocalActivityManager.saveInstanceState());
    }

    @Override
    public void onResume() {
        super.onResume();
        if (DEBUG)
            Log.d(TAG, "onResume(): " + getClass().getSimpleName());
        mLocalActivityManager.dispatchResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        if (DEBUG)
            Log.d(TAG, "onPause(): " + getClass().getSimpleName());
        mLocalActivityManager.dispatchPause(getActivity().isFinishing());
    }

    @Override
    public void onStop() {
        super.onStop();
        if (DEBUG)
            Log.d(TAG, "onStop(): " + getClass().getSimpleName());
        mLocalActivityManager.dispatchStop();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (DEBUG)
            Log.d(TAG, "onDestroy(): " + getClass().getSimpleName());
        mLocalActivityManager.dispatchDestroy(getActivity().isFinishing());
    }
}




Java Source Code List

com.stomachion.aurhelperdroid.activities.MainActivity.java
com.stomachion.aurhelperdroid.activities.PreferencesActivity.java
com.stomachion.aurhelperdroid.adapters.NewsAdapter.java
com.stomachion.aurhelperdroid.fallbacksupport.ActivityHostFragment.java
com.stomachion.aurhelperdroid.fallbacksupport.LocalActivityManagerFragment.java
com.stomachion.aurhelperdroid.fragments.AboutFrag.java
com.stomachion.aurhelperdroid.fragments.NewsRSSFrag.java
com.stomachion.aurhelperdroid.fragments.PreferencesFrag.java
com.stomachion.aurhelperdroid.fragments.SearchFrag.java
com.stomachion.aurhelperdroid.logic.NewsItem.java
com.stomachion.aurhelperdroid.network.InternetState.java
com.stomachion.aurhelperdroid.parser.MainRssParser.java
com.stomachion.aurhelperdroid.parser.RssNewsHandler.java
com.stomachion.aurhelperdroid.utils.CommonUtils.java
com.stomachion.aurhelperdroid.utils.Constants.java
com.stomachion.aurhelperdroid.utils.Prefs.java