Example usage for android.os Bundle getParcelableArrayList

List of usage examples for android.os Bundle getParcelableArrayList

Introduction

In this page you can find the example usage for android.os Bundle getParcelableArrayList.

Prototype

@Nullable
public <T extends Parcelable> ArrayList<T> getParcelableArrayList(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.ninetwozero.battlelog.ViewPagerDashboard.java

@Override
public void onCreate(Bundle icicle) {

    // onCreate - save the instance state
    super.onCreate(icicle);

    // Set sharedPreferences
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    // Did it get passed on?
    if (icicle != null && icicle.containsKey(Constants.SUPER_COOKIES)) {

        ArrayList<ShareableCookie> shareableCookies = icicle.getParcelableArrayList(Constants.SUPER_COOKIES);

        if (shareableCookies != null) {

            RequestHandler.setCookies(shareableCookies);

        } else {/*from ww  w  .  ja  v a2 s . co  m*/

            finish();

        }

    }

    // We should've gotten a profile
    if (SessionKeeper.getProfileData() == null) {

        if (getIntent().hasExtra("myProfile")) {

            SessionKeeper.setProfileData((ProfileData) getIntent().getParcelableExtra("myProfile"));

        } else {

            Toast.makeText(this, R.string.info_txt_session_lost, Toast.LENGTH_SHORT).show();
            return;

        }

    }

    // Setup the locale
    setupLocale();

    // Set the content view
    setContentView(R.layout.viewpager_dashboard);

    // Get the layoutInflater
    layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    fragmentManager = getSupportFragmentManager();

    // Let's setup the fragments
    if (menuFragment == null) {

        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.add(R.id.fragment_content, new MenuFragment());
        fragmentTransaction.add(R.id.fragment_content, new MenuFragment());
        fragmentTransaction.commit();

    }

    // Setup the data
    notificationArray = new ArrayList<NotificationData>();
    friendListData = new FriendListDataWrapper(null, null, null);

    // Setup COM & feed
    initActivity();
}

From source file:org.amahi.anywhere.fragment.ServerFilesFragment.java

private void setUpFilesState(Bundle state) {
    List<ServerFile> files = state.getParcelableArrayList(State.FILES);

    FilesSort filesSort = (FilesSort) state.getSerializable(State.FILES_SORT);

    setUpFilesContent(files);//from   w  w w  . ja v  a  2  s .c o  m
    setUpFilesContentSort(filesSort);

    showFilesContent();
}

From source file:de.gruenewald.udacity.spotifystreamer.PlaybackFragment.java

@Nullable
@Override/* w  w  w .j a v a 2 s  .c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mRootView == null) {
        mRootView = inflater.inflate(R.layout.fragment_playback, container, false);
        ButterKnife.inject(this, mRootView);

        //repopulate the views with the provided arguments; if no external arguments are
        //found try to use the savedInstanceState
        Bundle myBundle = null;
        if (savedInstanceState != null) {
            myBundle = savedInstanceState;
        } else if (getArguments() != null) {
            myBundle = getArguments();
        }

        if (myBundle != null) {
            mTrackIndex = myBundle.getInt(ARG_PLAYBACK_TRACKINDEX);
            mPlaybackEntries = myBundle.getParcelableArrayList(ARG_PLAYBACK_DATALIST);
        }
    }

    //avoid the title-area by disabling the feature
    if (getDialog() != null) {
        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    }

    return mRootView;
}

From source file:com.antew.redditinpictures.library.ui.ImageViewerActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (savedInstanceState.containsKey(Constants.Extra.EXTRA_ENTRIES)) {
        mImages = savedInstanceState.getParcelableArrayList(Constants.Extra.EXTRA_ENTRIES);
    }//from www .  j  ava2 s .  c  o m

    if (savedInstanceState.containsKey(Constants.Extra.EXTRA_IS_SWIPING_ENABLED)) {
        mSwipingEnabled = savedInstanceState.getBoolean(Constants.Extra.EXTRA_IS_SWIPING_ENABLED);
    }

    if (savedInstanceState.containsKey(Constants.Extra.EXTRA_IMAGE)) {
        mRequestedPage = savedInstanceState.getInt(Constants.Extra.EXTRA_IMAGE);
    }
}

From source file:com.amaze.filemanager.fragments.ZipExplorerFragment.java

private void onRestoreInstanceState(Bundle savedInstanceState) {
    realZipFile = new File(Uri.parse(savedInstanceState.getString(KEY_URI)).getPath());
    files = savedInstanceState.getParcelableArrayList(KEY_CACHE_FILES);
    isOpen = savedInstanceState.getBoolean(KEY_OPEN);
    if (realZipFile.getPath().endsWith(".rar")) {
        openmode = RAR_FILE;/* www  .j  a va 2 s  . c  o  m*/
        String path = savedInstanceState.getString(KEY_FILE);
        if (path != null && path.length() > 0) {
            realZipFile = new File(path);
            relativeDirectory = savedInstanceState.getString(KEY_PATH, "");
            changeRarPath(relativeDirectory);
        } else {
            changePath("");
        }
    } else {
        openmode = ZIP_FILE;
        elements = savedInstanceState.getParcelableArrayList(KEY_ELEMENTS);
        relativeDirectory = savedInstanceState.getString(KEY_PATH, "");
        realZipFile = new File(savedInstanceState.getString(KEY_FILE));
        createZipViews(elements, relativeDirectory);
    }
}

From source file:com.ayuget.redface.ui.fragment.TopicFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (topicPageAdapter == null) {
        topicPageAdapter = new TopicPageAdapter(getChildFragmentManager(), topic, currentPage);
    }//from  w w  w  .  j  a  v a2 s  .co m

    if (savedInstanceState != null) {
        topicPositionsStack = savedInstanceState.getParcelableArrayList(ARG_TOPIC_POSITIONS_STACK);
    }

    if (topicPositionsStack == null) {
        topicPositionsStack = new ArrayList<>();
    }

    setHasOptionsMenu(true);
}

From source file:com.ayuget.redface.ui.fragment.TopicListFragment.java

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Restore the list of topics when the fragment is recreated by the framework
    if (savedInstanceState != null) {
        displayedTopics = savedInstanceState.getParcelableArrayList(ARG_TOPIC_LIST);
        if (displayedTopics != null) {
            Log.i(LOG_TAG, "Restored " + String.valueOf(displayedTopics.size()) + " topics to fragment");
            topicsAdapter.replaceWith(displayedTopics);
            showTopics();//from www  .ja v  a 2s.c  o  m
        }

        lastLoadedPage = savedInstanceState.getInt(ARG_LAST_LOADED_PAGE, 0);
    }
}

From source file:org.videolan.vlc.gui.browser.BaseBrowserFragment.java

public void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    if (bundle == null)
        bundle = getArguments();//from w ww.j a  v  a2  s .  c  o m
    if (bundle != null) {
        mediaList = bundle.getParcelableArrayList(KEY_MEDIA_LIST);
        if (mediaList != null)
            mAdapter.addAll(mediaList);
        mCurrentMedia = bundle.getParcelable(KEY_MEDIA);
        if (mCurrentMedia != null)
            mMrl = mCurrentMedia.getLocation();
        else
            mMrl = bundle.getString(KEY_MRL);
        mSavedPosition = bundle.getInt(KEY_POSITION);
    }
}

From source file:io.github.hidroh.materialistic.widget.StoryRecyclerViewAdapter.java

@Override
public void restoreState(Bundle savedState) {
    if (savedState == null) {
        return;/*from   w  ww. j  a va2 s .c o  m*/
    }
    super.restoreState(savedState);
    ArrayList<Item> savedItems = savedState.getParcelableArrayList(STATE_ITEMS);
    setItemsInternal(savedItems);
    mUpdated = savedState.getParcelableArrayList(STATE_UPDATED);
    if (mUpdated != null) {
        for (int i = 0; i < mUpdated.size(); i++) {
            mUpdatedPositions.put(mUpdated.get(i).getLongId(), i);
        }
    }
    ArrayList<String> promotedKey = savedState.getStringArrayList(STATE_PROMOTED_KEY);
    ArrayList<Integer> promotedValue = savedState.getIntegerArrayList(STATE_PROMOTED_VALUE);
    mPromoted.clear();
    //noinspection ConstantConditions
    for (int i = 0; i < promotedKey.size(); i++) {
        //noinspection ConstantConditions
        mPromoted.put(promotedKey.get(i), promotedValue.get(i));
    }
    mShowAll = savedState.getBoolean(STATE_SHOW_ALL, true);
    mHighlightUpdated = savedState.getBoolean(STATE_HIGHLIGHT_UPDATED, true);
    mFavoriteRevision = savedState.getInt(STATE_FAVORITE_REVISION);
    mUsername = savedState.getString(STATE_USERNAME);
}

From source file:com.wglxy.example.dashL.SearchActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SEARCH_QUERY)
            && savedInstanceState.containsKey(KEY_USER_OBJ)) {
        searchStr = savedInstanceState.getString(KEY_SEARCH_QUERY);
        data = savedInstanceState.getParcelableArrayList(KEY_USER_OBJ);
    }/*  w  w w  .  ja  v a  2  s.  c om*/
}