Android Open Source - HijriCalendar-master Weekday Array Adapter






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  www.  j a  v  a2 s  . c  om*/
import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

/**
 * Customize the weekday gridview
 */
public class WeekdayArrayAdapter extends ArrayAdapter<String> {
  public static int textColor = Color.LTGRAY;

  public WeekdayArrayAdapter(Context context, int textViewResourceId,
      List<String> objects) {
    super(context, textViewResourceId, objects);
  }

  // To prevent cell highlighted when clicked
  @Override
  public boolean areAllItemsEnabled() {
    return false;
  }

  @Override
  public boolean isEnabled(int position) {
    return false;
  }

  // Set color to gray and text size to 12sp
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // To customize text size and color
    TextView textView = (TextView) super.getView(position, convertView,
        parent);

    // Set content
    String item = getItem(position);

    // Show smaller text if the size of the text is 4 or more in some
    // locale
    if (item.length() <= 3) {
      textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
    } else {
      textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11);
    }

    textView.setTextColor(textColor);
    textView.setGravity(Gravity.CENTER);
    return textView;
  }

}




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