mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-09 12:32:30 +01:00
Removed theme md option
This commit is contained in:
parent
1c2109cc58
commit
03480c2495
@ -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() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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!!)
|
||||
|
@ -7,8 +7,9 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath kau.Plugins.android
|
||||
// classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
|
||||
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE}"
|
||||
// classpath "com.android.tools.build:gradle:${ANDROID_GRADLE}"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN}"
|
||||
classpath "com.bugsnag:bugsnag-android-gradle-plugin:${BUGSNAG_PLUGIN}"
|
||||
classpath "com.diffplug.spotless:spotless-plugin-gradle:${SPOTLESS}"
|
||||
|
Loading…
Reference in New Issue
Block a user