kandi background
Explore Kits

Android-Week-View | Android Week View is an android library | Calendar library

 by   alamkanak Java Version: parent-1.2.6 License: Apache-2.0

 by   alamkanak Java Version: parent-1.2.6 License: Apache-2.0

Download this library from

kandi X-RAY | Android-Week-View Summary

Android-Week-View is a Java library typically used in User Interface, Calendar applications. Android-Week-View has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • Android-Week-View has a medium active ecosystem.
  • It has 3320 star(s) with 1175 fork(s). There are 154 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 171 open issues and 303 have been closed. On average issues are closed in 305 days. There are 19 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of Android-Week-View is parent-1.2.6
Android-Week-View Support
Best in #Calendar
Average in #Calendar
Android-Week-View Support
Best in #Calendar
Average in #Calendar

quality kandi Quality

  • Android-Week-View has 0 bugs and 0 code smells.
Android-Week-View Quality
Best in #Calendar
Average in #Calendar
Android-Week-View Quality
Best in #Calendar
Average in #Calendar

securitySecurity

  • Android-Week-View has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • Android-Week-View code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
Android-Week-View Security
Best in #Calendar
Average in #Calendar
Android-Week-View Security
Best in #Calendar
Average in #Calendar

license License

  • Android-Week-View is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
Android-Week-View License
Best in #Calendar
Average in #Calendar
Android-Week-View License
Best in #Calendar
Average in #Calendar

buildReuse

  • Android-Week-View releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • Android-Week-View saves you 871 person hours of effort in developing the same functionality from scratch.
  • It has 1994 lines of code, 173 functions and 20 files.
  • It has high code complexity. Code complexity directly impacts maintainability of the code.
Android-Week-View Reuse
Best in #Calendar
Average in #Calendar
Android-Week-View Reuse
Best in #Calendar
Average in #Calendar
Top functions reviewed by kandi - BETA

kandi has reviewed Android-Week-View and discovered the below as its top functions. This is intended to give you an instant insight into Android-Week-View implemented functionality, and help decide if they suit your requirements.

  • Draw the header row and events .
  • Handles month change events .
  • Initializes the view .
  • Called when an option is selected .
  • Splits a WeekViewEvent into two Lists .
  • cast event to a week view event
  • Set the date time interpreter .
  • Set the activity to create an instance .
  • Compares the specified WeekViewEvent .
  • Returns today .

Android-Week-View Key Features

Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.

default

copy iconCopydownload iconDownload
* Week view calendar
* Day view calendar
* Custom styling
* Horizontal and vertical scrolling
* Infinite horizontal scrolling
* Live preview of custom styling in xml preview window

Who uses it
---------------

* [Series Addict](https://play.google.com/store/apps/details?id=com.alamkanak.seriesaddict)
* Using the library? Just [tweet me](https://twitter.com/alamkanak) or [send me an email](mailto:alam.kanak@gmail.com).

Usage
---------

1. Import the library into your project.
  * Grab via maven

    ```xml
    <dependency>
      <groupId>com.github.alamkanak</groupId>
      <artifactId>android-week-view</artifactId>
      <version>1.2.6</version>
      <type>aar</type>
    </dependency>
    ```
  * Grab via gradle

    ```groovy
    compile 'com.github.alamkanak:android-week-view:1.2.6'
    ```
2. Add WeekView in your xml layout.

    ```xml
    <com.alamkanak.weekview.WeekView
            android:id="@+id/weekView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:eventTextColor="@android:color/white"
            app:textSize="12sp"
            app:hourHeight="60dp"
            app:headerColumnPadding="8dp"
            app:headerColumnTextColor="#8f000000"
            app:headerRowPadding="12dp"
            app:columnGap="8dp"
            app:noOfVisibleDays="3"
            app:headerRowBackgroundColor="#ffefefef"
            app:dayBackgroundColor="#05000000"
            app:todayBackgroundColor="#1848adff"
            app:headerColumnBackground="#ffffffff"/>
    ```
3. Write the following code in your java file.

    ```java
    // Get a reference for the week view in the layout.
    mWeekView = (WeekView) findViewById(R.id.weekView);

    // Set an action when any event is clicked.
    mWeekView.setOnEventClickListener(mEventClickListener);

    // The week view has infinite scrolling horizontally. We have to provide the events of a
    // month every time the month changes on the week view.
    mWeekView.setMonthChangeListener(mMonthChangeListener);

    // Set long press listener for events.
    mWeekView.setEventLongPressListener(mEventLongPressListener);
    ```
4. Implement `WeekView.MonthChangeListener`, `WeekView.EventClickListener`, `WeekView.EventLongPressListener` according to your need.

5. Provide the events for the `WeekView` in `WeekView.MonthChangeListener.onMonthChange()` callback. Please remember that the calendar pre-loads events of three consecutive months to enable lag-free scrolling.

    ```java
    MonthLoader.MonthChangeListener mMonthChangeListener = new MonthLoader.MonthChangeListener() {
        @Override
        public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
            // Populate the week view with some events.
            List<WeekViewEvent> events = getEvents(newYear, newMonth);
            return events;
        }
    };
    ```

Customization
-------------------

You can customize the look of the `WeekView` in xml. Use the following attributes in xml. All these attributes also have getters and setters to enable you to change the style dynamically.

- `allDayEventHeight`
- `columnGap`
- `dayBackgroundColor`
- `dayNameLength`
- `eventMarginVertical`
- `eventPadding`
- `eventTextColor`
- `eventTextSize`
- `firstDayOfWeek`
- `headerColumnBackground`
- `headerColumnPadding`
- `headerColumnTextColor`
- `headerRowBackgroundColor`
- `headerRowPadding`
- `hourHeight`
- `hourSeparatorColor`
- `hourSeparatorHeight`
- `noOfVisibleDays`
- `overlappingEventGap`
- `textSize`
- `todayBackgroundColor`
- `todayHeaderTextColor`
- `showDistinctPastFutureColor`
- `futureBackgroundColor`
- `pastBackgroundColor`
- `showDistinctWeekendColor`
- `futureWeekendBackgroundColor`
- `pastWeekendBackgroundColor`
- `showNowLine`
- `nowLineColor`
- `nowLineThickness`
- `scrollDuration`

Interfaces
----------

Use the following interfaces according to your need.

- `mWeekView.setWeekViewLoader()` to provide events to the calendar
- `mWeekView.setMonthChangeListener()` to provide events to the calendar by months
- `mWeekView.setOnEventClickListener()` to get a callback when an event is clicked
- `mWeekView.setEventLongPressListener()` to get a callback when an event is long pressed
- `mWeekView.setEmptyViewClickListener()` to get a callback when any empty space is clicked
- `mWeekView.setEmptyViewLongPressListener()` to get a callback when any empty space is long pressed
- `mWeekView.setDateTimeInterpreter()` to set your own labels for the calendar header row and header column
- `mWeekView.setScrollListener()` to get an event every time the first visible day has changed

Sample
----------

There is also a [sample app](https://github.com/alamkanak/Android-Week-View/tree/master/sample) to get you started.

To do
-------

* Add event touch feedback selector
* Show events that expand multiple days properly

Changelog
---------

**Version 1.2.6**

* Add empty view click listener
* Fix padding bug
* Fix bug when setting colors of different components
* Add ability to turn off fling gesture
* Add example of how to load events asynchronously in the sample app

**Version 1.2.5**

* Add support for using subclasses of `WeekViewEvent`
* Fix scroll animation
* Add support for semi-transparent header colors

**Version 1.2.4**

* **NOTE:** If you are using `WeekView.MonthChangeListener`, make sure to change it into `MonthLoader.MonthChangeListener`
* Add support to have loaders other than MonthViewLoader
* Add pinch to zoom support
* Add support for location
* Add ability to have different colors for past, future, weekend days
* Add support for "now" line

**Version 1.2.3**

* Get callbacks when scrolling horizontally
* `goToHour` and `goToDate` methods has been fixed
* Use `getFirstVisibleHour` method to get the first visible hour in the week view

**Version 1.2.1**

* Better scrolling added
* Get callbacks when empty view is tapped/long pressed
* Control the speed of scrolling
* Support for multiple language added
* Ability to set your own interpreter for header row and column added

**Version 1.1.7**

* You can now dynamically scroll to an hour of your preference.

**Version 1.1.6**

* Added support for events that expands to multiple days

**Version 1.1.5**

* A bug related to overlapping events fixed
* You can now programmatically get first and last visible day in the week view

**Version 1.1.4**

* Small bug fixed

**Version 1.1.3**

* Margins support added for overlapping events

**Version 1.1.2**

* Small bugs fixed
* Hour separator inconsistency fixed

**Version 1.1.1**

* Overlapping event bug fixed

**Version 1.1.0**

* Added support for overlapping events

License
----------

    Copyright 2014 Raquib-ul-Alam

    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.

Code conversion issue from Java to Kotlin

copy iconCopydownload iconDownload
val mMonthChangeListener:(Int,Int) -> List<WeekViewEvent> = MonthChangeListener { newYear, newMonth -> // Populate the week view with some events.
            return getEvents(newYear, newMonth)
        }
-----------------------
val monthChangeListener : object = MonthChangeListener {}
-----------------------
 val monthChangeListener = MonthChangeListener { newYear, newMonth -> ArrayList<WeekViewEvent>() }

Community Discussions

Trending Discussions on Android-Week-View
  • Code conversion issue from Java to Kotlin
Trending Discussions on Android-Week-View

QUESTION

Code conversion issue from Java to Kotlin

Asked 2021-May-31 at 16:35

I am trying to integrated this awesome Calender event library in my Kotlin project

https://github.com/alamkanak/Android-Week-View

I have created a Kotlin project. I am unable to convert the MonthChangeListener in Kotlin

MonthLoader.MonthChangeListener mMonthChangeListener = new MonthLoader.MonthChangeListener() {
    @Override
    public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
        // Populate the week view with some events.
        List<WeekViewEvent> events = getEvents(newYear, newMonth);
        return events;
    }
};

I copied and pasted the Java code and pasted it into Kotlin project, here the code converted

val mMonthChangeListener = MonthChangeListener { newYear, newMonth -> // Populate the week view with some events.
    getEvents(newYear, newMonth)
}

Its throwing error

Without implementing this App crashes on start, here is the log

021-05-31 19:21:18.163 27099-27099/com.calendar.event101 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.calendar.event101, PID: 27099
    java.lang.IllegalStateException: You must provide a MonthChangeListener
        at com.alamkanak.weekview.WeekView.getMoreEvents(WeekView.java:882)
        at com.alamkanak.weekview.WeekView.drawHeaderRowAndEvents(WeekView.java:616)
        at com.alamkanak.weekview.WeekView.onDraw(WeekView.java:488)
        at android.view.View.draw(View.java:17185)
        at android.view.View.updateDisplayListIfDirty(View.java:16167)
        at android.view.View.draw(View.java:16951)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
        at android.view.View.updateDisplayListIfDirty(View.java:16162)
        at android.view.View.draw(View.java:16951)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
        at android.view.View.updateDisplayListIfDirty(View.java:16162)
        at android.view.View.draw(View.java:16951)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
        at android.view.View.updateDisplayListIfDirty(View.java:16162)
        at android.view.View.draw(View.java:16951)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
        at android.view.View.updateDisplayListIfDirty(View.java:16162)
        at android.view.View.draw(View.java:16951)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
        at android.view.View.updateDisplayListIfDirty(View.java:16162)
        at android.view.View.draw(View.java:16951)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
        at android.view.View.draw(View.java:17188)
        at com.android.internal.policy.DecorView.draw(DecorView.java:753)
        at android.view.View.updateDisplayListIfDirty(View.java:16167)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:648)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:654)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:762)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2800)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2608)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2215)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6337)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
        at android.view.Choreographer.doCallbacks(Choreographer.java:686)
        at android.view.Choreographer.doFrame(Choreographer.java:621)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
        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:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

enter image description here

ANSWER

Answered 2021-May-31 at 16:04

Try this

val mMonthChangeListener:(Int,Int) -> List<WeekViewEvent> = MonthChangeListener { newYear, newMonth -> // Populate the week view with some events.
            return getEvents(newYear, newMonth)
        }

Source https://stackoverflow.com/questions/67776938

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install Android-Week-View

You can download it from GitHub, Maven.
You can use Android-Week-View like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the Android-Week-View component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.