update target SDK to 26

This commit is contained in:
tibbi 2017-10-30 17:40:47 +01:00
parent 10b40f5b99
commit aeadf3bd03
6 changed files with 19 additions and 19 deletions

View File

@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.simplemobiletools.calendar"
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 26
versionCode 99
versionName "2.9.1"
multiDexEnabled true
@ -44,7 +44,7 @@ ext {
}
dependencies {
compile 'com.simplemobiletools:commons:2.31.11'
compile 'com.simplemobiletools:commons:2.34.2'
compile 'joda-time:joda-time:2.9.1'
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View File

@ -153,7 +153,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
week_num.beVisible()
for (i in 0..5) {
(findViewById(mRes.getIdentifier("week_num_$i", "id", mPackageName)) as TextView).apply {
findViewById<TextView>(mRes.getIdentifier("week_num_$i", "id", mPackageName)).apply {
text = "${mDays!![i * 7 + 3].weekOfYear}:"
setTextColor(mTextColor)
beVisible()
@ -163,7 +163,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
val dividerMargin = mRes.displayMetrics.density.toInt()
for (i in 0 until len) {
(findViewById(mRes.getIdentifier("day_$i", "id", mPackageName)) as LinearLayout).apply {
findViewById<LinearLayout>(mRes.getIdentifier("day_$i", "id", mPackageName)).apply {
val day = mDays!![i]
removeAllViews()
@ -198,7 +198,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
private fun updateLabels() {
for (i in 0..6) {
(findViewById(mRes.getIdentifier("label_$i", "id", mPackageName)) as TextView).apply {
findViewById<TextView>(mRes.getIdentifier("label_$i", "id", mPackageName)).apply {
setTextColor(mTextColor)
}
}

View File

@ -85,7 +85,7 @@ class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListen
private fun pickDay() {
activity.setTheme(context.getAppropriateTheme())
val view = getLayoutInflater(arguments).inflate(R.layout.date_picker, null)
val datePicker = view.findViewById(R.id.date_picker) as DatePicker
val datePicker = view.findViewById<DatePicker>(R.id.date_picker)
val dateTime = Formatter.getDateTimeFromCode(mDayCode)
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, dateTime.dayOfMonth, null)

View File

@ -127,8 +127,8 @@ class MonthFragment : Fragment(), MonthlyCalendar {
private fun showMonthDialog() {
activity.setTheme(context.getAppropriateTheme())
val view = getLayoutInflater(arguments).inflate(R.layout.date_picker, null)
val datePicker = view.findViewById(R.id.date_picker) as DatePicker
datePicker.findViewById(Resources.getSystem().getIdentifier("day", "id", "android")).beGone()
val datePicker = view.findViewById<DatePicker>(R.id.date_picker)
datePicker.findViewById<View>(Resources.getSystem().getIdentifier("day", "id", "android")).beGone()
val dateTime = DateTime(mCalendar.mTargetDate.toString())
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
@ -156,7 +156,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
if (!mSundayFirst)
index = (index + 1) % letters.size
(mHolder.findViewById(mRes.getIdentifier("label_$i", "id", mPackageName)) as TextView).apply {
mHolder.findViewById<TextView>(mRes.getIdentifier("label_$i", "id", mPackageName)).apply {
setTextColor(mTextColor)
text = getString(letters[index])
}
@ -174,7 +174,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
week_num.beVisibleIf(displayWeekNumbers)
for (i in 0..5) {
(mHolder.findViewById(mRes.getIdentifier("week_num_$i", "id", mPackageName)) as TextView).apply {
mHolder.findViewById<TextView>(mRes.getIdentifier("week_num_$i", "id", mPackageName)).apply {
text = "${days[i * 7 + 3].weekOfYear}:" // fourth day of the week matters
setTextColor(mTextColor)
beVisibleIf(displayWeekNumbers)
@ -183,7 +183,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
val dividerMargin = mRes.displayMetrics.density.toInt()
for (i in 0 until len) {
(mHolder.findViewById(mRes.getIdentifier("day_$i", "id", mPackageName)) as LinearLayout).apply {
mHolder.findViewById<LinearLayout>(mRes.getIdentifier("day_$i", "id", mPackageName)).apply {
val day = days[i]
setOnClickListener { openDay(day.code) }

View File

@ -135,7 +135,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
for (i in 0..6) {
val dayCode = Formatter.getDayCodeFromDateTime(curDay)
val dayLetter = getDayLetter(curDay.dayOfWeek)
(mView.findViewById(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)) as TextView).apply {
mView.findViewById<TextView>(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)).apply {
text = "$dayLetter\n${curDay.dayOfMonth}"
setTextColor(if (todayCode == dayCode) primaryColor else textColor)
if (todayCode == dayCode)
@ -427,7 +427,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
mWasDestroyed = true
}
private fun getColumnWithId(id: Int) = mView.findViewById(mRes.getIdentifier("week_column_$id", "id", context.packageName)) as ViewGroup
private fun getColumnWithId(id: Int) = mView.findViewById<ViewGroup>(mRes.getIdentifier("week_column_$id", "id", context.packageName))
fun updateScrollY(y: Int) {
if (wasFragmentInit)

View File

@ -64,7 +64,7 @@ class YearFragment : Fragment(), YearlyCalendar {
markCurrentMonth(res)
for (i in 1..12) {
val monthView = mView.findViewById(res.getIdentifier("month_" + i, "id", activity.packageName)) as SmallMonthView
val monthView = mView.findViewById<SmallMonthView>(res.getIdentifier("month_" + i, "id", activity.packageName))
var dayOfWeek = dateTime.withMonthOfYear(i).dayOfWeek().get()
if (!mSundayFirst)
dayOfWeek--
@ -79,10 +79,10 @@ class YearFragment : Fragment(), YearlyCalendar {
private fun markCurrentMonth(res: Resources) {
val now = DateTime()
if (now.year == mYear) {
val monthLabel = mView.findViewById(res.getIdentifier("month_${now.monthOfYear}_label", "id", activity.packageName)) as TextView
val monthLabel = mView.findViewById<TextView>(res.getIdentifier("month_${now.monthOfYear}_label", "id", activity.packageName))
monthLabel.setTextColor(context.config.primaryColor)
val monthView = mView.findViewById(res.getIdentifier("month_${now.monthOfYear}", "id", activity.packageName)) as SmallMonthView
val monthView = mView.findViewById<SmallMonthView>(res.getIdentifier("month_${now.monthOfYear}", "id", activity.packageName))
monthView.todaysId = now.dayOfMonth
}
}
@ -97,7 +97,7 @@ class YearFragment : Fragment(), YearlyCalendar {
lastHash = hashCode
val res = resources
for (i in 1..12) {
val monthView = mView.findViewById(res.getIdentifier("month_$i", "id", context.packageName)) as SmallMonthView
val monthView = mView.findViewById<SmallMonthView>(res.getIdentifier("month_$i", "id", context.packageName))
monthView.setEvents(events.get(i))
}
}