• 大小: 242KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-09
  • 语言: Java
  • 标签: Android  

资源简介

Android记账源代码

资源截图

代码片段和文件信息

// Copyright 2013 Square Inc.

package com.squareup.timessquare;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import com.squareup.timessquare.MonthCellDescriptor.RangeState;

public class CalendarCellView extends TextView {
  private static final int[] STATE_SELECTABLE = {
      R.attr.state_selectable
  };
  private static final int[] STATE_CURRENT_MONTH = {
      R.attr.state_current_month
  };
  private static final int[] STATE_TODAY = {
      R.attr.state_today
  };
  private static final int[] STATE_HIGHLIGHTED = {
      R.attr.state_highlighted
  };
  private static final int[] STATE_RANGE_FIRST = {
      R.attr.state_range_first
  };
  private static final int[] STATE_RANGE_MIDDLE = {
      R.attr.state_range_middle
  };
  private static final int[] STATE_RANGE_LAST = {
      R.attr.state_range_last
  };

  private boolean isSelectable = false;
  private boolean isCurrentMonth = false;
  private boolean isToday = false;
  private boolean isHighlighted = false;
  private RangeState rangeState = RangeState.NONE;

  @SuppressWarnings(“UnusedDeclaration“)
  public CalendarCellView(Context context AttributeSet attrs) {
    super(context attrs);
  }

  public void setSelectable(boolean isSelectable) {
    this.isSelectable = isSelectable;
    refreshDrawableState();
  }

  public void setCurrentMonth(boolean isCurrentMonth) {
    this.isCurrentMonth = isCurrentMonth;
    refreshDrawableState();
  }

  public void setToday(boolean isToday) {
    this.isToday = isToday;
    refreshDrawableState();
  }

  public void setRangeState(MonthCellDescriptor.RangeState rangeState) {
    this.rangeState = rangeState;
    refreshDrawableState();
  }

  public void setHighlighted(boolean highlighted) {
    isHighlighted = highlighted;
  }

  @Override protected int[] onCreateDrawableState(int extraSpace) {
    final int[] drawableState = super.onCreateDrawableState(extraSpace + 5);

    if (isSelectable) {
      mergeDrawableStates(drawableState STATE_SELECTABLE);
    }

    if (isCurrentMonth) {
      mergeDrawableStates(drawableState STATE_CURRENT_MONTH);
    }

    if (isToday) {
      mergeDrawableStates(drawableState STATE_TODAY);
    }

    if (isHighlighted) {
      mergeDrawableStates(drawableState STATE_HIGHLIGHTED);
    }

    if (rangeState == MonthCellDescriptor.RangeState.FIRST) {
      mergeDrawableStates(drawableState STATE_RANGE_FIRST);
    } else if (rangeState == MonthCellDescriptor.RangeState.MIDDLE) {
      mergeDrawableStates(drawableState STATE_RANGE_MIDDLE);
    } else if (rangeState == RangeState.LAST) {
      mergeDrawableStates(drawableState STATE_RANGE_LAST);
    }

    return drawableState;
  }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......       142  2014-01-28 22:42  20140301086\android-times-square-master\.gitignore

    .......       388  2014-01-28 22:42  20140301086\android-times-square-master\.travis.yml

    .......      1010  2014-01-28 22:42  20140301086\android-times-square-master\CHANGELOG.md

    .......      5074  2014-01-28 22:42  20140301086\android-times-square-master\checkstyle.xml

    .......       737  2014-01-28 22:42  20140301086\android-times-square-master\CONTRIBUTING.md

    .......       292  2014-01-28 22:42  20140301086\android-times-square-master\library\AndroidManifest.xml

    .......      2591  2014-01-28 22:42  20140301086\android-times-square-master\library\pom.xml

    .......       382  2014-01-28 22:42  20140301086\android-times-square-master\library\project.properties

    .......       699  2014-01-28 22:42  20140301086\android-times-square-master\library\res\color\calendar_text_selector.xml

    .......       951  2014-01-28 22:42  20140301086\android-times-square-master\library\res\drawable\calendar_bg_selector.xml

    .......      2555  2014-01-28 22:42  20140301086\android-times-square-master\library\res\layout\month.xml

    .......      1577  2014-01-28 22:42  20140301086\android-times-square-master\library\res\layout\week.xml

    .......       510  2014-01-28 22:42  20140301086\android-times-square-master\library\res\values\attrs.xml

    .......       689  2014-01-28 22:42  20140301086\android-times-square-master\library\res\values\colors.xml

    .......       340  2014-01-28 22:42  20140301086\android-times-square-master\library\res\values\dimens.xml

    .......       277  2014-01-28 22:42  20140301086\android-times-square-master\library\res\values\strings.xml

    .......      1083  2014-01-28 22:42  20140301086\android-times-square-master\library\res\values\styles.xml

    .......       156  2014-01-28 22:42  20140301086\android-times-square-master\library\res\values-v9\strings.xml

    .......      2723  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\CalendarCellView.java

    .......      4326  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\CalendarGridView.java

    .......     28675  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\CalendarPickerView.java

    .......      2761  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\CalendarRowView.java

    .......       406  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\Logr.java

    .......      2102  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\MonthCellDescriptor.java

    .......       859  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\MonthDescriptor.java

    .......      3112  2014-01-28 22:42  20140301086\android-times-square-master\library\src\com\squareup\timessquare\MonthView.java

    .......     23653  2014-01-28 22:42  20140301086\android-times-square-master\library\test\com\squareup\timessquare\CalendarPickerViewTest.java

    .......     11358  2014-01-28 22:42  20140301086\android-times-square-master\LICENSE.txt

    .......      4686  2014-01-28 22:42  20140301086\android-times-square-master\pom.xml

    .......      2566  2014-01-28 22:42  20140301086\android-times-square-master\README.md

............此处省略55个文件信息

评论

共有 条评论