Tabnine Logo
DayItem
Code IndexAdd Tabnine to your IDE (free)

How to use
DayItem
in
jsc.kit.component.monthview

Best Java code snippets using jsc.kit.component.monthview.DayItem (Showing top 6 results out of 315)

origin: JustinRoom/JSCKit

public DayItem() {
  setBackground(-1);
  setLabelTextColor(0xFF333333);
  setLabelTextSize(14);
  setSubLabelTextColor(0xFF333333);
  setSubLabelTextSize(8);
}
origin: JustinRoom/JSCKit

  public void notifyDataChanged() {
    if (dayItem == null)
      return;

    if (dayItem.getBackground() != -1)
      setBackgroundResource(dayItem.getBackground());

    tvLabel.setTextColor(dayItem.getLabelTextColor());
    tvLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, dayItem.getLabelTextSize());
    tvLabel.setText(TextUtils.isEmpty(dayItem.getLabel()) ? "" : dayItem.getLabel());

    tvSubLabel.setTextColor(dayItem.getSubLabelTextColor());
    tvSubLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, dayItem.getSubLabelTextSize());
    tvSubLabel.setText(TextUtils.isEmpty(dayItem.getSubLabel()) ? "" : dayItem.getSubLabel());
  }
}
origin: JustinRoom/JSCKit

/**
 * 添加上个月的最后几天
 *
 * @param dayItems
 */
private static void addNextMonthDays(List<DayItem> dayItems, int count) {
  if (count == 0)
    return;
  DayItem lastItem = dayItems.get(dayItems.size() - 1);
  Calendar calendar = Calendar.getInstance();
  calendar.setTimeInMillis(lastItem.getDate());
  for (int i = 0; i < count; i++) {
    calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + 1);
    DayItem item = new DayItem();
    item.setKey(1);
    item.setDate(calendar.getTimeInMillis());
    item.setLabel(String.valueOf(calendar.get(Calendar.DAY_OF_MONTH)));
    dayItems.add(item);
  }
}
origin: JustinRoom/JSCKit

private void initMonthView(int year, int month){
  List<DayItem> dayItems = MonthUtils.getMonthDays(year, month);
  for (int i = 0; i < dayItems.size(); i++) {
    boolean enable = new Random().nextBoolean();
    DayItem item = dayItems.get(i);
    switch (item.getKey()){
      case -1://上个月的最后几天
      case 1://下个月的前几天
        item.setBackground(R.drawable.circle_gray_light_shape);
        break;
      case 0://本月的所有天数
        item.setBackground(R.drawable.circle_theme_light_shape);
        break;
    }
    item.setSubLabel(enable ? "可约" : "不可约");
    item.setSubLabelTextColor(enable ? Color.YELLOW : 0xFF666666);
  }
  monthView.setDays(dayItems);
}
origin: JustinRoom/JSCKit

/**
 * 添加上个月的最后几天
 *
 * @param dayItems
 */
private static void addPreMonthDays(List<DayItem> dayItems) {
  DayItem firstItem = dayItems.get(0);
  Calendar calendar = Calendar.getInstance();
  calendar.setTimeInMillis(firstItem.getDate());
  int weekDay = calendar.get(Calendar.DAY_OF_WEEK);
  if (weekDay > Calendar.SUNDAY) {
    calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 1);
    DayItem item = new DayItem();
    item.setKey(-1);
    item.setDate(calendar.getTimeInMillis());
    item.setLabel(String.valueOf(calendar.get(Calendar.DAY_OF_MONTH)));
    dayItems.add(0, item);
    addPreMonthDays(dayItems);
  }
}
origin: JustinRoom/JSCKit

/**
 * 添加本月所有天数
 *
 * @param dayItems
 */
private static void addCurrentMonthDays(List<DayItem> dayItems, int year, int month) {
  Calendar calendar = Calendar.getInstance();
  calendar.set(Calendar.YEAR, year);
  calendar.set(Calendar.MONTH, month - 1);
  calendar.set(Calendar.HOUR_OF_DAY, 0);
  calendar.set(Calendar.MINUTE, 0);
  calendar.set(Calendar.SECOND, 0);
  calendar.set(Calendar.MILLISECOND, 0);
  int curMonthDayCount = getMonthDayCount(calendar);
  for (int i = 0; i < curMonthDayCount; i++) {
    calendar.set(Calendar.DAY_OF_MONTH, i + 1);
    DayItem item = new DayItem();
    item.setKey(0);
    item.setDate(calendar.getTimeInMillis());
    item.setLabel(String.valueOf(calendar.get(Calendar.DAY_OF_MONTH)));
    dayItems.add(item);
  }
}
jsc.kit.component.monthviewDayItem

Javadoc


Email:1006368252@qq.com
QQ:1006368252
https://github.com/JustinRoom/JSCKit

Most used methods

  • setBackground
  • setSubLabelTextColor
  • <init>
  • getBackground
  • getDate
  • getKey
  • getLabel
  • getLabelTextColor
  • getLabelTextSize
  • getSubLabel
  • getSubLabelTextColor
  • getSubLabelTextSize
  • getSubLabelTextColor,
  • getSubLabelTextSize,
  • setDate,
  • setKey,
  • setLabel,
  • setLabelTextColor,
  • setLabelTextSize,
  • setSubLabel,
  • setSubLabelTextSize

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • BoxLayout (javax.swing)
  • JComboBox (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now