Android Open Source - infinitep Month Fragment Test






From Project

Back to project page infinitep.

License

The source code is released under:

Apache License

If you think the Android project infinitep 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 es.daconstenla.infinip.customcomponents;
//from   w  ww .j  a v a 2  s . c o  m
import android.graphics.Color;
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;

public class MonthFragmentTest extends Fragment {
  
  /**
   * Key to insert the background color into the mapping of a Bundle.
   */
  private static final String BACKGROUND_COLOR = "color";

  /**
   * Key to insert the index page into the mapping of a Bundle.
   */
  private static final String INDEX = "index";

  private int color;
  private int index;

  /**
   * Instances a new fragment with a background color and an index page.
   * 
   * @param color
   *            background color
   * @param index
   *            index page
   * @return a new page
   */
  public static MonthFragmentTest newInstance(int color, int index) {

    // Instantiate a new fragment
    MonthFragmentTest fragment = new MonthFragmentTest();

    // Save the parameters
    Bundle bundle = new Bundle();
    bundle.putInt(BACKGROUND_COLOR, color);
    bundle.putInt(INDEX, index);
    fragment.setArguments(bundle);
    fragment.setRetainInstance(true);

    return fragment;

  }

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

    // Load parameters when the initial creation of the fragment is done
    this.color = (getArguments() != null) ? getArguments().getInt(
        BACKGROUND_COLOR) : Color.GRAY;
    this.index = (getArguments() != null) ? getArguments().getInt(INDEX)
        : -1;

  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {

    ViewGroup rootView = (ViewGroup) inflater.inflate(es.daconstenla.infinip.R.layout.fragment_text, container, false);

    // Show the current page index in the view
    TextView tvIndex = (TextView) rootView.findViewById(es.daconstenla.infinip.R.id.tvIndex);
    tvIndex.setText(String.valueOf(this.index));

    // Change the background color
    rootView.setBackgroundColor(this.color);

    return rootView;

  }
}




Java Source Code List

com.example.databasetest.FullscreenActivity.java
com.example.databasetest.util.SystemUiHiderBase.java
com.example.databasetest.util.SystemUiHiderHoneycomb.java
com.example.databasetest.util.SystemUiHider.java
com.example.datatest.MainActivity.java
com.example.datatest.database.InfinitepHelper.java
com.example.datatest.database.MovementRaw.java
com.example.datatest.database.MovementSummary.java
com.example.datatest.database.TableMovementRaw.java
com.example.datatest.database.TableMovementSummary.java
com.example.datatest.databaseTest.DatabaseTester.java
com.example.datatest.util.Utils.java
es.daconstenla.infinip.activity.CalendarActivity.java
es.daconstenla.infinip.activity.DayActivity.java
es.daconstenla.infinip.activity.MainActivity.java
es.daconstenla.infinip.activity.RangeActivity.java
es.daconstenla.infinip.activity.SettingsActivity.java
es.daconstenla.infinip.activity.SplashActivity.java
es.daconstenla.infinip.activity.SyncActivity.java
es.daconstenla.infinip.customcomponents.HorizontalGraph.java
es.daconstenla.infinip.customcomponents.InformationBox.java
es.daconstenla.infinip.customcomponents.MonthFragmentTest.java
es.daconstenla.infinip.customcomponents.MonthFragment.java
es.daconstenla.infinip.customcomponents.MonthView.java
es.daconstenla.infinip.customcomponents.MyFragmentMonthAdapter.java
es.daconstenla.infinip.customcomponents.events.OnSwipeTouchListener.java
es.daconstenla.infinip.customcomponents.pieces.ElementBackground.java
es.daconstenla.infinip.customcomponents.pieces.HorGraphBar.java
es.daconstenla.infinip.customcomponents.pieces.ItemCalendarDay.java
es.daconstenla.infinip.customcomponents.pieces.data.BarElementData.java
es.daconstenla.infinip.customcomponents.pieces.data.ColorMyCustom.java
es.daconstenla.infinip.customcomponents.pieces.data.CustomScrollView.java
es.daconstenla.infinip.customcomponents.pieces.data.ItemHorizontalBar.java
es.daconstenla.infinip.database.InfinitepHelper.java
es.daconstenla.infinip.database.MovementRaw.java
es.daconstenla.infinip.database.MovementSummary.java
es.daconstenla.infinip.database.TableMovementRaw.java
es.daconstenla.infinip.database.TableMovementSummary.java
es.daconstenla.infinip.database.utils.Utils.java
es.daconstenla.infinip.unused.AutoResizeTextView.java