upgrade to API Level 27, fix nullability problems with new support library

This commit is contained in:
Conny Duck 2017-11-09 14:35:52 +01:00
parent 0cad3831c6
commit dec7da9655
3 changed files with 11 additions and 13 deletions

View file

@ -2,12 +2,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
compileSdkVersion 27
buildToolsVersion '27.0.0'
defaultConfig {
applicationId "com.keylesspalace.tusky"
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 27
versionCode 28
versionName "1.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@ -35,7 +35,7 @@ android {
}
}
ext.supportLibraryVersion = '26.1.0'
ext.supportLibraryVersion = '27.0.0'
dependencies {
compile('com.mikepenz:materialdrawer:5.9.5@aar') {

View file

@ -15,7 +15,6 @@
package com.keylesspalace.tusky.fragment
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
@ -56,8 +55,9 @@ class AccountMediaFragment : BaseFragment() {
@JvmStatic
fun newInstance(accountId: String): AccountMediaFragment {
val fragment = AccountMediaFragment()
fragment.arguments = Bundle()
fragment.arguments.putString(ACCOUNT_ID_ARG, accountId)
val args = Bundle()
args.putString(ACCOUNT_ID_ARG, accountId)
fragment.arguments = args
return fragment
}
@ -129,7 +129,7 @@ class AccountMediaFragment : BaseFragment() {
savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_timeline, container, false)
val recyclerView = view.findViewById<RecyclerView>(R.id.recycler_view)
val columnCount = context.resources.getInteger(R.integer.profile_media_column_count)
val columnCount = context?.resources?.getInteger(R.integer.profile_media_column_count) ?: 2
val layoutManager = GridLayoutManager(context, columnCount)
val lightThemeEnabled = PreferenceManager.getDefaultSharedPreferences(context)
@ -141,7 +141,7 @@ class AccountMediaFragment : BaseFragment() {
recyclerView.layoutManager = layoutManager
recyclerView.adapter = adapter
val accountId = arguments.getString(ACCOUNT_ID_ARG)
val accountId = arguments?.getString(ACCOUNT_ID_ARG)
swipeLayout = view.findViewById(R.id.swipe_refresh_layout)
swipeLayout.setOnRefreshListener {
@ -182,7 +182,7 @@ class AccountMediaFragment : BaseFragment() {
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (!isVisibleToUser) return
val accountId = arguments.getString(ACCOUNT_ID_ARG)
val accountId = arguments?.getString(ACCOUNT_ID_ARG)
if (fetchingStatus == FetchingStatus.NOT_FETCHING && statuses.isEmpty()) {
fetchingStatus = FetchingStatus.INITIAL_FETCHING
currentCall = api.accountStatuses(accountId, null, null, null, true)
@ -199,11 +199,10 @@ class AccountMediaFragment : BaseFragment() {
val intent = Intent(context, ViewMediaActivity::class.java)
intent.putExtra("urls", urls)
intent.putExtra("urlIndex", currentIndex)
if (view != null) {
if (view != null && activity != null) {
val url = urls[currentIndex]
ViewCompat.setTransitionName(view, url)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
view, url)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity!!, view, url)
startActivity(intent, options.toBundle())
} else {
startActivity(intent)

View file

@ -16,7 +16,6 @@ allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
google()
}
}