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 ++++++++------ app/src/main/play/en-US/whatsnew | 5 ++--- 24 files changed, 91 insertions(+), 72 deletions(-) (limited to 'app/src') 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) diff --git a/app/src/main/play/en-US/whatsnew b/app/src/main/play/en-US/whatsnew index a3653b1b..1f57fc15 100644 --- a/app/src/main/play/en-US/whatsnew +++ b/app/src/main/play/en-US/whatsnew @@ -1,4 +1,3 @@ -v2.4.0 +v2.4.1 -* Removed request services, which potentially caused phishing warnings. -* Save images with the correct extensions. \ No newline at end of file +* Notification tab will keep first page in the same window; fixes marking notifications as read \ No newline at end of file -- cgit v1.2.3