traex / calendarlistview Goto Github PK
View Code? Open in Web Editor NEWImplementation of a calendar in a ListView. One month by row
License: MIT License
Implementation of a calendar in a ListView. One month by row
License: MIT License
I'm getting a build failure after adding this library, adding tools:replace="android:icon" to my manifest doesn't fix it. Any ideas?
/Users/myapp/Documents/myapp-mobile-android/app/src/main/AndroidManifest.xml
Warning:(24, 5) application@android:icon was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present
:app:fabricGenerateResourcesDebug
:app:jrebelPinDebugResids
:app:processDebugResources
/Users/myapp/Documents/myapp-mobile-android/app/build/intermediates/res/debug/drawable-hdpi-v4/ic_launcher.png: error: Duplicate file.
/Users/myapp/Documents/myapp-mobile-android/app/build/intermediates/res/debug/drawable-hdpi/ic_launcher.png: Original is here. The version qualifier may be implied.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/myapp/Library/Android/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1
08-05 18:07:26.343 12953-12953/? I/art﹕ Late-enabling -Xcheck:jni
08-05 18:07:26.367 12953-12963/? I/art﹕ Debugger is no longer active
08-05 18:07:26.401 12953-12953/? W/System﹕ ClassLoader referenced unknown path: /data/app/com.example.zhaowencong.calenderdemo-1/lib/arm
08-05 18:07:26.486 12953-12982/? D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
08-05 18:07:26.551 12953-12982/? I/Adreno﹕ QUALCOMM build : 4436883, Iff6937fcf5
Build Date : 06/04/15
OpenGL ES Shader Compiler Version: E031.26.00.02
Local Branch : master-M5
Remote Branch :
Remote Branch :
Reconstruct Branch :
08-05 18:07:26.553 12953-12982/? W/Adreno-GSL﹕ <gsl_device_getinfo_ext:1163>: Requested extened device info; but it isn't supported
08-05 18:07:26.561 12953-12982/? I/OpenGLRenderer﹕ Initialized EGL, version 1.4
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
08-05 18:07:26.562 12953-12982/? I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
Hi,
Thanks for the post.
I observed that Arabic language layout is not supported. How can we update the code to support Arabic language?
There is only getMaxYear() interface to select year. But i want select month.
/Layout:
<com.andexert.calendarlistview.library.DayPickerView
android:id="@+id/pickerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
calendar:drawRoundRect="true" />
Activity Class:
package com.example.enny.agendando.ui.activities;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import com.andexert.calendarlistview.library.DayPickerView;
import com.andexert.calendarlistview.library.SimpleMonthAdapter;
import com.example.enny.agendando.R;
public class SelectDateActivity extends Activity implements com.andexert.calendarlistview.library.DatePickerController {
private DayPickerView dayPickerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_date);
dayPickerView = (DayPickerView) findViewById(R.id.pickerView);
dayPickerView.setController(this);
}
@Override
public int getMaxYear() {
return 2015;
}
@Override
public void onDayOfMonthSelected(int year, int month, int day) {
Log.e("Day Selected", day + " / " + month + " / " + year);
}
@Override
public void onDateRangeSelected(SimpleMonthAdapter.SelectedDays<SimpleMonthAdapter.CalendarDay> selectedDays) {
Log.e("Date range selected", selectedDays.getFirst().toString() + " --> " + selectedDays.getLast().toString());
}
}
Why can't I find the method getMinYear() and how can I set the minium year?
@traex
Running sample shows an empty screen. 😢
The issue is in the title (http://www.timeanddate.com/calendar/custom.html?year=2016&country=1&hol=25&df=1). I'm getting the same error for February 2020 and 2024.
Below my code:
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.widget.TextView;
import com.andexert.calendarlistview.library.DayPickerView;
import com.andexert.calendarlistview.library.SimpleMonthAdapter;
public class Calendar extends AppCompatActivity implements com.andexert.calendarlistview.library.DatePickerController{
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.calendar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_layout);
TextView mTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
mTitle.setText("Calendar");
setSupportActionBar(toolbar);
assert getSupportActionBar() != null;
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
this.getSupportActionBar().setDisplayShowTitleEnabled(false);
DayPickerView dayPickerView = (DayPickerView)findViewById(R.id.pickerView);
dayPickerView.setController(this);
}
@Override
public int getMaxYear()
{
return 2026;
}
@Override
public void onDayOfMonthSelected(int year, int month, int day)
{
Log.e("Day Selected", day + " / " + month + " / " + year);
}
@Override
public void onDateRangeSelected(SimpleMonthAdapter.SelectedDays<SimpleMonthAdapter.CalendarDay> selectedDays)
{
Log.e("Date range selected", selectedDays.getFirst().toString() + " --> " + selectedDays.getLast().toString());
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
Hi, I notice one thing which is probably related to days count in February when it is not leap year.
For instance February 2015 ends with Sunday 29th and March begins with Sunday 1st. First thing was that March should start with Monday 1st but 2015 is not leap year so February should ends with Saturday 28th.
P.S. I have screenshot by I don't know how to attach it here.
UPD:
CalendarUtils
class contains line:
return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 28 : 29;
which means that leap year contain 28 and regular 29 days.
Just switch 28 and 29 like this
return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28;
I set get Max Year to 2017 and leave the rest the same as the sample.
The app is crashing with error:
java.lang.UnsupportedOperationException: Can't convert value at index 9 to dimension: type=0x12 at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:737) at com.andexert.calendarlistview.library.SimpleMonthView.<init>(SimpleMonthView.java:146) at com.andexert.calendarlistview.library.SimpleMonthAdapter.onCreateViewHolder(SimpleMonthAdapter.java:63) at com.andexert.calendarlistview.library.SimpleMonthAdapter.onCreateViewHolder(SimpleMonthAdapter.java:39) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6487) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5674) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5557) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5553) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2229) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1556) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1516) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:608) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3693) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3410) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3962) at android.view.View.layout(View.java:18804) at android.view.ViewGroup.layout(ViewGroup.java:5951) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079) at android.view.View.layout(View.java:18804) at android.view.ViewGroup.layout(ViewGroup.java:5951) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:18804) at android.view.ViewGroup.layout(ViewGroup.java:5951) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:18804) at android.view.ViewGroup.layout(ViewGroup.java:5951) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:887) at android.view.View.layout(View.java:18804) at android.view.ViewGroup.layout(ViewGroup.java:5951) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2655) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2371) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7098) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927) at android.view.Choreographer.doCallbacks(Choreographer.java:702) at android.view.Choreographer.doFrame(Choreographer.java:638) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1534) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1424)
unable to change background color of current day working from one week does not find solution
Hi,
I am using Eclipse version Mars.1 while using am always getting error and app force close. The error am getting is :
android.view.InflateException: Binary XML file line #8: Error inflating class com.andexert.calendarlistview.library.DayPickerView
Caused by: java.lang.ClassNotFoundException: com.andexert.calendarlistview.library.DayPickerView.
Please help me to sort this out.
This may just be a personal preference, but I think the method setmController should be renamed to remove the "m".
Hi,
I am trying to change your code to achieve something that I want but unfortunately things are not going in the right direction. I have an ArrayList and all i want is to highlight the calendar list dates based on the data in the list i.e I don't want any ranges. Can you please help me out..?
If you select the last day, then select the first day when you get the range of selected days it reports the last day in the range as the first and the first day in the range as the last. It should probably have logic to return the chronological first and chronological last.
Hello,
how to add this calendar to Fragment.
Can you show me.
thank u.
Steps to Reproduce
Issue Faced : None of the dates in year 2017 is hi-lighted
When I import the project and run the sample but the activity show none
I hope I can use this library at sdk version 10(eg, Android 2.3.3)
Hi,
I wanna if is possible that calendar dont use the implementation of onDateRangeSelected, because i need just select a day.
When selecting days across or within month (e.g. from 1 January to 31 January, or 1 January to 1 February), the selected days respects the DaySelectedBackgroundColor that I specified.
However, when selecting days across years (e.g. from 30 Dec 2015 to 10 January 2016), the selected days does not respect my DaySelectedBackgroundColor. The font is changes color but the background doesnt do that.
unable to change the background color or background shape of selected date
According to the docs TypedArray should be recycled when finished with.
http://developer.android.com/reference/android/content/res/TypedArray.html
This doesn't seem to be happening within the library.
i download the demo but the sample doesn'have data , would i miss something?
Hi,I downloaded run the sample app, It is not displaying anything only empty screen.What I am missing.
How do i display next month and previous month dates to fill up the gaps for the empty spaces in the current month.
Can provide the method of setMinYear,so we can set the min year we want to show. now it can only show the month which is bigger than current month.
The default mode of the view is to have select multiple dates or a date range but i want only one selectable date.
The GitHub demo is not displaying Calendar. It is not giving any error or exceptions. I am using Android 4.3.
The following classes could not be instantiated:
java.lang.UnsupportedOperationException: Unsupported Service: accessibility
at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:465)
at android.support.v7.widget.RecyclerView.(RecyclerView.java:290)
at com.example.caledarlistlib.DayPickerView.(DayPickerView.java:28)
at com.example.caledarlistlib.DayPickerView.(DayPickerView.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java:-2)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:438)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:190)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
Hi!
How to set limitation for date range? Is it passible?
How can Add Events in Calendar as well as How can I display Event using Webserivices(JsonData) on Calendar.
Hey guys,
I downloaded the sample and attempted to integrate this view into my project but I cannot actually see the view. Is this a styling thing?
Please advise.
If I extend the DayPickerView with a view to overriding the setAdapter method, I can't provide my own adapter as the mController and typedArray attributes are private, so I have no way of accessing them to pass to my own adapter.
The new first/lastMonth attributes in XML can only be set to know values e.g. March. How can I set it to the current month?
There doesn't seem to be an API callback that lets me know when a date range has been selected. I can see in the controller that there is a callback when a date is selected, but internally this could be the firstDate or lastDate which will be populated into selectedDays.
Apart from constantly checking if first != null && last != null, how can I know when a range is available?
How can I change the background color of the selected dates in a range so that they look like the selected day with circle or square background instead of only text color?
when I set the LinearLayoutManager to Horizontal, then calendar does not show any more,is anything go wrong?
Hi,
If I set the getMaxYear to 2015 and only use the default flags then the calendar shows dates from January 2014 (current year) to December 2015, which is what I'd expect.
However, if I then apply the startCurrentMonth = true in my XML file, the calendar starts with November 2014 as expected, but the end of the calendar is now October 2016!! I'd have expected the end date to remain the same as before (December 2015).
I'm using v1.1.2.
Thanks,
Andy.
According to wikipedia the following logic should be used to calculate leap years.
if (year is not divisible by 4) then (it is a common year)
else
if (year is not divisible by 100) then (it is a leap year)
else
if (year is not divisible by 400) then (it is a common year)
else (it is a leap year)
The CalendarUtils doesn't take into account the 100 and 400 year special conditions.
I set the getMaxYear() to 2415
When 2415 comes, it will not show up anymore, but this will not be my business.
However, just asking, why did you need to implement such a method?
Is it possible to disable dates and also those dates will not be selected during selecting range?
It would be nice to be able to specify the minimum range for selection (e,g,. 2 days) as well as a maximum selection (e.g. 21 days). Or it would be nice to at least have a flag for whether same day should be allowed (i.e. don't allow a range of 1 - require at least two different days to be selected).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.