Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master: added month name as String #718

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ru-alxr
Copy link

@ru-alxr ru-alxr commented Feb 17, 2019

No description provided.

@xiaosong520
Copy link
Member

Good job

@mrinmoy007roy
Copy link

mrinmoy007roy commented Feb 25, 2019 via email

@ru-alxr
Copy link
Author

ru-alxr commented Feb 25, 2019

class TimePickerFragment : Fragment(), IMonthNameResolver, OnTimeSelectListener{

      override fun resolveName(position: Int): String = resources.getStringArray(R.array.months)[position - 1]

      override fun onTimeSelect(date: Date?, view: View?) {
        mViewModel.onBirthdaySelected(date)
      }    

      private fun showDateSelector(resolver: IMonthNameResolver, listener: OnTimeSelectListener) {
              activity
                      ?.apply {
                          val selectedDate = Calendar.getInstance()
                          val startDate = Calendar.getInstance()
                          val endDate = Calendar.getInstance()
                          startDate.set(1913, 0, 1)
                          val view: TimePickerView = TimePickerBuilder(this, listener)
                                  .setType(booleanArrayOf(true, true, true, false, false, false))
// and some setup code
                                  .setMonthNameResolver(resolver)
                                  .build()

                          // Some code to show picker
                      }
          }
    
}

<resources>


<string-array name="months">
        <item>January</item>
        <item>February</item>
        <item>March</item>
        <item>April</item>
        <item>May</item>
        <item>June</item>
        <item>July</item>
        <item>August</item>
        <item>September</item>
        <item>October</item>
        <item>November</item>
        <item>December</item>
    </string-array>


</resources>

@mrinmoy007roy
Copy link

hi
i added implementation 'com.contrarywind:Android-PickerView:4.1.7' in my build gradle file.
It is not showing IMonthNameResolver.

@ru-alxr
Copy link
Author

ru-alxr commented Apr 13, 2019

@mrinmoy007roy Hi
This pull request still is not merged.
So you could fork my repo or force owner to merge it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants