Android Open Source - HijriCalendar-master Date Grid Fragment






From Project

Back to project page HijriCalendar-master.

License

The source code is released under:

MIT License

If you think the Android project HijriCalendar-master 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 com.sahaab.hijri.caldroid;
//from  w  ww. j  a  va 2 s  . c o m
import com.sahaab.hijrical.R;

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.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.GridView;

/**
 * DateGridFragment contains only 1 gridview with 7 columns to display all the
 * dates within a month.
 * 
 * Client must supply gridAdapter and onItemClickListener before the fragment is
 * attached to avoid complex crash due to fragment life cycles.
 * 
 * @author thomasdao
 * 
 */
public class DateGridFragment extends Fragment {
  private GridView gridView;
  private CaldroidGridAdapter gridAdapter;
  private OnItemClickListener onItemClickListener;
  private OnItemLongClickListener onItemLongClickListener;

  public OnItemClickListener getOnItemClickListener() {
    return onItemClickListener;
  }

  public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
    this.onItemClickListener = onItemClickListener;
  }
  
  public OnItemLongClickListener getOnItemLongClickListener() {
    return onItemLongClickListener;
  }
  
  public void setOnItemLongClickListener(OnItemLongClickListener onItemLongClickListener) {
    this.onItemLongClickListener = onItemLongClickListener;
  }

  public CaldroidGridAdapter getGridAdapter() {
    return gridAdapter;
  }

  public void setGridAdapter(CaldroidGridAdapter gridAdapter) {
    this.gridAdapter = gridAdapter;
  }

  public GridView getGridView() {
    return gridView;
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    gridView = (GridView) inflater.inflate(R.layout.date_grid_fragment,
        container, false);
    // Client normally needs to provide the adapter and onItemClickListener
    // before the fragment is attached to avoid complex crash due to
    // fragment life cycles
    if (gridAdapter != null) {
      gridView.setAdapter(gridAdapter);
    }

    if (onItemClickListener != null) {
      gridView.setOnItemClickListener(onItemClickListener);
    }
    if(onItemLongClickListener != null) {
      gridView.setOnItemLongClickListener(onItemLongClickListener);
    }
    return gridView;
  }

}




Java Source Code List

com.antonyt.infiniteviewpager.InfinitePagerAdapter.java
com.antonyt.infiniteviewpager.InfiniteViewPager.java
com.caldroidsample.CaldroidSampleActivity.java
com.caldroidsample.CaldroidSampleCustomAdapter.java
com.caldroidsample.CaldroidSampleCustomFragment.java
com.sahaab.hijri.caldroid.CaldroidFragment.java
com.sahaab.hijri.caldroid.CaldroidGridAdapter.java
com.sahaab.hijri.caldroid.CaldroidListener.java
com.sahaab.hijri.caldroid.CalendarHelper.java
com.sahaab.hijri.caldroid.DateGridFragment.java
com.sahaab.hijri.caldroid.MonthPagerAdapter.java
com.sahaab.hijri.caldroid.SquareTextView.java
com.sahaab.hijri.caldroid.WeekdayArrayAdapter.java
com.sahaab.hijricalendar.HijriCalendarDate.java