remove some local variables

This commit is contained in:
tibbi 2017-10-21 19:17:34 +02:00
parent 879ba83574
commit 5e8a41d4c7
6 changed files with 6 additions and 18 deletions

View File

@ -22,7 +22,7 @@ class MyDayPagerAdapter(fm: FragmentManager, private val mCodes: List<String>, p
val fragment = DayFragment() val fragment = DayFragment()
fragment.arguments = bundle fragment.arguments = bundle
fragment.setListener(mListener) fragment.mListener = mListener
mFragments.put(position, fragment) mFragments.put(position, fragment)
return fragment return fragment

View File

@ -20,7 +20,7 @@ class MyWeekPagerAdapter(fm: FragmentManager, val mWeekTimestamps: List<Int>, va
val fragment = WeekFragment() val fragment = WeekFragment()
fragment.arguments = bundle fragment.arguments = bundle
fragment.setListener(mListener) fragment.mListener = mListener
mFragments.put(position, fragment) mFragments.put(position, fragment)
return fragment return fragment

View File

@ -21,7 +21,7 @@ class MyYearPagerAdapter(fm: FragmentManager, val mYears: List<Int>, val mListen
val fragment = YearFragment() val fragment = YearFragment()
fragment.arguments = bundle fragment.arguments = bundle
fragment.setListener(mListener) fragment.mListener = mListener
mFragments.put(position, fragment) mFragments.put(position, fragment)
return fragment return fragment

View File

@ -33,9 +33,9 @@ import org.joda.time.DateTime
import java.util.* import java.util.*
class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListener { class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListener {
var mListener: NavigationListener? = null
private var mTextColor = 0 private var mTextColor = 0
private var mDayCode = "" private var mDayCode = ""
private var mListener: NavigationListener? = null
private var lastHash = 0 private var lastHash = 0
lateinit var mRes: Resources lateinit var mRes: Resources
@ -82,10 +82,6 @@ class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListen
} }
} }
fun setListener(listener: NavigationListener) {
mListener = listener
}
private fun pickDay() { private fun pickDay() {
activity.setTheme(context.getAppropriateTheme()) activity.setTheme(context.getAppropriateTheme())
val view = getLayoutInflater(arguments).inflate(R.layout.date_picker, null) val view = getLayoutInflater(arguments).inflate(R.layout.date_picker, null)

View File

@ -33,7 +33,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private val CLICK_DURATION_THRESHOLD = 150 private val CLICK_DURATION_THRESHOLD = 150
private val PLUS_FADEOUT_DELAY = 5000L private val PLUS_FADEOUT_DELAY = 5000L
private var mListener: WeekScrollListener? = null var mListener: WeekScrollListener? = null
private var mWeekTimestamp = 0 private var mWeekTimestamp = 0
private var mRowHeight = 0 private var mRowHeight = 0
private var minScrollY = -1 private var minScrollY = -1
@ -424,10 +424,6 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private fun getColumnWithId(id: Int) = mView.findViewById(mRes.getIdentifier("week_column_$id", "id", context.packageName)) as ViewGroup private fun getColumnWithId(id: Int) = mView.findViewById(mRes.getIdentifier("week_column_$id", "id", context.packageName)) as ViewGroup
fun setListener(listener: WeekScrollListener) {
mListener = listener
}
fun updateScrollY(y: Int) { fun updateScrollY(y: Int) {
if (wasFragmentInit) if (wasFragmentInit)
mView.week_events_scrollview.scrollY = y mView.week_events_scrollview.scrollY = y

View File

@ -22,7 +22,7 @@ import org.joda.time.DateTime
import java.util.* import java.util.*
class YearFragment : Fragment(), YearlyCalendar { class YearFragment : Fragment(), YearlyCalendar {
private var mListener: NavigationListener? = null var mListener: NavigationListener? = null
private var mYear = 0 private var mYear = 0
private var mSundayFirst = false private var mSundayFirst = false
private var lastHash = 0 private var lastHash = 0
@ -87,10 +87,6 @@ class YearFragment : Fragment(), YearlyCalendar {
} }
} }
fun setListener(listener: NavigationListener) {
mListener = listener
}
override fun updateYearlyCalendar(events: SparseArray<ArrayList<DayYearly>>, hashCode: Int) { override fun updateYearlyCalendar(events: SparseArray<ArrayList<DayYearly>>, hashCode: Int) {
if (!isAdded) if (!isAdded)
return return