aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-28 23:46:52 -0700
committerGitHub <noreply@github.com>2019-09-28 23:46:52 -0700
commit08a0bbe6e921f411e04a13c4fdc1282cf9fb4221 (patch)
tree58dec3f2e3cd977fe99a18aef93d78d09fc4c892 /app
parenteb5e83cdadc348eea8d76d6778f18850444783d1 (diff)
parentb82fadbff34ced9193f7b95e0d46dda5c33e9e08 (diff)
downloadfrost-08a0bbe6e921f411e04a13c4fdc1282cf9fb4221.tar.gz
frost-08a0bbe6e921f411e04a13c4fdc1282cf9fb4221.tar.bz2
frost-08a0bbe6e921f411e04a13c4fdc1282cf9fb4221.zip
Merge pull request #1555 from AllanWang/system-flag-color
Update system flag color
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt18
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/enums/FeedSort.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragments.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt17
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt20
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt2
-rw-r--r--app/src/main/play/en-US/whatsnew6
-rw-r--r--app/src/main/res/xml/frost_changelog.xml2
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt2
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt2
44 files changed, 130 insertions, 110 deletions
diff --git a/app/build.gradle b/app/build.gradle
index b1e8085e..745a1559 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -260,7 +260,9 @@ dependencies {
implementation "com.devbrackets.android:exomedia:${Versions.exoMedia}"
- implementation kau.Dependencies.fastAdapter("extensions")
+ implementation kau.Dependencies.fastAdapter("diff")
+ implementation kau.Dependencies.fastAdapter("drag")
+ implementation kau.Dependencies.fastAdapter("expandable")
//noinspection GradleDependency
implementation kau.Dependencies.glide
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..5b3a7315 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,11 @@ 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.IItem
+import com.mikepenz.fastadapter.GenericItem
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 +87,7 @@ class AboutActivity : AboutActivityBase(null, {
var lastClick = -1L
var clickCount = 0
- override fun postInflateMainPage(adapter: FastItemThemedAdapter<IItem<*, *>>) {
+ override fun postInflateMainPage(adapter: FastItemThemedAdapter<GenericItem>) {
/**
* Frost may not be a library but we're conveying the same info
*/
@@ -104,7 +104,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 +126,15 @@ class AboutActivity : AboutActivityBase(null, {
}
}
- class AboutLinks : AbstractItem<AboutLinks, AboutLinks.ViewHolder>(),
+ 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<Any>) {
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..798ee4b3 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
}
@@ -465,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)
@@ -602,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/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..5da6d970 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
@@ -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 eeda94d4..77a58cf2 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
@@ -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/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<AccountItem>() {
+ adapter.addEventHook(object : ClickEventHook<AccountItem>() {
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..42964bce 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
@@ -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/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/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/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/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("&amp;", "&")
- 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<FrostMessages>(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<FrostNotifs>(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 &nbsp;
+ a.text().replace("\u00a0", " ").removeSuffix(timeString).trim() // remove &nbsp;
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 71c27dd2..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,8 +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.IItem
+import com.mikepenz.fastadapter.GenericFastAdapter
+import com.mikepenz.fastadapter.GenericItem
import com.mikepenz.fastadapter.adapters.ItemAdapter
import com.mikepenz.fastadapter.adapters.ModelAdapter
import com.pitchedapps.frost.R
@@ -36,7 +36,7 @@ import kotlinx.coroutines.withContext
/**
* Created by Allan Wang on 27/12/17.
*/
-abstract class RecyclerFragment<T, Item : IItem<*, *>> : BaseFragment(), RecyclerContentContract {
+abstract class RecyclerFragment<T, Item : GenericItem> : BaseFragment(), RecyclerContentContract {
override val layoutRes: Int = R.layout.view_content_recycler
@@ -72,7 +72,7 @@ abstract class RecyclerFragment<T, Item : IItem<*, *>> : BaseFragment(), Recycle
protected abstract suspend fun reloadImpl(progress: (Int) -> Unit): List<T>?
}
-abstract class GenericRecyclerFragment<T, Item : IItem<*, *>> : RecyclerFragment<T, Item>() {
+abstract class GenericRecyclerFragment<T, Item : GenericItem> : RecyclerFragment<T, Item>() {
abstract fun mapper(data: T): Item
@@ -93,10 +93,10 @@ abstract class GenericRecyclerFragment<T, Item : IItem<*, *>> : RecyclerFragment
/**
* Create the fast adapter to bind to the recyclerview
*/
- open fun getAdapter(): FastAdapter<IItem<*, *>> = fastAdapter(this.adapter)
+ open fun getAdapter(): GenericFastAdapter = fastAdapter(this.adapter)
}
-abstract class FrostParserFragment<T : ParseData, Item : IItem<*, *>> :
+abstract class FrostParserFragment<T : ParseData, Item : GenericItem> :
RecyclerFragment<Item, Item>() {
/**
@@ -125,7 +125,7 @@ abstract class FrostParserFragment<T : ParseData, Item : IItem<*, *>> :
/**
* Create the fast adapter to bind to the recyclerview
*/
- open fun getAdapter(): FastAdapter<IItem<*, *>> = fastAdapter(this.adapter)
+ open fun getAdapter(): GenericFastAdapter = fastAdapter(this.adapter)
override suspend fun reloadImpl(progress: (Int) -> Unit): List<Item>? =
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<IItem<*, *>>) {
- adapter.fastAdapter.withSelectable(false)
- .withOnClickListener { v, _, item, _ ->
+ fun bindEvents(adapter: IAdapter<GenericItem>) {
+ 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<HeaderIItem, HeaderIItem.ViewHolder>(R.layout.iitem_header, ::ViewHolder, itemId) {
+) : KauIItem<HeaderIItem.ViewHolder>(R.layout.iitem_header, ::ViewHolder, itemId) {
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<HeaderIItem>(itemView) {
@@ -92,7 +97,7 @@ open class TextIItem(
val text: String?,
override val url: String?,
itemId: Int = R.layout.iitem_text
-) : KauIItem<TextIItem, TextIItem.ViewHolder>(R.layout.iitem_text, ::ViewHolder, itemId),
+) : KauIItem<TextIItem.ViewHolder>(R.layout.iitem_text, ::ViewHolder, itemId),
ClickableIItemContract {
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TextIItem>(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..b2d328ec 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<NotificationIItem, NotificationIItem.ViewHolder>(
+ KauIItem<NotificationIItem.ViewHolder>(
R.layout.iitem_notification, ::ViewHolder
) {
companion object {
fun bindEvents(adapter: ItemAdapter<NotificationIItem>) {
- 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,9 +65,10 @@ 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
+ // todo see if necessary
val DIFF: DiffCallback<NotificationIItem> by lazy(::Diff)
}
@@ -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<TabIItem, TabIItem.ViewHolder>(
+class TabIItem(val item: FbItem) : KauIItem<TabIItem.ViewHolder>(
R.layout.iitem_tab_preview,
{ ViewHolder(it) }
-), IDraggable<TabIItem, IItem<*, *>> {
+), IDraggable {
- override fun withIsDraggable(draggable: Boolean): TabIItem = this
-
- override fun isDraggable() = true
+ override val isDraggable: Boolean = true
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TabIItem>(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..9a4ec0c1 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
@@ -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/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/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 <reified T : JobService> 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/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<AccountItem, AccountItem.ViewHolder>
+class AccountItem(val cookie: CookieEntity?) : KauIItem<AccountItem.ViewHolder>
(R.layout.view_account, { ViewHolder(it) }, R.id.item_account) {
- override fun bindView(viewHolder: ViewHolder, payloads: MutableList<Any>) {
- super.bindView(viewHolder, payloads)
- with(viewHolder) {
+ override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) {
+ 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<AccountItem, AccountItem
}
}
- class ViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
+ class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val image: ImageView by bindView(R.id.account_image)
val text: AppCompatTextView by bindView(R.id.account_text)
}
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/views/FrostVideoViewer.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
index 8d433c9e..3889300d 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.google_material_typeface_library.GoogleMaterial
+import com.mikepenz.iconics.typeface.library.googlematerial.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/KPrefTextSeekbar.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt
index e018b6d8..1a287c46 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt
@@ -45,7 +45,7 @@ class KPrefTextSeekbar(builder: KPrefSeekbarContract) : KPrefSeekbar(builder) {
}
@SuppressLint("MissingSuperCall")
- override fun bindView(holder: ViewHolder, payloads: List<Any>) {
+ override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) {
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<KeywordItem>() {
+ adapter.addEventHook(object : ClickEventHook<KeywordItem>() {
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<KeywordItem, KeywordItem.ViewHolder>() {
+class KeywordItem(val keyword: String) : AbstractItem<KeywordItem.ViewHolder>() {
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<Any>) {
super.bindView(holder, payloads)
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 a3653b1b..39bb331f 100644
--- a/app/src/main/play/en-US/whatsnew
+++ b/app/src/main/play/en-US/whatsnew
@@ -1,4 +1,4 @@
-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
+* 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 @@
<version title="v2.4.1" />
<item text="Notification tab will keep first page in the same window; fixes marking notifications as read" />
- <item text="" />
+ <item text="Fix nav and status bar icon colors for custom themes (Android O+)" />
<item text="" />
<item text="" />
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