Android Open Source - StikkyHeader Main Fragment






From Project

Back to project page StikkyHeader.

License

The source code is released under:

Apache License

If you think the Android project StikkyHeader 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

package it.carlom.stickyheader.example.fragment;
//from w w w . j a  v a 2 s  .co  m

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import it.carlom.stickyheader.example.MainActivity;
import it.carlom.stickyheader.example.R;

public class MainFragment extends Fragment {


    public MainFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_main, container, false);
    }

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

        ListView listView = (ListView) getView().findViewById(R.id.listview);

        String[] mFrags = {
            "Simple Stikky Header",
            "Parallax Simple Stikky Header",
            "ActionBarImage Header Animator",
            "I/O 2014 Header Animator",
            "Fade Out Interpolated Animator"
        };

        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, mFrags);

        listView.setAdapter(arrayAdapter);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                Fragment fragment = null;

                switch (position) {

                    case 0:
                        fragment = new SimpleStikkyFragment();
                        break;

                    case 1:
                        fragment = new ParallaxStikkyFragment();
                        break;

                    case 2:
                        fragment = new ActionBarImageFragment();
                        break;

                    case 3:
                        fragment = new IO2014HeaderFragment();
                        break;

                    case 4:
                        fragment = new FadeOutInterpolatedFragment();
                        break;

                }

                ((MainActivity) getActivity()).loadFragment(fragment);
            }
        });


    }
}




Java Source Code List

it.carlom.stickyheader.example.MainActivity.java
it.carlom.stickyheader.example.animator.IO2014HeaderAnimator.java
it.carlom.stickyheader.example.animator.IconActionBarAnimator.java
it.carlom.stickyheader.example.fragment.ActionBarImageFragment.java
it.carlom.stickyheader.example.fragment.FadeOutInterpolatedFragment.java
it.carlom.stickyheader.example.fragment.IO2014HeaderFragment.java
it.carlom.stickyheader.example.fragment.MainFragment.java
it.carlom.stickyheader.example.fragment.ParallaxStikkyFragment.java
it.carlom.stickyheader.example.fragment.SimpleStikkyFragment.java
it.carlom.stikkyheader.core.HeaderAnimator.java
it.carlom.stikkyheader.core.StikkyHeaderBuilder.java
it.carlom.stikkyheader.core.StikkyHeader.java
it.carlom.stikkyheader.core.animator.AnimatorBuilder.java
it.carlom.stikkyheader.core.animator.BaseStickyHeaderAnimator.java
it.carlom.stikkyheader.core.animator.HeaderStikkyAnimator.java