Update support library and kotlin

This commit is contained in:
inorichi 2017-11-28 00:21:38 +01:00
parent 4a9151e4aa
commit 604929d002
14 changed files with 29 additions and 31 deletions

View File

@ -12,7 +12,7 @@ if [ -z "$TRAVIS_TAG" ]; then
else
./gradlew clean assembleStandardRelease
TOOLS="${ANDROID_HOME}/build-tools/26.0.1"
TOOLS="$(ls -d ${ANDROID_HOME}/build-tools/* | tail -1)"
export ARTIFACT="tachiyomi-${TRAVIS_TAG}.apk"
${TOOLS}/zipalign -v -p 4 app/build/outputs/apk/standard/release/app-standard-release-unsigned.apk app-aligned.apk

View File

@ -30,7 +30,7 @@ ext {
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
buildToolsVersion "27.0.1"
publishNonDefault true
defaultConfig {
@ -106,7 +106,7 @@ dependencies {
implementation 'com.github.inorichi:junrar-android:634c1f5'
// Android support library
final support_library_version = '26.1.0'
final support_library_version = '27.0.1'
implementation "com.android.support:support-v4:$support_library_version"
implementation "com.android.support:appcompat-v7:$support_library_version"
implementation "com.android.support:cardview-v7:$support_library_version"
@ -122,13 +122,13 @@ dependencies {
// ReactiveX
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.3'
implementation 'io.reactivex:rxjava:1.3.4'
implementation 'com.jakewharton.rxrelay:rxrelay:1.2.0'
implementation 'com.f2prateek.rx.preferences:rx-preferences:1.0.2'
implementation 'com.github.pwittchen:reactivenetwork:0.7.0'
// Network client
implementation "com.squareup.okhttp3:okhttp:3.9.0"
implementation "com.squareup.okhttp3:okhttp:3.9.1"
implementation 'com.squareup.okio:okio:1.13.0'
// REST
@ -232,7 +232,7 @@ dependencies {
}
buildscript {
ext.kotlin_version = '1.1.51'
ext.kotlin_version = '1.1.61'
repositories {
mavenCentral()
}

View File

@ -79,7 +79,7 @@ class LibraryAdapter(private val controller: LibraryController) : RecyclerViewPa
/**
* Returns the position of the view.
*/
override fun getItemPosition(obj: Any?): Int {
override fun getItemPosition(obj: Any): Int {
val view = obj as? LibraryCategoryView ?: return POSITION_NONE
val index = categories.indexOfFirst { it.id == view.category.id }
return if (index == -1) POSITION_NONE else index

View File

@ -64,7 +64,7 @@ class ReaderCustomFilterDialog : DialogFragment() {
* @param savedState The last saved instance state of the Fragment.
*/
override fun onCreateDialog(savedState: Bundle?): Dialog {
val dialog = MaterialDialog.Builder(activity)
val dialog = MaterialDialog.Builder(activity!!)
.customView(R.layout.reader_custom_filter_dialog, false)
.positiveText(android.R.string.ok)
.build()

View File

@ -24,7 +24,7 @@ class ReaderSettingsDialog : DialogFragment() {
private lateinit var subscriptions: CompositeSubscription
override fun onCreateDialog(savedState: Bundle?): Dialog {
val dialog = MaterialDialog.Builder(activity)
val dialog = MaterialDialog.Builder(activity!!)
.title(R.string.label_settings)
.customView(R.layout.reader_settings_dialog, true)
.positiveText(android.R.string.ok)
@ -40,8 +40,11 @@ class ReaderSettingsDialog : DialogFragment() {
viewer.onItemSelectedListener = IgnoreFirstSpinnerListener { position ->
subscriptions += Observable.timer(250, MILLISECONDS, AndroidSchedulers.mainThread())
.subscribe {
(activity as ReaderActivity).presenter.updateMangaViewer(position)
activity.recreate()
val readerActivity = activity as? ReaderActivity
if (readerActivity != null) {
readerActivity.presenter.updateMangaViewer(position)
readerActivity.recreate()
}
}
}
viewer.setSelection((activity as ReaderActivity).presenter.manga.viewer, false)

View File

@ -100,12 +100,12 @@ abstract class PagerReader : BaseReader() {
/**
* Text color for black theme.
*/
val whiteColor by lazy { ContextCompat.getColor(context, R.color.textColorSecondaryDark) }
val whiteColor by lazy { ContextCompat.getColor(context!!, R.color.textColorSecondaryDark) }
/**
* Text color for white theme.
*/
val blackColor by lazy { ContextCompat.getColor(context, R.color.textColorSecondaryLight) }
val blackColor by lazy { ContextCompat.getColor(context!!, R.color.textColorSecondaryLight) }
/**
* Initializes the pager.

View File

@ -24,7 +24,7 @@ class HorizontalPager(context: Context) : ViewPager(context), Pager {
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
try {
if (ev.action and MotionEvent.ACTION_MASK == MotionEvent.ACTION_DOWN) {
if (currentItem == 0 || currentItem == adapter.count - 1) {
if (currentItem == 0 || currentItem == adapter!!.count - 1) {
startDragX = ev.x
}
}
@ -50,7 +50,7 @@ class HorizontalPager(context: Context) : ViewPager(context), Pager {
startDragX = 0f
}
} else if (currentItem == adapter.count - 1) {
} else if (currentItem == adapter!!.count - 1) {
if (ev.action and MotionEvent.ACTION_MASK == MotionEvent.ACTION_UP) {
val displacement = startDragX - ev.x

View File

@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerReader
class LeftToRightReader : PagerReader() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedState: Bundle?): View? {
return HorizontalPager(activity).apply { initializePager(this) }
return HorizontalPager(activity!!).apply { initializePager(this) }
}
}

View File

@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerReader
class RightToLeftReader : PagerReader() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedState: Bundle?): View? {
return HorizontalPager(activity).apply {
return HorizontalPager(activity!!).apply {
rotation = 180f
initializePager(this)
}

View File

@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerReader
class VerticalReader : PagerReader() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedState: Bundle?): View? {
return VerticalPager(activity).apply { initializePager(this) }
return VerticalPager(activity!!).apply { initializePager(this) }
}
}

View File

@ -33,7 +33,6 @@ import android.support.annotation.DrawableRes;
import android.support.v4.os.ParcelableCompat;
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.KeyEventCompat;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.VelocityTrackerCompat;
@ -2598,14 +2597,10 @@ public class VerticalViewPagerImpl extends ViewGroup {
handled = arrowScroll(FOCUS_RIGHT);
break;
case KeyEvent.KEYCODE_TAB:
if (Build.VERSION.SDK_INT >= 11) {
// The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
// before Android 3.0. Ignore the tab key on those devices.
if (KeyEventCompat.hasNoModifiers(event)) {
handled = arrowScroll(FOCUS_FORWARD);
} else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
handled = arrowScroll(FOCUS_BACKWARD);
}
if (event.hasNoModifiers()) {
handled = arrowScroll(FOCUS_FORWARD);
} else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {
handled = arrowScroll(FOCUS_BACKWARD);
}
break;
default:

View File

@ -73,7 +73,7 @@ class WebtoonReader : BaseReader() {
private var scrollDistance: Int = 0
val screenHeight by lazy {
val display = activity.windowManager.defaultDisplay
val display = activity!!.windowManager.defaultDisplay
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
val metrics = DisplayMetrics()
@ -91,7 +91,7 @@ class WebtoonReader : BaseReader() {
val screenHeight = resources.displayMetrics.heightPixels
scrollDistance = screenHeight * 3 / 4
layoutManager = PreCachingLayoutManager(activity)
layoutManager = PreCachingLayoutManager(activity!!)
layoutManager.extraLayoutSpace = screenHeight / 2
recycler = RecyclerView(activity).apply {

View File

@ -194,7 +194,7 @@ class SettingsDownloadController : SettingsController() {
File.separator + "downloads"
return mutableListOf(File(defaultDir)) +
ContextCompat.getExternalFilesDirs(activity, "").filterNotNull()
ContextCompat.getExternalFilesDirs(activity!!, "").filterNotNull()
}
}

View File

@ -7,7 +7,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.1'
// NOTE: Do not place your application dependencies here; they belong