aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-20 15:50:08 -0700
committerAllan Wang <me@allanwang.ca>2017-06-20 15:50:08 -0700
commite916afddb89550d7f99f17e1477ad17f3bd770f9 (patch)
treeb9a846da082599295d2671d29eaee74d9310f4c6
parent2d7fa0f6d0c152bb9f3fd30370ef510a0d452d00 (diff)
downloadfrost-e916afddb89550d7f99f17e1477ad17f3bd770f9.tar.gz
frost-e916afddb89550d7f99f17e1477ad17f3bd770f9.tar.bz2
frost-e916afddb89550d7f99f17e1477ad17f3bd770f9.zip
Add user switching for notifications
-rw-r--r--.idea/markdown-navigator.xml71
-rw-r--r--.idea/misc.xml98
-rw-r--r--.idea/vcs.xml2
-rw-r--r--app/build.gradle3
-rw-r--r--app/src/main/AndroidManifest.xml12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt18
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt21
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt29
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationExtensions.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt2
-rw-r--r--app/src/main/res/values/dimens.xml1
-rw-r--r--app/src/main/res/values/strings.xml1
-rw-r--r--app/src/main/res/values/styles.xml2
-rw-r--r--app/src/main/res/xml/changelog.xml5
-rw-r--r--docs/Changelog.md4
20 files changed, 185 insertions, 126 deletions
diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml
deleted file mode 100644
index 838ef398..00000000
--- a/.idea/markdown-navigator.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="MarkdownProjectSettings">
- <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.25" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="LINE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="true" showSelectionInPreview="true">
- <PanelProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
- </PanelProvider>
- </PreviewSettings>
- <ParserSettings gitHubSyntaxChange="false">
- <PegdownExtensions>
- <option name="ABBREVIATIONS" value="false" />
- <option name="ANCHORLINKS" value="true" />
- <option name="ASIDE" value="false" />
- <option name="ATXHEADERSPACE" value="true" />
- <option name="AUTOLINKS" value="true" />
- <option name="DEFINITIONS" value="false" />
- <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
- <option name="FENCED_CODE_BLOCKS" value="true" />
- <option name="FOOTNOTES" value="false" />
- <option name="HARDWRAPS" value="false" />
- <option name="INSERTED" value="false" />
- <option name="QUOTES" value="false" />
- <option name="RELAXEDHRULES" value="true" />
- <option name="SMARTS" value="false" />
- <option name="STRIKETHROUGH" value="true" />
- <option name="SUBSCRIPT" value="false" />
- <option name="SUPERSCRIPT" value="false" />
- <option name="SUPPRESS_HTML_BLOCKS" value="false" />
- <option name="SUPPRESS_INLINE_HTML" value="false" />
- <option name="TABLES" value="true" />
- <option name="TASKLISTITEMS" value="true" />
- <option name="TOC" value="false" />
- <option name="WIKILINKS" value="true" />
- </PegdownExtensions>
- <ParserOptions>
- <option name="COMMONMARK_LISTS" value="false" />
- <option name="DUMMY" value="false" />
- <option name="EMOJI_SHORTCUTS" value="true" />
- <option name="FLEXMARK_FRONT_MATTER" value="false" />
- <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
- <option name="GFM_TABLE_RENDERING" value="true" />
- <option name="GITBOOK_URL_ENCODING" value="false" />
- <option name="GITHUB_EMOJI_URL" value="false" />
- <option name="GITHUB_LISTS" value="true" />
- <option name="GITHUB_WIKI_LINKS" value="true" />
- <option name="JEKYLL_FRONT_MATTER" value="false" />
- <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
- </ParserOptions>
- </ParserSettings>
- <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
- <GeneratorProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
- </GeneratorProvider>
- <headerTop />
- <headerBottom />
- <bodyTop />
- <bodyBottom />
- </HtmlSettings>
- <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
- <StylesheetProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
- </StylesheetProvider>
- <ScriptProviders />
- <cssText />
- </CssSettings>
- <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
- <LinkMapSettings>
- <textMaps />
- </LinkMapSettings>
- </component>
-</project> \ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 6e3f694c..8449ce70 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,6 +3,74 @@
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
+ <component name="MarkdownProjectSettings">
+ <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.25" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="LINE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="true" showSelectionInPreview="true">
+ <PanelProvider>
+ <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
+ </PanelProvider>
+ </PreviewSettings>
+ <ParserSettings gitHubSyntaxChange="false">
+ <PegdownExtensions>
+ <option name="ABBREVIATIONS" value="false" />
+ <option name="ANCHORLINKS" value="true" />
+ <option name="ASIDE" value="false" />
+ <option name="ATXHEADERSPACE" value="true" />
+ <option name="AUTOLINKS" value="true" />
+ <option name="DEFINITIONS" value="false" />
+ <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
+ <option name="FENCED_CODE_BLOCKS" value="true" />
+ <option name="FOOTNOTES" value="false" />
+ <option name="HARDWRAPS" value="false" />
+ <option name="INSERTED" value="false" />
+ <option name="QUOTES" value="false" />
+ <option name="RELAXEDHRULES" value="true" />
+ <option name="SMARTS" value="false" />
+ <option name="STRIKETHROUGH" value="true" />
+ <option name="SUBSCRIPT" value="false" />
+ <option name="SUPERSCRIPT" value="false" />
+ <option name="SUPPRESS_HTML_BLOCKS" value="false" />
+ <option name="SUPPRESS_INLINE_HTML" value="false" />
+ <option name="TABLES" value="true" />
+ <option name="TASKLISTITEMS" value="true" />
+ <option name="TOC" value="false" />
+ <option name="WIKILINKS" value="true" />
+ </PegdownExtensions>
+ <ParserOptions>
+ <option name="COMMONMARK_LISTS" value="false" />
+ <option name="DUMMY" value="false" />
+ <option name="EMOJI_SHORTCUTS" value="true" />
+ <option name="FLEXMARK_FRONT_MATTER" value="false" />
+ <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
+ <option name="GFM_TABLE_RENDERING" value="true" />
+ <option name="GITBOOK_URL_ENCODING" value="false" />
+ <option name="GITHUB_EMOJI_URL" value="false" />
+ <option name="GITHUB_LISTS" value="true" />
+ <option name="GITHUB_WIKI_LINKS" value="true" />
+ <option name="JEKYLL_FRONT_MATTER" value="false" />
+ <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
+ </ParserOptions>
+ </ParserSettings>
+ <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
+ <GeneratorProvider>
+ <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
+ </GeneratorProvider>
+ <headerTop />
+ <headerBottom />
+ <bodyTop />
+ <bodyBottom />
+ </HtmlSettings>
+ <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
+ <StylesheetProvider>
+ <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
+ </StylesheetProvider>
+ <ScriptProviders />
+ <cssText />
+ </CssSettings>
+ <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
+ <LinkMapSettings>
+ <textMaps />
+ </LinkMapSettings>
+ </component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
@@ -27,7 +95,35 @@
</value>
</option>
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
+ <component name="ProjectInspectionProfilesVisibleTreeState">
+ <entry key="Project Default">
+ <profile-state>
+ <expanded-state>
+ <State>
+ <id />
+ </State>
+ </expanded-state>
+ <selected-state>
+ <State>
+ <id>Android</id>
+ </State>
+ </selected-state>
+ </profile-state>
+ </entry>
+ </component>
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/build/classes" />
+ </component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1ddf..94a25f7f 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
- <mapping directory="" vcs="Git" />
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project> \ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 7c6956b0..39bcab46 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -39,6 +39,7 @@ android {
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
resValue "string", "app_name", "Frost Debug"
+ resValue "string", "frost_web", "Frost Web Debug"
}
releaseTest {
minifyEnabled true
@@ -48,12 +49,14 @@ android {
signingConfig signingConfigs.test
versionNameSuffix "-test"
resValue "string", "app_name", "Frost Test"
+ resValue "string", "frost_web", "Frost Web Test"
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "Frost"
+ resValue "string", "frost_web", "Frost Web"
}
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e715dc54..67366d71 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -10,7 +10,6 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
- <uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".FrostApp"
@@ -20,10 +19,10 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
- android:theme="@style/FrostThemeBase">
+ android:theme="@style/FrostTheme.Splash">
<activity
android:name=".StartActivity"
- android:configChanges="orientation|screenSize|locale"
+ android:noHistory="true"
android:label="@string/app_name"
android:theme="@style/FrostTheme.Splash">
<intent-filter>
@@ -47,16 +46,15 @@
android:name=".FrostWebActivity"
android:autoRemoveFromRecents="true"
android:exported="true"
- android:label="@string/frost_web"
android:hardwareAccelerated="true"
+ android:label="@string/frost_web"
android:launchMode="singleInstance"
android:taskAffinity="com.pitchedapps.frost.single.web"
android:theme="@style/FrostTheme.Overlay">
- <intent-filter android:autoVerify="true"
+ <intent-filter
+ android:autoVerify="true"
tools:ignore="UnusedAttribute">
- <action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
-
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt
index 31ebfda2..c853e8f0 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt
@@ -1,17 +1,8 @@
package com.pitchedapps.frost
import android.os.Bundle
-import android.support.design.widget.CoordinatorLayout
-import android.support.v7.app.AppCompatActivity
-import android.support.v7.widget.Toolbar
-import ca.allanwang.kau.utils.*
-import com.jude.swipbackhelper.SwipeBackHelper
-import com.pitchedapps.frost.facebook.FbTab
-import com.pitchedapps.frost.utils.ARG_URL
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.formattedFbUrl
-import com.pitchedapps.frost.utils.setFrostColors
-import com.pitchedapps.frost.web.FrostWebView
/**
@@ -20,8 +11,15 @@ import com.pitchedapps.frost.web.FrostWebView
* Replica of [WebOverlayActivity] with a different base url
* Didn't use activity-alias because it causes issues when only one activity has the singleInstance mode
*/
-class FrostWebActivity:WebOverlayActivity() {
+class FrostWebActivity : WebOverlayActivity() {
+
override val url: String
get() = intent.dataString!!.formattedFbUrl
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ Prefs.prevId = Prefs.userId
+ super.onCreate(savedInstanceState)
+ }
+
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index ca50d4e2..fcffffb2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -28,6 +28,7 @@ import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.Drawer
import com.pitchedapps.frost.dbflow.loadFbTabs
+import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbCookie.switchUser
import com.pitchedapps.frost.facebook.FbTab
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
@@ -83,8 +84,8 @@ class MainActivity : BaseActivity() {
super.onPageScrolled(position, positionOffset, positionOffsetPixels)
val delta: Float by lazy { positionOffset * (255 - 128).toFloat() }
tabsForEachView {
- position, view ->
- view.setAllAlpha(when (position) {
+ tabPosition, view ->
+ view.setAllAlpha(when (tabPosition) {
position -> 255.0f - delta
position + 1 -> 128.0f + delta
else -> 128f
@@ -243,6 +244,11 @@ class MainActivity : BaseActivity() {
return true
}
+ override fun onResume() {
+ super.onResume()
+ FbCookie.switchBackUser { }
+ }
+
override fun onBackPressed() {
if (currentFragment.onBackPressed()) return
super.onBackPressed()
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
index b55b2a10..19fa6362 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
@@ -87,7 +87,6 @@ class SettingsActivity : KPrefActivity() {
_, _, which, text ->
item.pref = options[which]
this@SettingsActivity.scheduleNotifications(item.pref)
- this@SettingsActivity.toast(text)
true
})
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
index bdac366e..0b2be3ee 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
@@ -1,9 +1,10 @@
package com.pitchedapps.frost
import android.os.Bundle
+import android.os.Handler
import android.support.v7.app.AppCompatActivity
import com.pitchedapps.frost.dbflow.loadFbCookiesAsync
-import com.pitchedapps.frost.services.requestNotifications
+import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.launchNewTask
@@ -16,15 +17,15 @@ class StartActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
L.d("Load cookies ${System.currentTimeMillis()}")
- loadFbCookiesAsync {
- cookies ->
- cookies.forEach { requestNotifications(it.id) }
-
- L.d("Cookies loaded ${System.currentTimeMillis()} $cookies")
- if (cookies.isNotEmpty())
- launchNewTask(if (Prefs.userId != -1L) MainActivity::class.java else SelectorActivity::class.java, ArrayList(cookies))
- else
- launchNewTask(LoginActivity::class.java)
+ FbCookie.switchBackUser {
+ loadFbCookiesAsync {
+ cookies ->
+ L.d("Cookies loaded ${System.currentTimeMillis()} $cookies")
+ if (cookies.isNotEmpty())
+ launchNewTask(if (Prefs.userId != -1L) MainActivity::class.java else SelectorActivity::class.java, ArrayList(cookies))
+ else
+ launchNewTask(LoginActivity::class.java)
+ }
}
}
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
index 320e4028..1660d8db 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
@@ -6,6 +6,8 @@ import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import ca.allanwang.kau.utils.*
import com.jude.swipbackhelper.SwipeBackHelper
+import com.mikepenz.google_material_typeface_library.GoogleMaterial
+import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.ARG_URL
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.formattedFbUrl
@@ -22,27 +24,38 @@ open class WebOverlayActivity : AppCompatActivity() {
val frostWeb: FrostWebView by bindView(R.id.overlay_frost_webview)
val coordinator: CoordinatorLayout by bindView(R.id.overlay_main_content)
+ companion object {
+ const val ARG_USER_ID = "arg_user_id"
+ }
+
open val url: String
get() = intent.extras!!.getString(ARG_URL).formattedFbUrl
+ val userId: Long
+ get() = intent.extras?.getLong(ARG_USER_ID) ?: Prefs.userId
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_web_overlay)
setSupportActionBar(toolbar)
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
- toolbar.setNavigationOnClickListener { onBackPressed() }
- frostWeb.web.setupWebview(url)
- frostWeb.web.loadBaseUrl()
+ toolbar.navigationIcon = GoogleMaterial.Icon.gmd_close.toDrawable(this, 16, Prefs.iconColor)
+ toolbar.setNavigationOnClickListener { slideOut() }
SwipeBackHelper.onCreate(this)
SwipeBackHelper.getCurrentPage(this)
.setSwipeBackEnable(true)
.setSwipeSensitivity(0.5f)
.setSwipeRelateEnable(true)
.setSwipeRelateOffset(300)
- frostWeb.web.addTitleListener({ toolbar.title = it })
setFrostColors(toolbar, themeWindow = false)
coordinator.setBackgroundColor(Prefs.bgColor.withAlpha(255))
+
+ frostWeb.web.setupWebview(url)
+ frostWeb.web.addTitleListener({ toolbar.title = it })
+
+ if (userId != Prefs.userId) FbCookie.switchUser(userId) { frostWeb.web.loadBaseUrl() }
+ else frostWeb.web.loadBaseUrl()
}
/**
@@ -70,8 +83,12 @@ open class WebOverlayActivity : AppCompatActivity() {
override fun onBackPressed() {
if (!frostWeb.onBackPressed()) {
- finish()
- overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_slide_out_right_top)
+ slideOut()
}
}
+
+ fun slideOut() {
+ finish()
+ overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_slide_out_right_top)
+ }
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
index 42232fc6..ac58fb2f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
@@ -84,4 +84,18 @@ object FbCookie {
removeCookie(id)
reset(callback)
}
+
+ /**
+ * Notifications may come from different accounts, and we need to switch the cookies to load them
+ * When coming back to the main app, switch back to our original account before continuing
+ */
+ fun switchBackUser(callback: () -> Unit) {
+ if (Prefs.prevId != -1L && Prefs.prevId != Prefs.userId) {
+ switchUser(Prefs.prevId) {
+ L.d("Switched from ${Prefs.userId} to ${Prefs.prevId}")
+ Prefs.prevId = -1L
+ callback()
+ }
+ } else callback()
+ }
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationExtensions.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationExtensions.kt
deleted file mode 100644
index ac94b527..00000000
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationExtensions.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.pitchedapps.frost.services
-
-import android.content.Context
-import android.content.Intent
-
-/**
- * Created by Allan Wang on 2017-06-14.
- */
-fun Context.requestNotifications(id: Long) {
- val intent = Intent(this, NotificationService::class.java)
- intent.putExtra(NotificationService.ARG_ID, id)
- startService(intent)
-} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
index 813bdce2..9c8bf2e6 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
@@ -12,6 +12,7 @@ import ca.allanwang.kau.utils.string
import com.pitchedapps.frost.BuildConfig
import com.pitchedapps.frost.FrostWebActivity
import com.pitchedapps.frost.R
+import com.pitchedapps.frost.WebOverlayActivity
import com.pitchedapps.frost.dbflow.*
import com.pitchedapps.frost.facebook.FACEBOOK_COM
import com.pitchedapps.frost.facebook.FB_URL_BASE
@@ -109,6 +110,7 @@ class NotificationService : JobService() {
} else {
val intent = Intent(context, FrostWebActivity::class.java)
intent.data = Uri.parse("$FB_URL_BASE$href")
+ intent.putExtra(WebOverlayActivity.ARG_USER_ID, data.id)
val group = "frost_${data.id}"
val pendingIntent = PendingIntent.getActivity(context, 0, intent, 0)
val notifBuilder = context.frostNotification
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
index 62ed3cdd..40735544 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -17,6 +17,8 @@ object Prefs : KPref() {
var userId: Long by kpref("user_id", -1L)
+ var prevId: Long by kpref("prev_id", -1L)
+
var theme: Int by kpref("theme", 0, postSetter = { value: Int ->
loader.invalidate()
})
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 fe56d6d6..d4942e9e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -30,7 +30,7 @@ import com.pitchedapps.frost.services.NotificationService
internal const val EXTRA_COOKIES = "extra_cookies"
internal const val ARG_URL = "arg_url"
-fun Context.launchNewTask(clazz: Class<out Activity>, cookieList: ArrayList<CookieModel> = arrayListOf(), clearStack: Boolean = clazz != LoginActivity::class.java) {
+fun Context.launchNewTask(clazz: Class<out Activity>, cookieList: ArrayList<CookieModel> = arrayListOf(), clearStack: Boolean = false) {
startActivity(clazz, clearStack, {
putParcelableArrayListExtra(EXTRA_COOKIES, cookieList)
})
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 24bba22f..28f09eea 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -10,5 +10,4 @@
<dimen name="splash_logo">16dp</dimen>
<dimen name="progress_bar_height">1dip</dimen>
<dimen name="account_image_size">100dp</dimen>
-
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6fd465c2..f05d2ce5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,5 +1,4 @@
<resources>
- <string name="frost_web">Frost Web</string>
<string name="action_settings">Settings</string>
<string name="section_format">Hello World from section: %1$d</string>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 0adb5967..b999d606 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -3,6 +3,7 @@
<style name="FrostThemeBase" parent="MaterialDrawerTheme.ActionBar">
<item name="colorPrimary">@color/facebook_blue</item>
<item name="colorPrimaryDark">@color/facebook_blue_dark</item>
+ <item name="colorAccent">@android:color/white</item>
</style>
<style name="FrostTheme" parent="@style/FrostThemeBase">
@@ -13,6 +14,7 @@
<style name="FrostTheme.Light" parent="MaterialDrawerTheme.Light.DarkToolbar">
<item name="colorPrimary">@color/facebook_blue</item>
<item name="colorPrimaryDark">@color/facebook_blue_dark</item>
+ <item name="colorAccent">@android:color/black</item>
</style>
<style name="FrostTheme.Transparent">
diff --git a/app/src/main/res/xml/changelog.xml b/app/src/main/res/xml/changelog.xml
index 964bc8e1..fc87ce08 100644
--- a/app/src/main/res/xml/changelog.xml
+++ b/app/src/main/res/xml/changelog.xml
@@ -8,7 +8,10 @@
<version title="v0.2"/>
<item text="Removed unnecessary permissions" />
- <item text="" />
+ <item text="Added notifications" />
+ <item text="Themed more components" />
+ <item text="Separated independent web overlay from in app overlay" />
+ <item text="Allow notifications from any account" />
<item text="" />
<item text="" />
<item text="" />
diff --git a/docs/Changelog.md b/docs/Changelog.md
index b7b6333a..d78cad34 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -2,6 +2,10 @@
## v0.2
* Removed unnecessary permissions
+* Added notifications
+* Themed more components
+* Separated independent web overlay from in app overlay
+* Allow notifications from any account
## v0.1
* Initial Changelog