jhonnyx2012 / horizontalpicker Goto Github PK
View Code? Open in Web Editor NEWDatePicker horizontal con selección smooth por día para Android.
DatePicker horizontal con selección smooth por día para Android.
I m getting following issue after selecting a date
java.lang.NullPointerException: Attempt to invoke virtual method 'void devs.mulham.horizontalcalendar.utils.HorizontalCalendarListener.onDateSelected(java.util.Calendar, int)' on a null object reference
at devs.mulham.horizontalcalendar.utils.HorizontalSnapHelper.notifyCalendarListener(HorizontalSnapHelper.java:46)
at devs.mulham.horizontalcalendar.utils.HorizontalSnapHelper.findSnapView(HorizontalSnapHelper.java:37)
at android.support.v7.widget.SnapHelper.snapToTargetExistingView(SnapHelper.java:191)
at android.support.v7.widget.SnapHelper$1.onScrollStateChanged(SnapHelper.java:53)
at android.support.v7.widget.RecyclerView.dispatchOnScrollStateChanged(RecyclerView.java:4759)
at android.support.v7.widget.RecyclerView.setScrollState(RecyclerView.java:1434)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4908)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:773)
at android.view.Choreographer.doCallbacks(Choreographer.java:586)
at android.view.Choreographer.doFrame(Choreographer.java:555)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:759)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5422)
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:914)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
Hello
In your description we have: Configurable number of generated days (default: 120).
How can chage this value?
I want to be able to deselect programmatically, is this possible today?
A other thing is that you cannot select first day of the calendar if its the first thing you want to select. Is that normal?
Can you pls check with this error, I got from crashlytics
I want to try to add black title on a specific date but I am not able to do it.
I need to add start date and end date for calendar , how can i set most lowest and highest date and year ?
How to set specific dates instead of range ?
Is there any way to configure the datepicker so that you can scroll through past months/dates? Right now, mine starts on the current month and lets you scroll forward but not back, however, I need to make it so that you can scroll back and look at entries made on earlier dates.
Hi,
How to change of selected background as a circle shape
i want to change the date size
Can't we set today's date by default whenever the app is open?
When picker is not in center today button isnt working
How do I change the default active square pill to round?
Picker looks not the way it should in my dialog. Have no idea why. Hope you'll see this message and try to solve it.
MainActivity.class
package tyan.hainee.datepicker;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.github.jhonnyx2012.horizontalpicker.HorizontalPicker;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View dialogView = getLayoutInflater().inflate(R.layout.dialog, null);
HorizontalPicker dialogPicker = (HorizontalPicker) dialogView.findViewById(R.id.date_picker);
dialogPicker.init();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(dialogView);
final AlertDialog dialog = builder.create();
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.show();
}
});
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="tyan.hainee.datepicker.MainActivity"
android:orientation="vertical"
android:padding="16dp">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DIALOG"/>
</LinearLayout>
dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<com.github.jhonnyx2012.horizontalpicker.HorizontalPicker
android:id="@+id/date_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
In my case, I need to set currentDate
as endDate
and total no. of days are 14.
So as per today, 16-03-2019 is last date (end date) and 02-03-2019 will be starting date.
I think it will be done using setDays
with setOffset
.
Can you please elaborate how it works?
Hi @jhonnyx2012 , thanks for your efforts with this library. It's been very helpful and I haven't found any other library that works as well as yours. I came across the following issue whilst using your lib and thought I would share some info:
If the library is used by any app which sets the value for allowBackup to false within their manifest, the manifest merger will fail with an error similar to the one below:
Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:10:9-36 is also present at [com.github.jhonnyx2012:horizontal-picker:1.0.6] AndroidManifest.xml:12:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:8:5-63:19 to override.
I believe by simply removing the android:allowBackup part at this line it would fix this issue. I will see if I can create a PR for this, but thought I would create the issue in the meantime until I get around to it.
This article gives some more background
It doesn't seem to be possible to use this with Gradle 7 and Jcentre being depreciated.
Dear Sir,
I have a senario where i want to show only some particular dates enable and all other dates disable. how to do that sir?
Dude this needs to be in English, it's great. Can you do it yourself? I can help with that if you need it :)
Also, 'horizontal picker' is not really a good name, it might collide with other number pickers (trust me, I know) - consider changing to horizontal 'date' picker.
Cheers
Besides the background color, whenever I try changing the color of any of the entities, it still remains default grey. Below is the code.
picker
.setListener(this)
.setDateSelectedColor(Color.WHITE)
.setDateSelectedTextColor(Color.WHITE)
.setMonthAndYearTextColor(Color.WHITE)
.setTodayDateBackgroundColor(Color.GRAY)
.setUnselectedDayTextColor(Color.WHITE)
.setDayOfWeekTextColor(Color.WHITE)
.setUnselectedDayTextColor(Color.WHITE)
.init();
Any suggestions?
visibility gone and visible is not working. when i set visibility visible of picker it show unrecognized string instead of showing dates. can you fix it immediately??
This date picker is great. But I encounter an issue below, hope someone can advise:
I initialise the picker with days=7, offset=0, then select a date by default via setDate() function. But no matter what date I set, it's always set to the date in the middle of that 7 days, not the date I wanted to set. Is this the intended behaviour?
Error-
Inconvertible types; cannot cast 'anonymous android.view.View.OnClickListener' to 'com.github.jhonnyx2012.horizontalpicker.DatePickerListener'
when I click alt+ enter it gives
-Introduce Local Variable
-merge sequential method calls into call chain
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.