aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-06-13 14:05:23 -0700
committerGitHub <noreply@github.com>2019-06-13 14:05:23 -0700
commitace51697528fc05bad88eddf4dea6fe52ca008ba (patch)
tree9c1977db7018c710ae6080687cff5e4cabc5d260 /app/src/main
parentdc409d14c26a9cb6be4eecfb59e56f37207572c8 (diff)
parent1af2414105b33e92b7a9902b016aa7f4a9b3c869 (diff)
downloadfrost-ace51697528fc05bad88eddf4dea6fe52ca008ba.tar.gz
frost-ace51697528fc05bad88eddf4dea6fe52ca008ba.tar.bz2
frost-ace51697528fc05bad88eddf4dea6fe52ca008ba.zip
Merge pull request #1437 from AllanWang/plugin
Plugin
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt28
-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.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragments.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt33
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt27
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt17
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt21
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt22
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt19
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.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/Keywords.kt2
-rw-r--r--app/src/main/res/values/dimens.xml2
-rw-r--r--app/src/main/res/values/styles.xml4
24 files changed, 124 insertions, 126 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
index cf8acdd3..cc1ae466 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 56125303..3c5f71c2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt
@@ -40,10 +40,10 @@ import ca.allanwang.kau.utils.withMinAlpha
import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.entity.Library
import com.mikepenz.aboutlibraries.entity.License
-import com.mikepenz.community_material_typeface_library.CommunityMaterial
+import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import com.mikepenz.fastadapter.IItem
import com.mikepenz.fastadapter.items.AbstractItem
-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.BuildConfig
import com.pitchedapps.frost.R
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
index 49d5f8bf..ea062cf7 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -40,6 +40,7 @@ import ca.allanwang.kau.searchview.SearchViewHolder
import ca.allanwang.kau.searchview.bindSearchView
import ca.allanwang.kau.utils.bindView
import ca.allanwang.kau.utils.fadeScaleTransition
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.restart
import ca.allanwang.kau.utils.setIcon
import ca.allanwang.kau.utils.setMenuIcons
@@ -56,9 +57,10 @@ import co.zsmb.materialdrawerkt.draweritems.badgeable.secondaryItem
import co.zsmb.materialdrawerkt.draweritems.divider
import co.zsmb.materialdrawerkt.draweritems.profile.profile
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.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.materialdrawer.AccountHeader
@@ -99,7 +101,6 @@ import com.pitchedapps.frost.utils.frostNavigationBar
import com.pitchedapps.frost.utils.launchLogin
import com.pitchedapps.frost.utils.launchNewTask
import com.pitchedapps.frost.utils.launchWebOverlay
-import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.utils.setFrostColors
import com.pitchedapps.frost.views.BadgedIcon
import com.pitchedapps.frost.views.FrostVideoViewer
@@ -293,21 +294,21 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
FbCookie.reset()
launchLogin(cookies(), true)
} else {
- materialDialogThemed {
+ materialDialog {
title(R.string.kau_logout)
- content(
+ message(
+ text =
String.format(
string(R.string.kau_logout_confirm_as_x),
currentCookie.name ?: Prefs.userId.toString()
)
)
- positiveText(R.string.kau_yes)
- negativeText(R.string.kau_no)
- onPositive { _, _ ->
+ positiveButton(R.string.kau_yes) {
this@BaseMainActivity.launch {
FbCookie.logout(this@BaseMainActivity)
}
}
+ negativeButton(R.string.kau_no)
}
}
}
@@ -518,13 +519,14 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
if (currentFragment.onBackPressed()) return true
if (Prefs.exitConfirmation) {
- materialDialogThemed {
+ materialDialog {
title(R.string.kau_exit)
- content(R.string.kau_exit_confirmation)
- positiveText(R.string.kau_yes)
- negativeText(R.string.kau_no)
- onPositive { _, _ -> finish() }
- checkBoxPromptRes(R.string.kau_do_not_show_again, false) { _, b -> Prefs.exitConfirmation = !b }
+ message(R.string.kau_exit_confirmation)
+ positiveButton(R.string.kau_yes) { finish() }
+ negativeButton(R.string.kau_no)
+ checkBoxPrompt(R.string.kau_do_not_show_again, isCheckedDefault = false) {
+ Prefs.exitConfirmation = !it
+ }
}
return true
}
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 a1b41830..0ad0204f 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 b94acb63..de553376 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
@@ -33,6 +33,7 @@ import ca.allanwang.kau.utils.copyFromInputStream
import ca.allanwang.kau.utils.fadeOut
import ca.allanwang.kau.utils.isHidden
import ca.allanwang.kau.utils.isVisible
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.scaleXY
import ca.allanwang.kau.utils.setIcon
import ca.allanwang.kau.utils.tint
@@ -41,7 +42,7 @@ import ca.allanwang.kau.utils.withMinAlpha
import com.davemorrissey.labs.subscaleview.ImageSource
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
import com.google.android.material.floatingactionbutton.FloatingActionButton
-import com.mikepenz.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.facebook.FB_IMAGE_ID_MATCHER
@@ -58,7 +59,6 @@ import com.pitchedapps.frost.utils.frostSnackbar
import com.pitchedapps.frost.utils.frostUriFromFile
import com.pitchedapps.frost.utils.isIndirectImageUrl
import com.pitchedapps.frost.utils.logFrostEvent
-import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.utils.sendFrostEmail
import com.pitchedapps.frost.utils.setFrostColors
import com.sothree.slidinguppanel.SlidingUpPanelLayout
@@ -297,18 +297,17 @@ internal enum class FabStates(
val err =
activity.errorRef?.takeIf { it !is FileNotFoundException && it.message != "Image failed to decode using JPEG decoder" }
?: return
- activity.materialDialogThemed {
+ activity.materialDialog {
title(R.string.kau_error)
- content(R.string.bad_image_overlay)
- positiveText(R.string.kau_yes)
- onPositive { _, _ ->
+ message(R.string.bad_image_overlay)
+ positiveButton(R.string.kau_yes) {
activity.sendFrostEmail(R.string.debug_image_link_subject) {
addItem("Url", activity.imageUrl)
addItem("Type", err.javaClass.name)
addItem("Message", err.message ?: "Null")
}
}
- negativeText(R.string.kau_no)
+ negativeButton(R.string.kau_no)
}
}
},
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 1e106765..e1d03314 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/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
index bc20aa2d..e78da3be 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
@@ -29,14 +29,16 @@ import ca.allanwang.kau.kpref.activity.KPrefActivity
import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
import ca.allanwang.kau.ui.views.RippleCanvas
import ca.allanwang.kau.utils.finishSlideOut
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.setMenuIcons
import ca.allanwang.kau.utils.startActivityForResult
import ca.allanwang.kau.utils.startLink
import ca.allanwang.kau.utils.string
import ca.allanwang.kau.utils.tint
import ca.allanwang.kau.utils.withSceneTransitionAnimation
-import com.mikepenz.community_material_typeface_library.CommunityMaterial
-import com.mikepenz.google_material_typeface_library.GoogleMaterial
+import com.afollestad.materialdialogs.list.listItems
+import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
+import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.pitchedapps.frost.R
import com.pitchedapps.frost.enums.Support
import com.pitchedapps.frost.settings.getAppearancePrefs
@@ -55,7 +57,6 @@ import com.pitchedapps.frost.utils.frostChangelog
import com.pitchedapps.frost.utils.frostNavigationBar
import com.pitchedapps.frost.utils.launchNewTask
import com.pitchedapps.frost.utils.loadAssets
-import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.utils.setFrostTheme
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.launch
@@ -235,10 +236,11 @@ class SettingsActivity : KPrefActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
- R.id.action_email -> materialDialogThemed {
+ R.id.action_email -> materialDialog {
title(R.string.subject)
- items(Support.values().map { string(it.title) })
- itemsCallback { _, _, which, _ -> Support.values()[which].sendEmail(this@SettingsActivity) }
+ listItems(items = Support.values().map { string(it.title) }) { _, index, _ ->
+ Support.values()[index].sendEmail(this@SettingsActivity)
+ }
}
R.id.action_changelog -> frostChangelog()
else -> return super.onOptionsItemSelected(item)
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 6ad7d3f2..c6bcbb6a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
@@ -32,7 +32,7 @@ import ca.allanwang.kau.utils.withAlpha
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
import com.mikepenz.fastadapter_extensions.drag.ItemTouchCallback
import com.mikepenz.fastadapter_extensions.drag.SimpleDragCallback
-import com.mikepenz.google_material_typeface_library.GoogleMaterial
+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
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 ec4ff9dd..ff31b56b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
@@ -36,6 +36,7 @@ import ca.allanwang.kau.utils.copyToClipboard
import ca.allanwang.kau.utils.darken
import ca.allanwang.kau.utils.dpToPx
import ca.allanwang.kau.utils.finishSlideOut
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.navigationBarColor
import ca.allanwang.kau.utils.setMenuIcons
import ca.allanwang.kau.utils.shareText
@@ -46,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
@@ -69,7 +70,6 @@ import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.Showcase
import com.pitchedapps.frost.utils.frostSnackbar
-import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.utils.setFrostColors
import com.pitchedapps.frost.views.FrostContentWeb
import com.pitchedapps.frost.views.FrostVideoViewer
@@ -109,9 +109,9 @@ class FrostWebActivity : WebOverlayActivityBase(false) {
refreshReceiver.receive()
refreshReceiver.cancel()
withMainContext {
- materialDialogThemed {
+ materialDialog {
title(R.string.invalid_share_url)
- content(R.string.invalid_share_url_desc)
+ message(R.string.invalid_share_url_desc)
}
}
}
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 82e15111..16952e49 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.MenuFragment
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 72367eaa..c81c780b 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/intro/IntroImageFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt
index 1fd8c76e..bddf42b2 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/settings/Appearance.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
index a6437123..718b2dbb 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
@@ -20,7 +20,9 @@ import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
import ca.allanwang.kau.kpref.activity.items.KPrefColorPicker
import ca.allanwang.kau.kpref.activity.items.KPrefSeekbar
import ca.allanwang.kau.ui.views.RippleCanvas
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.string
+import com.afollestad.materialdialogs.list.listItemsSingleChoice
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.enums.MainActivityLayout
@@ -33,7 +35,6 @@ import com.pitchedapps.frost.utils.frostEvent
import com.pitchedapps.frost.utils.frostNavigationBar
import com.pitchedapps.frost.utils.frostSnackbar
import com.pitchedapps.frost.utils.launchTabCustomizerActivity
-import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.utils.setFrostTheme
import com.pitchedapps.frost.views.KPrefTextSeekbar
@@ -46,20 +47,21 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
text(R.string.theme, Prefs::theme, { Prefs.theme = it }) {
onClick = {
- materialDialogThemed {
+ materialDialog {
title(R.string.theme)
- items(Theme.values().map { string(it.textRes) })
- itemsCallbackSingleChoice(item.pref) { _, _, which, _ ->
- if (item.pref != which) {
- item.pref = which
+ listItemsSingleChoice(
+ items = Theme.values().map { string(it.textRes) },
+ initialSelection = item.pref
+ ) { _, index, _ ->
+ if (item.pref != index) {
+ item.pref = index
shouldRestartMain()
reload()
setFrostTheme(true)
themeExterior()
invalidateOptionsMenu()
- frostEvent("Theme", "Count" to Theme(which).name)
+ frostEvent("Theme", "Count" to Theme(index).name)
}
- true
}
}
}
@@ -134,16 +136,17 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
text(R.string.main_activity_layout, Prefs::mainActivityLayoutType, { Prefs.mainActivityLayoutType = it }) {
textGetter = { string(Prefs.mainActivityLayout.titleRes) }
onClick = {
- materialDialogThemed {
+ materialDialog {
title(R.string.main_activity_layout_desc)
- items(MainActivityLayout.values.map { string(it.titleRes) })
- itemsCallbackSingleChoice(item.pref) { _, _, which, _ ->
- if (item.pref != which) {
- item.pref = which
+ listItemsSingleChoice(
+ items = MainActivityLayout.values.map { string(it.titleRes) },
+ initialSelection = item.pref
+ ) { _, index, _ ->
+ if (item.pref != index) {
+ item.pref = index
shouldRestartMain()
- frostEvent("Main Layout", "Type" to MainActivityLayout(which).name)
+ frostEvent("Main Layout", "Type" to MainActivityLayout(index).name)
}
- true
}
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
index 1ee06464..ea50a57b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
@@ -24,6 +24,8 @@ import ca.allanwang.kau.utils.startActivityForResult
import ca.allanwang.kau.utils.string
import ca.allanwang.kau.utils.toast
import ca.allanwang.kau.utils.withMainContext
+import com.afollestad.materialdialogs.callbacks.onDismiss
+import com.afollestad.materialdialogs.list.listItems
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.DebugActivity
import com.pitchedapps.frost.activities.SettingsActivity
@@ -68,20 +70,18 @@ fun SettingsActivity.getDebugPrefs(): KPrefAdapterBuilder.() -> Unit = {
val parsers = arrayOf(NotifParser, MessageParser, SearchParser)
materialDialog {
- items(parsers.map { string(it.nameRes) })
- itemsCallback { dialog, _, position, _ ->
+ listItems(items = parsers.map { string(it.nameRes) }) { dialog, position, _ ->
dialog.dismiss()
val parser = parsers[position]
var attempt: Job? = null
val loading = materialDialog {
- content(parser.nameRes)
- progress(true, 100)
- negativeText(R.string.kau_cancel)
- onNegative { dialog, _ ->
+ message(parser.nameRes)
+ // TODO change dialog? No more progress view
+ negativeButton(R.string.kau_cancel) {
attempt?.cancel()
- dialog.dismiss()
+ it.dismiss()
}
- canceledOnTouchOutside(false)
+ cancelOnTouchOutside(false)
}
attempt = launch(Dispatchers.IO) {
@@ -122,18 +122,17 @@ fun SettingsActivity.sendDebug(url: String, html: String?) {
val md = materialDialog {
title(R.string.parsing_data)
- progress(false, 100)
- negativeText(R.string.kau_cancel)
- onNegative { dialog, _ -> dialog.dismiss() }
- canceledOnTouchOutside(false)
- dismissListener { job.cancel() }
+ // TODO remove dialog? No progress ui
+ negativeButton(R.string.kau_cancel) { it.dismiss() }
+ cancelOnTouchOutside(false)
+ onDismiss { job.cancel() }
}
val progressChannel = Channel<Int>(10)
launchMain {
for (p in progressChannel) {
- md.setProgress(p)
+// md.setProgress(p)
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
index baf68634..f7cf3ee3 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
@@ -17,13 +17,14 @@
package com.pitchedapps.frost.settings
import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.string
+import com.afollestad.materialdialogs.list.listItemsSingleChoice
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.enums.FeedSort
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.REQUEST_REFRESH
-import com.pitchedapps.frost.utils.materialDialogThemed
/**
* Created by Allan Wang on 2017-06-29.
@@ -33,15 +34,17 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
text(R.string.newsfeed_sort, Prefs::feedSort, { Prefs.feedSort = it }) {
descRes = R.string.newsfeed_sort_desc
onClick = {
- materialDialogThemed {
+ materialDialog {
title(R.string.newsfeed_sort)
- items(FeedSort.values().map { string(it.textRes) })
- itemsCallbackSingleChoice(item.pref) { _, _, which, _ ->
- if (item.pref != which) {
- item.pref = which
+ listItemsSingleChoice(
+ items = FeedSort.values().map { string(it.textRes) },
+ initialSelection = item.pref
+ ) { _, index, _ ->
+ if (item.pref != index) {
+ item.pref = index
shouldRestartMain()
}
- true
+
}
}
}
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 c58710b5..777b4edd 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
@@ -24,8 +24,12 @@ import android.os.Build
import android.provider.Settings
import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
import ca.allanwang.kau.kpref.activity.items.KPrefText
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.minuteToText
import ca.allanwang.kau.utils.string
+import com.afollestad.materialdialogs.callbacks.onDismiss
+import com.afollestad.materialdialogs.customview.customView
+import com.afollestad.materialdialogs.list.listItemsSingleChoice
import com.pitchedapps.frost.BuildConfig
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.SettingsActivity
@@ -35,7 +39,6 @@ import com.pitchedapps.frost.services.fetchNotifications
import com.pitchedapps.frost.services.scheduleNotifications
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.frostSnackbar
-import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.views.Keywords
import kotlinx.coroutines.launch
@@ -49,13 +52,11 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
val options = longArrayOf(15, 30, 60, 120, 180, 300, 1440, 2880)
val texts = options.map { if (it <= 0) string(R.string.no_notifications) else minuteToText(it) }
onClick = {
- materialDialogThemed {
+ materialDialog {
title(R.string.notification_frequency)
- items(texts)
- itemsCallbackSingleChoice(options.indexOf(item.pref)) { _, _, which, _ ->
- item.pref = options[which]
+ listItemsSingleChoice(items = texts, initialSelection = options.indexOf(item.pref)) { _, index, _ ->
+ item.pref = options[index]
scheduleNotifications(item.pref)
- true
}
}
}
@@ -72,11 +73,11 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
descRes = R.string.notification_keywords_desc
onClick = {
val keywordView = Keywords(this@getNotificationPrefs)
- materialDialogThemed {
+ materialDialog {
title(R.string.notification_keywords)
- customView(keywordView, false)
- dismissListener { keywordView.save() }
- positiveText(R.string.kau_done)
+ customView(view = keywordView)
+ positiveButton(R.string.kau_done)
+ onDismiss { keywordView.save() }
}
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt
index 50863e10..b0012b0d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt
@@ -25,6 +25,7 @@ import android.webkit.URLUtil
import ca.allanwang.kau.permissions.PERMISSION_WRITE_EXTERNAL_STORAGE
import ca.allanwang.kau.permissions.kauRequestPermissions
import ca.allanwang.kau.utils.isAppEnabled
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.showAppInfo
import ca.allanwang.kau.utils.string
import ca.allanwang.kau.utils.toast
@@ -64,12 +65,13 @@ fun Context.frostDownload(
return L.e { "Invalid download $uri" }
}
if (!isAppEnabled(DOWNLOAD_MANAGER_PACKAGE)) {
- materialDialogThemed {
+ materialDialog {
title(R.string.no_download_manager)
- content(R.string.no_download_manager_desc)
- positiveText(R.string.kau_yes)
- onPositive { _, _ -> showAppInfo(DOWNLOAD_MANAGER_PACKAGE) }
- negativeText(R.string.kau_no)
+ message(R.string.no_download_manager_desc)
+ positiveButton(R.string.kau_yes) {
+ showAppInfo(DOWNLOAD_MANAGER_PACKAGE)
+ }
+ negativeButton(R.string.kau_no)
}
return
}
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 557980af..a6a9e721 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -167,24 +167,6 @@ fun WebOverlayActivity.url(): String {
return intent.getStringExtra(ARG_URL) ?: FbItem.FEED.url
}
-fun Context.materialDialogThemed(action: MaterialDialog.Builder.() -> Unit): MaterialDialog {
- val builder = MaterialDialog.Builder(this).theme()
- builder.action()
- return builder.show()
-}
-
-fun MaterialDialog.Builder.theme(): MaterialDialog.Builder {
- val dimmerTextColor = Prefs.textColor.adjustAlpha(0.8f)
- titleColor(Prefs.textColor)
- contentColor(dimmerTextColor)
- widgetColor(dimmerTextColor)
- backgroundColor(Prefs.bgColor.lighten(0.1f).withMinAlpha(200))
- positiveColor(Prefs.textColor)
- negativeColor(Prefs.textColor)
- neutralColor(Prefs.textColor)
- return this
-}
-
fun Activity.setFrostTheme(forceTransparent: Boolean = false) {
val isTransparent =
(Color.alpha(Prefs.bgColor) != 255) || (Color.alpha(Prefs.headerColor) != 255) || forceTransparent
@@ -360,9 +342,7 @@ val dependentSegments = arrayOf(
inline val String?.isExplicitIntent
get() = this != null && (startsWith("intent://") || startsWith("market://"))
-fun Context.frostChangelog() = showChangelog(R.xml.frost_changelog, Prefs.textColor) {
- theme()
-}
+fun Context.frostChangelog() = showChangelog(R.xml.frost_changelog)
fun Context.frostUriFromFile(file: File): Uri =
FileProvider.getUriForFile(
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 fbaa4574..0a3be830 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
@@ -18,8 +18,11 @@ package com.pitchedapps.frost.utils
import android.content.Context
import ca.allanwang.kau.utils.copyToClipboard
+import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.shareText
import ca.allanwang.kau.utils.string
+import com.afollestad.materialdialogs.callbacks.onDismiss
+import com.afollestad.materialdialogs.list.listItems
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.MainActivity
import com.pitchedapps.frost.facebook.formattedFbUrl
@@ -36,13 +39,12 @@ fun Context.showWebContextMenu(wc: WebContext) {
val menuItems = WebContextType.values
.filter { it.constraint(wc) }
- materialDialogThemed {
- title(title)
- items(menuItems.map { string(it.textId) })
- itemsCallback { _, _, position, _ ->
+ materialDialog {
+ title(text = title)
+ listItems(items = menuItems.map { string(it.textId) }) { _, position, _ ->
menuItems[position].onClick(this@showWebContextMenu, wc)
}
- dismissListener {
+ onDismiss {
//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
}
@@ -66,11 +68,10 @@ enum class WebContextType(
COPY_TEXT(R.string.copy_text, { it.hasText }, { c, wc -> c.copyToClipboard(wc.text) }),
SHARE_LINK(R.string.share_link, { it.hasUrl }, { c, wc -> c.shareText(wc.url) }),
DEBUG_LINK(R.string.debug_link, { it.hasUrl }, { c, wc ->
- c.materialDialogThemed {
+ c.materialDialog {
title(R.string.debug_link)
- content(R.string.debug_link_desc)
- positiveText(R.string.kau_ok)
- onPositive { _, _ ->
+ message(R.string.debug_link_desc)
+ positiveButton(R.string.kau_ok) {
c.sendFrostEmail(R.string.debug_link_subject) {
message = c.string(R.string.debug_link_content)
addItem("Unformatted url", wc.unformattedUrl!!)
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..98909e0a 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
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 4d88ad3d..6593a8df 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/Keywords.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
index e63fcc21..0d596086 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
@@ -34,7 +34,7 @@ import com.mikepenz.fastadapter.FastAdapter
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
import com.mikepenz.fastadapter.items.AbstractItem
import com.mikepenz.fastadapter.listeners.ClickEventHook
-import com.mikepenz.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.utils.Prefs
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 847e74cb..1f66683d 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -11,4 +11,6 @@
<dimen name="badge_icon_size">20dp</dimen>
<dimen name="toolbar_icon_size">24dp</dimen>
+
+ <dimen name="dialog_corner_radius">8dp</dimen>
</resources>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 0faa00ab..7816533b 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -7,6 +7,8 @@
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowSoftInputMode">adjustResize</item>
+ <item name="md_color_button_text">?colorAccent</item>
+ <item name="md_corner_radius">@dimen/dialog_corner_radius</item>
</style>
<style name="FrostTheme" parent="@style/FrostThemeBase">
@@ -21,6 +23,8 @@
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowSoftInputMode">adjustResize</item>
+ <item name="md_color_button_text">?colorAccent</item>
+ <item name="md_corner_radius">@dimen/dialog_corner_radius</item>
</style>
<style name="FrostTheme.Transparent">