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

main
Conny Duck 7 years ago
parent 7ca23c63b5
commit c73b4b227a
  1. 6
      app/build.gradle
  2. 17
      app/src/main/java/com/keylesspalace/tusky/fragment/AccountMediaFragment.kt
  3. 1
      build.gradle

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

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

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

Loading…
Cancel
Save