GithubHelp home page GithubHelp logo

datepicker-timeline's People

Contributors

badoualy avatar devdroidraul avatar mrhadisatrio 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

datepicker-timeline's Issues

Foreground color disappears when I add to an AlertDialog.

Hello,

When I put the datepicker in an AlertDialog, the forecolor disappears, as follows:

Set Body Weight

Here's some code:
`

    btn.setOnClickListener(v -> {

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.CustomAlertDialog);

        LayoutInflater inflater1 = getLayoutInflater();
        View dlgWeights = inflater1.inflate(R.layout.weights_dialog,null);

        builder.setTitle("Set Body Weight");

        builder.setView(dlgWeights);

        tvWeights = dlgWeights.findViewById(R.id.tvWeights);

        tvWeights.setText(spnWeights.getSelectedItemPosition() == 0 ? getString(R.string.lbs) : getString(R.string.kilos));

        npWeight = dlgWeights.findViewById(R.id.npWeight);

        Log.i("ProfileDialog", "Launching DatePickerTimeline");
        final DatePickerTimeline timeline = dlgWeights.findViewById(R.id.datePickerTimeLine);

        final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        timeline.setOnDateSelectedListener((year, month, day, index) -> {
            Calendar date = Calendar.getInstance();
            date.set(year, month, day);
            refreshWeight(sdf.format(date.getTime()));
        });

        Calendar current = Calendar.getInstance();

        timeline.setSelectedDate(current.get(Calendar.YEAR), current.get(Calendar.MONTH), current.get(Calendar.DATE));

        refreshWeight(sdf.format(current.getTime()));

        builder.setPositiveButton(getString(R.string.OK), (dialog, which) -> {
            Calendar d = Calendar.getInstance();
            d.set(timeline.getSelectedYear(), timeline.getSelectedMonth(), timeline.getSelectedDay(), 0, 0, 0);
            ((ExerciseActivity) getActivity()).exerciseViewModel.ensureWeight(npWeight.getValue(), (int) (d.getTimeInMillis() / 1000L));
            refreshBodyWeight();
            dialog.dismiss();
        });

        builder.setNegativeButton(getString(R.string.Cancel), (dialog, which) -> dialog.dismiss());

        final AlertDialog dialog = builder.create();

        dialog.show();

    });`

R.layout.weights_dialog:

`

<com.github.badoualy.datepicker.DatePickerTimeline
    android:id="@+id/datePickerTimeLine"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="15dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/tvWeights"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView" />

    <com.michaelmuenzer.android.scrollablennumberpicker.ScrollableNumberPicker
        android:id="@+id/npWeight"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:orientation="horizontal"
        app:snp_scrollEnabled="true"
        app:snp_updateInterval="5" />

</LinearLayout>
`

Thanks in advance for any assistance.

Year on MonthView functionality lost?

Hello,

in the sample app, I can see that the year can be displayed in the MonthView, jkust beneath. Checking the the library embedded in the sample code, I can see the following lines in MonthViewHolder private class:

void bind(int year, int month, boolean selected, boolean beforeSelection) {
            this.year = year;
            this.month = month;

            String text = MONTHS[month].substring(0, 3).toUpperCase(Locale.US);
            **if (yearDigitCount > 0) {
                text += yearOnNewLine ? "\n" : " ";
                text += year % (int) Math.pow(10, yearDigitCount);
            }**
            lbl.setText(text);
            int color = selected ? colorSelected : beforeSelection ? colorBeforeSelection : defaultColor;
            lbl.setTextColor(color);
            indicator.setColor(color);
            indicator.setCircleSizeDp(selected ? 12 : 5);
        }

Where this same method lacks the part if(yearDigitCount > 0){} . This seems lost in 1.0.1. Was it removed on purpose? Or this the gradle link not updated?

EDIT. Ah well, I checked the commits, I guess this is not in the gradle release yet. I will try using the library directly in my code. Awesome job man! Keep it up :) Thanks!

intoroduce method to set last visible date.

hi love the library u created from the inspiration of the design.

There occasion when u don't want the user to pink up the date after a given date, for example not beyond today's date.

To cover max use cases. can v make the adapter to look if the developer has set last visible date. if not we can have the infinite scrollable date picker as it is right now

how to set different color for labels

i wanna to change labels in different days but the application crash

mCalendarView.setDateLabelAdapter(new MonthView.DateLabelAdapter() {
@OverRide
public CharSequence getLabel(Calendar calendar, int index) {
if (calendar.get(Calendar.DATE) == 5) {
mCalendarView.getTimelineView().setLabelColor(getResources().getColor(R.color.red_50));

                return "busy";
            }else
                return Integer.toString(calendar.get(Calendar.MONTH) + 1) + "/" + 
                           (calendar.get(Calendar.YEAR) % 2000);
        }
    });
    mCalendarView.getTimelineView().getAdapter().notifyDataSetChanged();

Add a label only in certain dates

How can I put a label below the date, but only at the date I want?
I tried to do it with the adapter but you need to check if the date is correct in each index and that is too much work.

date picker seems to crash when activity restores from savedInstanceState

When the activity gets killed in the background, and then resumes, the app crashes with the following stack trace:

java.lang.StringIndexOutOfBoundsException: length=2; regionStart=0; regionLength=3
  at java.lang.String.substring(String.java:1931)
  at com.github.badoualy.datepicker.MonthView$MonthViewHolder.bind(MonthView.java:307)
  at com.github.badoualy.datepicker.MonthView$MonthAdapter.onBindViewHolder(MonthView.java:273)
  at com.github.badoualy.datepicker.MonthView$MonthAdapter.onBindViewHolder(MonthView.java:256)
  /*
  at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6482)
  at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6515)
  at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5458)
  at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5724)
  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5563)
  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5559)
  at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2229)
  at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1556)
  at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1516)
  at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:618)
  at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3693)
  at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3410)
  at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3962)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
  at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
  at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
  at android.support.v4.widget.NestedScrollView.onLayout(NestedScrollView.java:1670)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1767)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:132)
  at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
  at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1361)
  at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:869)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
  at android.view.View.layout(View.java:17523)
  at android.view.ViewGroup.layout(ViewGroup.java:5612)
  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
  */

I guess this is related to the library. any ideas on how to solve this?

Supply labels at runtime

Suppose I want to fetch labels from server upon selection of date. And then reflect the fetched data as label. (Label means the text shown below date, which is supplied by DateLabelAdapter as per your sample).

How do I do it? How do I refresh labels with data fetched from server.

ART

Hi,
I like your library,
I downloaded it to test and it's simple to use & pretty ;)

But you should improve your Readme with some pictures & sample code to have more downloads

views hidden after pick a date before

val current = Calendar.getInstance()
timeLine.setFirstVisibleDate(2016, Calendar.JULY, 19)
timeLine.setLastVisibleDate(2020, Calendar.JULY, 19)

i am doing this, but when i pick by example the 2017/02/18 all the months after that date disappear
i am adding it from this way
<com.github.badoualy.datepicker.DatePickerTimeline
android:id="@+id/timeLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
/>

Cannot resolve class com.github.badoualy.datepicker.DatePickerTimeline

Hi!,

I have a problem with Class referenced in the layout file, com.github.badoualy.datepicker.DatePickerTimeline, was not found in the project or the libraries in Kotlin.

In build.gradle already is added implementation 'com.github.badoualy:datepicker-timeline:1.0.0' but still not working.

Any idea?

Can't use setOnDateSelectedListener in kotlin

When I call setOnDateSelectedListener I get an error "Expresstion cannot be invoke as a function. The function invoke() is not found"
My code:
datePicker.onDateSelectedListener(object: DatePickerTimeline.OnDateSelectedListener{
override fun onDateSelected(year: Int, month: Int, day: Int, index: Int) {
calendar.set(year, month, day)
viewModel.getDiaryByPriority(calendar, "objective")
}
})

Which commit is the stable one

compile 'com.github.badoualy:datepicker-timeline:1.0.1'
or
compile 'com.github.badoualy:datepicker-timeline:c6dcd05737'
or
'a62c066'

Months and Timeline dont center properly

For Release 1.0.0
When selecting date on timelineview or month monthview, selected month doesn't centre on the month view. Same issue when scrolling timelineview, the month view starts to scroll, but the current selected month is not visible.

Understanding is that, if the selected date is visible on the timelineview, and we start to scroll left or right on the timeline the month view will also scroll in the same direction.

Add colapse Feature.

this could be the ultimate calendar library for android if supports Full calendar view, with collapse feature.

cheers!

Some queries

I liked your library as I am using it in my project. I have some queries regarding some functionality.

  1. How to hide the month view top of timeline view? is there any option available?
  2. Can I change text size of date & week digits?
  3. Can I set custom text to week day digits? like Mon, Tue, Wed (uppercase & small case etc.)

StringIndexOutOfBoundsException on MonthView

Recently, my app has reported a significant number of crashes that was caused by StringIndexOutOfBoundsException from within this library's MonthView.

The crash logs have led me here:

String text = MONTHS[month].substring(0, 3).toUpperCase(Locale.US);

It's an early guess, but it seems like there is a possibility for MONTHS[month] to be less than 3 in length. Hence the error.

Color of selected date

Even if I set on layout a different color, sometimes it will popup back with the defaults. I think I set the correct attrs:
app:mti_bgLblDateSelectedColor="..." app:mti_lblDateColor="..." app:mti_ringLblDateSelectedColor="..." app:mti_tabBeforeSelectionColor="..." app:mti_tabSelectedColor="..."

Next days if I have time I'll look into src code to find the bug, if you spot it before me please answer this issue.
ty

Any option to change background color of the dates?

Hi! First of all, I want to say thank you for taking the time to develop and maintain this library. Your implementation of the calendar is, without a doubt, unique and pleasant to look at.

I've been developing an app that shall have DayNight theme as one of its features. Using your Datepicker Timeline, this is what I see whenever my app get into the Night (Dark) theme:

screen shot 2018-02-07 at 22 51 30

Please note that the rest of my app has been properly adapted to use dark backgrounds (as can be seen from the window and CardView background in the screencap above).

Looking into the sources, I can tell that it's currently not possible to change the background to another color. Could you please provide a way to do so?

Thanks in advance!

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.