Giter VIP home page Giter VIP logo

horizontal-calendar's Introduction

Horizontal Calendar

Download License

A material horizontal calendar view for Android based on RecyclerView.

showcase

Installation

The library is hosted on jcenter, add this to your build.gradle:

repositories {
      jcenter()
    }
    
dependencies {
      compile 'devs.mulham.horizontalcalendar:horizontalcalendar:1.3.4'
    }

Prerequisites

The minimum API level supported by this library is API 14 (ICE_CREAM_SANDWICH).

Usage

  • Add HorizontalCalendarView to your layout file, for example:
<android.support.design.widget.AppBarLayout>
		............ 
		
        <devs.mulham.horizontalcalendar.HorizontalCalendarView
            android:id="@+id/calendarView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            app:textColorSelected="#FFFF"/>
            
</android.support.design.widget.AppBarLayout>
  • In your Activity or Fragment, define your start and end dates to set the range of the calendar:
/* starts before 1 month from now */
Calendar startDate = Calendar.getInstance();
startDate.add(Calendar.MONTH, -1);

/* ends after 1 month from now */
Calendar endDate = Calendar.getInstance();
endDate.add(Calendar.MONTH, 1);
  • Then setup HorizontalCalendar in your Activity through its Builder:
HorizontalCalendar horizontalCalendar = new HorizontalCalendar.Builder(this, R.id.calendarView)
                .range(startDate, endDate)
                .datesNumberOnScreen(5)
                .build();
  • Or if you are using a Fragment:
HorizontalCalendar horizontalCalendar = new HorizontalCalendar.Builder(rootView, R.id.calendarView)
	...................
  • To listen to date change events you need to set a listener:
horizontalCalendar.setCalendarListener(new HorizontalCalendarListener() {
            @Override
            public void onDateSelected(Calendar date, int position) {
                //do something
            }
        });
  • You can also listen to scroll and long press events by overriding each perspective method within HorizontalCalendarListener:
horizontalCalendar.setCalendarListener(new HorizontalCalendarListener() {
            @Override
            public void onDateSelected(Calendar date, int position) {

            }

            @Override
            public void onCalendarScroll(HorizontalCalendarView calendarView, 
            int dx, int dy) {
                
            }

            @Override
            public boolean onDateLongClicked(Calendar date, int position) {
                return true;
            }
        });

Customization

  • You can customize it directly inside your layout:
<devs.mulham.horizontalcalendar.HorizontalCalendarView
            android:id="@+id/calendarView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:textColorNormal="#bababa"
            app:textColorSelected="#FFFF"
            app:selectorColor="#c62828"  //default to colorAccent
            app:selectedDateBackground="@drawable/myDrawable"/>
  • Or you can do it programmatically in your Activity or Fragment using HorizontalCalendar.Builder:
HorizontalCalendar horizontalCalendar = new HorizontalCalendar.Builder(this, R.id.calendarView)
                .range(Calendar startDate, Calendar endDate)
                .datesNumberOnScreen(int number)   // Number of Dates cells shown on screen (default to 5).
                .configure()    // starts configuration.
                    .formatTopText(String dateFormat)       // default to "MMM".
                    .formatMiddleText(String dateFormat)    // default to "dd".
                    .formatBottomText(String dateFormat)    // default to "EEE".
                    .showTopText(boolean show)              // show or hide TopText (default to true).
                    .showBottomText(boolean show)           // show or hide BottomText (default to true).
                    .textColor(int normalColor, int selectedColor)    // default to (Color.LTGRAY, Color.WHITE).
                    .selectedDateBackground(Drawable background)      // set selected date cell background.
                    .selectorColor(int color)               // set selection indicator bar's color (default to colorAccent).
                .end()          // ends configuration.
                .defaultSelectedDate(Calendar date)    // Date to be selected at start (default to current day `Calendar.getInstance()`).
                .build();

More Customizations

builder.configure()
           .textSize(float topTextSize, float middleTextSize, float bottomTextSize)
           .sizeTopText(float size)
           .sizeMiddleText(float size)
           .sizeBottomText(float size)
           .colorTextTop(int normalColor, int selectedColor)
           .colorTextMiddle(int normalColor, int selectedColor)
           .colorTextBottom(int normalColor, int selectedColor)
       .end()

Months Mode

HorizontalCalendar can display only Months instead of Dates by adding mode(HorizontalCalendar.Mode.MONTHS) to the builder, for example:

horizontalCalendar = new HorizontalCalendar.Builder(this, R.id.calendarView)
                .range(Calendar startDate, Calendar endDate)
                .datesNumberOnScreen(int number)
                .mode(HorizontalCalendar.Mode.MONTHS)
                .configure()
                    .formatMiddleText("MMM")
                    .formatBottomText("yyyy")
                    .showTopText(false)
                    .showBottomText(true)
                    .textColor(Color.LTGRAY, Color.WHITE)
                .end()
                .defaultSelectedDate(defaultSelectedDate)

Events

A list of Events can be provided for each Date which will be represented as circle indicators under the Date with:

builder.addEvents(new CalendarEventsPredicate() {

                    @Override
                    public List<CalendarEvent> events(Calendar date) {
                        // test the date and return a list of CalendarEvent to assosiate with this Date.
                    }
                })

Reconfiguration

HorizontalCalendar configurations can be changed after initialization:

  • Change calendar dates range:
horizontalCalendar.setRange(Calendar startDate, Calendar endDate);
  • Change default(not selected) items style:
horizontalCalendar.getDefaultStyle()
        .setColorTopText(int color)
        .setColorMiddleText(int color)
        .setColorBottomText(int color)
        .setBackground(Drawable background);      
  • Change selected item style:
horizontalCalendar.getSelectedItemStyle()
        .setColorTopText(int color)
        ..............
  • Change formats, text sizes and selector color:
horizontalCalendar.getConfig()
        .setSelectorColor(int color)
        .setFormatTopText(String format)
        .setSizeTopText(float size)
        ..............

Important

Make sure to call horizontalCalendar.refresh(); when you finish your changes

Features

  • Disable specific dates with HorizontalCalendarPredicate, a unique style for disabled dates can be specified as well with CalendarItemStyle:
builder.disableDates(new HorizontalCalendarPredicate() {
                           @Override
                           public boolean test(Calendar date) {
                               return false;    // return true if this date should be disabled, false otherwise.
                           }
       
                           @Override
                           public CalendarItemStyle style() {
                               return null;     // create and return a new Style for disabled dates, or null if no styling needed.
                           }
                       })
  • Select a specific Date programmatically with the option whether to play the animation or not:
horizontalCalendar.selectDate(Calendar date, boolean immediate); // set immediate to false to ignore animation.
	// or simply
horizontalCalendar.goToday(boolean immediate);
  • Check if a date is contained in the Calendar:
horizontalCalendar.contains(Calendar date);
  • Check if two dates are equal (year, month, day of month):
Utils.isSameDate(Calendar date1, Calendar date2);
  • Get number of days between two dates:
Utils.daysBetween(Calendar startInclusive, Calendar endExclusive);

Contributing

Contributions are welcome, feel free to submit a pull request.

License

Copyright 2017 Mulham Raee

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

horizontal-calendar's People

Contributors

barbeu avatar forbroteam avatar ianmcxa avatar muraee avatar theironmarx 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

horizontal-calendar's Issues

Select the month instead of every single day

Hello,

I'd like to use this amazing library in my application, the horizontal calendar under the action bar is intuitive and easy.

In my application i've got some records regarding Insurance's documents. I need to filter them basing only on the month and not the single day.

I want to use this library but i can't figure out how to display the 12 months instead every single day of the year.

Thanks.

Change date call onDateSelected() twice

When changing date onDateSelected() called twice, once with old date and once more with new date.
why this behavior happens?

Clarification: It happens only when scrolling calendar and working right when clicking

Unable to selectDate

I'm having problem changing the selected date. Basically I have a button that should select "tomorrow"
public void onClick(View v) { Calendar tomorrow = Calendar.getInstance(); tomorrow.add(Calendar.DAY_OF_MONTH, 1); horizontalCalendar.selectDate(tomorrow); }
I never used Calendar or Date before so maybe is just an error in my comprehension.
This is the Horizontal Calendar build:
final HorizontalCalendar horizontalCalendar = new HorizontalCalendar.Builder(view, R.id.calendarView) .startDate(startDate.getTime()) .endDate(endDate.getTime()) .showMonthName(false) .build();

Fix bug with selection previous item when select day before current

For fix bug with selection previous item when select day before current need change next method in HorizontalCalendarView:
public int getPositionOfCenterItem() {
int numberOfDatesOnScreen = horizontalCalendar.getNumberOfDatesOnScreen();
int firstVisibilePosition = getLayoutManager().findFirstCompletelyVisibleItemPosition();
if (firstVisibilePosition == -1) {
return -1;
}
return firstVisibilePosition + (numberOfDatesOnScreen / 2);
}

To:

public int getPositionOfCenterItem() {
int numberOfDatesOnScreen = horizontalCalendar.getNumberOfDatesOnScreen();
int firstVisiblePosition = getLayoutManager().findFirstVisibleItemPosition();
if (firstVisiblePosition == -1) {
return -1;
}
return firstVisiblePosition + (numberOfDatesOnScreen / 2);
}

Bug: goToday not immediate enough

Expected Behavior / Goal

To go straight to the given date, by using:
horizontalCalendar.goToday(true);

Actual Behavior

It doesn't always go so quickly to there. Depends on device or Android version

Steps to Reproduce the Problem (sample code if possible)

  1. Make the date range large. I used this:
    #45
  2. scroll a lot.
  3. Choose to go to current day.

Specifications

  • Android Version:
    6.0.1 on OnePlus 2
  • Horizontal-Calendar Version:
    1.1.8

See how slow it can be (took about 2 seconds to reach there) :
VID_20171024_121150 (1).zip

Bug when scrolling the calendar v1.1.5

I got this error when i'm scrolling the calendar.

java.lang.ArrayIndexOutOfBoundsException: length=1021; index=-1 at java.util.ArrayList.get(ArrayList.java:306) at devs.mulham.horizontalcalendar.HorizontalCalendarAdapter$1.onClick(HorizontalCalendarAdapter.java:57) at android.view.View.performClick(View.java:4091) at android.view.View$PerformClick.run(View.java:17072) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:4987) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) at dalvik.system.NativeStart.main(Native Method)

Need to add Locales

Add localization by Locale.getDefault() or set it manually in Builder.
But it is necessary to provide for the correct spelling of words in all languages.
For example, in Russain not "марта" and "Март" (is it March).

Select Dates in Interval

I certainly have a query, whether we can select the dates that forms an interval
Eg: Select dates between October 7- October 12

Request: avoid caching of dates

I've noticed that before the view is used, an AsyncTask is executed that saves all dates in the range:

    @Override
    protected Void doInBackground(Void... params) {
        //ArrayList of dates is set with all the dates between
        //start and end date
        GregorianCalendar calendar = new GregorianCalendar();

        calendar.setTime(dateStartCalendar);
        calendar.add(Calendar.DATE, -(numberOfDatesOnScreen / 2));
        Date dateStartBefore = calendar.getTime();
        calendar.setTime(dateEndCalendar);
        calendar.add(Calendar.DATE, numberOfDatesOnScreen / 2);
        Date dateEndAfter = calendar.getTime();

        Date date = dateStartBefore;
        while (!date.after(dateEndAfter)) {
            mListDays.add(date);
            calendar.setTime(date);
            calendar.add(Calendar.DATE, 1);
            date = calendar.getTime();
        }

        return null;
    }

This is a bad thing:

  1. It takes time till the view is ready, for a view that simply needs to show dates.
  2. It can take a huge amount of Date items. In my case, that I wanted to show a large range, it takes at least 60K of Date objects.
    All of this in memory.

Instead of this, the view should immediately go to the correct date.
The calculation can be done on the UI thread, in the onBindViewHolder callback, by comparing the current item position to the pivot date (the date you started from, or the start date).

Incorrect default date is selected

Hi,
I have a small issue here, today it is 22nd January, but default date displayed on calendar is 26th January, even when I call "goToday" or "selectDate".

Also, the methods "getDateEndCalendar" and "getDateStartCalendar" return 22nd December and 22nd February, which is correct, but rendered dates are from 20th December to 24th February.

This is my code, I am not doing anything special.

calendar = new HorizontalCalendar.Builder(layout, R.id.date_picker).build();
calendar.setCalendarListener(new CalendarListener(this));

and layout file

<devs.mulham.horizontalcalendar.HorizontalCalendarView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#fff"
                app:textColorNormal="#000"
                app:textColorSelected="#fff"
                app:selectorColor="#000"
                app:selectedDateBackground="#000"
                android:id="@+id/date_picker" />

EDIT: Building on Android 4.4.2 with appcompat-v7:25.1.0

Calendar defaults to yesterday/tomorrow when datesNumberOnScreen set to 3

Thank you for the work that's gone into this very useful library.

Unfortunately I am experiencing an issue where the calendar always defaults to tomorrow's date (occasionally yesterday's). I'am configuring the Calendar as shown below...

`private HorizontalCalendar initCalendar() {
Calendar endDate = Calendar.getInstance();
endDate.add(Calendar.DAY_OF_MONTH, 1);
Calendar startDate = Calendar.getInstance();
startDate.add(Calendar.DAY_OF_MONTH, -1);

    return new HorizontalCalendar.Builder(this, R.id.calendarView)
            .startDate(startDate.getTime())
            .endDate(endDate.getTime())
            .datesNumberOnScreen(3)   // Number of Dates cells shown on screen (Recommended 5)
            .dayNameFormat("EEE")      // WeekDay text format
            .dayNumberFormat("dd")    // Date format
            .monthFormat("MMM")      // Month format
            .showDayName(true)          // Show or Hide dayName text
            .showMonthName(true)      // Show or Hide month text
            .textColor(Color.LTGRAY, Color.WHITE)    // Text color for none selected Dates
            .selectorColor(Color.BLUE)   // Color of the selection indicator bar (default to colorAccent).
            .build();

}`

The value of 'onDateSelected' when the calendar is initialised is always today's date yet the Calendar shows tomorrow as selected. I understand that the recommended 'datesNumberOnScreen' value is 5 and i've found that this issue doesn't happen when changing the value of 5.

I would ideally like to show 3 dates if this is possible, and I've tried setting defaultSelectedDate() to today and running goToday(true) without success.

I've tested a previous version of my project - with datesNumberOnScreen set to 3 - and it works as expected. This has started happening in a branch where I have made a number of upgrades to my project including upgrading to 'com.android.tools.build:gradle:3.0.1'

Any assistance with this issue would be much appreciated. Many thanks

Calendar Tabs nested in Fragment Tabs

Cant access the first few day tabs in the calendar tab when nested in fragment tabs using the below, wants to page across to previous parent fragment tabs tab or cant access touch event either;

    // Add Fragments to Tabs in MainActivity
    private void setupViewPager(ViewPager viewPager) {
    Adapter adapter = new Adapter(getSupportFragmentManager());
    adapter.addFragment(new PlaceHolderFragment(), "Latest");

    //the Calendar fragment here
    adapter.addFragment(new FixturesFragment(), "Calendar");

    adapter.addFragment(new CalanderTabFragment(), "Results");

    viewPager.setAdapter(adapter);
    }

How can i disable click & horizontal scroll listener?

HI Mulham,

Builder Class I done enable for click listener
public Builder setEnable(boolean enable){
this.enable = enable;
return this;
}

HorizontalCalendarAdapter class I modified.

if(enable) {
holder.rootView.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
//int stepX = getStepX(v);
Date date = datesList.get(holder.getAdapterPosition());

                if (!date.before(horizontalCalendar.getDateStartCalendar())
                        && !date.after(horizontalCalendar.getDateEndCalendar())) {
                    //horizontalCalendarView.smoothScrollBy(stepX, 0);
                    horizontalCalendarView.setSmoothScrollSpeed(HorizontalLayoutManager.SPEED_SLOW);
                    horizontalCalendar.centerCalendarToPosition(holder.getAdapterPosition());
                }
            }
        });

        holder.rootView.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                Date date = datesList.get(holder.getAdapterPosition());
                HorizontalCalendarListener calendarListener = horizontalCalendar.getCalendarListener();
                if (calendarListener != null && !date.before(horizontalCalendar.getDateStartCalendar())
                        && !date.after(horizontalCalendar.getDateEndCalendar())) {
                    return calendarListener.onDateLongClicked(date, holder.getAdapterPosition());
                }
                return false;
            }
        });
    }

But I cannot stop Horizontal Scroll Listener. Because My project features requirements. Please help me out from my project issue!

Thanks in advance.

Reset Horizontal-Calendar settings

I want to reinitialize the HorizontalCalendar every time I select Spinner item.

But I get below error:
java.lang.IllegalStateException: An instance of OnFlingListener already set.

For following code :

 sp_bkapt_select_pgm.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
                System.out.println("I m setSpinner : " + adapterView.getItemAtPosition(i));

    horizontalCalendar_viewSch = new HorizontalCalendar.Builder(Activity_ViewAppointmentsSchedule.this, R.id.horizontalCalendar_viewSch)
                                .startDate(actualStrtDate)
                                .endDate(endDate)
                                .datesNumberOnScreen(5)
                                .dayNameFormat("EEE")
                                .dayNumberFormat("dd")
                                .monthFormat("MMM")
                                .showDayName(true)
                                .showMonthName(true)
                                .defaultSelectedDate(strtDate)
                                .textColor(Color.parseColor("#191919"), Color.WHITE)
                                .build();       


            }

            @Override
            public void onNothingSelected(AdapterView<?> adapterView) {

            }
        });

selectDate() problem

horizontalCalendar.setCalendarListener-> onDateSelected function working fine

but when i using selectDate() to select the date
the date return result is correct but the selected position is -1

for example:
selectDate(11-11-2017)
but showing the selectedItem is (10-11-2017)
(the date return result is showing 11-11-2017<-correct

i think the problem is your position calculation wrong

wrong date is selected.

If the month format is passed as "MMMM" I'm not able to select the future date.
You can see that in GIF, I'm not able to select 8th Sep.
ezgif com-video-to-gif

I'm not able to reproduce the same behavior when month format is "MMM".

default date selection or goToday doesn't show current date selected

when we are using defaultSelectedDate the calendar is not selecting current in stead it selects one day back to the current date.

also i gave
**horizontalCalendar.goToday(true);
**horizontalCalendar.selectDate(new Date(),true);
so for above settings also it shows it is not selected current date.

Expected Behavior / Goal

? It has to select by default current date.

Actual Behavior

?

Steps to Reproduce the Problem (sample code if possible)

HorizontalCalendar horizontalCalendar = new HorizontalCalendar.Builder(this, R.id.calendarView)
.startDate(startDate.getTime())
.endDate(endDate.getTime())
.datesNumberOnScreen(7)
.dayNameFormat("EEE")
.dayNumberFormat("dd")
.monthFormat("MMM")
.showDayName(true)
.showMonthName(true)
.selectedDateBackground(ContextCompat.getDrawable(this, R.drawable.ic_selectable_background))
.defaultSelectedDate(defaultDate.getTime())
.textColor(Color.GRAY, Color.rgb(15,26,42))
.selectorColor(Color.rgb(15,26,42))
.build();

Above is my constructor am using.

Specifications

  • Android Version:
  • Horizontal-Calendar Version:

Request: reduce lags while scrolling

I've noticed that when performing a fast scrolling of the view, there is sometimes lag. a jump between frames.

Enabling the "profile GPU rendering", I noticed that indeed it can get very slow :

image

At first I thought it's something with the adapter onBindViewHolder function, but it's far from the truth.
The real reason for this, is that the scrolling constantly calls notifyDataSetChanged, as I wrote here:

    @Override
    public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
        //On Scroll, agenda is refresh to update background colors
        post(new Runnable() {
            @Override
            public void run() {
                mCalendarAdapter.notifyDataSetChanged();
            }
        });

Commenting this part, scrolling becomes super smooth, but of course there won't be any selection of items during scroll:

image

Please do think of a better way to update the views.
It doesn't make sense to update all of the views, whenever you scroll, or even whenever a new selection is made. Only 2 views are supposed to be updated, and only when the selection has changed.

Request: avoid useless calls to notifyDataSetChanged when scrolling

You should only refresh the views of the RecyclerView when needed.

Currently what you do is this:

    @Override
    public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
        //On Scroll, agenda is refresh to update background colors
        post(new Runnable() {
            @Override
            public void run() {
                mCalendarAdapter.notifyDataSetChanged();
            }
        });
        ...
    }

First, the "post" is not needed because you are already on the UI thread.
Second, on most cases, when scrolling, the selected item doesn't change, so it's not needed to call notifyDataSetChanged.
Instead, you can check if the previously selected item is the same as the current one, and only if they are not, call notifyDataSetChanged.

Disable scrolling

Hello buddy,

Great library and thank you for sharing this with us!

How would i disable scrolling or listen for scroll when user stopped scrolling at one date, so i can fetch data from server. Otherwise if he is scrolling fast, it will not be good for performance and maybe some data will not be loaded at right date.

Thank you in advance.
Greetz.

Bad display of scrolling, especially on the previous date

I have downloaded the source code and I guess it because of adjustCalendarLocation method.
So I suggest remove it and add this code snippet into loadHorizontalCalendar() method

LinearSnapHelper snapHelper = new LinearSnapHelper();
snapHelper.attachToRecyclerView(calendarView);
calendarView.setOnFlingListener(snapHelper);

With this change, the display is much better

How to set the min and max dates range to be largest as possible?

Currently I use this:

    Calendar startDate = Calendar.getInstance();
    startDate.setTime(new Date(0L));
    Calendar endDate = Calendar.getInstance();
    endDate.add(Calendar.YEAR, 120);

    horizontalCalendar = new HorizontalCalendar.Builder(this, R.id.calendarView)
            .startDate(startDate.getTime())
            .endDate(endDate.getTime())
            ...

but what's the largest range this library support?

Incorrect date selection for custom layout

Bugs:
In the application, I set my own layout, instead of the default. (By creating a layout with the same name in the layout directory: https://developer.android.com/studio/write/add-resources.html#resource_merging )
In this layout I set the width to 60dp and ran it on a device with a resolution of 480x800. I record the video: RecordWithLogs.zip

Expected Behavior / Goal

Central date selected

Actual Behavior

The date was chosen after the central one.

Steps to Reproduce the Problem (sample code if possible)

  1. Set you own layout in your project (not Horizontal-Calendar library) with some width
  2. Try to select date

Specifications

  • Android Version: 23
  • Screen size: 480x800 hdpi
  • Horizontal-Calendar Version: 1.1.8

How can i fix next date is default selection?

@Mulham-Raee

final Calendar defaultDate = Calendar.getInstance();
defaultDate.add(Calendar.MONTH, -1);
defaultDate.add(Calendar.DAY_OF_WEEK, +3);

horizontalCalendar.post(new Runnable() {
@OverRide
public void run() {
Log.i("MainActivity", "defaultDate "+defaultDate.getTime());
horizontalCalendar.selectDate(defaultDate.getTime(), true);
}
});

But response is two date is selected. How can i fix this issue?
Reason :
int selectedItemPosition = horizontalCalendarView.getPositionOfCenterItem();
Current Date & Default Date 1st time loading centerItemPostion.

ScreenShot

Can i disable the month to be displayed

@Mulham-Raee, I have the current month being displayed on the toolbar and in the library the month name above every date becomes redundant, can i remove it without adopting the library. If youd could provide this option as for date and day, it would be of great help

Change month selection place

Expected Behavior / Goal

I need to change month selection place , it should be either on right side or left side rather than top. Something like attached screenshot.

snap

Cannot select the dates first dates.

Hi,

Great work!!!

Issue observed :
I cannot select the dates that are displayed starting.
eg : If date range is from Jan 22nd to Feb 28th, when the screen loads, by default selected date is Jan 24th and i cannot make clicks on dates Jan 22nd and Jan 23rd.

Regards,
Titto Jose.

Is there a way to highlight particular dates in the tabs?

I was wondering if there is a way to use some markers or such thing to highlight a particular date, such as when the user has events on that date? For example, I would like to achieve something of this sort with the calendar (look at the right screen):

alt tag

Is there a way to customize the calendar to achieve that?

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.