From 981d6ffb409a501e6efcf4fe0cbe719e192beee7 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 22 Sep 2019 22:36:16 -0700 Subject: Apply kau migration --- app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt | 2 +- .../main/kotlin/com/pitchedapps/frost/StartActivity.kt | 2 +- .../com/pitchedapps/frost/activities/AboutActivity.kt | 17 ++++++++++------- .../pitchedapps/frost/activities/BaseMainActivity.kt | 6 ++++-- .../com/pitchedapps/frost/activities/DebugActivity.kt | 2 +- .../com/pitchedapps/frost/activities/ImageActivity.kt | 2 +- .../com/pitchedapps/frost/activities/IntroActivity.kt | 2 +- .../pitchedapps/frost/activities/SelectorActivity.kt | 6 +++--- .../pitchedapps/frost/activities/SettingsActivity.kt | 4 ++-- .../frost/activities/TabCustomizerActivity.kt | 10 +++++----- .../pitchedapps/frost/activities/WebOverlayActivity.kt | 5 +++-- .../kotlin/com/pitchedapps/frost/facebook/FbItem.kt | 6 +++--- .../frost/fragments/RecyclerFragmentBase.kt | 12 +++++++----- .../com/pitchedapps/frost/fragments/WebFragments.kt | 2 +- .../com/pitchedapps/frost/iitems/GenericIItems.kt | 17 +++++++++++------ .../com/pitchedapps/frost/iitems/NotificationIItem.kt | 18 +++++++++++++----- .../kotlin/com/pitchedapps/frost/iitems/TabIItem.kt | 11 ++++------- .../com/pitchedapps/frost/intro/IntroImageFragments.kt | 2 +- .../com/pitchedapps/frost/intro/IntroMainFragments.kt | 2 +- .../kotlin/com/pitchedapps/frost/views/AccountItem.kt | 12 ++++++------ .../com/pitchedapps/frost/views/FrostVideoViewer.kt | 2 +- .../com/pitchedapps/frost/views/KPrefTextSeekbar.kt | 2 +- .../kotlin/com/pitchedapps/frost/views/Keywords.kt | 14 ++++++++------ 23 files changed, 89 insertions(+), 69 deletions(-) (limited to 'app/src/main/kotlin') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt index 7a4472b4..ea0de778 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt @@ -80,7 +80,7 @@ class FrostApp : Application() { * Reload the image on every version update */ DrawerImageLoader.init(object : AbstractDrawerImageLoader() { - override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String) { + override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String?) { val c = imageView.context val request = GlideApp.with(c) val old = request.load(uri).apply(RequestOptions().placeholder(placeholder)) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt index d03a7ea4..547718dd 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.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.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 4b98c6c9..4cfa46c8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -40,11 +40,12 @@ 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.community_material_typeface_library.CommunityMaterial +import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.items.AbstractItem -import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon +import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.BuildConfig import com.pitchedapps.frost.R import com.pitchedapps.frost.utils.L @@ -87,7 +88,7 @@ class AboutActivity : AboutActivityBase(null, { var lastClick = -1L var clickCount = 0 - override fun postInflateMainPage(adapter: FastItemThemedAdapter>) { + override fun postInflateMainPage(adapter: FastItemThemedAdapter) { /** * Frost may not be a library but we're conveying the same info */ @@ -104,7 +105,7 @@ class AboutActivity : AboutActivityBase(null, { } } adapter.add(LibraryIItem(frost)).add(AboutLinks()) - adapter.withOnClickListener { _, _, item, _ -> + adapter.onClickListener = { _, _, item, _ -> if (item is LibraryIItem) { val now = System.currentTimeMillis() if (now - lastClick > 500) @@ -126,13 +127,15 @@ class AboutActivity : AboutActivityBase(null, { } } - class AboutLinks : AbstractItem(), + class AboutLinks : AbstractItem< AboutLinks.ViewHolder>(), ThemableIItem by ThemableIItemDelegate() { override fun getViewHolder(v: View): ViewHolder = ViewHolder(v) - override fun getType(): Int = R.id.item_about_links + override val layoutRes: Int + get() = R.layout.item_about_links - override fun getLayoutRes(): Int = R.layout.item_about_links + override val type: Int + get() = R.id.item_about_links override fun bindView(holder: ViewHolder, payloads: MutableList) { super.bindView(holder, payloads) 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 521049e7..2574d507 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -60,9 +60,11 @@ 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.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.IconicsDrawable import com.mikepenz.iconics.typeface.IIcon +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.iconics.utils.colorInt +import com.mikepenz.iconics.utils.paddingDp import com.mikepenz.materialdrawer.AccountHeader import com.mikepenz.materialdrawer.Drawer import com.pitchedapps.frost.BuildConfig @@ -279,7 +281,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, this@BaseMainActivity, GoogleMaterial.Icon.gmd_add ).actionBar().paddingDp(5) - .color(Prefs.textColor) + .colorInt(Prefs.textColor) textColor = Prefs.textColor.toLong() identifier = -3L } 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 87454c10..e0dc409b 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.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.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 09620a54..1549e23e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -48,7 +48,7 @@ import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.floatingactionbutton.FloatingActionButton -import com.mikepenz.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon import com.pitchedapps.frost.R import com.pitchedapps.frost.databinding.ActivityImageBinding 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 eeda94d4..5983bd30 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.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.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/SelectorActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt index 686768cc..87fb1b17 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt @@ -24,7 +24,7 @@ import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import ca.allanwang.kau.utils.bindView import com.mikepenz.fastadapter.FastAdapter -import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter +import com.mikepenz.fastadapter.adapters.FastItemAdapter import com.mikepenz.fastadapter.listeners.ClickEventHook import com.pitchedapps.frost.R import com.pitchedapps.frost.facebook.FbCookie @@ -51,9 +51,9 @@ class SelectorActivity : BaseActivity() { recycler.adapter = adapter adapter.add(cookies().map { AccountItem(it) }) adapter.add(AccountItem(null)) // add account - adapter.withEventHook(object : ClickEventHook() { + adapter.addEventHook(object : ClickEventHook() { override fun onBind(viewHolder: RecyclerView.ViewHolder): View? = - (viewHolder as? AccountItem.ViewHolder)?.v + (viewHolder as? AccountItem.ViewHolder)?.itemView override fun onClick( v: View, 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 c239bb80..4a7f25c2 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.community_material_typeface_library.CommunityMaterial -import com.mikepenz.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.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 eae4d717..743a4733 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt @@ -29,10 +29,10 @@ import ca.allanwang.kau.utils.launchMain import ca.allanwang.kau.utils.scaleXY import ca.allanwang.kau.utils.setIcon 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.google_material_typeface_library.GoogleMaterial +import com.mikepenz.fastadapter.adapters.FastItemAdapter +import com.mikepenz.fastadapter.drag.ItemTouchCallback +import com.mikepenz.fastadapter.drag.SimpleDragCallback +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.db.GenericDao import com.pitchedapps.frost.db.TAB_COUNT @@ -84,7 +84,7 @@ class TabCustomizerActivity : BaseActivity() { bindSwapper(adapter, tab_recycler) - adapter.withOnClickListener { view, _, _, _ -> view!!.wobble(); true } + adapter.onClickListener = { view, _, _, _ -> view!!.wobble(); true } } setResult(Activity.RESULT_CANCELED) 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 2f49b235..312e7665 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.community_material_typeface_library.CommunityMaterial -import com.mikepenz.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.contracts.ActivityContract import com.pitchedapps.frost.contracts.FileChooserContract @@ -290,6 +290,7 @@ abstract class WebOverlayActivityBase : BaseActivity(), override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (onActivityResultWeb(requestCode, resultCode, data)) return + super.onActivityResult(requestCode, resultCode, data) } override fun onCreateOptionsMenu(menu: Menu): Boolean { 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 6f726b5b..74f323b0 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.community_material_typeface_library.CommunityMaterial -import com.mikepenz.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon -import com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic +import com.mikepenz.iconics.typeface.library.materialdesigniconic.MaterialDesignIconic import com.pitchedapps.frost.R import com.pitchedapps.frost.fragments.BaseFragment import com.pitchedapps.frost.fragments.WebFragment diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt index 71c27dd2..d73f3eb9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt @@ -19,6 +19,8 @@ package com.pitchedapps.frost.fragments import ca.allanwang.kau.adapters.fastAdapter import ca.allanwang.kau.utils.withMainContext import com.mikepenz.fastadapter.FastAdapter +import com.mikepenz.fastadapter.GenericFastAdapter +import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.adapters.ItemAdapter import com.mikepenz.fastadapter.adapters.ModelAdapter @@ -36,7 +38,7 @@ import kotlinx.coroutines.withContext /** * Created by Allan Wang on 27/12/17. */ -abstract class RecyclerFragment> : BaseFragment(), RecyclerContentContract { +abstract class RecyclerFragment : BaseFragment(), RecyclerContentContract { override val layoutRes: Int = R.layout.view_content_recycler @@ -72,7 +74,7 @@ abstract class RecyclerFragment> : BaseFragment(), Recycle protected abstract suspend fun reloadImpl(progress: (Int) -> Unit): List? } -abstract class GenericRecyclerFragment> : RecyclerFragment() { +abstract class GenericRecyclerFragment : RecyclerFragment() { abstract fun mapper(data: T): Item @@ -93,10 +95,10 @@ abstract class GenericRecyclerFragment> : RecyclerFragment /** * Create the fast adapter to bind to the recyclerview */ - open fun getAdapter(): FastAdapter> = fastAdapter(this.adapter) + open fun getAdapter(): GenericFastAdapter = fastAdapter(this.adapter) } -abstract class FrostParserFragment> : +abstract class FrostParserFragment : RecyclerFragment() { /** @@ -125,7 +127,7 @@ abstract class FrostParserFragment> : /** * Create the fast adapter to bind to the recyclerview */ - open fun getAdapter(): FastAdapter> = fastAdapter(this.adapter) + open fun getAdapter(): GenericFastAdapter = fastAdapter(this.adapter) override suspend fun reloadImpl(progress: (Int) -> Unit): List? = withContext(Dispatchers.IO) { 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 7c96235f..0a3884ff 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.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.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/iitems/GenericIItems.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt index 6eacf48e..ca8bf352 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt @@ -23,8 +23,9 @@ import ca.allanwang.kau.iitems.KauIItem import ca.allanwang.kau.ui.createSimpleRippleDrawable import ca.allanwang.kau.utils.bindView import com.mikepenz.fastadapter.FastAdapter +import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.IAdapter -import com.mikepenz.fastadapter.IItem +import com.mikepenz.fastadapter.select.selectExtension import com.pitchedapps.frost.R import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.launchWebOverlay @@ -46,15 +47,19 @@ interface ClickableIItemContract { } companion object { - fun bindEvents(adapter: IAdapter>) { - adapter.fastAdapter.withSelectable(false) - .withOnClickListener { v, _, item, _ -> + fun bindEvents(adapter: IAdapter) { + adapter.fastAdapter?.apply { + selectExtension { + isSelectable = false + } + onClickListener = { v, _, item, _ -> if (item is ClickableIItemContract) { item.click(v!!.context) true } else false } + } } } } @@ -66,7 +71,7 @@ interface ClickableIItemContract { open class HeaderIItem( val text: String?, itemId: Int = R.layout.iitem_header -) : KauIItem(R.layout.iitem_header, ::ViewHolder, itemId) { +) : KauIItem(R.layout.iitem_header, ::ViewHolder, itemId) { class ViewHolder(itemView: View) : FastAdapter.ViewHolder(itemView) { @@ -92,7 +97,7 @@ open class TextIItem( val text: String?, override val url: String?, itemId: Int = R.layout.iitem_text -) : KauIItem(R.layout.iitem_text, ::ViewHolder, itemId), +) : KauIItem(R.layout.iitem_text, ::ViewHolder, itemId), ClickableIItemContract { class ViewHolder(itemView: View) : FastAdapter.ViewHolder(itemView) { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt index 1806d351..894a220d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt @@ -28,7 +28,8 @@ import ca.allanwang.kau.utils.visible import ca.allanwang.kau.utils.withAlpha import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.adapters.ItemAdapter -import com.mikepenz.fastadapter.commons.utils.DiffCallback +import com.mikepenz.fastadapter.diff.DiffCallback +import com.mikepenz.fastadapter.select.selectExtension import com.pitchedapps.frost.R import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.parsers.FrostNotif @@ -42,14 +43,17 @@ import com.pitchedapps.frost.utils.launchWebOverlay * Created by Allan Wang on 27/12/17. */ class NotificationIItem(val notification: FrostNotif, val cookie: String) : - KauIItem( + KauIItem( R.layout.iitem_notification, ::ViewHolder ) { companion object { fun bindEvents(adapter: ItemAdapter) { - adapter.fastAdapter.withSelectable(false) - .withOnClickListener { v, _, item, position -> + adapter.fastAdapter?.apply { + selectExtension { + isSelectable = false + } + onClickListener = { v, _, item, position -> val notif = item.notification if (notif.unread) { adapter.set( @@ -61,6 +65,7 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) : v!!.context.launchWebOverlay(if (notif.url.isIndependent) notif.url else FbItem.NOTIFICATIONS.url) true } + } } //todo see if necessary @@ -72,7 +77,10 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) : override fun areItemsTheSame(oldItem: NotificationIItem, newItem: NotificationIItem) = oldItem.notification.id == newItem.notification.id - override fun areContentsTheSame(oldItem: NotificationIItem, newItem: NotificationIItem) = + override fun areContentsTheSame( + oldItem: NotificationIItem, + newItem: NotificationIItem + ) = oldItem.notification == newItem.notification override fun getChangePayload( diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt index 51201d09..186e6288 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt @@ -26,8 +26,7 @@ import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.visible import ca.allanwang.kau.utils.withAlpha import com.mikepenz.fastadapter.FastAdapter -import com.mikepenz.fastadapter.IItem -import com.mikepenz.fastadapter_extensions.drag.IDraggable +import com.mikepenz.fastadapter.drag.IDraggable import com.pitchedapps.frost.R import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.utils.Prefs @@ -35,14 +34,12 @@ import com.pitchedapps.frost.utils.Prefs /** * Created by Allan Wang on 26/11/17. */ -class TabIItem(val item: FbItem) : KauIItem( +class TabIItem(val item: FbItem) : KauIItem( R.layout.iitem_tab_preview, { ViewHolder(it) } -), IDraggable> { +), IDraggable { - override fun withIsDraggable(draggable: Boolean): TabIItem = this - - override fun isDraggable() = true + override val isDraggable: Boolean = true class ViewHolder(itemView: View) : FastAdapter.ViewHolder(itemView) { 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 4f1e5182..36924551 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.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.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/intro/IntroMainFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt index f3d64b32..94531000 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt @@ -32,7 +32,7 @@ import ca.allanwang.kau.utils.Kotterknife import ca.allanwang.kau.utils.bindViewResettable import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.setOnSingleTapListener -import com.mikepenz.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.activities.IntroActivity import com.pitchedapps.frost.utils.Prefs 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 0269b1a9..1f4e62ab 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.google_material_typeface_library.GoogleMaterial +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.db.CookieEntity import com.pitchedapps.frost.facebook.profilePictureUrl @@ -42,12 +42,12 @@ import com.pitchedapps.frost.utils.Prefs /** * Created by Allan Wang on 2017-06-05. */ -class AccountItem(val cookie: CookieEntity?) : KauIItem +class AccountItem(val cookie: CookieEntity?) : KauIItem (R.layout.view_account, { ViewHolder(it) }, R.id.item_account) { - override fun bindView(viewHolder: ViewHolder, payloads: MutableList) { - super.bindView(viewHolder, payloads) - with(viewHolder) { + override fun bindView(holder: ViewHolder, payloads: MutableList) { + super.bindView(holder, payloads) + with(holder) { text.invisible() text.setTextColor(Prefs.textColor) if (cookie != null) { @@ -97,7 +97,7 @@ class AccountItem(val cookie: CookieEntity?) : KauIItem) { + override fun bindView(holder: ViewHolder, payloads: MutableList) { super.bindView(holder, payloads) descOriginalSize = holder.desc?.textSize ?: 1f holder.desc?.layoutParams 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 02c60288..8f0309cb 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt @@ -31,11 +31,11 @@ import ca.allanwang.kau.utils.string import ca.allanwang.kau.utils.tint import ca.allanwang.kau.utils.toDrawable import com.mikepenz.fastadapter.FastAdapter -import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter +import com.mikepenz.fastadapter.adapters.FastItemAdapter import com.mikepenz.fastadapter.items.AbstractItem import com.mikepenz.fastadapter.listeners.ClickEventHook -import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon +import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.utils.Prefs @@ -68,7 +68,7 @@ class Keywords @JvmOverloads constructor( adapter.add(Prefs.notificationKeywords.map { KeywordItem(it) }) recycler.layoutManager = LinearLayoutManager(context) recycler.adapter = adapter - adapter.withEventHook(object : ClickEventHook() { + adapter.addEventHook(object : ClickEventHook() { override fun onBind(viewHolder: RecyclerView.ViewHolder): View? = (viewHolder as? KeywordItem.ViewHolder)?.delete @@ -91,13 +91,15 @@ class Keywords @JvmOverloads constructor( private fun IIcon.keywordDrawable(context: Context): Drawable = toDrawable(context, 20, Prefs.textColor) -class KeywordItem(val keyword: String) : AbstractItem() { +class KeywordItem(val keyword: String) : AbstractItem() { override fun getViewHolder(v: View): ViewHolder = ViewHolder(v) - override fun getType(): Int = R.id.item_keyword + override val layoutRes: Int + get() = R.layout.item_keyword - override fun getLayoutRes(): Int = R.layout.item_keyword + override val type: Int + get() = R.id.item_keyword override fun bindView(holder: ViewHolder, payloads: MutableList) { super.bindView(holder, payloads) -- cgit v1.2.3 From 142b95f0ae82a849b1e9ef390a2a068b4c792be6 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 22 Sep 2019 22:47:07 -0700 Subject: Optimize imports and update changelog --- .../kotlin/com/pitchedapps/frost/activities/AboutActivity.kt | 1 - .../com/pitchedapps/frost/activities/BaseMainActivity.kt | 4 ++-- .../kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | 2 +- .../kotlin/com/pitchedapps/frost/activities/IntroActivity.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/enums/FeedSort.kt | 2 +- .../kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt | 2 +- .../kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt | 4 ++-- .../com/pitchedapps/frost/facebook/parsers/MessageParser.kt | 2 +- .../com/pitchedapps/frost/facebook/parsers/NotifParser.kt | 4 ++-- .../com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt | 2 -- .../kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt | 2 +- .../com/pitchedapps/frost/intro/IntroImageFragments.kt | 2 +- .../com/pitchedapps/frost/services/NotificationUtils.kt | 2 +- .../kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt | 2 +- .../kotlin/com/pitchedapps/frost/settings/Notifications.kt | 2 +- .../com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 12 ++++++------ .../kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt | 4 ++-- .../main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | 2 +- .../main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt | 2 +- app/src/main/play/en-US/whatsnew | 3 ++- app/src/main/res/xml/frost_changelog.xml | 2 +- .../test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt | 2 +- app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt | 2 +- docs/Changelog.md | 1 + 28 files changed, 36 insertions(+), 37 deletions(-) (limited to 'app/src/main/kotlin') 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 4cfa46c8..5b3a7315 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -41,7 +41,6 @@ import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.entity.Library import com.mikepenz.aboutlibraries.entity.License import com.mikepenz.fastadapter.GenericItem -import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.items.AbstractItem import com.mikepenz.iconics.typeface.IIcon import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial 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 2574d507..798ee4b3 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -467,7 +467,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, fun hasRequest(flag: Int) = resultCode and flag > 0 if (requestCode == ACTIVITY_SETTINGS) { - if (resultCode and REQUEST_RESTART_APPLICATION > 0) { //completely restart application + if (resultCode and REQUEST_RESTART_APPLICATION > 0) { // completely restart application L.d { "Restart Application Requested" } val intent = packageManager.getLaunchIntentForPackage(packageName)!! Intent.makeRestartActivityTask(intent.component) @@ -604,7 +604,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, if (!fragmentChannel.isClosedForSend) { fragmentChannel.offer(0) } - } //trigger hook so title is set + } // trigger hook so title is set } fun saveInstanceState(outState: Bundle) { 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 1549e23e..5da6d970 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -258,7 +258,7 @@ class ImageActivity : KauBaseActivity() { ) { super.onViewPositionChanged(changedView, left, top, dx, dy) with(binding) { - //make sure that we are using the proper axis + // make sure that we are using the proper axis scrollPercent = abs(top.toFloat() / imageContainer.height) scrollToTop = top < 0 val multiplier = max(1f - scrollPercent, 0f) 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 5983bd30..77a58cf2 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt @@ -123,7 +123,7 @@ class IntroActivity : KauBaseActivity(), ViewPager.PageTransformer, ViewPager.On * All fragments are locked in position */ override fun transformPage(page: View, position: Float) { - //only apply to adjacent pages + // only apply to adjacent pages if ((position < 0 && position > -1) || (position > 0 && position < 1)) { val pageWidth = page.width val translateValue = position * -pageWidth diff --git a/app/src/main/kotlin/com/pitchedapps/frost/enums/FeedSort.kt b/app/src/main/kotlin/com/pitchedapps/frost/enums/FeedSort.kt index 7312399e..1fbba812 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/enums/FeedSort.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/FeedSort.kt @@ -29,7 +29,7 @@ enum class FeedSort(@StringRes val textRes: Int, val item: FbItem) { TOP(R.string.top_stories, FbItem.FEED_TOP_STORIES); companion object { - val values = values() //save one instance + val values = values() // save one instance operator fun invoke(index: Int) = values[index] } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt b/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt index 2d51b032..a3a4c1a4 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt @@ -40,7 +40,7 @@ enum class MainActivityLayout( { Prefs.textColor }); companion object { - val values = values() //save one instance + val values = values() // save one instance operator fun invoke(index: Int) = values[index] } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt b/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt index 345aa88e..6c911e9c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt @@ -104,7 +104,7 @@ enum class Theme( get() = iconColorGetter() companion object { - val values = values() //save one instance + val values = values() // save one instance operator fun invoke(index: Int) = values[index] } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt index 2095f8fd..6292f4f0 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt @@ -67,7 +67,7 @@ class FbUrlFormatter(url: String) { return url } cleanedUrl = cleanedUrl.replace("&", "&") - if (changed && !cleanedUrl.contains("?")) //ensure we aren't missing '?' + if (changed && !cleanedUrl.contains("?")) // ensure we aren't missing '?' cleanedUrl = cleanedUrl.replaceFirst("&", "?") val qm = cleanedUrl.indexOf("?") if (qm > -1) { @@ -82,7 +82,7 @@ class FbUrlFormatter(url: String) { cleanedUrl = cleanedUrl.replaceFirst( ".facebook.com//", ".facebook.com/" - ) //sometimes we are given a bad url + ) // sometimes we are given a bad url L.v { "Formatted url from $url to $cleanedUrl" } return cleanedUrl } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt index 3705448a..f754b454 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt @@ -136,7 +136,7 @@ private class MessageParserImpl : FrostParserBase(true) { val a = element.getElementsByTag("a").first() ?: return null val abbr = element.getElementsByTag("abbr") val epoch = FB_EPOCH_MATCHER.find(abbr.attr("data-store"))[1]?.toLongOrNull() ?: -1L - //fetch id + // fetch id val id = FB_MESSAGE_NOTIF_ID_MATCHER.find(element.id())[1]?.toLongOrNull() ?: System.currentTimeMillis() % FALLBACK_TIME_MOD val snippet = element.select("span.snippet").firstOrNull() diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt index f9db0a8f..ab18172f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt @@ -105,13 +105,13 @@ private class NotifParserImpl : FrostParserBase(false) { val a = element.getElementsByTag("a").first() ?: return null val abbr = element.getElementsByTag("abbr") val epoch = FB_EPOCH_MATCHER.find(abbr.attr("data-store"))[1]?.toLongOrNull() ?: -1L - //fetch id + // fetch id val id = FB_NOTIF_ID_MATCHER.find(element.id())[1]?.toLongOrNull() ?: System.currentTimeMillis() % FALLBACK_TIME_MOD val img = element.getInnerImgStyle() val timeString = abbr.text() val content = - a.text().replace("\u00a0", " ").removeSuffix(timeString).trim() //remove   + a.text().replace("\u00a0", " ").removeSuffix(timeString).trim() // remove   val thumbnail = element.selectFirst("img.thumbnail")?.attr("src") return FrostNotif( id = id, diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt index d73f3eb9..21ba17ae 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt @@ -18,10 +18,8 @@ package com.pitchedapps.frost.fragments import ca.allanwang.kau.adapters.fastAdapter import ca.allanwang.kau.utils.withMainContext -import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.GenericFastAdapter import com.mikepenz.fastadapter.GenericItem -import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.adapters.ItemAdapter import com.mikepenz.fastadapter.adapters.ModelAdapter import com.pitchedapps.frost.R diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt index 894a220d..b2d328ec 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt @@ -68,7 +68,7 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) : } } - //todo see if necessary + // todo see if necessary val DIFF: DiffCallback by lazy(::Diff) } 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 36924551..9a4ec0c1 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt @@ -71,7 +71,7 @@ abstract class BaseImageIntroFragment( override fun onPageScrolledImpl(positionOffset: Float) { super.onPageScrolledImpl(positionOffset) val alpha = ((1 - abs(positionOffset)) * 255).toInt() - //apply alpha to all layers except the phone base + // apply alpha to all layers except the phone base (0 until imageDrawable.numberOfLayers).forEach { val d = imageDrawable.getDrawable(it) if (d != phone) d.alpha = alpha diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt index 8a8893e5..7352082d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt @@ -140,7 +140,7 @@ inline fun Context.scheduleJob(id: Int, minutes: Long): .setPeriodic(minutes * 60000) .setExtras(id) .setPersisted(true) - .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) //TODO add options + .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) // TODO add options val result = scheduler.schedule(builder.build()) if (result <= 0) { L.eThrow("${T::class.java.simpleName} scheduler failed") diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt index 2d86f3b9..2dbe6b6b 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt @@ -32,6 +32,6 @@ class UpdateReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { if (intent.action != Intent.ACTION_MY_PACKAGE_REPLACED) return L.d { "Frost has updated" } - context.scheduleNotifications(Prefs.notificationFreq) //Update notifications + context.scheduleNotifications(Prefs.notificationFreq) // Update notifications } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt index 9fcf2e96..b8a80e8d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt @@ -144,7 +144,7 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = { if (it.isBlank()) string(R.string.kau_default) else RingtoneManager.getRingtone(this@getNotificationPrefs, frostUri(it)) ?.getTitle(this@getNotificationPrefs) - ?: "---" //todo figure out why this happens + ?: "---" // todo figure out why this happens } onClick = { val intent = Intent(RingtoneManager.ACTION_RINGTONE_PICKER).apply { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt index c9e64eb3..0195f168 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt @@ -86,7 +86,7 @@ class AnimatedVectorDelegate( private fun animateImpl(toStart: Boolean) { if ((atStart == toStart)) return L.d { "AVD already at ${if (toStart) "start" else "end"}" } - if (avd == null) return L.d { "AVD null resource" } //no longer using animated vector; do not modify + if (avd == null) return L.d { "AVD null resource" } // no longer using animated vector; do not modify avd?.stop() view.setImageResource(if (toStart) avdEnd else avdStart) animatedVectorListener?.invoke(avd!!, !toStart) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt index f69af40b..edbe7682 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt @@ -25,7 +25,7 @@ import ca.allanwang.kau.kpref.KPref */ object Showcase : KPref() { - //check if this is the first time launching the web overlay; show snackbar if true + // check if this is the first time launching the web overlay; show snackbar if true val firstWebOverlay: Boolean by kprefSingle("first_web_overlay") val intro: Boolean by kprefSingle("intro_pages") 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 c2f28a4b..d725acd9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -242,11 +242,11 @@ fun View.frostSnackbar(@StringRes text: Int, builder: Snackbar.() -> Unit = {}) @SuppressLint("RestrictedApi") private inline fun frostSnackbar(crossinline builder: Snackbar.() -> Unit): Snackbar.() -> Unit = { builder() - //hacky workaround, but it has proper checks and shouldn't crash + // hacky workaround, but it has proper checks and shouldn't crash ((view as? FrameLayout)?.getChildAt(0) as? SnackbarContentLayout)?.apply { messageView.setTextColor(Prefs.textColor) actionView.setTextColor(Prefs.accentColor) - //only set if previous text colors are set + // only set if previous text colors are set view.setBackgroundColor(Prefs.bgColor.withAlpha(255).colorToForeground(0.1f)) } } @@ -316,10 +316,10 @@ inline val String.isIndirectImageUrl: Boolean */ inline val String?.isIndependent: Boolean get() { - if (this == null || length < 5) return false // ignore short queries - if (this[0] == '#' && !contains('/')) return false // ignore element values - if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls - if (dependentSegments.any { contains(it) }) return false // ignore known dependent segments + if (this == null || length < 5) return false // ignore short queries + if (this[0] == '#' && !contains('/')) return false // ignore element values + if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls + if (dependentSegments.any { contains(it) }) return false // ignore known dependent segments return true } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt index 7fdd485d..9089d891 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt @@ -34,7 +34,7 @@ fun Context.showWebContextMenu(wc: WebContext) { if (wc.isEmpty) return var title = wc.url ?: string(R.string.menu) title = - title.substring(title.indexOf("m/") + 1) //just so if defaults to 0 in case it's not .com/ + title.substring(title.indexOf("m/") + 1) // just so if defaults to 0 in case it's not .com/ if (title.length > 100) title = title.substring(0, 100) + '\u2026' val menuItems = WebContextType.values @@ -46,7 +46,7 @@ fun Context.showWebContextMenu(wc: WebContext) { menuItems[position].onClick(this@showWebContextMenu, wc) } onDismiss { - //showing the dialog interrupts the touch down event, so we must ensure that the viewpager's swipe is enabled + // showing the dialog interrupts the touch down event, so we must ensure that the viewpager's swipe is enabled (this@showWebContextMenu as? MainActivity)?.viewPager?.enableSwipe = true } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt index 9f2b8a5d..19bf9f69 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt @@ -67,7 +67,7 @@ class BadgedIcon @JvmOverloads constructor( } fun setAllAlpha(alpha: Float) { - //badgeTextView.setTextColor(Prefs.textColor.withAlpha(alpha.toInt())) + // badgeTextView.setTextColor(Prefs.textColor.withAlpha(alpha.toInt())) badge_image.drawable.alpha = alpha.toInt() } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt index 449e98f1..187ab9eb 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -78,7 +78,7 @@ class FrostJSI(val web: FrostWebView) { @JavascriptInterface fun contextMenu(url: String?, text: String?) { - //url will be formatted through webcontext + // url will be formatted through webcontext web.post { context.showWebContextMenu(WebContext(url.takeIf { it.isIndependent }, text)) } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt index 857c166d..33a4875f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt @@ -106,7 +106,7 @@ class LoginWebView @JvmOverloads constructor( } override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { - //For now, we will ignore all attempts to launch external apps during login + // For now, we will ignore all attempts to launch external apps during login if (request.url == null || request.url.scheme == "intent" || request.url.scheme == "android-app") return true return super.shouldOverrideUrlLoading(view, request) diff --git a/app/src/main/play/en-US/whatsnew b/app/src/main/play/en-US/whatsnew index 1f57fc15..39bb331f 100644 --- a/app/src/main/play/en-US/whatsnew +++ b/app/src/main/play/en-US/whatsnew @@ -1,3 +1,4 @@ v2.4.1 -* Notification tab will keep first page in the same window; fixes marking notifications as read \ No newline at end of file +* Notification tab will keep first page in the same window; fixes marking notifications as read +* Fix nav and status bar icon colors for custom themes (Android O+) \ No newline at end of file diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml index f2f8539d..d85d86d1 100644 --- a/app/src/main/res/xml/frost_changelog.xml +++ b/app/src/main/res/xml/frost_changelog.xml @@ -8,7 +8,7 @@ - + diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt index 7e13e6dc..27dd9af9 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt @@ -103,7 +103,7 @@ class FbUrlTest { @Test fun video() { - //note that the video numbers have been changed to maintain privacy + // note that the video numbers have been changed to maintain privacy val url = "/video_redirect/?src=https%3A%2F%2Fvideo-yyz1-1.xx.fbcdn.net%2Fv%2Ft42.1790-2%2F2349078999904_n.mp4%3Fefg%3DeyJ87J9%26oh%3Df5777784%26oe%3D56FD4&source=media_collage&id=1735049&refid=8&_ft_=qid.6484464%3Amf_story_key.-43172431214%3Atop_level_post_id.102773&__tn__=FEH-R" val expected = diff --git a/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt index 088a7fbe..3bac33ac 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt @@ -25,7 +25,7 @@ import kotlin.test.assertEquals */ class PrefsTest { - //Replicate logic + // Replicate logic var test: Long = -1L get() { if (field == -1L) field = file diff --git a/docs/Changelog.md b/docs/Changelog.md index 9d92fa43..3fb5ca1b 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -2,6 +2,7 @@ ## v2.4.1 * Notification tab will keep first page in the same window; fixes marking notifications as read +* Fix nav and status bar icon colors for custom themes (Android O+) ## v2.4.0 * Removed request services, which potentially caused phishing warnings. -- cgit v1.2.3 From b82fadbff34ced9193f7b95e0d46dda5c33e9e08 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 22 Sep 2019 23:02:03 -0700 Subject: Fix lint problems --- .../main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt | 3 ++- gradle.properties | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app/src/main/kotlin') 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 4a7f25c2..42964bce 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt @@ -67,7 +67,7 @@ import kotlinx.coroutines.launch */ class SettingsActivity : KPrefActivity() { - var resultFlag = Activity.RESULT_CANCELED + private var resultFlag = Activity.RESULT_CANCELED companion object { private const val REQUEST_RINGTONE = 0b10111 shl 5 @@ -78,6 +78,7 @@ class SettingsActivity : KPrefActivity() { } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) if (fetchRingtone(requestCode, resultCode, data)) return when (requestCode) { ACTIVITY_REQUEST_TABS -> { diff --git a/gradle.properties b/gradle.properties index e54c3bc5..85c9e4ee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ org.gradle.daemon = true APP_ID=Frost APP_GROUP=com.pitchedapps -KAU=788cec5 +KAU=dba4c72 android.useAndroidX=true android.enableJetifier=true -- cgit v1.2.3