Comments (16)
@gantonious Ok great, thank you once again for your quick reply.
from materialdaypicker.
Okay I updated to version 0.3.2
. How does this look: https://github.com/gantonious/MaterialDayPicker/blob/dev/app/src/main/java/ca/antonious/sampleapp/MainActivity.java#L25
from materialdaypicker.
It should be possible! The getSelectedDays() method returns a list of MaterialDayPicker.Weekday
which is an enum type not a string type so to get your snipped working try doing (notice how I dropped the quotes in the contains method):
if (daysSelected.contains(MaterialDayPicker.Weekday.TUESDAY)) {
Toast.makeText(getContext(), "TUESDAY", Toast.LENGTH_SHORT).show();
}
from materialdaypicker.
@gantonious Thank you for the quick reply. Ok, I got that working, but is there a way to check when a day is unselected? Or should I handle it with a separate boolean?
from materialdaypicker.
Right now there is no simple method to check. You can iterate through the daysSelected
list you have and check if the date is NOT in the list. I just created an issue #3 to add methods to directly query if a day is selected or unselected. I will try and get those in the afternoon and get a new version of the lib up later today.
from materialdaypicker.
Okay you can now check if a day is selected by doing:
boolean isTuesdaySelected = materialDayPicker.isSelected(MaterialDayPicker.Weekday.TUESDAY);
Here is the new compile dependency:
dependencies {
compile 'ca.antonious:materialdaypicker:0.3.1'
}
from materialdaypicker.
@gantonious Thank you. But it is still a issue because if I have the following:
boolean isTuesdaySelected = materialDayPicker.isSelected(MaterialDayPicker.Weekday.TUESDAY);
if (isTuesdaySelected == true){
Toast.makeText(getContext(), "TUESDAY - true", Toast.LENGTH_SHORT).show
}else if (isTuesdaySelected == false){
Toast.makeText(getContext(), "TUESDAY - false", Toast.LENGTH_SHORT).show();
}
Inside of setDaySelectionChangedListener
, then when I press on lets say Friday, it will also return isTuesdaySelected == false
instead of just returning the day that was selected's state.
from materialdaypicker.
So what I'm understanding is that you want to get the day of the week as well as its state inside the listener when you select a day?
from materialdaypicker.
@gantonious Yes exactly
from materialdaypicker.
Okay I'll look into something
from materialdaypicker.
@gantonious Okay thank you.
from materialdaypicker.
Perfect, thank you so much for taking the time to resolve this issue. Much appreciated!
from materialdaypicker.
@gantonious One last suggestion would be to have the ability to set a single day, currently setSelectedDays
has to be done like this:
materialDayPicker.setSelectedDays(MaterialDayPicker.Weekday.MONDAY, MaterialDayPicker.Weekday.TUESDAY);
But the issue is that if I want to store a selected day in a database and restore the specific selected day in OnCreate
like this:
//Set MONDAY
if (myDb.getAll().containsKey("MONDAY")){
materialDayPicker.setSelectedDays(MaterialDayPicker.Weekday.MONDAY);
}
//Set TUESDAY
if (myDb.getAll().containsKey("TUESDAY")){
materialDayPicker.setSelectedDays(MaterialDayPicker.Weekday.TUESDAY);
}
Then materialDayPicker.setSelectedDays(MaterialDayPicker.Weekday.MONDAY);
will not be set because it is overwritten by materialDayPicker.setSelectedDays(MaterialDayPicker.Weekday.TUESDAY);
In order for me to achieve the desired result I will have to create a LARGE amount of if statements.
from materialdaypicker.
Can't you use:
materialDayPicker.selectDay(MaterialDayPicker.Weekday.MONDAY)
That will not override your last selection. Also sorry for the late reply.
from materialdaypicker.
Hey there! Thank you for creating this amazing tool. I'm having a problem with resizing the dial (circle) size. If I change the layout property, it just ignored days that cannot fit into it. How can I make it smaller in order to fit it properly into a CardView
from materialdaypicker.
Similar to colour customization. The button and text size can be updated in your app's resource. If you don't have any dimension resources specified in your app you can create a new src/main/res/values/dimens.xml
file and place the following dimensions in it:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="day_button_size">40dp</dimen>
<dimen name="day_button_max_font_size">22sp</dimen>
</resources>
Unfortunately this will apply globally to your app. There is no way to currently override this on a per view basis.
from materialdaypicker.
Related Issues (20)
- Localize first day of the week
- Consider alternatives to java.time for getting day abbreviations
- change language HOT 2
- Provide way to override language ignoring system locale
- Properly Render Abbreviations Larger than button width
- Provide way to disable specific days
- Add day range selection HOT 3
- Possible to add selectionMode in the xml to the widget? HOT 3
- Font size adjustment HOT 2
- Flashing when updating selection via code HOT 5
- BUG NEEDED TO FIX ASAP! HOT 2
- Event icons placed below each day HOT 5
- Bug when used in LiveData observer or binding adapter HOT 6
- Picked days colours HOT 2
- crash with Error inflating class ca.antonious.materialdaypicker.MaterialDayPicker HOT 4
- Crash in release mode with proground HOT 2
- Add enable or disabled touch mode or add busy mode with an icon HOT 3
- Add support for custom first day of week HOT 2
- Deploy to Maven Central HOT 3
- Is it possible to circle un - selected date with border and whilte background HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialdaypicker.