Commit 10c680f3 authored by Waweic's avatar Waweic 💬
Browse files

Do not start a new Activity when you click anywhere

parent b79de637
Pipeline #289596 failed with stages
in 46 seconds
......@@ -16,6 +16,7 @@ If you want to download the Application without building it yourself, you can do
* Open application when gemini:// link in other app / browser is clicked
* Open other application when a link is clicked that has a scheme the client can't handle
* Basic redirection
* Does not start a new Activity when you click anywhere (thanks to a much appreciated hint by [https://fosstodon.org/@utf8equalsX](@utf8equalsX@fosstodon.org))
## Stuff that doesn't work (aka wishlist for the future)
* A browsing history
......@@ -37,4 +38,4 @@ If you want to download the Application without building it yourself, you can do
* Security
## Stuff that probably should be done differently
* Every link / redirection calls an Android Intent. I don't know anything about it but it's probably inefficient
\ No newline at end of file
* Probably a lot
\ No newline at end of file
......@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
......
......@@ -42,11 +42,13 @@ class MainActivity : AppCompatActivity() {
goToPage(URI.create(uriField.text.toString()))
}
if(intent.data != null) {
intent.data.toString().let {goToPage(URI.create(it))}
}
else {
goToPage(URI.create(getString(R.string.default_url)))
goToPage(URI.create(getString(R.string.default_url)))
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
if(intent?.data != null) {
intent?.data.toString().let{goToPage(URI.create(it))}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment