Android Open Source - StickyGridHeaders Item Detail Fragment






From Project

Back to project page StickyGridHeaders.

License

The source code is released under:

Apache License

If you think the Android project StickyGridHeaders 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 2013 Tonic Artos/* w  ww. jav a  2 s.  c om*/

 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.tonicartos.stickygridheadersexample;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * A fragment representing a single Item detail screen. This fragment is either
 * contained in a {@link com.tonicartos.stickygridheadersexample.ItemListActivity} in two-pane mode (on tablets) or a
 * {@link com.tonicartos.stickygridheadersexample.ItemDetailActivity} on handsets.
 * 
 * @author Tonic Artos
 */
public class ItemDetailFragment extends Fragment {
    /**
     * The fragment argument representing the item ID that this fragment
     * represents.
     */
    public static final String ARG_ITEM_ID = "item_id";

    /**
     * The dummy content this fragment is presenting.
     */
    private int mItem;

    /**
     * Mandatory empty constructor for the fragment manager to instantiate the
     * fragment (e.g. upon screen orientation changes).
     */
    public ItemDetailFragment() {
    }

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

        if (getArguments().containsKey(ARG_ITEM_ID)) {
            // Load the dummy content specified by the fragment
            // arguments. In a real-world scenario, use a Loader
            // to load content from a content provider.
            mItem = getArguments().getInt(ARG_ITEM_ID);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_item_detail, container, false);

        ((TextView) rootView.findViewById(R.id.item_detail)).setText(getResources().getStringArray(R.array.countries)[mItem]);
        return rootView;
    }
}




Java Source Code List

com.tonicartos.stickygridheadersexample.ItemDetailActivity.java
com.tonicartos.stickygridheadersexample.ItemDetailFragment.java
com.tonicartos.stickygridheadersexample.ItemListActivity.java
com.tonicartos.stickygridheadersexample.ItemListFragment.java
com.tonicartos.widget.stickygridheaders.StickyGridHeadersBaseAdapterWrapper.java
com.tonicartos.widget.stickygridheaders.StickyGridHeadersBaseAdapter.java
com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView.java
com.tonicartos.widget.stickygridheaders.StickyGridHeadersListAdapterWrapper.java
com.tonicartos.widget.stickygridheaders.StickyGridHeadersSimpleAdapterWrapper.java
com.tonicartos.widget.stickygridheaders.StickyGridHeadersSimpleAdapter.java
com.tonicartos.widget.stickygridheaders.StickyGridHeadersSimpleArrayAdapter.java