1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 04:52:38 +01:00

Add option to open overlay links in browser

This commit is contained in:
Allan Wang 2019-09-29 02:12:35 -07:00
parent a4e9eb4427
commit 8b6daa04fc
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
6 changed files with 17 additions and 15 deletions

View File

@ -38,8 +38,8 @@ 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
import ca.allanwang.kau.utils.startLink
import ca.allanwang.kau.utils.statusBarColor
import ca.allanwang.kau.utils.tint
import ca.allanwang.kau.utils.toDrawable
@ -47,7 +47,6 @@ 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.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
@ -314,18 +313,15 @@ abstract class WebOverlayActivityBase(private val userAgent: String = USER_AGENT
menuInflater.inflate(R.menu.menu_web, menu)
overlayContext?.onMenuCreate(this, menu)
toolbar.tint(Prefs.iconColor)
setMenuIcons(
menu, Prefs.iconColor,
R.id.action_share to CommunityMaterial.Icon2.cmd_share,
R.id.action_copy_link to GoogleMaterial.Icon.gmd_content_copy
)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val url = web.currentUrl.formattedFbUrl
when (item.itemId) {
R.id.action_copy_link -> copyToClipboard(web.currentUrl.formattedFbUrl)
R.id.action_share -> shareText(web.currentUrl.formattedFbUrl)
R.id.action_copy_link -> copyToClipboard(url)
R.id.action_share -> shareText(url)
R.id.action_open_in_browser -> startLink(url)
else -> if (!OverlayContext.onOptionsItemSelected(web, item.itemId))
return super.onOptionsItemSelected(item)
}

View File

@ -4,4 +4,5 @@ v2.4.1
* 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+)
* Fix biometric prompt, and prompt on activity resume
* Fix notification title
* Fix notification title
* Add option to open overlay links in browser

View File

@ -5,14 +5,17 @@
<item
android:id="@+id/action_copy_link"
android:orderInCategory="100"
android:title="@string/copy_link"
app:showAsAction="ifRoom" />
app:showAsAction="never" />
<item
android:id="@+id/action_share"
android:orderInCategory="200"
android:title="@string/kau_share"
app:showAsAction="ifRoom" />
app:showAsAction="never" />
<item
android:id="@+id/action_open_in_browser"
android:title="@string/open_in_browser"
app:showAsAction="never" />
</menu>

View File

@ -11,4 +11,5 @@
<string name="copy_link">Copy Link</string>
<string name="copy_text">Copy Text</string>
<string name="debug_image_link_subject" translatable="false">Frost for Facebook: Image Link Debug</string>
<string name="open_in_browser">Open in browser</string>
</resources>

View File

@ -12,7 +12,7 @@
<item text="Fix nav and status bar icon colors for custom themes (Android O+)" />
<item text="Fix biometric prompt, and prompt on activity resume" />
<item text="Fix notification title" />
<item text="" />
<item text="Add option to open overlay links in browser" />
<item text="" />
<version title="v2.4.0" />

View File

@ -6,6 +6,7 @@
* Fix nav and status bar icon colors for custom themes (Android O+)
* Fix biometric prompt, and prompt on activity resume
* Fix notification title
* Add option to open overlay links in browser
## v2.4.0
* Removed request services, which potentially caused phishing warnings.