roomorama / caldroid Goto Github PK
View Code? Open in Web Editor NEWA better calendar for Android
License: Other
A better calendar for Android
License: Other
Hello,
I'm making photo app, but I'm stuck with a thing that goes like this: when You click on the date I want it to open new activity (or whatever needs to be opened) where You can take a picture of a day and set that picture as a background of that date - just like here: https://play.google.com/store/apps/details?id=pl.pawelbialecki.a365photoapp
Simply put: just want to copy the app above and enhance it with tweaks that I think will be a great feature.
I'm programming Android like for 2 months with no prior experience so please keep it simple :) Thank You in advance for helping out!
When the calendar is viewed as a dialog, on rotation it moves to the next the month. It seems the DatePageChangeListener refreshAdapters is being called each time it rotates causing it to move to the next month.
Hi there. Caldroid is great, will highly recommend it. I have a question. I want to grab 12 images of the calendar, one for each of the last 12 months. This is invisible to the user and the calendar isn't shown while this happens.
My code to generate the image is as follows:
public ByteArrayOutputStream getImage() {
myCalendarView.setBackgroundColor(Color.WHITE);
myCalendarView.layout(0, 0, 700, 700);
myCalendarView.buildDrawingCache();
Bitmap b = calendarView.getDrawingCache();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
b = Bitmap.createScaledBitmap(b, 400, 400, true);
b.compress(Bitmap.CompressFormat.JPEG /* FileType */, 100 /* Ratio */,
stream);
myCalendarView.setBackgroundColor(Color.TRANSPARENT);
myCalendarView.destroyDrawingCache();
return stream;
}
Then I loop through the last 12 months like this
for (int i = 0; i < months; i++) {
ByteArrayOutputStream stream = getImage();
Image graph = Image.getInstance(stream.toByteArray());
graph.setAbsolutePosition(xRows, (pdfHeight - topOffset - 550)
- (i * 500));
document.add(graph);
now.addMonths(-1);
calendarFrag.moveToDateTime(now.toDateTime());
Thread.sleep(10);
}
(I know sleeping the main thread is not good, but otherwise the image gets grabbed half way between transitions on the month change on the calendar).
This works fine for the current month and the month before, bet any month before that shows blank. I guess this is to do with the buffered page viewer having one month either side buffered, however I have looked and cannot for the life of me work out what is wrong.
If you have any ideas that would be great.
Thanks!
Simon
I have been using the caldroid in my app, so i need to change the height of calendar. how is it possible? Because i didn't see anywhere the size and other specifies.
There is a second license file located here.
Caldroid/src/com/antonyt/infiniteviewpager/LICENSE.txt.
I tried the custom cell view for Date Grid. While clicking on the Date cell gives an ANR.
While checking the log there is a problem in casting the type View type to Textview in the onItemClickListener. Please fix it
Change "LUN. MAR. MER. JEU. VEN. SAM. DIM." color, change arrows and red_border without editing the lib itself.
Thanks for sharing this great piece of work.
I wanted to use the dialog fragment without any title so I modified CaldroidFragment to this:
String dialogTitle = args.getString("dialogTitle");
if (dialogTitle != null) {
getDialog().setTitle(dialogTitle);
} else {
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
}
...which makes sense for me, because if I don't provide a title, I probably won't have an empty title bar displayed.
Just a note to anyone that may come across it, if you are using the HoloEverywhere library with this, make sure that the Caldroid library comes before the HoloEverywhere library or else you will get some strange layout errors and crashes. Not sure if it was exclusive to me, but it may be beneficial to other developers who cannot find this issue.
I am loading the calender firstly, then on call of onMonthChange function, I am fetching data (which is basically a count for each day) through Json in asynctask. Thereafter, I have to update the view with count for each day. To do that I am calling notifydatasetchanged in postExecute of the AsynTask.
However, notifydatasetchanged doesn't update view for all months. The pattern is somethign like this:
For example- if we load any month from January, February, or March, view of February is only updated. Then on opening April, no view is updated. Then on calling May, June, or July only view of June is updated each time. This pattern get repeated.
I need to know if I am wrong in calling notifydatasetchanged...Is there any other function I need to call for this purpose?
Is it possible to add a gradient or several colors for one day? I am using to mark holidays blue but there may be a different color from another brand and overlap.
On the other hand, I am implementing a DrawerLayout and get stuck half second it is barely noticeable but it is annoying, I've tried everything but I can not be fluid.
Hello Sir,
I Have followed the procedure to setup the application and i successfully seted up. The problem is when i run the application in my log its showing Null Pointer exception. I don't know whats happening. Can you please guide me regarding this issue.
Thanxs
Hello,
Is it possible to define for each cell (day), a different background color ?
For example, I would like to have the 01/07 green, 02/07 red, 03/07 pink, etc ...
Thank you !
I've been mading changes to calendar_view.xml and noticed that seting padding or margin (left or right) any of the parent layout that hold InfiniteViewPager causes app to loop somewhere.
I'm attempting to use the Caldroid library, and have added all the source files to my current project. However, upon deployment, I receive a fatal error every time I try to show a calendar (using the CaldroidFragment).
The error is java.lang.NoClassDefFoundError: com.caldroid.R$layout
at com.caldroid.CaldroidFragment.onCreateView(CaldroidFragment.java:683).
Does anyone know of a possible fix? I can provide any other info if needed.
Thanks.
When i am trying to Customize calendar in dialog view its throwing java.lang.NullPointerException at
com.caldroid.CaldroidFragment.setEnableSwipe(CaldroidFragment.java:569)
Would it be possible for you to implement swipe left and right to change the month?
I need to change that red color into black,How to use that methods leftarrow and right arrow, also i need to do one background image for month name?
Currently using the FragmentDialog version of the Calendar and on rotation the calendar view pager disappears on rotation. Has anyone seen this issue and no the solution?
do you intend to make it possible?
The 2 red arrows on top left and right are sometimes not responding well and seem to cancel the touch event.
This happens when pressing these buttons repeatedly & sometimes when just using it for regular switching.
In CaldroidSample, on changing to landscape mode, the "Customize" and "Show Dialog" button disappear. So I added a scroll view to the whole layout. But after doing so, the calendar grid is no longer visible. Although the calendar arrow and date can be seen, the date grid is vanished. (the buttons are visible). So how to handle the grid when mode is changed to landscape?
first i inject an arraylist by extraData to CaldroidGridAdapter, and then i get the arraylist in getView function of CaldroidGridAdapter to Iterate through this arraylist, checking whether current date is in the arraylist, but it always causes Null Pointer Exception.am i doing something wrong because i can inject simple string but arraylist seems not work, please help
Hi I understand there is a CaldroidListener for program to listen to long tap and single tap. This is good but I am wondering can we have a programmatically feature? That is in Android view we have the performClick() method. This allow us to simulate a click on the view programmatically.
So I am requesting for something similar for Caldroid but maybe to programmatically performClick(Date t) and performLongClick(Date t). Then internally it will trigger the existing CaldroidListener methods.
Thanks.
Hi, how can I remove free gray space at the bottom of calendar? Thanks in advance.
Hi, I'm trying to highlight certain dates in Caldroid and i'm using a HashMap and A custom Function for parsing a String into a Date variable .. But, it is not working .. What have i done wrong here ?
// CUSTOM FUNCTION FOR PARSING STRING TO DATA
public Date ParseDate(String date_str)
{
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy");
Date dateStr = null;
try {
dateStr = formatter.parse(date_str);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return dateStr;
}
// SETTING THE BACKGROUND
// Create a hash map
HashMap hm = new HashMap();
// Put elements to the map
hm.put(ParseDate("Jun 14 2013"), R.color.blue);
hm.put(ParseDate("Jun 16 2013"), R.color.green);
hm.put(ParseDate("Jun 18 2013"), R.color.blue);
hm.put(ParseDate("Jun 20 2013"), R.color.green);
hm.put(ParseDate("Jun 22 2013"), R.color.blue);
if (caldroidFragment != null) {
caldroidFragment.setBackgroundResourceForDates(hm);
}
So, what is wrong here ?? Any help would be greatly appreciated ...
hi! i have a problem with your code... i have a fragment where i want to display your calendar... i tried from your wiki but it doesnt work... can you help me?
Hi I am a new user of Caldroid. I don't know if this is a bug but just want to list down something that does not seem to allow refresh.
HashMap<Date, Integer> map = new HashMap<Date,Integer>();
//put in values etc
m_fragCaldroid.setBackgroundResourceForDates(map);
m_fragCaldroid.refreshView();
Upon calling refreshView below error occurs
org.joda.time.IllegalFieldValueException: Value -1 for monthOfYear must be in the range [1,12]
Trace to below code in refreshView method
// Refresh title view
monthTitleTextView.setText(new DateTime(year, month, 1, 0, 0, 0, 0)
.monthOfYear().getAsText().toUpperCase()
+ " " + year);
Basically I am calling setBackgroundResourceForDates for different map so I want to re-use the Caldroid fragment by doing a refresh every time I set a new map. Is this supported or whenever I change the map, I need to instantiate a new Caldroid fragment ?
Hello,
I have a Navigation Drawer in my app : http://developer.android.com/training/implementing-navigation/nav-drawer.html
But when I want to include Caldroid with the android-support-v4 library a conflict these imports are no more resolved in my app:
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
So can I replace the android-support-v4 library in Caldroid with the new version 13 of Google?
I'm building a a calendar with 3 kinds of cell, normal cells, cells with price and cells with amount in percentage (see the picture).
I added an ArrayList of my cells, order by date in the Adapter.
It's working fine for the selected month, but when i change the month the method getNewDatesGridAdapter is called and i can't figure how to use my array to build the display.
Very interesting library, only maven support is missing, here is good example how to do it:
https://github.com/square/android-times-square
When i change the orientation from Portrait to landscape and then landscape to portrait,
another calendar view gets added at the bottom of the previous view.
To select the first day of week can be useful, depends on the country
Given I add the CaldroidFragment into an existing fragment, I will receive this error message:
java.lang.IllegalStateException: Can't retain fragements that are nested in other fragments
This is how I set things up:
@EFragment(R.layout.frg_analysis)
public class AnalysisFragment extends SherlockFragment {
@AfterViews
protected void setupView() {
CaldroidFragment caldroidFragment = new CaldroidFragment();
Bundle args = new Bundle();
Calendar cal = Calendar.getInstance();
args.putInt("month", cal.get(Calendar.MONTH) + 1);
args.putInt("year", cal.get(Calendar.YEAR));
caldroidFragment.setArguments(args);
FragmentTransaction t = getChildFragmentManager().beginTransaction();
t.add(R.id.containerCalendar, caldroidFragment);
t.commit();
}
}
Stackoverflow has some hints: http://stackoverflow.com/questions/14850573/cant-retain-nested-fragments .
Full stacktrace:
E/AndroidRuntime( 1763): java.lang.IllegalStateException: Can't retain fragements that are nested in other fragments
E/AndroidRuntime( 1763): at android.support.v4.app.Fragment.setRetainInstance(Fragment.java:742)
E/AndroidRuntime( 1763): at com.caldroid.CaldroidFragment.onCreate(CaldroidFragment.java:924)
E/AndroidRuntime( 1763): at android.support.v4.app.Fragment.performCreate(Fragment.java:1437)
E/AndroidRuntime( 1763): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:877)
E/AndroidRuntime( 1763): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
E/AndroidRuntime( 1763): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
E/AndroidRuntime( 1763): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
E/AndroidRuntime( 1763): at android.support.v4.app.Fragment.performStart(Fragment.java:1481)
E/AndroidRuntime( 1763): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:941)
E/AndroidRuntime( 1763): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
E/AndroidRuntime( 1763): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
E/AndroidRuntime( 1763): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
E/AndroidRuntime( 1763): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
E/AndroidRuntime( 1763): at android.os.Handler.handleCallback(Handler.java:725)
E/AndroidRuntime( 1763): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 1763): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1763): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 1763): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1763): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1763): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 1763): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 1763): at dalvik.system.NativeStart.main(Native Method)
To all those trying to make Caldroid work along with ActionbarSherlock (without any errors).
Now, everything will work without any errors !
Hello.
First, Thank you so much for the great work what I ve been looking for, for many days.
I am a student, and studying android development beginner.
Could I ask how to store daily schedule with SQLite?
I ve tried to make an sqlite db and a column of date to integrate db with each date.
i.e. I want to make an input and saving daily record app, just like "Work Mate" app.
Please give me some hints.
Thank you.
Sincerely S.
Hi,
Tried to reproduce Roomorama's nice Availability page, with multiple, scrollable Caldroid fragments:
https://www.dropbox.com/s/0kpb8435ffv1psp/Screenshot_2013-08-26-18-17-53.png
If I add multiple Caldroid fragments to a LinearLayout that's fine, no problem at all. BUT if I embed it into a ScrollView, height will be messed, and I'll get this:
https://www.dropbox.com/s/g3ntnkrnr8shbbv/Screenshot_2013-08-26-17-57-54.png
Please let me know if you have any idea, or workaround.
Thank you!
E/AndroidRuntime(12198): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.candroidsample/com.candroidsample.CaldroidSampleActivity}: java.lang.ClassNotFoundException: Didn't find class "com.candroidsample.CaldroidSampleActivity" on path: /data/app/com.candroidsample-1.apk
i just run the download sample app, but ....
Hi, I am using CaldroidSampleCustomAdapter to customize cell layout. I am putting some text on few textview on few dates. It sets data fine, but when i scroll the layout it also sets the text on wrong grids which i don't want. Please check attached image to see the duplicate text on wrong grids. Can you please look into this issue? Because i find this tutorial very helpful and useful, so it can help others perfectly.
I am using Caldroid in my app Work Mate:
http://play.google.com/store/apps/details?id=com.michaelmcneildev.workmate
Thanks for the great work!
When refreshView() is called, caldroid updates the date cells for the previous, current and next month. This takes up around 2 seconds to get the dates and refresh. How about adding an extraData (HashMap) parameter inside refreshView() so that dates of some particular cells can be passed and then caldroid would take much less time to refresh these cells?
It would be wonderful if there was a method to change the gridview and date to the current day. I'm having a hard time implementing this with the new InfinePager.
I want to add numbers at the top left corner of the grid views when events are added for a particular date. How can i achieve this?
I'm injecting Caldroid fragment into my layout.Here is layout code:
<LinearLayout
android:id="@+id/left_page"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="35dp"
android:layout_marginLeft="75dp"
android:layout_marginRight="40dp"
android:layout_marginTop="35dp"
android:layout_weight="0.5"
android:orientation="vertical" >
</LinearLayout>
Calendar is properly stretched in width however takes ony like a half of the fragment height making me scroll.
Hello! At first thank you for great work. Now I will describe issue or maybe the feature which seems to be lack in your lib. I would like to see the way of quick switch between years not only months. So the user wont clik 12 times to get the year he expects.
Please guide me about this :)
I update the project today and now i can't retrieve ids and layouts from R, i don't understand why
JodaTime is great library, but I'm not sure if I want 0.5 MB library only because of datepicker :-(
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.