From a8521935200a858d77fb8abfcc6d60e6a626eece Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 13 Jun 2019 14:05:10 -0700 Subject: [PATCH] Update kau and fix 29 incompatibilities --- app/build.gradle | 2 +- .../kotlin/com/pitchedapps/frost/StartActivity.kt | 2 +- .../com/pitchedapps/frost/activities/AboutActivity.kt | 4 ++-- .../pitchedapps/frost/activities/BaseMainActivity.kt | 2 +- .../com/pitchedapps/frost/activities/DebugActivity.kt | 2 +- .../com/pitchedapps/frost/activities/ImageActivity.kt | 8 +++++--- .../com/pitchedapps/frost/activities/IntroActivity.kt | 2 +- .../pitchedapps/frost/activities/SettingsActivity.kt | 4 ++-- .../frost/activities/TabCustomizerActivity.kt | 2 +- .../frost/activities/WebOverlayActivity.kt | 11 +++++++---- .../com/pitchedapps/frost/debugger/OfflineWebsite.kt | 4 ++-- .../kotlin/com/pitchedapps/frost/facebook/FbItem.kt | 6 +++--- .../com/pitchedapps/frost/fragments/FragmentBase.kt | 2 +- .../com/pitchedapps/frost/fragments/WebFragments.kt | 2 +- .../pitchedapps/frost/intro/IntroImageFragments.kt | 2 +- .../pitchedapps/frost/services/FrostRequestService.kt | 2 +- .../main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 2 +- .../kotlin/com/pitchedapps/frost/views/AccountItem.kt | 2 +- .../com/pitchedapps/frost/views/FrostVideoViewer.kt | 2 +- .../kotlin/com/pitchedapps/frost/views/Keywords.kt | 2 +- gradle.properties | 2 +- 21 files changed, 36 insertions(+), 31 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 302d79c18..2348e0537 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,7 +20,7 @@ android { } defaultConfig { - applicationId "${project.APP_GROUP}." + project.APP_ID.toLowerCase(Locale.CANADA) + applicationId "${project.APP_GROUP}.${project.APP_ID.toLowerCase(Locale.CANADA)}" minSdkVersion kau.Versions.minSdk targetSdkVersion kau.Versions.targetSdk versionCode androidGitVersion.code() diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt index cc1ae4662..cf8acdd36 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt @@ -28,7 +28,7 @@ import ca.allanwang.kau.utils.buildIsLollipopAndUp import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.startActivity import ca.allanwang.kau.utils.string -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.activities.LoginActivity import com.pitchedapps.frost.activities.MainActivity import com.pitchedapps.frost.activities.SelectorActivity diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt index 3c5f71c2f..561253033 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -40,10 +40,10 @@ import ca.allanwang.kau.utils.withMinAlpha import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.entity.Library import com.mikepenz.aboutlibraries.entity.License -import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial +import com.mikepenz.community_material_typeface_library.CommunityMaterial import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.items.AbstractItem -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon import com.pitchedapps.frost.BuildConfig import com.pitchedapps.frost.R diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt index ea062cf77..b2946852d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -60,7 +60,7 @@ import co.zsmb.materialdrawerkt.draweritems.profile.profileSetting import com.afollestad.materialdialogs.checkbox.checkBoxPrompt import com.google.android.material.appbar.AppBarLayout import com.google.android.material.tabs.TabLayout -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.IconicsDrawable import com.mikepenz.iconics.typeface.IIcon import com.mikepenz.materialdrawer.AccountHeader diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt index 0ad0204f0..a1b418306 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt @@ -25,7 +25,7 @@ import ca.allanwang.kau.internal.KauBaseActivity import ca.allanwang.kau.utils.launchMain import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.visible -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.injectors.JsActions diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt index de5533761..814ce7789 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -42,7 +42,7 @@ import ca.allanwang.kau.utils.withMinAlpha import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.google.android.material.floatingactionbutton.FloatingActionButton -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon import com.pitchedapps.frost.R import com.pitchedapps.frost.facebook.FB_IMAGE_ID_MATCHER @@ -121,7 +121,7 @@ class ImageActivity : KauBaseActivity() { private val cookie: String? by lazy { intent.getStringExtra(ARG_COOKIE) } - val imageUrl: String by lazy { intent.getStringExtra(ARG_IMAGE_URL).trim('"') } + val imageUrl: String by lazy { intent.getStringExtra(ARG_IMAGE_URL)?.trim('"') ?: "" } private lateinit var trueImageUrl: Deferred @@ -146,7 +146,9 @@ class ImageActivity : KauBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - intent?.extras ?: return finish() + if (imageUrl.isEmpty()) { + return finish() + } L.i { "Displaying image" } trueImageUrl = async(Dispatchers.IO) { val result = if (!imageUrl.isIndirectImageUrl) imageUrl diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt index e1d033148..1e1067659 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt @@ -41,7 +41,7 @@ import ca.allanwang.kau.utils.postDelayed import ca.allanwang.kau.utils.scaleXY import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.statusBarColor -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.intro.BaseIntroFragment import com.pitchedapps.frost.intro.IntroAccountFragment diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt index e78da3be7..3007933c6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt @@ -37,8 +37,8 @@ import ca.allanwang.kau.utils.string import ca.allanwang.kau.utils.tint import ca.allanwang.kau.utils.withSceneTransitionAnimation import com.afollestad.materialdialogs.list.listItems -import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.community_material_typeface_library.CommunityMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.enums.Support import com.pitchedapps.frost.settings.getAppearancePrefs diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt index c6bcbb6ae..6ad7d3f23 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt @@ -32,7 +32,7 @@ import ca.allanwang.kau.utils.withAlpha import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter import com.mikepenz.fastadapter_extensions.drag.ItemTouchCallback import com.mikepenz.fastadapter_extensions.drag.SimpleDragCallback -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.db.GenericDao import com.pitchedapps.frost.db.TAB_COUNT diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt index ff31b56bb..5b2d01d45 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt @@ -47,8 +47,8 @@ import ca.allanwang.kau.utils.toast import ca.allanwang.kau.utils.withAlpha import ca.allanwang.kau.utils.withMainContext import com.google.android.material.snackbar.BaseTransientBottomBar -import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.community_material_typeface_library.CommunityMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.contracts.ActivityContract import com.pitchedapps.frost.contracts.FileChooserContract @@ -163,13 +163,16 @@ open class WebOverlayActivityBase(private val forceDesktopAgent: Boolean) : Base val content: FrostContentWeb by bindView(R.id.frost_content_web) val web: FrostWebView get() = content.coreView - val coordinator: CoordinatorLayout by bindView(R.id.overlay_main_content) + private val coordinator: CoordinatorLayout by bindView(R.id.overlay_main_content) private inline val urlTest: String? get() = intent.getStringExtra(ARG_URL) ?: intent.dataString + /** + * Nonnull variant; verify by checking [urlTest] + */ override val baseUrl: String - get() = (intent.getStringExtra(ARG_URL) ?: intent.dataString).formattedFbUrl + get() = urlTest!!.formattedFbUrl override val baseEnum: FbItem? = null diff --git a/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt b/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt index f128edcfb..6bb50ccd6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt @@ -209,9 +209,9 @@ class OfflineWebsite( delete() } baseDir.listFiles { file -> file != zip } - .forEach { it.zip() } + ?.forEach { it.zip() } assetDir.listFiles() - .forEach { it.zip("assets/${it.name}") } + ?.forEach { it.zip("assets/${it.name}") } assetDir.delete() } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt index 16952e490..82e151117 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt @@ -17,10 +17,10 @@ package com.pitchedapps.frost.facebook import androidx.annotation.StringRes -import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.community_material_typeface_library.CommunityMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon -import com.mikepenz.iconics.typeface.library.materialdesigniconic.MaterialDesignIconic +import com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic import com.pitchedapps.frost.R import com.pitchedapps.frost.fragments.BaseFragment import com.pitchedapps.frost.fragments.MenuFragment diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt index 0000195ca..55fbcd402 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt @@ -82,7 +82,7 @@ abstract class BaseFragment : Fragment(), CoroutineScope, FragmentContract, Dyna override val coroutineContext: CoroutineContext get() = ContextHelper.dispatcher + job - override val baseUrl: String by lazy { arguments!!.getString(ARG_URL) } + override val baseUrl: String by lazy { arguments!!.getString(ARG_URL)!! } override val baseEnum: FbItem by lazy { FbItem[arguments]!! } override val position: Int by lazy { arguments!!.getInt(ARG_POSITION) } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragments.kt index c81c780b5..72367eaa4 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragments.kt @@ -17,7 +17,7 @@ package com.pitchedapps.frost.fragments import android.webkit.WebView -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.contracts.MainFabContract import com.pitchedapps.frost.facebook.FbItem diff --git a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt index bddf42b2d..1fd8c76ea 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt @@ -27,7 +27,7 @@ import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.tint import ca.allanwang.kau.utils.visible import ca.allanwang.kau.utils.withAlpha -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.launchTabCustomizerActivity diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt index a8ecb27dc..0d707daea 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt @@ -82,7 +82,7 @@ private const val ARG_1 = "frost_request_arg_1" private const val ARG_2 = "frost_request_arg_2" private const val ARG_3 = "frost_request_arg_3" -private fun BaseBundle.getCookie() = getString(ARG_COOKIE) +private fun BaseBundle.getCookie(): String = getString(ARG_COOKIE)!! private fun BaseBundle.putCookie(cookie: String) = putString(ARG_COOKIE, cookie) /** diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt index a6a9e721d..44a666947 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -389,7 +389,7 @@ fun File.createFreshFile(): Boolean { if (!delete()) return false } else { val parent = parentFile - if (!parent.exists() && !parent.mkdirs()) + if (parent != null && !parent.exists() && !parent.mkdirs()) return false } return createNewFile() diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt index 98909e0a6..0269b1a9c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt @@ -31,7 +31,7 @@ import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.target.Target -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.db.CookieEntity import com.pitchedapps.frost.facebook.profilePictureUrl diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt index 6593a8dff..4d88ad3d0 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt @@ -38,7 +38,7 @@ import ca.allanwang.kau.utils.setMenuIcons import ca.allanwang.kau.utils.visible import ca.allanwang.kau.utils.withMinAlpha import com.devbrackets.android.exomedia.listener.VideoControlsVisibilityListener -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.db.FrostDatabase import com.pitchedapps.frost.db.currentCookie diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt index 0d596086d..e63fcc21a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt @@ -34,7 +34,7 @@ import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter import com.mikepenz.fastadapter.items.AbstractItem import com.mikepenz.fastadapter.listeners.ClickEventHook -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon import com.pitchedapps.frost.R import com.pitchedapps.frost.utils.Prefs diff --git a/gradle.properties b/gradle.properties index 4b4a34bd3..5b4637fd2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ org.gradle.daemon = true APP_ID=Frost APP_GROUP=com.pitchedapps -KAU=318e42c +KAU=e1849c9 android.useAndroidX=true android.enableJetifier=true