diff --git a/app/src/main/java/com/simplemobiletools/calendar/adapters/MyPagerAdapter.java b/app/src/main/java/com/simplemobiletools/calendar/adapters/MyPagerAdapter.java deleted file mode 100644 index 936a4b060..000000000 --- a/app/src/main/java/com/simplemobiletools/calendar/adapters/MyPagerAdapter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.simplemobiletools.calendar.adapters; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; - -import com.simplemobiletools.calendar.Constants; -import com.simplemobiletools.calendar.fragments.MonthFragment; - -import java.util.List; - -public class MyPagerAdapter extends FragmentStatePagerAdapter { - private final List mCodes; - private final MonthFragment.NavigationListener mListener; - - public MyPagerAdapter(FragmentManager fm, List codes, MonthFragment.NavigationListener listener) { - super(fm); - mCodes = codes; - mListener = listener; - } - - @Override - public int getCount() { - return mCodes.size(); - } - - @Override - public Fragment getItem(int position) { - final Bundle bundle = new Bundle(); - final String code = mCodes.get(position); - bundle.putString(Constants.DAY_CODE, code); - - final MonthFragment fragment = new MonthFragment(); - fragment.setArguments(bundle); - fragment.setListener(mListener); - return fragment; - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/MyPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/MyPagerAdapter.kt new file mode 100644 index 000000000..bf021b450 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/MyPagerAdapter.kt @@ -0,0 +1,27 @@ +package com.simplemobiletools.calendar.adapters + +import android.os.Bundle +import android.support.v4.app.Fragment +import android.support.v4.app.FragmentManager +import android.support.v4.app.FragmentStatePagerAdapter + +import com.simplemobiletools.calendar.Constants +import com.simplemobiletools.calendar.fragments.MonthFragment + +class MyPagerAdapter(fm: FragmentManager, private val mCodes: List, private val mListener: MonthFragment.NavigationListener) : FragmentStatePagerAdapter(fm) { + + override fun getCount(): Int { + return mCodes.size + } + + override fun getItem(position: Int): Fragment { + val bundle = Bundle() + val code = mCodes[position] + bundle.putString(Constants.DAY_CODE, code) + + val fragment = MonthFragment() + fragment.arguments = bundle + fragment.setListener(mListener) + return fragment + } +}