spans = new LinkedList<>();
20 | private boolean daysDisabled = false;
21 |
22 | DayViewFacade() {
23 | isDecorated = false;
24 | }
25 |
26 | /**
27 | * Set a drawable to draw behind everything else
28 | *
29 | * @param drawable Drawable to draw behind everything
30 | */
31 | public void setBackgroundDrawable(@NonNull Drawable drawable) {
32 | if (drawable == null) {
33 | throw new IllegalArgumentException("Cannot be null");
34 | }
35 | this.backgroundDrawable = drawable;
36 | isDecorated = true;
37 | }
38 |
39 | /**
40 | * Set a custom selection drawable
41 | * TODO: define states that can/should be used in StateListDrawables
42 | *
43 | * @param drawable the drawable for selection
44 | */
45 | public void setSelectionDrawable(@NonNull Drawable drawable) {
46 | if (drawable == null) {
47 | throw new IllegalArgumentException("Cannot be null");
48 | }
49 | selectionDrawable = drawable;
50 | isDecorated = true;
51 | }
52 |
53 | /**
54 | * Add a span to the entire text of a day
55 | *
56 | * @param span text span instance
57 | */
58 | public void addSpan(@NonNull Object span) {
59 | if (spans != null) {
60 | this.spans.add(new Span(span));
61 | isDecorated = true;
62 | }
63 | }
64 |
65 | /**
66 | * Set days to be in a disabled state, or re-enabled.
67 | * Note, passing true here will not override minimum and maximum dates, if set.
68 | * This will only re-enable disabled dates.
69 | *
70 | * @param daysDisabled true to disable days, false to re-enable days
71 | */
72 | public void setDaysDisabled(boolean daysDisabled) {
73 | this.daysDisabled = daysDisabled;
74 | this.isDecorated = true;
75 | }
76 |
77 | void reset() {
78 | backgroundDrawable = null;
79 | selectionDrawable = null;
80 | spans.clear();
81 | isDecorated = false;
82 | daysDisabled = false;
83 | }
84 |
85 | /**
86 | * Apply things set this to other
87 | *
88 | * @param other facade to apply our data to
89 | */
90 | void applyTo(DayViewFacade other) {
91 | if (selectionDrawable != null) {
92 | other.setSelectionDrawable(selectionDrawable);
93 | }
94 | if (backgroundDrawable != null) {
95 | other.setBackgroundDrawable(backgroundDrawable);
96 | }
97 | other.spans.addAll(spans);
98 | other.isDecorated |= this.isDecorated;
99 | other.daysDisabled = daysDisabled;
100 | }
101 |
102 | boolean isDecorated() {
103 | return isDecorated;
104 | }
105 |
106 | Drawable getSelectionDrawable() {
107 | return selectionDrawable;
108 | }
109 |
110 | Drawable getBackgroundDrawable() {
111 | return backgroundDrawable;
112 | }
113 |
114 | List getSpans() {
115 | return Collections.unmodifiableList(spans);
116 | }
117 |
118 | /**
119 | * Are days from this facade disabled
120 | *
121 | * @return true if disabled, false if not re-enabled
122 | */
123 | public boolean areDaysDisabled() {
124 | return daysDisabled;
125 | }
126 |
127 | static class Span {
128 |
129 | final Object span;
130 |
131 | public Span(Object span) {
132 | this.span = span;
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/DecoratorResult.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | class DecoratorResult {
4 | public final DayViewDecorator decorator;
5 | public final DayViewFacade result;
6 |
7 | DecoratorResult(DayViewDecorator decorator, DayViewFacade result) {
8 | this.decorator = decorator;
9 | this.result = result;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/DirectionButton.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.content.Context;
4 | import android.graphics.PorterDuff;
5 | import android.os.Build;
6 | import android.util.TypedValue;
7 | import android.widget.ImageView;
8 |
9 | /**
10 | * An {@linkplain ImageView} to pragmatically set the color of arrows
11 | * using a {@linkplain android.graphics.ColorFilter}
12 | */
13 | class DirectionButton extends ImageView {
14 |
15 | public DirectionButton(Context context) {
16 | super(context);
17 |
18 | setBackgroundResource(getThemeSelectableBackgroundId(context));
19 | }
20 |
21 | public void setColor(int color) {
22 | setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
23 | }
24 |
25 | @Override
26 | public void setEnabled(boolean enabled) {
27 | super.setEnabled(enabled);
28 | setAlpha(enabled ? 1f : 0.1f);
29 | }
30 |
31 | private static int getThemeSelectableBackgroundId(Context context) {
32 | //Get selectableItemBackgroundBorderless defined for AppCompat
33 | int colorAttr = context.getResources().getIdentifier(
34 | "selectableItemBackgroundBorderless", "attr", context.getPackageName());
35 |
36 | if (colorAttr == 0) {
37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
38 | colorAttr = android.R.attr.selectableItemBackgroundBorderless;
39 | } else {
40 | colorAttr = android.R.attr.selectableItemBackground;
41 | }
42 | }
43 |
44 | TypedValue outValue = new TypedValue();
45 | context.getTheme().resolveAttribute(colorAttr, outValue, true);
46 | return outValue.resourceId;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/Experimental.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | /*
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Inspired from https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/annotations/Beta.java
17 | */
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Signifies that a public API (public class, method or field) is will almost certainly
27 | * be changed or removed in a future release. An API bearing this annotation should not
28 | * be used or relied upon in production code. APIs exposed with this annotation exist
29 | * to allow broad testing and feedback on experimental features.
30 | **/
31 | @Retention(RetentionPolicy.CLASS)
32 | @Target({
33 | ElementType.ANNOTATION_TYPE,
34 | ElementType.CONSTRUCTOR,
35 | ElementType.FIELD,
36 | ElementType.METHOD,
37 | ElementType.TYPE})
38 | @Documented
39 | @Experimental
40 | public @interface Experimental {
41 | }
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/MonthPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v4.util.SparseArrayCompat;
5 |
6 | /**
7 | * Pager adapter backing the calendar view
8 | */
9 | class MonthPagerAdapter extends CalendarPagerAdapter {
10 |
11 | MonthPagerAdapter(MaterialCalendarView mcv) {
12 | super(mcv);
13 | }
14 |
15 | @Override
16 | protected MonthView createView(int position) {
17 | return new MonthView(mcv, getItem(position), mcv.getFirstDayOfWeek());
18 | }
19 |
20 | @Override
21 | protected int indexOf(MonthView view) {
22 | CalendarDay month = view.getMonth();
23 | return getRangeIndex().indexOf(month);
24 | }
25 |
26 | @Override
27 | protected boolean isInstanceOfView(Object object) {
28 | return object instanceof MonthView;
29 | }
30 |
31 | @Override
32 | protected DateRangeIndex createRangeIndex(CalendarDay min, CalendarDay max) {
33 | return new Monthly(min, max);
34 | }
35 |
36 | public static class Monthly implements DateRangeIndex {
37 |
38 | private final CalendarDay min;
39 | private final int count;
40 |
41 | private SparseArrayCompat dayCache = new SparseArrayCompat<>();
42 |
43 | public Monthly(@NonNull CalendarDay min, @NonNull CalendarDay max) {
44 | this.min = CalendarDay.from(min.getYear(), min.getMonth(), 1);
45 | max = CalendarDay.from(max.getYear(), max.getMonth(), 1);
46 | this.count = indexOf(max) + 1;
47 | }
48 |
49 | public int getCount() {
50 | return count;
51 | }
52 |
53 | public int indexOf(CalendarDay day) {
54 | int yDiff = day.getYear() - min.getYear();
55 | int mDiff = day.getMonth() - min.getMonth();
56 |
57 | return (yDiff * 12) + mDiff;
58 | }
59 |
60 | public CalendarDay getItem(int position) {
61 |
62 | CalendarDay re = dayCache.get(position);
63 | if (re != null) {
64 | return re;
65 | }
66 |
67 | int numY = position / 12;
68 | int numM = position % 12;
69 |
70 | int year = min.getYear() + numY;
71 | int month = min.getMonth() + numM;
72 | if (month >= 12) {
73 | year += 1;
74 | month -= 12;
75 | }
76 |
77 | re = CalendarDay.from(year, month, 1);
78 | dayCache.put(position, re);
79 | return re;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/MonthView.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.support.annotation.NonNull;
5 |
6 | import java.util.Calendar;
7 | import java.util.Collection;
8 |
9 | /**
10 | * Display a month of {@linkplain DayView}s and seven {@linkplain WeekDayView}s.
11 | */
12 | @SuppressLint("ViewConstructor")
13 | class MonthView extends CalendarPagerView {
14 |
15 | public MonthView(@NonNull MaterialCalendarView view, CalendarDay month, int firstDayOfWeek) {
16 | super(view, month, firstDayOfWeek);
17 | }
18 |
19 | @Override
20 | protected void buildDayViews(Collection dayViews, Calendar calendar) {
21 | for (int r = 0; r < DEFAULT_MAX_WEEKS; r++) {
22 | for (int i = 0; i < DEFAULT_DAYS_IN_WEEK; i++) {
23 | addDayView(dayViews, calendar);
24 | }
25 | }
26 | }
27 |
28 | public CalendarDay getMonth() {
29 | return getFirstViewDay();
30 | }
31 |
32 | @Override
33 | protected boolean isDayEnabled(CalendarDay day) {
34 | return day.getMonth() == getFirstViewDay().getMonth();
35 | }
36 |
37 | @Override
38 | protected int getRows() {
39 | return DEFAULT_MAX_WEEKS + DAY_NAMES_ROW;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/OnDateSelectedListener.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | /**
6 | * The callback used to indicate a date has been selected or deselected
7 | */
8 | public interface OnDateSelectedListener {
9 |
10 | /**
11 | * Called when a user clicks on a day.
12 | * There is no logic to prevent multiple calls for the same date and state.
13 | *
14 | * @param widget the view associated with this listener
15 | * @param date the date that was selected or unselected
16 | * @param selected true if the day is now selected, false otherwise
17 | */
18 | void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean
19 | selected);
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/OnMonthChangedListener.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | /**
4 | * The callback used to indicate the user changes the displayed month
5 | */
6 | public interface OnMonthChangedListener {
7 |
8 | /**
9 | * Called upon change of the selected day
10 | *
11 | * @param widget the view associated with this listener
12 | * @param date the month picked, as the first day of the month
13 | */
14 | void onMonthChanged(MaterialCalendarView widget, CalendarDay date);
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/OnRangeSelectedListener.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * The callback used to indicate a range has been selected
9 | */
10 | public interface OnRangeSelectedListener {
11 |
12 | /**
13 | * Called when a user selects a range of days.
14 | * There is no logic to prevent multiple calls for the same date and state.
15 | *
16 | * @param widget the view associated with this listener
17 | * @param dates the dates in the range, in ascending order
18 | */
19 | void onRangeSelected(@NonNull MaterialCalendarView widget, @NonNull List dates);
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/TitleChanger.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.animation.Animator;
4 | import android.content.res.Resources;
5 | import android.text.TextUtils;
6 | import android.util.Log;
7 | import android.util.TypedValue;
8 | import android.view.ViewPropertyAnimator;
9 | import android.view.animation.DecelerateInterpolator;
10 | import android.view.animation.Interpolator;
11 | import android.widget.TextView;
12 |
13 | import com.benmu.widget.view.calendar.format.TitleFormatter;
14 |
15 | class TitleChanger {
16 |
17 | public static final int DEFAULT_ANIMATION_DELAY = 400;
18 | public static final int DEFAULT_Y_TRANSLATION_DP = 20;
19 |
20 | private final TextView title;
21 | private TitleFormatter titleFormatter;
22 |
23 | private final int animDelay;
24 | private final int animDuration;
25 | private final int translate;
26 | private final Interpolator interpolator = new DecelerateInterpolator(2f);
27 |
28 | private int orientation = MaterialCalendarView.VERTICAL;
29 |
30 | private long lastAnimTime = 0;
31 | private CalendarDay previousMonth = null;
32 |
33 | public TitleChanger(TextView title) {
34 | this.title = title;
35 |
36 | Resources res = title.getResources();
37 |
38 | animDelay = DEFAULT_ANIMATION_DELAY;
39 |
40 | animDuration = res.getInteger(android.R.integer.config_shortAnimTime) / 2;
41 |
42 | translate = (int) TypedValue.applyDimension(
43 | TypedValue.COMPLEX_UNIT_DIP, DEFAULT_Y_TRANSLATION_DP, res.getDisplayMetrics()
44 | );
45 | }
46 |
47 | public void change(final CalendarDay currentMonth) {
48 | long currentTime = System.currentTimeMillis();
49 |
50 | if (currentMonth == null) {
51 | return;
52 | }
53 |
54 | if (TextUtils.isEmpty(title.getText()) || (currentTime - lastAnimTime) < animDelay) {
55 | doChange(currentTime, currentMonth, false);
56 | }
57 |
58 | if (currentMonth.equals(previousMonth) ||
59 | (currentMonth.getMonth() == previousMonth.getMonth()
60 | && currentMonth.getYear() == previousMonth.getYear())) {
61 | return;
62 | }
63 |
64 | doChange(currentTime, currentMonth, true);
65 | }
66 |
67 | private void doChange(final long now, final CalendarDay currentMonth, boolean animate) {
68 |
69 | title.animate().cancel();
70 | doTranslation(title, 0);
71 |
72 | title.setAlpha(1);
73 | lastAnimTime = now;
74 |
75 | final CharSequence newTitle = titleFormatter.format(currentMonth);
76 | Log.e("title","tilte>>>>>>"+newTitle);
77 | if (!animate) {
78 | title.setText(newTitle);
79 | } else {
80 | final int translation = translate * (previousMonth.isBefore(currentMonth) ? 1 : -1);
81 | final ViewPropertyAnimator viewPropertyAnimator = title.animate();
82 |
83 | if (orientation == MaterialCalendarView.HORIZONTAL) {
84 | viewPropertyAnimator.translationX(translation * -1);
85 | } else {
86 | viewPropertyAnimator.translationY(translation * -1);
87 | }
88 |
89 | viewPropertyAnimator
90 | .alpha(0)
91 | .setDuration(animDuration)
92 | .setInterpolator(interpolator)
93 | .setListener(new AnimatorListener() {
94 |
95 | @Override
96 | public void onAnimationCancel(Animator animator) {
97 | doTranslation(title, 0);
98 | title.setAlpha(1);
99 | }
100 |
101 | @Override
102 | public void onAnimationEnd(Animator animator) {
103 | title.setText(newTitle);
104 | doTranslation(title, translation);
105 |
106 | final ViewPropertyAnimator viewPropertyAnimator = title.animate();
107 | if (orientation == MaterialCalendarView.HORIZONTAL) {
108 | viewPropertyAnimator.translationX(0);
109 | } else {
110 | viewPropertyAnimator.translationY(0);
111 | }
112 |
113 | viewPropertyAnimator
114 | .alpha(1)
115 | .setDuration(animDuration)
116 | .setInterpolator(interpolator)
117 | .setListener(new AnimatorListener())
118 | .start();
119 | }
120 | }).start();
121 | }
122 |
123 | previousMonth = currentMonth;
124 | }
125 |
126 | private void doTranslation(final TextView title, final int translate) {
127 | if (orientation == MaterialCalendarView.HORIZONTAL) {
128 | title.setTranslationX(translate);
129 | } else {
130 | title.setTranslationY(translate);
131 | }
132 | }
133 |
134 | public TitleFormatter getTitleFormatter() {
135 | return titleFormatter;
136 | }
137 |
138 | public void setTitleFormatter(TitleFormatter titleFormatter) {
139 | this.titleFormatter = titleFormatter;
140 | }
141 |
142 | public void setOrientation(int orientation) {
143 | this.orientation = orientation;
144 | }
145 |
146 | public int getOrientation() {
147 | return orientation;
148 | }
149 |
150 | public void setPreviousMonth(CalendarDay previousMonth) {
151 | this.previousMonth = previousMonth;
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/WeekDayView.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.os.Build;
6 | import android.text.TextUtils;
7 | import android.view.Gravity;
8 | import android.widget.TextView;
9 |
10 | import com.benmu.widget.view.calendar.format.WeekDayFormatter;
11 |
12 | import java.util.Calendar;
13 |
14 | /**
15 | * Display a day of the week
16 | */
17 | @Experimental
18 | @SuppressLint("ViewConstructor")
19 | class WeekDayView extends TextView {
20 |
21 | private WeekDayFormatter formatter = WeekDayFormatter.DEFAULT;
22 | private int dayOfWeek;
23 |
24 | public WeekDayView(Context context, int dayOfWeek) {
25 | super(context);
26 |
27 | setGravity(Gravity.CENTER);
28 |
29 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
30 | setTextAlignment(TEXT_ALIGNMENT_CENTER);
31 | }
32 |
33 | setDayOfWeek(dayOfWeek);
34 | }
35 |
36 | public void setWeekDayFormatter(WeekDayFormatter formatter) {
37 | this.formatter = formatter == null ? WeekDayFormatter.DEFAULT : formatter;
38 | setDayOfWeek(dayOfWeek);
39 | }
40 |
41 | public void setDayOfWeek(int dayOfWeek) {
42 | this.dayOfWeek = dayOfWeek;
43 | CharSequence week = formatter.format(dayOfWeek);
44 | if (!TextUtils.isEmpty(week) && week.length() > 1)
45 | setText(week.subSequence(0, 1));
46 | }
47 |
48 | public void setDayOfWeek(Calendar calendar) {
49 | setDayOfWeek(CalendarUtils.getDayOfWeek(calendar));
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/WeekPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import java.util.Calendar;
6 | import java.util.Date;
7 | import java.util.concurrent.TimeUnit;
8 |
9 | @Experimental
10 | public class WeekPagerAdapter extends CalendarPagerAdapter {
11 |
12 | public WeekPagerAdapter(MaterialCalendarView mcv) {
13 | super(mcv);
14 | }
15 |
16 | @Override
17 | protected WeekView createView(int position) {
18 | return new WeekView(mcv, getItem(position), mcv.getFirstDayOfWeek());
19 | }
20 |
21 | @Override
22 | protected int indexOf(WeekView view) {
23 | CalendarDay week = view.getFirstViewDay();
24 | return getRangeIndex().indexOf(week);
25 | }
26 |
27 | @Override
28 | protected boolean isInstanceOfView(Object object) {
29 | return object instanceof WeekView;
30 | }
31 |
32 | @Override
33 | protected DateRangeIndex createRangeIndex(CalendarDay min, CalendarDay max) {
34 | return new Weekly(min, max, mcv.getFirstDayOfWeek());
35 | }
36 |
37 | public static class Weekly implements DateRangeIndex {
38 |
39 | private static final int DAYS_IN_WEEK = 7;
40 | private final CalendarDay min;
41 | private final int count;
42 |
43 | public Weekly(@NonNull CalendarDay min, @NonNull CalendarDay max, int firstDayOfWeek) {
44 | this.min = getFirstDayOfWeek(min, firstDayOfWeek);
45 | this.count = weekNumberDifference(this.min, max) + 1;
46 | }
47 |
48 | @Override
49 | public int getCount() {
50 | return count;
51 | }
52 |
53 | @Override
54 | public int indexOf(CalendarDay day) {
55 | return weekNumberDifference(min, day);
56 | }
57 |
58 | @Override
59 | public CalendarDay getItem(int position) {
60 | long minMillis = min.getDate().getTime();
61 | long millisOffset = TimeUnit.MILLISECONDS.convert(
62 | position * DAYS_IN_WEEK,
63 | TimeUnit.DAYS);
64 | long positionMillis = minMillis + millisOffset;
65 | return CalendarDay.from(new Date(positionMillis));
66 | }
67 |
68 | private int weekNumberDifference(@NonNull CalendarDay min, @NonNull CalendarDay max) {
69 | long millisDiff = max.getDate().getTime() - min.getDate().getTime();
70 |
71 | int dstOffsetMax = max.getCalendar().get(Calendar.DST_OFFSET);
72 | int dstOffsetMin = min.getCalendar().get(Calendar.DST_OFFSET);
73 |
74 | long dayDiff = TimeUnit.DAYS.convert(millisDiff + dstOffsetMax - dstOffsetMin,
75 | TimeUnit.MILLISECONDS);
76 | return (int) (dayDiff / DAYS_IN_WEEK);
77 | }
78 |
79 | /*
80 | * Necessary because of how Calendar handles getting the first day of week internally.
81 | */
82 | private CalendarDay getFirstDayOfWeek(@NonNull CalendarDay min, int wantedFirstDayOfWeek) {
83 | Calendar calendar = Calendar.getInstance();
84 | min.copyTo(calendar);
85 | while (calendar.get(Calendar.DAY_OF_WEEK) != wantedFirstDayOfWeek) {
86 | calendar.add(Calendar.DAY_OF_WEEK, -1);
87 | }
88 | return CalendarDay.from(calendar);
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/WeekView.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.support.annotation.NonNull;
5 |
6 | import java.util.Calendar;
7 | import java.util.Collection;
8 |
9 | /**
10 | * Display a week of {@linkplain DayView}s and
11 | * seven {@linkplain WeekDayView}s.
12 | */
13 | @Experimental
14 | @SuppressLint("ViewConstructor")
15 | public class WeekView extends CalendarPagerView {
16 |
17 | public WeekView(@NonNull MaterialCalendarView view,
18 | CalendarDay firstViewDay,
19 | int firstDayOfWeek) {
20 | super(view, firstViewDay, firstDayOfWeek);
21 | }
22 |
23 | @Override
24 | protected void buildDayViews(Collection dayViews, Calendar calendar) {
25 | for (int i = 0; i < DEFAULT_DAYS_IN_WEEK; i++) {
26 | addDayView(dayViews, calendar);
27 | }
28 | }
29 |
30 | @Override
31 | protected boolean isDayEnabled(CalendarDay day) {
32 | return true;
33 | }
34 |
35 | @Override
36 | protected int getRows() {
37 | return DAY_NAMES_ROW + 1;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/ArrayWeekDayFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 | /**
4 | * Use an array to supply week day labels
5 | */
6 | public class ArrayWeekDayFormatter implements WeekDayFormatter {
7 |
8 | private final CharSequence[] weekDayLabels;
9 |
10 | /**
11 | * @param weekDayLabels an array of 7 labels, starting with Sunday
12 | */
13 | public ArrayWeekDayFormatter(CharSequence[] weekDayLabels) {
14 | if (weekDayLabels == null) {
15 | throw new IllegalArgumentException("Cannot be null");
16 | }
17 | if (weekDayLabels.length != 7) {
18 | throw new IllegalArgumentException("Array must contain exactly 7 elements");
19 | }
20 | this.weekDayLabels = weekDayLabels;
21 | }
22 |
23 | /**
24 | * {@inheritDoc}
25 | */
26 | @Override
27 | public CharSequence format(int dayOfWeek) {
28 | return weekDayLabels[dayOfWeek - 1];
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/CalendarWeekDayFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 | import com.benmu.widget.view.calendar.CalendarUtils;
4 |
5 | import java.util.Calendar;
6 | import java.util.Locale;
7 |
8 | /**
9 | * Use a {@linkplain Calendar} to get week day labels.
10 | *
11 | * @see Calendar#getDisplayName(int, int, Locale)
12 | */
13 | public class CalendarWeekDayFormatter implements WeekDayFormatter {
14 |
15 | private final Calendar calendar;
16 |
17 | /**
18 | * Format with a specific calendar
19 | *
20 | * @param calendar Calendar to retrieve formatting information from
21 | */
22 | public CalendarWeekDayFormatter(Calendar calendar) {
23 | // recompute all fields of the calendar based on current date
24 | // See "Getting and Setting Calendar Field Values"
25 | // in https://developer.android.com/reference/java/util/Calendar.html
26 | calendar.get(Calendar.DAY_OF_WEEK); // Any fields to get is OK to recompute all fields in the calendar.
27 | this.calendar = calendar;
28 |
29 | }
30 |
31 | /**
32 | * Format with a default calendar
33 | */
34 | public CalendarWeekDayFormatter() {
35 | this(CalendarUtils.getInstance());
36 | }
37 |
38 | /**
39 | * {@inheritDoc}
40 | */
41 | @Override
42 | public CharSequence format(int dayOfWeek) {
43 | calendar.set(Calendar.DAY_OF_WEEK, dayOfWeek);
44 | return calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.ENGLISH);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/DateFormatDayFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import com.benmu.widget.view.calendar.CalendarDay;
6 |
7 | import java.text.DateFormat;
8 | import java.text.SimpleDateFormat;
9 | import java.util.Locale;
10 |
11 | /**
12 | * Format using a {@linkplain DateFormat} instance.
13 | */
14 | public class DateFormatDayFormatter implements DayFormatter {
15 |
16 | private final DateFormat dateFormat;
17 |
18 | /**
19 | * Format using a default format
20 | */
21 | public DateFormatDayFormatter() {
22 | this.dateFormat = new SimpleDateFormat("d", Locale.getDefault());
23 | }
24 |
25 | /**
26 | * Format using a specific {@linkplain DateFormat}
27 | *
28 | * @param format the format to use
29 | */
30 | public DateFormatDayFormatter(@NonNull DateFormat format) {
31 | this.dateFormat = format;
32 | }
33 |
34 | /**
35 | * {@inheritDoc}
36 | */
37 | @Override
38 | @NonNull
39 | public String format(@NonNull CalendarDay day) {
40 | return dateFormat.format(day.getDate());
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/DateFormatTitleFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 | import com.benmu.widget.view.calendar.CalendarDay;
4 |
5 | import java.text.DateFormat;
6 | import java.text.SimpleDateFormat;
7 | import java.util.Locale;
8 |
9 | /**
10 | * Format using a {@linkplain DateFormat} instance.
11 | */
12 | public class DateFormatTitleFormatter implements TitleFormatter {
13 |
14 | private final DateFormat dateFormat;
15 |
16 | /**
17 | * Format using "LLLL yyyy" for formatting
18 | */
19 | public DateFormatTitleFormatter() {
20 | this.dateFormat = new SimpleDateFormat(
21 | "yyyy年MM月", Locale.getDefault()
22 | );
23 | }
24 |
25 | /**
26 | * Format using a specified {@linkplain DateFormat}
27 | *
28 | * @param format the format to use
29 | */
30 | public DateFormatTitleFormatter(DateFormat format) {
31 | this.dateFormat = format;
32 | }
33 |
34 | /**
35 | * {@inheritDoc}
36 | */
37 | @Override
38 | public CharSequence format(CalendarDay day) {
39 | return dateFormat.format(day.getDate());
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/DayFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 |
6 | import com.benmu.widget.view.calendar.CalendarDay;
7 |
8 | import java.text.SimpleDateFormat;
9 |
10 | /**
11 | * Supply labels for a given day. Default implementation is to format using a {@linkplain SimpleDateFormat}
12 | */
13 | public interface DayFormatter {
14 |
15 | /**
16 | * Format a given day into a string
17 | *
18 | * @param day the day
19 | * @return a label for the day
20 | */
21 | @NonNull
22 | String format(@NonNull CalendarDay day);
23 |
24 | /**
25 | * Default implementation used by {@linkplain com.prolificinteractive.materialcalendarview.MaterialCalendarView}
26 | */
27 | public static final DayFormatter DEFAULT = new DateFormatDayFormatter();
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/MonthArrayTitleFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 | import android.text.SpannableStringBuilder;
4 |
5 | import com.benmu.widget.view.calendar.CalendarDay;
6 |
7 | /**
8 | * Use an array to generate a month/year label
9 | */
10 | public class MonthArrayTitleFormatter implements TitleFormatter {
11 |
12 | private final CharSequence[] monthLabels;
13 |
14 | /**
15 | * Format using an array of month labels
16 | *
17 | * @param monthLabels an array of 12 labels to use for months, starting with January
18 | */
19 | public MonthArrayTitleFormatter(CharSequence[] monthLabels) {
20 | if (monthLabels == null) {
21 | throw new IllegalArgumentException("Label array cannot be null");
22 | }
23 | if (monthLabels.length < 12) {
24 | throw new IllegalArgumentException("Label array is too short");
25 | }
26 | this.monthLabels = monthLabels;
27 | }
28 |
29 | /**
30 | * {@inheritDoc}
31 | */
32 | @Override
33 | public CharSequence format(CalendarDay day) {
34 | return new SpannableStringBuilder()
35 | .append(monthLabels[day.getMonth()])
36 | .append(" ")
37 | .append(String.valueOf(day.getYear()));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/TitleFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 |
4 | import com.benmu.widget.view.calendar.CalendarDay;
5 |
6 | /**
7 | * Used to format a {@linkplain com.prolificinteractive.materialcalendarview.CalendarDay} to a string for the month/year title
8 | */
9 | public interface TitleFormatter {
10 |
11 | /**
12 | * Converts the supplied day to a suitable month/year title
13 | *
14 | * @param day the day containing relevant month and year information
15 | * @return a label to display for the given month/year
16 | */
17 | CharSequence format(CalendarDay day);
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/format/WeekDayFormatter.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.format;
2 |
3 |
4 | import com.benmu.widget.view.calendar.CalendarUtils;
5 |
6 | /**
7 | * Supply labels for a given day of the week
8 | */
9 | public interface WeekDayFormatter {
10 | /**
11 | * Convert a given day of the week into a label
12 | *
13 | * @param dayOfWeek the day of the week as returned by {@linkplain java.util.Calendar#get(int)} for {@linkplain java.util.Calendar#DAY_OF_YEAR}
14 | * @return a label for the day of week
15 | */
16 | CharSequence format(int dayOfWeek);
17 |
18 | /**
19 | * Default implementation used by {@linkplain com.prolificinteractive.materialcalendarview.MaterialCalendarView}
20 | */
21 | public static final WeekDayFormatter DEFAULT = new CalendarWeekDayFormatter(CalendarUtils.getInstance());
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/calendar/spans/DotSpan.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.calendar.spans;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.text.style.LineBackgroundSpan;
6 |
7 | /**
8 | * Span to draw a dot centered under a section of text
9 | */
10 | public class DotSpan implements LineBackgroundSpan {
11 |
12 | /**
13 | * Default radius used
14 | */
15 | public static final float DEFAULT_RADIUS = 3;
16 |
17 | private final float radius;
18 | private final int color;
19 |
20 | /**
21 | * Create a span to draw a dot using default radius and color
22 | *
23 | * @see #DotSpan(float, int)
24 | * @see #DEFAULT_RADIUS
25 | */
26 | public DotSpan() {
27 | this.radius = DEFAULT_RADIUS;
28 | this.color = 0;
29 | }
30 |
31 | /**
32 | * Create a span to draw a dot using a specified color
33 | *
34 | * @param color color of the dot
35 | * @see #DotSpan(float, int)
36 | * @see #DEFAULT_RADIUS
37 | */
38 | public DotSpan(int color) {
39 | this.radius = DEFAULT_RADIUS;
40 | this.color = color;
41 | }
42 |
43 | /**
44 | * Create a span to draw a dot using a specified radius
45 | *
46 | * @param radius radius for the dot
47 | * @see #DotSpan(float, int)
48 | */
49 | public DotSpan(float radius) {
50 | this.radius = radius;
51 | this.color = 0;
52 | }
53 |
54 | /**
55 | * Create a span to draw a dot using a specified radius and color
56 | *
57 | * @param radius radius for the dot
58 | * @param color color of the dot
59 | */
60 | public DotSpan(float radius, int color) {
61 | this.radius = radius;
62 | this.color = color;
63 | }
64 |
65 | @Override
66 | public void drawBackground(
67 | Canvas canvas, Paint paint,
68 | int left, int right, int top, int baseline, int bottom,
69 | CharSequence charSequence,
70 | int start, int end, int lineNum
71 | ) {
72 | int oldColor = paint.getColor();
73 | if (color != 0) {
74 | paint.setColor(color);
75 | }
76 | canvas.drawCircle((left + right) / 2, bottom + radius, radius, paint);
77 | paint.setColor(oldColor);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/main/java/com/benmu/widget/view/loading/LoadingDialog.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget.view.loading;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.text.TextUtils;
6 | import android.view.Gravity;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.Window;
10 | import android.view.WindowManager;
11 | import android.widget.LinearLayout;
12 | import android.widget.TextView;
13 |
14 | import com.benmu.widget.R;
15 |
16 | /**
17 | * Created by liuyuanxiao on 17/12/13.
18 | */
19 |
20 | public class LoadingDialog {
21 | TextView tipTextView;
22 | Dialog loadingDialog;
23 |
24 | public Dialog createLoadingDialog(Context context, String msg) {
25 | LayoutInflater inflater = LayoutInflater.from(context);
26 | View v = inflater.inflate(R.layout.dialog_progress_layout, null);// 得到加载view
27 | tipTextView = (TextView) v.findViewById(R.id.tvMsg);// 提示文字
28 | tipTextView.setText(msg);// 设置加载信息
29 |
30 | loadingDialog = new Dialog(context, R.style.MyDialogStyle);// 创建自定义样式dialog
31 | loadingDialog.setCancelable(true); // 是否可以按“返回键”消失
32 | loadingDialog.setCanceledOnTouchOutside(false); // 点击加载框以外的区域
33 | loadingDialog.setContentView(v, new LinearLayout.LayoutParams(
34 | LinearLayout.LayoutParams.MATCH_PARENT,
35 | LinearLayout.LayoutParams.MATCH_PARENT));// 设置布局
36 | /**
37 | *将显示Dialog的方法封装在这里面
38 | */
39 | Window window = loadingDialog.getWindow();
40 | WindowManager.LayoutParams lp = window.getAttributes();
41 | lp.width = WindowManager.LayoutParams.MATCH_PARENT;
42 | lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
43 | window.setGravity(Gravity.CENTER);
44 | window.setAttributes(lp);
45 | window.setWindowAnimations(R.style.PopWindowAnimStyle);
46 |
47 | return loadingDialog;
48 | }
49 |
50 | public void setTipText(String msg) {
51 | if (TextUtils.isEmpty(msg)) {
52 | tipTextView.setVisibility(View.GONE);
53 | } else {
54 | tipTextView.setVisibility(View.VISIBLE);
55 | tipTextView.setText(msg);
56 | }
57 | }
58 |
59 | public void show() {
60 | if (loadingDialog.isShowing()) return;
61 | loadingDialog.show();
62 | }
63 |
64 | public void dismiss() {
65 | if (loadingDialog.isShowing()) {
66 | loadingDialog.dismiss();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/res/anim/bottom_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/src/main/res/anim/bottom_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
--------------------------------------------------------------------------------
/src/main/res/anim/dialog_enter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
--------------------------------------------------------------------------------
/src/main/res/anim/dialog_exit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
--------------------------------------------------------------------------------
/src/main/res/anim/svfade_in_center.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/res/anim/svfade_out_center.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/res/anim/svslide_in_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
--------------------------------------------------------------------------------
/src/main/res/anim/svslide_in_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
--------------------------------------------------------------------------------
/src/main/res/anim/svslide_out_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
--------------------------------------------------------------------------------
/src/main/res/anim/svslide_out_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
--------------------------------------------------------------------------------
/src/main/res/color/mcv_text_date_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/res/color/mcv_text_date_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/ic_svstatus_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/ic_svstatus_error.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/ic_svstatus_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/ic_svstatus_info.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/ic_svstatus_loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/ic_svstatus_loading.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/ic_svstatus_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/ic_svstatus_success.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/icon_backnav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/icon_backnav.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/loading_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/loading_icon.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/mcv_action_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/mcv_action_next.png
--------------------------------------------------------------------------------
/src/main/res/drawable-xhdpi/mcv_action_previous.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/BMWidget/ed14aef04e56b24cf51e1d3d89b3964c203ceadb/src/main/res/drawable-xhdpi/mcv_action_previous.png
--------------------------------------------------------------------------------
/src/main/res/drawable/bg_black.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/main/res/drawable/bg_overlay_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/src/main/res/drawable/bg_svprogresshuddefault.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/main/res/drawable/dialog_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/main/res/drawable/floatlayer_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/main/res/drawable/shape_round_rectange.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/main/res/layout/dialog_debug_error_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
18 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/main/res/layout/dialog_progress_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
18 |
25 |
26 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_animloading.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
25 |
26 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_custom_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
19 |
20 |
31 |
32 |
43 |
44 |
45 |
46 |
53 |
54 |
65 |
66 |
67 |
68 |
74 |
75 |
82 |
83 |
96 |
97 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
27 |
28 |
32 |
33 |
34 |
44 |
45 |
52 |
53 |
54 |
55 |
62 |
63 |
68 |
69 |
73 |
74 |
84 |
85 |
89 |
90 |
100 |
101 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_floatlayer.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_grid_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
25 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_grid_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
25 |
26 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_svprogresshud.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/src/main/res/layout/layout_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
21 |
22 |
33 |
34 |
35 |
36 |
41 |
42 |
50 |
51 |
52 |
53 |
54 |
59 |
60 |
69 |
70 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/src/main/res/layout/view_svprogressdefault.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
24 |
25 |
31 |
32 |
40 |
41 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/main/res/values/Integer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 300
4 |
--------------------------------------------------------------------------------
/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #66000000
7 | #f2f2f2
8 | #e6e6e6
9 | #46c4dd
10 | #ffff0c15
11 | #ff333333
12 | #FFdddddd
13 | #b0000000
14 | #e0e0e0
15 | #16d4b8
16 | #ffffffff
17 | #dddddd
18 | #00000000
19 | #ffffff
20 | #60000000
21 | #c0ffff00
22 | #666666
23 | #04b0ed
24 | #b2b2b2
25 | #999999
26 | #cccccc
27 | #d9d9d9
28 | #45c4dd
29 | #FF9900
30 | #6633B5E5
31 | #00d5b8
32 | #f38893
33 | #808080
34 | #4c4c4c
35 | #f5f5f5
36 | #fafafc
37 | #d2d3d9
38 | #8a8a99
39 | #00b4cb
40 | #eff3f4
41 | #777777
42 | #fafafa
43 |
44 |
45 | #60000000
46 | #95000000
47 |
48 | @android:color/white
49 |
50 | #000000
51 | #e5e5e5
52 | @android:color/black
53 |
--------------------------------------------------------------------------------
/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 40
4 | 12dp
5 | 13dp
6 | 15dp
7 | 18dp
8 | 16dp
9 | 75dp
10 |
11 |
12 | 15dp
13 |
14 | 120dp
15 |
16 | 80dp
17 |
18 | 60dp
19 |
20 | 25px
21 |
22 | 15sp
23 | 10dp
24 |
--------------------------------------------------------------------------------
/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | bmWidgetLib
3 | Go to previous
4 | Go to next
5 | Calendar
6 |
7 |
--------------------------------------------------------------------------------
/src/main/res/values/style.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
26 |
27 |
42 |
43 |
61 |
62 |
63 |
67 |
68 |
69 |
73 |
74 |
79 |
80 |
84 |
85 |
91 |
92 |
102 |
--------------------------------------------------------------------------------
/src/test/java/com/benmu/widget/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.benmu.widget;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------