Giter Club home page Giter Club logo

material-calendarview's Introduction

Material Calendar View

Android Arsenal Travis branch

A Material design back port of Android's CalendarView. The goal is to have a Material look and feel, rather than 100% parity with the platform's implementation.

Demo Screen Capture

Installation

Step 1. Add the JitPack repository to your build file

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Step 2. Add the dependency

dependencies {
  implementation 'com.github.prolificinteractive:material-calendarview:${version}'
}

Usage

  1. Add MaterialCalendarView into your layouts or view hierarchy.
  2. Set a OnDateSelectedListener or call MaterialCalendarView.getSelectedDates() when you need it.

Javadoc Available Here

Example:

<com.prolificinteractive.materialcalendarview.MaterialCalendarView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/calendarView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:mcv_showOtherDates="all"
    app:mcv_selectionColor="#00F"
    />

Documentation

Make sure to check all the documentation available here.

Customization

One of the aims of this library is to be customizable. The many options include:

Events, Highlighting, Custom Selectors, and More!

All of this and more can be done via the decorator api. Please check out the decorator documentation.

Recent Changes

Major Change in 2.0

Material CalendarView 2.0 comes in with a major change into the core of it's API, we transitioned from using java.util.Calendar to java.time.LocalDate. Also that should not impact the public api (we are still using CalendarDay), both Calendar and LocalDate function a little bit differently. One example of that: Months are now indexed from 1 (January) to 12 (December). You can access from the LocalDate from CalendarDay using getDate().

Major Change in 1.6.0

Also this release doesn't have any break changes, it provides significant improvements to the widget. More customization have been added for the user (custom fonts, long click listener, show/hide weekdays) as well as various fixes, improvements to the sample app, and general cleanup. Make sure to check the CHANGELOG and the release section for more details.

Major Change in 1.5.0

We recently updated to the latest gradle and decided to move over our libraries to the hosting service Jitpack. Please refer to the installation section for more details.

Major Change in 1.4.0

  • Breaking Change: setFirstDayOfWeek, setMin/MaxDate, and setCalendarDisplayMode are moved to a State object. This was necessary because it was unclear that these were not simple setters--individually, they were side effecting and triggered full adapter/date range recalculations. Typical usage of the view involves setting all these invariants up front during onCreate and it was unknown to the user that setting all 4 of these would create a lot of waste. Not to mention certain things were side effecting--some would reset the current day or selected date. As a result, the same 4 methods called in a different order could result in a different state, which is bad.

    For most cases you will simply need to replace setting those invariants with:

    mcv.state().edit()
      .setFirstDayOfWeek(Calendar.WEDNESDAY)
      .setMinimumDate(CalendarDay.from(2016, 4, 3))
      .setMaximumDate(CalendarDay.from(2016, 5, 12))
      .setCalendarDisplayMode(CalendarMode.WEEKS)
      .commit();

    mcv.state().edit() will retain previously set values; mcv.newState() will create a new state using default values. Calling commit will trigger the rebuild of adapters and date ranges. It is recommended these state changes occur as the first modification to MCV (before configuring anything else like current date or selected date); we make no guarantee those modifications will be retained when the state is modified.

    See CUSTOMIZATION_BUILDER for usage details.

  • New: setSelectionMode(SELECTION_MODE_RANGE) was added to allow 2 dates to be selected and have the entire range of dates selected. Much thanks to papageorgiouk for his work on this feature.

See other changes in the CHANGELOG.

Contributing

Would you like to contribute? Fork us and send a pull request! Be sure to checkout our issues first.

License

Material Calendar View is Copyright (c) 2018 Prolific Interactive. It may be redistributed under the terms specified in the LICENSE file.

Maintainers

prolific

Material Calendar View is maintained and funded by Prolific Interactive. The names and logos are trademarks of Prolific Interactive.

material-calendarview's People

Contributors

ardacebi avatar barnhill avatar bryant1410 avatar bschnack avatar caltseng avatar carlos-ot avatar codeskraps avatar dandc87 avatar dotnick avatar dsn5ft avatar ekchang avatar gitter-badger avatar glennhayward avatar halimomar avatar jlindenbaum avatar jogan avatar johnjohndoe avatar jorpaspr avatar kingargyle avatar laces avatar levaja avatar lucas34 avatar nicbell avatar quentin41500 avatar skarempudi avatar stankocken avatar sumio avatar tevjef avatar yuriheupa avatar zach-cs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

material-calendarview's Issues

Allow customizing weekday and month names

Thank you for creating this great library.

It would be nice if the library allows customizing the names of weekdays and months through passing the corresponding String arrays.

Title does not show

When o give small height to the calendar it does not show the title. Happens even inside a scroll view.

DayTextView is off center

screenshot_2015-03-02-11-43-33

Look like the gravity is set on the LEFT and not CENTER, the circle for the selected date allign with the name of the day, but everyday day are off.

flag to hide a month header

Thank you for awesome calendarview first!

Is there any optional flag to hide a month header?
I want to hide it as I'm trying to display current month text in actionbar title like google calendar

Is there an 'weekview' in this library?

Right now I'm using the Android Week View library to show things in the calendar. That library isn't optimized very well, and it's lagging on my device.
Does this library contain an 'mode' to only show one week (or x number of days) at a time?

If yes, I'll try to implement this library into my project.

Thanks!
Tim

Build not working?

Is it just for me or is the 0.5.0 build not compiling in Sudio?
Also its not building properly on jitpack.io

log of the build on jitpack.io
find: dirname' terminated by signal 13 find:dirname' terminated by signal 13
Run gradle build
Gradle build script
Downloading https://services.gradle.org/distributions/gradle-2.2.1-all.zip
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Unzipping /home/jitpack/.gradle/wrapper/dists/gradle-2.2.1-all/6dibv5rcnnqlfbq9klf8imrndn/gradle-2.2.1-all.zip to /home/jitpack/.gradle/wrapper/dists/gradle-2.2.1-all/6dibv5rcnnqlfbq9klf8imrndn
Set executable permissions for: /home/jitpack/.gradle/wrapper/dists/gradle-2.2.1-all/6dibv5rcnnqlfbq9klf8imrndn/gradle-2.2.1/bin/gradle


Gradle 2.2.1

Build time: 2014-11-24 09:45:35 UTC
Build number: none
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a

Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_76 (Oracle Corporation 24.76-b04)
OS: Linux 3.13.0-36-generic amd64

Getting a list of gradle tasks
Running: ./gradlew clean -Pgroup=com.github.prolificinteractive -Pversion=v0.5.0 -xtest uploadArchives
:library:clean UP-TO-DATE
:sample:clean UP-TO-DATE
:library:compileLint
:library:copyReleaseLint UP-TO-DATE
:library:preBuild UP-TO-DATE
:library:preReleaseBuild UP-TO-DATE
:library:checkReleaseManifest
:library:preDebugAndroidTestBuild UP-TO-DATE
:library:preDebugBuild UP-TO-DATE
:library:preDebugUnitTestBuild UP-TO-DATE
:library:preReleaseUnitTestBuild UP-TO-DATE
:library:prepareComAndroidSupportSupportV42220Library
:library:prepareReleaseDependencies
:library:compileReleaseAidl
:library:compileReleaseRenderscript
:library:generateReleaseBuildConfig
:library:generateReleaseAssets UP-TO-DATE
:library:mergeReleaseAssets
:library:generateReleaseResValues
:library:generateReleaseResources
:library:mergeReleaseResources
:library:processReleaseManifest
:library:processReleaseResources
:library:generateReleaseSources
:library:processReleaseJavaRes UP-TO-DATE
:library:compileReleaseJavaNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:library:extractReleaseAnnotations
:library:mergeReleaseProguardFiles
:library:packageReleaseJar
:library:compileReleaseNdk UP-TO-DATE
:library:packageReleaseJniLibs UP-TO-DATE
:library:packageReleaseLocalJar UP-TO-DATE
:library:packageReleaseRenderscript UP-TO-DATE
:library:packageReleaseResources
:library:bundleRelease
:library:sourcesJar
:library:signArchives SKIPPED
:library:uploadArchivesUploading: com/prolificinteractive/material-calendarview/0.5.0/material-calendarview-0.5.0.aar to repository remote at https://oss.sonatype.org/service/local/staging/deploy/maven2/
Transferring 47K from remote
FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 19.643 secs
Trying again without wrapper
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=cb19a298-3b33-4e7c-8eed-e2501d01999a.1, currentDir=/build}
Attempting to read last messages from the daemon log...
Daemon pid: 204
log file: /home/jitpack/.gradle/daemon/2.4/daemon-204.out.log
----- Last 20 lines from daemon log file - daemon-204.out.log -----
13:48:10.957 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] Command execution: started DaemonCommandExecution[command = Build{id=cb19a298-3b33-4e7c-8eed-e2501d01999a.1, currentDir=/build}, connection = org.gradle.launcher.daemon.server.DefaultDaemonConnection@31873729] after 0.0 minutes of idle
13:48:10.958 [INFO] [org.gradle.launcher.daemon.server.DomainRegistryUpdater] Marking the daemon as busy, address: [2482979d-8c63-4cfb-801f-6316ec43c004 port:49651, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]]
13:48:10.959 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Marking busy by address: [2482979d-8c63-4cfb-801f-6316ec43c004 port:49651, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]]
13:48:10.960 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
13:48:10.961 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
13:48:10.965 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
13:48:10.966 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] updating lastActivityAt to 1434635290966
13:48:10.966 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] Daemon is busy, sleeping until state changes.
13:48:10.967 [INFO] [org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy] Daemon is about to start building Build{id=cb19a298-3b33-4e7c-8eed-e2501d01999a.1, currentDir=/build}. Dispatching build started information...
13:48:10.968 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 15: dispatching class org.gradle.launcher.daemon.protocol.BuildStarted
13:48:10.976 [DEBUG] [org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment] Configuring env variables: {HOSTNAME=4a22f13f5471, PWD=/build, OLDPWD=/usr/share/gradle, HOME=/home/jitpack, JAVA8_HOME=/usr/lib/jvm/java-8-oracle, JAVA_HOME=/usr/lib/jvm/java-7-oracle, SHLVL=2, XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt, PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, JAVA7_HOME=/usr/lib/jvm/java-7-oracle, ANDROID_HOME=/android, NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat}
13:48:10.988 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 13: received class org.gradle.launcher.daemon.protocol.CloseInput
13:48:10.989 [DEBUG] [org.gradle.launcher.daemon.server.DefaultDaemonConnection] Received IO message from client: CloseInput[id=cb19a298-3b33-4e7c-8eed-e2501d01999a.2]
13:48:10.992 [DEBUG] [org.gradle.launcher.daemon.server.exec.LogToClient] About to start relaying all logs to the client via the connection.
13:48:10.993 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 204). The daemon log file: /home/jitpack/.gradle/daemon/2.4/daemon-204.out.log
13:48:11.002 [INFO] [org.gradle.launcher.daemon.server.health.DaemonHealthTracker] Starting build in new daemon [memory: 954.7 MB]
13:48:11.004 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] Closing daemon's stdin at end of input.
13:48:11.005 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] The daemon will no longer process any standard input.
13:48:11.008 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
13:48:11.009 [INFO] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=eb3d3b4d-18d6-4b80-b4a0-fc5bf9a17871,javaHome=/usr/lib/jvm/java-7-oracle,daemonRegistryDir=/home/jitpack/.gradle/daemon,pid=204,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant]
----- End of the daemon log -----

FAILURE: Build failed with an exception.

  • What went wrong:
    Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    No build artifacts found

Starting date

In my opinion the first month to show up should be the current month, right now, it's february 1970.

setSelectDate() performance issue

I try to use a RecyclerView to change the selected date based on the scrolling. But the performance is not as expected I am not sure I use it correctly. I just add a OnScrollListener within which I check the if the date need to been changed then call setSelectedDate(). It turns out a little bit lag happens.
Here is my code:

 mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
            }
            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                calendarView.setOnDateChangedListener(null);
                super.onScrolled(recyclerView, dx, dy);
                LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
                EventAdapter adapter = (EventAdapter) recyclerView.getAdapter();
                int firstPosition = layoutManager.findFirstVisibleItemPosition();
                Calendar firstCal = dataWrapper.positionCalMap.get(firstPosition);
                if (!firstCal.equals(currentCal)) {
                    currentCal = firstCal;
                    calendarView.setSelectedDate(firstCal);
                }

Xml app:mcv attributes aren't compiling

Hi, I'm new to Android so I don't know if it's a bug or if I'm missing something.

I followed the configuration septs from the README.md and I got the following error:

screenshot 2015-05-24 12 26 17

The attributes with the app:mcv_* aren't compiling.

<com.prolificinteractive.materialcalendarview.MaterialCalendarView
    android:id="@+id/calendarView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:mcv_showOtherDates="boolean"
    app:mcv_arrowColor="color"
    app:mcv_selectionColor="color"
    app:mcv_headerTextAppearance="style"
    app:mcv_dateTextAppearance="style"
    app:mcv_weekDayTextAppearance="style"
    app:mcv_weekDayLabels="array"
    app:mcv_monthLabels="array"
    app:mcv_tileSize="dimension"
    app:mcv_firstDayOfWeek="enum"
    />

I tried with compileSdkVersion 21/22and buildToolsVersion "21.1.2/22.0.1".

If I remove the app:mcv_* it work just fine.

<com.prolificinteractive.materialcalendarview.MaterialCalendarView
    android:id="@+id/calendarView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    />

What am I missing?

DayView is not public

I added compile 'com.prolificinteractive:material-calendarview:0.3.0' in my android studio, and able to access basic api's but when i tried to add DayView class in my decotors class (similar to samples), it's showing DayView class is not public. Please can you tell me why it's not public when i add library as dependency in studio, but given sample works fine with source code, as it has DayView class public.

Make Resizeable

Right now, the day view is hard coded (44dp). This should be allowed to be set via XML and code.

We might need to switch from using xml internally for layouts.

Should we also add an option for auto-resizing? Like how android:adjustViewBounds works for ImageViews?

Should we do anything special with text sizes if we allow resizing?

setDecorator doesn't update the UI

I am setting the decorator with dates that i get from http request.
Calling setDecorator doesnt update the UI at all, however, when I move few months away, and
go back, the decorators are set correctly.
My code looks as the one in the sample with one exception: setDecorators is called outside the onCreate method (at the http resposne method).

Any input regarding this issue will be helpful.

Remove the padding left and right

I'd like to remove the padding to the left and right.
You can see in the issue #9 the padding that I'm talking about.
It would be great to have the choice to remove it.

How to clear TextDecorator?

How to clear all TextDecorator?

screenshot_2015-05-05-08-03-18 1

widget.removeDecorators() delete all decorators but i want delete only TextDecorator, i dont want delete HighlightWeekendsDecorator()

On the other hand, i dont want use loop to delete each individual with:
widget.removeDecorator();

How to change selected date color

When I click on specific date, how to change color.? For example: if all my data color is white but I want on press select specific date and set blue color.How to do it? Thanks

Multiple day selection

Is there a way to customize the calendar to allow for more than one day to be selected?

Question - Gregorian To Shamsi

Hi,
This is an amzing library. I really loved it
Is this calendar supports converting Gregorian to Shamsi? I want to use this lib for a Persian language based application

What to do when View is too small?

What should be the behavior when the calendar is set to a size too small (e.g. the height and width were set to something silly like 20dp). Currently, the contents of the calendar are sized according to tile size, but are centered inside of a FrameLayout. This means that if the calendar is sized too small, it gets cropped (see #43).

Options:

  • Pick a tile size that would allow the calendar to fit the small size
  • Ignore width and height and force the view to be the size dictated by tile size
  • Make the calendar react to changes in width and height, and ditch the tile size feature

Custom to show lunar date

Hello,
I'd like to make a lunar calendar by using this library. But I haven't found any solution. The problem is how to add a digit in the bottom of lib's date. The following image make you see easily

image

Is it possible? How to do it?
That's it. Thanks everyone. I'm looking forward to hearing the answers

hide arrows

Can I hide that view with navigation arrows ?

Make month and days of the week hideable.

The ability to hide month name and days of the week would be a nice feature for people who want to save vertical screen real estate. I could even see displaying the month name in the Toolbar that will be present in many material apps.

Set "data" in days

Hello,

is there a way to set some "content" for the single days from Java? I mean, if you have an appointment, to show it in the View as a marker or something? Like an adapter or such, in order to feed the data externally

MonthChangedListener

Hi. please add MonthChangedListener (or tell me how to track changes in a month).
sorry for bad english . I hope you understand me
thank you.

decorate() being called late

I'm having an issue, I think it may be with my code, but I can't seem to find what's wrong with my code.
So I'm retrieving event dates from my server and storing them in an ArrayList. Then I highlight those dates.

Here's my HighlightDecorator.java class:

public class HighlightDecorator implements DayViewDecorator {

    List<CalendarDay> dates;

    public HighlightDecorator(List<CalendarDay> dates){
        this.dates = dates;
    }

    @Override
    public boolean shouldDecorate(CalendarDay calendarDay) {
        return dates.contains(calendarDay);
    }

    @Override
    public void decorate(DayViewFacade dayViewFacade) {
        Log.e("day view", dayViewFacade.getDate().toString());
        dayViewFacade.setBackgroundUnselected(generateBackgroundDrawable());
    }

    private static Drawable generateBackgroundDrawable() {
        final int r = 0;
        final float[] outerR = new float[] {r, r, r, r, r, r, r, r};
        final int color = Color.parseColor("#660033");

        RoundRectShape rr = new RoundRectShape(outerR, null, null);

        ShapeDrawable drawable = new ShapeDrawable(rr);
        drawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {
            @Override
            public Shader resize(int width, int height) {
                return new LinearGradient(0, 0, 0, 0, color, color, Shader.TileMode.REPEAT);
            }
        });
        return drawable;
    }
}

And here is a short excerpt from my fragment, which contains the MaterialCalendarView:
CalendarTab.java

MaterialCalendarView calendarView = (MaterialCalendarView) v.findViewById(R.id.calendarView);
        calendarView.setOnDateChangedListener(this);
        calendarView.setSelectedDate(Calendar.getInstance().getTime());

        JSONObject jsonObject;
        String date;
        String[] dateComponents;
        CalendarDay eventDay;
        events = new ArrayList<CalendarDay>();
        for(int i = 0; i < jsonArray.length(); i++){
            try {
                jsonObject = jsonArray.getJSONObject(i);
                date = jsonObject.getString("startDate").split(" ")[0];
                dateComponents = date.split("-");
                eventDay = new CalendarDay(Integer.parseInt(dateComponents[0]), Integer.parseInt(dateComponents[1])-1, Integer.parseInt(dateComponents[2]));
                events.add(eventDay);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        Log.e("events", events.toString());

        calendarView.addDecorator(new HighlightDecorator(events));
}

So from the log, I see that the ArrayList correctly has all the dates. Now, when I first open the app, the calendar is completely undecorated. When I move to May, I can see from the log that it is decorating the June dates. When I move to June, it is not decorating anything. When I move back to May, it is decorating April and May, but decorations for May are not shown. Then moving back to April, it decorates March.

What's going on?? This isn't happening in the sample that I downloaded, and my code is almost the same as that.

Change the first day of the week

As far as I can see there isn't a way to change the first day of the week at the moment. It would be nice if there was an option to change it.

Looking at the code, MonthView internally sets the day to Sunday.

I hacked something together by exposing the setFirstDayOfTheWeek method to the MaterialCalendarView; if you want I can checkout the repo and open a pull request.

Range Selection

How to make range selection? I checked sample activity but i think calendarview has no ability for it yet.

Cannot find weekDayLabels and monthLabels attr

Hi, in my Android Studio, it could not resolve these attributes.

app:weekDayLabels="@array/custom_weekdays"
app:monthLabels="@array/custom_months"

Although this attribute was resolved

app:weekDayTextAppearance="?android:attr/textAppearanceMedium"

Thank you for this nice library.

Calendar is only showing last week for current month.

I can't seem to reproduce this on my emulators, but on stock Nexus 4 and Nexus 5 both running 5.1.1 I can reproduce this consistently. I can reproduce this on 0.4.0, 0.5.0, and 0.6.0.

The calendar view only shows the last week of the current month, and then shows the greyed out days of next month, scrolling to the next month shows the active day buttons of the last week of the next month, and then greyed out day buttons of the month after that.

For example. Opening up the calendar in June shows, under the month bar, the weekdays from Sunday to Monday. Below I see 26, 27, 28, 29. When I select those I properly get June 26 2015 as dates. The remaining days in the calendar are not tappable and appear to be for July.

When I swipe over to August it again shows me 26, 27, 28, 29, 30, 31 along the top - which, when tapped, are the correct July 26 2015 dates. The remainder of the days appear to be August, and are not selectable.

The fragment view code is below, as well as a screen shot of the issue.

I am using DayDecorators.

I build against 21, with 21.1.1 build tools. Support library support-v13:21.0.3 with app compat appcompat-v7:22.2.0

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@color/screen_background_light"
                android:orientation="vertical">

    <com.prolificinteractive.materialcalendarview.MaterialCalendarView
        android:id="@+id/event_calendar_view"
        android:layout_width="match_parent"
        android:layout_height="320dp"
        app:mcv_showOtherDates="true"
        app:mcv_tileSize="40dp"/>

    <include
        android:id="@+id/list_header_title"
        layout="@layout/list_header"
        android:layout_width="match_parent"
        android:layout_height="30dip"
        android:layout_below="@+id/event_calendar_view"/>

    <ProgressBar
        android:id="@+id/event_progress_bar"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:layout_below="@id/list_header_title"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dip"/>

    <ListView
        android:id="@+id/event_list_view"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/list_header_title"
        android:visibility="gone"/>
</RelativeLayout>

screenshot_2015-07-02-12-50-51

setSelectionDrawable(Drawable drawable) not working for me

Hi,
What I want is to mark selected date with drawable from resources (PNG file). I took BasicActivity from sample application and added this code:

    DayViewDecorator decorator = new DayViewDecorator() {
        @Override
        public boolean shouldDecorate(CalendarDay day) {
            return true;
        }

        @Override
        public void decorate(DayViewFacade view) {
            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                view.setSelectionDrawable(getDrawable(R.drawable.select_date));
            } else {
                view.setSelectionDrawable(ContextCompat.getDrawable(BasicActivity.this, R.drawable.select_date));
            }
        }
    };
    widget.addDecorator(decorator);

Unfortunately when I select a date only default, blue, circle background is displayed. Am I missing something?

TextDecorator is very slow

Hi!

I'm using Your library in my application, and it's a very cool and unique calendar. I have just one problem with the new decorators. It's a great new feature for me, so I've started using it.

My problem is, that when I'm using the sample class, TextDecorator, my app runs really slow. The GPU rendering chart shows that my GPU is working on a full performance.

Here is my code:

private List mDateOfEvents;
private TextDecorator mTextDecorator;
onCreate {
mDateOfEvents = new ArrayList<>();
mTextDecorator = new TextDecorator("โ—", mDateOfEvents);
mMonthCalendar.addDecorator(mTextDecorator);
}

.
.
.

addEvents() {
for (Object object : objectList) {
mDateOfEvents.add(event.getStartTime().getTime());
}

mTextDecorator = new TextDecorator("โ—", mDateOfEvents);
mMonthCalendar.invalidateDecorators();
}

Thanks for your help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.