Code Monkey home page Code Monkey logo

weekcalendar's Introduction

I AM NOT WORKING ON THIS LIBRARY ANYMORE. I AM NOT VERY PROUD OF THEY WAY I WROTE THIS WIDGET 😁. I WOULD RECOMMEND TO USE CALENDAR AS A CUSTOM VIEW INSTEAD OF ADDING IT AS GRADLE DEPENDENCY. FORKS + PRS ARE WELCOME.



WeekCalendar is a library which provides a weekly calendar.

The sample project includes the usage of the library. Support for Android 4.0 and up.

Feel free to fork or issue pull requests on github. Issues can be reported on the github issue tracker.

Android Arsenal

Demo

Setup


Gradle
dependencies {
   compile 'noman.weekcalendar:weekcalendar:1.0.6'
}
Maven
<dependency>
  <groupId>noman.weekcalendar</groupId>
  <artifactId>weekcalendar</artifactId>
  <version>1.0.6</version>
</dependency>

Sample Usage


 <noman.weekcalendar.WeekCalendar
    android:id="@+id/weekCalendar"
    android:layout_width="match_parent"
    android:layout_height="65dp"
    android:background="@color/colorPrimary"/>

Theme the calendar

There are a few xml attributes to customise the calendar. If you feel that any customization option is missing, let me know.
  • numOfPages
  • daysTextSize
  • daysTextColor
  • daysBackgroundColor
  • weekTextSize
  • weekTextColor
  • weekBackgroundColor
  • selectedBgColor
  • todaysDateBgColor
  • todaysDateTextColor
  • dayNameLength
  • hideNames

Example
 <noman.weekcalendar.WeekCalendar
   android:id="@+id/weekCalendar"
   android:layout_width="match_parent"
   android:layout_height="65dp"
   android:background="@color/colorPrimary"
   app:numOfPages="150"
   app:dayNameLength="threeLetters"
   app:todaysDateBgColor="#ffffff"
   app:todaysDateTextColor="#000000"/>
Explained
  • numOfPages by default, calendar has 100 pages. You can scroll 49 to left and 49 to right. Using this attribute you can set number of pages. You can send it to 1000, it depends on requirements.
  • daysTextSize day means day of the month. By default text size is 17sp.
  • daysTextColor by default the day text color is set to be white.
  • daysBackgroundColor if you have colorPrimary attribute in color.xml, then the backgroud color will be that one. Otherwise the purple color shown in the demo.
  • weekTextSize week means day of the week,i.e (S,M,T ..). By default text size is 17sp.
  • weekTextColor by default the week day text color is set to be white.
  • weekBackgroundColor same as daysBackgroundColor
  • selectedBgColor By default, its color is set to be colorAccent, if you've that attribute in attribute in color.xml, then the backgroud color will be that one. Otherwise the pink color shown in the demo.
  • todaysDateBgColor todays date background color, same as selectedBgColor.
  • todaysDateTextColor todays date text color, by default the text color is set to be white.
  • dayNameLength week day name length, singleLetter means (S,M,T..) and threeLetters means (Sun, Mun, Tue..)
  • hideNames , set this attribute to hide name of week days.

Impelement Listener

`OnDateClickListener` returns `DateTime` object. `DateTime` is class available in Joda Time. I will recommend using this library if you are playing with date and time.
weekCalendar.setOnDateClickListener(new OnDateClickListener() {
        @Override
        public void onDateClick(DateTime dateTime) {
            Toast.makeText(MainActivity.this, 
            "You Selected " + dateTime.toString(), Toast.LENGTH_SHORT).show();
        }

    });

See the sample project for usage of methods like

  • reset()
  • moveToNext()
  • moveToPrevious()
  • setSelectedDate(DateTime)
  • setStartDate(DateTime)

Libraries Used


License


Copyright (c) 2015 Noman Rafique

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.

weekcalendar's People

Contributors

com2ghz avatar michel-t-86 avatar nomanr avatar sirajsumra 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

weekcalendar's Issues

WeekPager getting invisible with StickyHeaderListView

Hi,

I am trying to integrate WeekCalendar as header of StickyHeaderListView.

Its working fine as listview item but while scrolling and header gettting stick at top of listview, WeekCalendar getting invisible. Not able to see Dates of week.

Also tried with using getChildFragmentManager()

Help will be appreciated!!

Show month name

is there a way to show month name?
Otherwise library doesn't make sense as after swiping of a couple of weeks it's pretty much easy to get lost and figure out in which month you currently are

Localized short day name

Hi,

instead of hardcoded short day names, you can use dynamically loaded localized names. In WeekCalendar.java change String[] days = {...} to something like this:

// Get localized short names for days. Index 0 = empty string (always). Rest are name days starting with sunday
String[] weekDays = DateFormatSymbols.getInstance().getShortWeekdays();
// Convert into List
List<String> listDays = new ArrayList<>(Arrays.asList(weekDays));
// Remove empty string
listDays.remove(0);
// Remove Sunday from beginning
String sunday = listDays.remove(0);
// Add Sunday to the end of array
listDays.add(sunday);

// convert back into String[], or just use listDays
String[] days = new String[listDays.size()];
listDays.toArray(days);

On my Locale this will get array, where day names are two characters long, which is ok, they will fit in WeekView. But for example in English locale this will return day names three characters long and it's too long. So day names can be shortened like (before converting to String[]):

for (int i = 0; i < listDays.size(); i++) {
    listDays.set(i, listDays.get(i).substring(0, 1));
}

Hope this will help, keep up the good work, this View was exactly what I was looking for!

Unable to inflate it

Someone already seen this ?

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.app.android.yogowo, PID: 17193 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.android.yogowo/com.app.android.yogowo.Controllers.Main.Root}: android.view.InflateException: Binary XML file line #0: Error inflating class noman.weekcalendar.WeekCalendar at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class noman.weekcalendar.WeekCalendar at android.view.LayoutInflater.createView(LayoutInflater.java:633) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at com.app.android.yogowo.Controllers.Main.Feature.Calendar.View.onCreateView(View.java:57) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2261) at android.support.v4.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManager.java:1655) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1390) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1650) at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1906) at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3698) at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:350) at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39) at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.view.LayoutInflater.inflate(LayoutInflater.java:365) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378) at android.app.Activity.setContentView(Activity.java:2145) at com.app.android.yogowo.Controllers.Main.Root.onCreate(Root.java:393) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)  at android.app.ActivityThread.access$800(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.view.LayoutInflater.createView(LayoutInflater.java:607) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)  at android.view.LayoutInflater.inflate(LayoutInflater.java:504)  at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  at com.app.android.yogowo.Controllers.Main.Feature.Calendar.View.onCreateView(View.java:57)  at android.support.v4.app.Fragment.performCreateView(Fragment.java:2261)  at android.support.v4.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManager.java:1655)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1390)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1650)  at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1906)  at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3698)  at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)  at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:350)  at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39)  at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.inflate(LayoutInflater.java:504)  at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  at android.view.LayoutInflater.inflate(LayoutInflater.java:365)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)  at android.app.Activity.setContentView(Activity.java:2145)  at com.app.android.yogowo.Controllers.Main.Root.onCreate(Root.java:393)  at android.app.Activity.performCreate(Activity.java:5990)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)  at android.app.ActivityThread.access$800(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  Caused by: java.lang.ClassCastException: com.app.android.yogowo.Controllers.Main.Root cannot be cast to android.support.v7.app.AppCompatActivity at noman.weekcalendar.view.WeekPager.initPager(WeekPager.java:54) at noman.weekcalendar.view.WeekPager.initialize(WeekPager.java:47) at noman.weekcalendar.view.WeekPager.<init>(WeekPager.java:38) at noman.weekcalendar.WeekCalendar.init(WeekCalendar.java:6

Proguard Rules for this library

Hello, need proguard rules for this library.Searched extensively & found these rules
-dontwarn org.joda.convert.**
-dontwarn org.joda.time.**
-keep class org.joda.time.** { ; }
-keep interface org.joda.time.
* { *; }

but when applied and when on tapping on date in weekCalendar view the selected date is not encircled.Any solution?

Preview pane error: BridgeContext cannot be cast to android.support.v7.app.AppCompatActivity

Getting this error on Android Studio 1.5 preview pane:

Exception Details java.lang.ClassCastException: com.android.layoutlib.bridge.android.BridgeContext cannot be cast to android.support.v7.app.AppCompatActivity   at noman.weekcalendar.view.WeekPager.initPager(WeekPager.java:54)   at noman.weekcalendar.view.WeekPager.initialize(WeekPager.java:47)   at noman.weekcalendar.view.WeekPager.<init>(WeekPager.java:38)   at noman.weekcalendar.WeekCalendar.init(WeekCalendar.java:69)   at noman.weekcalendar.WeekCalendar.<init>(WeekCalendar.java:49)   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)   at android.view.LayoutInflater_Delegate.rInflate

app:todaysDateTextColor not found

app:todaysDateTextColor not found in "noman.weekcalendar.WeekCalendar"

Dependency "noman.weekcalendar:weekcalendar:1.0.6"
compileSdkVersion 28

java.lang.RuntimeException: Fragment is not currently in the FragmentManager

Hi.

After entering the activity containing the view for the first time, all methods (reset, setSelected, etc) work as they should, but after leaving the activty (i.e activity is finished) and then opening same activity again (new instance) and using WeekCalendar methods the following RuntimeException is thrown:

Unable to start activity : java.lang.RuntimeException: Could not dispatch event: class noman.weekcalendar.eventbus.Event$ResetEvent to handler [EventHandler public void noman.weekcalendar.view.WeekPager.reset(noman.weekcalendar.eventbus.Event$ResetEvent)]: Fragment WeekFragment{3a871760} is not currently in the FragmentManager

Any idea how to solve this?
Thanks in advance.

Crash

Crash in android 4.4.2
FATAL EXCEPTION: main
Process: br.com.iclinic.debug, PID: 19043
java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
at android.widget.GridView.onMeasure(GridView.java:1046)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16772)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:610)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:677)
at android.view.View.measure(View.java:16772)
at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:940)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2294)
at android.view.View.measure(View.java:16772)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1936)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1133)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1315)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1020)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5762)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:771)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:757)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)

Another starting day

Hi! Great work!

Would it be possible to start with a day of choice and display seven further days?

Feature request: Set the selected date by code

Hi.
I would love it if there was a way to set the selected date of WeekCalendar programatically with a method, in a fashion similiar to the reset method. Maybe with a LocalDate or DateTime as parameter?

About week count of year

May you to increase the following functions, thanks

  1. Current show data, can show the week count of current year ?

  2. According to the select week count,then show the data ?

Not a best library to add in Fragment or ViewPager

Although it is the best library so far for showing weekly calendar. But it is not the best one when you're using Fragment and showing via ViewPager. When you switch between fragments, the calendar won't show data.

add day from sunday

can not start with sunday view like how to start of the week day from sunday
Sun Mon Tue .. so on

RuntimeException, Fragment not in fragment manager

Happens on a Nexus 6s. The extent of the information I can get.

java.lang.RuntimeException: Unable to resume activity {MainActivity}: java.lang.RuntimeException: Could not dispatch event: class noman.weekcalendar.eventbus.Event$SetSelectedDateEvent to handler [EventHandler public void noman.weekcalendar.view.WeekPager.setSelectedDate(noman.weekcalendar.eventbus.Event$SetSelectedDateEvent)]: Fragment WeekFragment{78b5676} is not currently in the FragmentManager
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3103)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
    at android.app.ActivityThread.-wrap11(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5422)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.RuntimeException: Could not dispatch event: class noman.weekcalendar.eventbus.Event$SetSelectedDateEvent to handler [EventHandler public void noman.weekcalendar.view.WeekPager.setSelectedDate(noman.weekcalendar.eventbus.Event$SetSelectedDateEvent)]: Fragment WeekFragment{78b5676} is not currently in the FragmentManager
    at com.squareup.otto.Bus.throwRuntimeException(Bus.java:460)
    at com.squareup.otto.Bus.dispatch(Bus.java:387)
    at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:368)
    at com.squareup.otto.Bus.post(Bus.java:337)
    at noman.weekcalendar.eventbus.BusProvider.post(BusProvider.java:26)
    at noman.weekcalendar.WeekCalendar.setSelectedDate(WeekCalendar.java:165)
    at passio.fastfooddiary.MainActivity.onResume(MainActivity.java:349)
    at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1258)
    at android.app.Activity.performResume(Activity.java:6327)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)
    ... 10 more
Caused by: java.lang.IllegalStateException: Fragment WeekFragment{78b5676} is not currently in the FragmentManager
    at android.support.v4.app.FragmentManagerImpl.saveFragmentInstanceState(FragmentManager.java:687)
    at android.support.v4.app.FragmentStatePagerAdapter.destroyItem(FragmentStatePagerAdapter.java:136)
    at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:418)
    at noman.weekcalendar.view.WeekPager.initPager(WeekPager.java:56)
    at noman.weekcalendar.view.WeekPager.setSelectedDate(WeekPager.java:102)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.squareup.otto.EventHandler.handleEvent(EventHandler.java:89)
    at com.squareup.otto.Bus.dispatch(Bus.java:385)
    ... 18 more

Selected Background

Hey,

There are one issue which i am facing now , i am not able to change background of selected date ,it's only show circle on it .

java.lang.RuntimeException: Could not dispatch event

I am facing the following issue sometimes:

Fatal Exception: java.lang.RuntimeException: Could not dispatch event: class noman.weekcalendar.eventbus.Event$SetSelectedDateEvent to handler [EventHandler public void noman.weekcalendar.view.WeekPager.setSelectedDate(noman.weekcalendar.eventbus.Event$SetSelectedDateEvent)]: Fragment WeekFragment{426ab190} is not currently in the FragmentManager
at com.squareup.otto.Bus.throwRuntimeException(Bus.java:460)
at com.squareup.otto.Bus.dispatch(Bus.java:387)
at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:368)
at com.squareup.otto.Bus.post(Bus.java:337)
at noman.weekcalendar.eventbus.BusProvider.post(BusProvider.java:26)
at noman.weekcalendar.WeekCalendar.setSelectedDate(WeekCalendar.java:165)
at com.kwench.android.kfit.ui.SleepFragment$1$1.onDateSet(SleepFragment.java:147)
at android.app.DatePickerDialog.tryNotifyDateSet(DatePickerDialog.java:148)
at android.app.DatePickerDialog.onClick(DatePickerDialog.java:116)
at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5345)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.IllegalStateException: Fragment WeekFragment{426ab190} is not currently in the FragmentManager
at android.support.v4.app.FragmentManagerImpl.saveFragmentInstanceState(FragmentManager.java:687)
at android.support.v4.app.FragmentStatePagerAdapter.destroyItem(FragmentStatePagerAdapter.java:136)
at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:418)
at noman.weekcalendar.view.WeekPager.initPager(WeekPager.java:56)
at noman.weekcalendar.view.WeekPager.setSelectedDate(WeekPager.java:102)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.squareup.otto.EventHandler.handleEvent(EventHandler.java:89)
at com.squareup.otto.Bus.dispatch(Bus.java:385)
at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:368)
at com.squareup.otto.Bus.post(Bus.java:337)
at noman.weekcalendar.eventbus.BusProvider.post(BusProvider.java:26)
at noman.weekcalendar.WeekCalendar.setSelectedDate(WeekCalendar.java:165)
at com.kwench.android.kfit.ui.SleepFragment$1$1.onDateSet(SleepFragment.java:147)
at android.app.DatePickerDialog.tryNotifyDateSet(DatePickerDialog.java:148)
at android.app.DatePickerDialog.onClick(DatePickerDialog.java:116)
at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5345)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(NativeStart.java)

Add an OnWeekChangeListener

It would be beneficial if we could add an OnWeekChangeListener so we could do stuff like setting month and year on a TextView or change colors etc

Enable scroll only for current month.

How to enable scroll for only current month?

Is there any method to set numOfPages programatically?This is in xml wayapp:numOfPages="150".

Support custom background between two date, as the Date Range Bar?This is just as the sample.
screen shot 2016-10-04 at 4 45 17 pm

view gets detached from the window when a date is clicked

weekCalendar.setOnDateClickListener(new OnDateClickListener() {
@OverRide
public void onDateClick(DateTime dateTime) {
// I hit my server to fetch few data
}
});

When I do this view gets detached from the window by calling
@OverRide
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
BusProvider.disposeInstance();
}

No further on clicks or action happens

Issue in Current Gradle dependency project

Current Gradle dependency is version 1.0.6. In this version the week change listener is not updated. I am unable to access the WeekChangeListener. Is there any updated version code for the same?

Please update the Documentation for this issue. OnWeekChangeListener is not updated in 1.0.6.

Manifest merger fails due to duplicate application theme attribute in AndroidManifest

Error:(10, 9) Attribute application@allowBackup value=(false) from AndroidManifest.xml:10:9
Error:(13, 9) Attribute application@theme value=(@style/TokeniserTheme) from AndroidManifest.xml:13:9
is also present at noman.weekcalendar:weekcalendar:1.0.6:15:9 value=(@style/AppTheme)
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:9:5 to override

invisible day number

when open another fragment then back to fragment that contain calendar found the day number invisible must swipe to view again ???

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.