Android Open Source - androidSamples Page Fragment






From Project

Back to project page androidSamples.

License

The source code is released under:

GNU General Public License

If you think the Android project androidSamples 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 2012 The Android Open Source Project
 */* w w  w . j a v  a2 s. co 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.hainva.feedlynavigation;

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

public class PageFragment extends Fragment {

  public static final String ARG_PAGE = "page";
  private int mPageNumber;

  public static PageFragment create(int pageNumber) {
    PageFragment fragment = new PageFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_PAGE, pageNumber);
    fragment.setArguments(args);
    return fragment;
  }

  public PageFragment() {
  }

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPageNumber = getArguments().getInt(ARG_PAGE);
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(
        R.layout.fragment_screen_slide_page, container, false);

    // Set the title view to show the page number.
    ((TextView) rootView.findViewById(android.R.id.text1))
        .setText(getString(R.string.title_template_step,
            mPageNumber + 1));

    return rootView;
  }

  /**
   * Returns the page number represented by this fragment object.
   */
  public int getPageNumber() {
    return mPageNumber;
  }
}




Java Source Code List

com.hainva.feedlynavigation.ExtendedWebView.java
com.hainva.feedlynavigation.FeedlyActivity.java
com.hainva.feedlynavigation.FeedlyViewPager.java
com.hainva.feedlynavigation.PageFragment.java
com.hainva.feedlynavigation.PagerAdapter.java