aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt20
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt26
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt28
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt13
11 files changed, 43 insertions, 60 deletions
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 63ad8bae..b21cc3ab 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt
@@ -40,6 +40,8 @@ class AboutActivity : AboutActivityBase(null, {
val include = arrayOf(
"AboutLibraries",
"AndroidIconics",
+ "androidslidinguppanel",
+ "Crashlytics",
"dbflow",
"fastadapter",
"glide",
@@ -47,24 +49,10 @@ class AboutActivity : AboutActivityBase(null, {
"kau",
"kotterknife",
"materialdialogs",
- "materialdrawer"
+ "materialdrawer",
+ "subsamplingscaleimageview"
)
- /*
- * These are great libraries, but either aren't used directly or are too common to be listed
- * Give more emphasis on the unique libs!
- */
- val exclude = arrayOf(
- "GoogleMaterialDesignIcons",
- "intellijannotations",
- "MaterialDesignIconicIcons",
- "MaterialDesignIcons",
- "materialize",
- "appcompat_v7",
- "design",
- "recyclerview_v7",
- "support_v4"
- )
val l = libs.prepareLibraries(this, include, null, false, true)
// l.forEach { KL.d("Lib ${it.definedName}") }
return l
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 487f3a9d..0b8c1a56 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
@@ -166,11 +166,9 @@ class ImageActivity : AppCompatActivity() {
}
}
- @Suppress("SIMPLE_DATE_FORMAT")
@Throws(IOException::class)
private fun createImageFile(): File {
// Create an image file name
- @SuppressLint("SimpleDateFormat")
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
val imageFileName = "Frost_" + timeStamp + "_"
val storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES)
@@ -264,27 +262,9 @@ internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.iconC
* If it's in view, give it some animations
*/
fun update(fab: FloatingActionButton) {
- if (!fab.isShown) {
- fab.setIcon(iicon, color = iconColor)
- fab.backgroundTintList = ColorStateList.valueOf(backgroundTint)
- } else {
- var switched = false
- ValueAnimator.ofFloat(1.0f, 0.0f, 1.0f).apply {
- duration = 500L
- addUpdateListener {
- val x = it.animatedValue as Float
- val scale = x * 0.3f + 0.7f
- fab.scaleX = scale
- fab.scaleY = scale
- fab.imageAlpha = (x * 255).toInt()
- if (it.animatedFraction > 0.5f && !switched) {
- switched = true
- fab.setIcon(iicon, color = iconColor)
- fab.backgroundTintList = ColorStateList.valueOf(backgroundTint)
- }
- }
- start()
- }
+ fab.transition {
+ setIcon(iicon, color = iconColor)
+ backgroundTintList = ColorStateList.valueOf(backgroundTint)
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
index 1227fd6b..8ca18385 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
@@ -110,7 +110,7 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract,
if (BuildConfig.VERSION_CODE > Prefs.versionCode) {
Prefs.versionCode = BuildConfig.VERSION_CODE
if (!BuildConfig.DEBUG) {
- showChangelog(R.xml.changelog, Prefs.textColor) { theme() }
+ showChangelog(R.xml.frost_changelog, Prefs.textColor) { theme() }
frostAnswersCustom("Version") {
putCustomAttribute("Version code", BuildConfig.VERSION_CODE)
putCustomAttribute("Version name", BuildConfig.VERSION_NAME)
@@ -288,6 +288,7 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract,
divider()
primaryFrostItem(FbTab.PHOTOS)
primaryFrostItem(FbTab.GROUPS)
+ primaryFrostItem(FbTab.FRIENDS)
primaryFrostItem(FbTab.PAGES)
divider()
primaryFrostItem(FbTab.EVENTS)
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 b3b3bd7c..c40a705f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
@@ -132,7 +132,7 @@ class SettingsActivity : KPrefActivity(), IabBroadcastReceiver.IabBroadcastListe
items(Support.values().map { string(it.title) })
itemsCallback { _, _, which, _ -> Support.values()[which].sendEmail(this@SettingsActivity) }
}
- R.id.action_changelog -> showChangelog(R.xml.changelog, Prefs.textColor) { theme() }
+ R.id.action_changelog -> showChangelog(R.xml.frost_changelog, Prefs.textColor) { theme() }
else -> return super.onOptionsItemSelected(item)
}
return true
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt
index 7e7a8f42..d1f0b046 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt
@@ -11,26 +11,26 @@ import com.pitchedapps.frost.web.FrostWebViewClientMenu
import com.pitchedapps.frost.web.FrostWebViewCore
enum class FbTab(@StringRes val titleId: Int, val icon: IIcon, relativeUrl: String, val webClient: ((webCore: FrostWebViewCore) -> FrostWebViewClient)? = null) {
- FEED(R.string.feed, CommunityMaterial.Icon.cmd_newspaper, ""),
- FEED_MOST_RECENT(R.string.most_recent, GoogleMaterial.Icon.gmd_history, "?sk=h_chr"),
- FEED_TOP_STORIES(R.string.top_stories, GoogleMaterial.Icon.gmd_star, "?sk=h_nor"),
- PROFILE(R.string.profile, CommunityMaterial.Icon.cmd_account, "me"),
- EVENTS(R.string.events, GoogleMaterial.Icon.gmd_event_note, "events/upcoming"),
- FRIENDS(R.string.friends, GoogleMaterial.Icon.gmd_people, "friends/center/requests"),
- MESSAGES(R.string.messages, MaterialDesignIconic.Icon.gmi_comments, "messages"),
- NOTIFICATIONS(R.string.notifications, MaterialDesignIconic.Icon.gmi_globe, "notifications"),
ACTIVITY_LOG(R.string.activity_log, GoogleMaterial.Icon.gmd_list, "me/allactivity"),
- PAGES(R.string.pages, GoogleMaterial.Icon.gmd_flag, "pages"),
- GROUPS(R.string.groups, GoogleMaterial.Icon.gmd_group, "groups"),
- SAVED(R.string.saved, GoogleMaterial.Icon.gmd_bookmark, "saved"),
BIRTHDAYS(R.string.birthdays, GoogleMaterial.Icon.gmd_cake, "events/birthdays"),
CHAT(R.string.chat, GoogleMaterial.Icon.gmd_chat, "buddylist"),
- PHOTOS(R.string.photos, GoogleMaterial.Icon.gmd_photo, "me/photos"),
- SETTINGS(R.string.settings, GoogleMaterial.Icon.gmd_settings, "settings"),
+ EVENTS(R.string.events, GoogleMaterial.Icon.gmd_event_note, "events/upcoming"),
+ FEED(R.string.feed, CommunityMaterial.Icon.cmd_newspaper, ""),
+ FEED_MOST_RECENT(R.string.most_recent, GoogleMaterial.Icon.gmd_history, "home.php?sk=h_chr"),
+ FEED_TOP_STORIES(R.string.top_stories, GoogleMaterial.Icon.gmd_star, "home.php?sk=h_nor"),
+ FRIENDS(R.string.friends, GoogleMaterial.Icon.gmd_person_add, "friends/center/requests"),
+ GROUPS(R.string.groups, GoogleMaterial.Icon.gmd_group, "groups"),
MENU(R.string.menu, GoogleMaterial.Icon.gmd_menu, "settings", { FrostWebViewClientMenu(it) }),
+ MESSAGES(R.string.messages, MaterialDesignIconic.Icon.gmi_comments, "messages"),
NOTES(R.string.notes, CommunityMaterial.Icon.cmd_note, "notes"),
+ NOTIFICATIONS(R.string.notifications, MaterialDesignIconic.Icon.gmi_globe, "notifications"),
ON_THIS_DAY(R.string.on_this_day, GoogleMaterial.Icon.gmd_today, "onthisday"),
- SEARCH(R.string.search_menu_title, GoogleMaterial.Icon.gmd_search, "search")
+ PAGES(R.string.pages, GoogleMaterial.Icon.gmd_flag, "pages"),
+ PHOTOS(R.string.photos, GoogleMaterial.Icon.gmd_photo, "me/photos"),
+ PROFILE(R.string.profile, CommunityMaterial.Icon.cmd_account, "me"),
+ SAVED(R.string.saved, GoogleMaterial.Icon.gmd_bookmark, "saved"),
+ SEARCH(R.string.search_menu_title, GoogleMaterial.Icon.gmd_search, "search"),
+ SETTINGS(R.string.settings, GoogleMaterial.Icon.gmd_settings, "settings"),
;
val url = "$FB_URL_BASE$relativeUrl"
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
index 35acdcb3..2f2050cc 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
@@ -3,6 +3,7 @@ package com.pitchedapps.frost.injectors
import android.graphics.Color
import android.webkit.WebView
import ca.allanwang.kau.utils.*
+import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
/**
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
index cb33e527..e8a3128d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
@@ -1,7 +1,6 @@
package com.pitchedapps.frost.injectors
import android.webkit.WebView
-import com.pitchedapps.frost.utils.L
/**
* Created by Allan Wang on 2017-05-31.
@@ -16,7 +15,8 @@ enum class CssHider(vararg val items: String) : InjectorContract {
"article[data-store*=sponsor]"
),
PEOPLE_YOU_MAY_KNOW("article._d2r"),
- MESSENGER("._s15", "[data-testid=info_panel]", "js_i")
+ MESSENGER("._s15", "[data-testid=info_panel]", "js_i"),
+ NON_RECENT("article:not([data-store*=actor_name])")
;
val injector: JsInjector by lazy { JsBuilder().css("${items.joinToString(separator = ",")}{display:none!important}").build() }
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
index 1f35464b..1b7dad1c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
@@ -25,7 +25,7 @@ class JsBuilder {
override fun toString(): String {
val builder = StringBuilder().append("!function(){")
if (css.isNotBlank()) {
- val cssMin = css.replace(Regex("\\s+"), "")
+ val cssMin = css.replace(Regex("[\\r\\n\\t\\f\\v]\\s*"), "")
builder.append("var a=document.createElement('style');a.innerHTML='$cssMin';document.head.appendChild(a);")
}
if (js.isNotBlank())
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
index 737b86ab..a24e4778 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
@@ -35,6 +35,8 @@ val Context.frostNotification: NotificationCompat.Builder
color = color(R.color.frost_notification_accent)
}
+@Suppress("DEPRECATION")
+//The update feature is for Android O and seems to still be in beta
fun Notification.frostConfig() = apply {
if (Prefs.notificationVibrate) defaults = defaults or Notification.DEFAULT_VIBRATE
if (Prefs.notificationSound) defaults = defaults or Notification.DEFAULT_SOUND
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
index 669b2c9e..445f3ddf 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
@@ -134,7 +134,7 @@ fun SettingsActivity.restorePurchases() {
finishRestore(restore, false)
}
getInventory(false, true, reset) {
- inv, helper ->
+ inv, _ ->
val proSku = inv.hasPurchase(FROST_PRO)
Prefs.pro = proSku
L.d("Play Store Restore found: ${Prefs.pro}")
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index 3e6ddd06..89eef258 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -79,6 +79,7 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
internal fun injectAndFinish() {
L.d("Page finished reveal")
webCore.jsInject(CssHider.HEADER,
+ CssHider.NON_RECENT.maybe(webCore.url.contains("?sk=h_chr")),
Prefs.themeInjector,
callback = {
refreshObservable.onNext(false)
@@ -104,15 +105,25 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
* returns true to override the url
*/
private fun launchRequest(request: WebResourceRequest): Boolean {
- L.d("Launching ${request.url}")
+ L.d("Launching Url", request.url.toString())
webCore.context.launchWebOverlay(request.url.toString())
return true
}
+ private fun launchImage(request: WebResourceRequest, text: String? = null): Boolean {
+ L.d("Launching Image", request.url.toString())
+ webCore.context.launchImageActivity(request.url.toString(), text)
+ if (webCore.canGoBack()) webCore.goBack()
+ return true
+ }
+
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {
L.i("Url Loading ${request.url}")
val path = request.url.path ?: return super.shouldOverrideUrlLoading(view, request)
+ L.v("Url Loading Path $path")
if (path.startsWith("/composer/")) return launchRequest(request)
+ if (request.url.toString().contains("scontent-sea1-1.xx.fbcdn.net") && (path.endsWith(".jpg") || path.endsWith(".png")))
+ return launchImage(request)
return super.shouldOverrideUrlLoading(view, request)
}