0
0
mirror of https://github.com/markusfisch/BinaryEye.git synced 2024-09-20 12:02:17 +02:00

Use different URL hints for open/send URLs

While the ".../?content=" part is required for Open-With-URLs,
it's confusing for Send-Scan-URLs.
This commit is contained in:
Markus Fisch 2020-08-15 13:37:22 +02:00
parent 242bf4c0a1
commit d34673ddc3
3 changed files with 11 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import android.support.v7.preference.PreferenceDialogFragmentCompat
import android.view.View
import android.widget.TextView
import de.markusfisch.android.binaryeye.R
import de.markusfisch.android.binaryeye.preference.Preferences
import de.markusfisch.android.binaryeye.preference.UrlPreference
class UrlDialogFragment : PreferenceDialogFragmentCompat() {
@ -13,7 +14,12 @@ class UrlDialogFragment : PreferenceDialogFragmentCompat() {
override fun onBindDialogView(view: View?) {
super.onBindDialogView(view)
urlView = view?.findViewById(R.id.url)
urlView?.text = urlPreference().getUrl()
val urlPref = urlPreference()
urlView?.text = urlPref.getUrl()
urlView?.hint = getString(when (urlPref.key) {
Preferences.OPEN_WITH_URL -> R.string.url_hint_add_content
else -> R.string.url_hint
})
}
override fun onDialogClosed(positiveResult: Boolean) {

View File

@ -1,5 +1,6 @@
<resources>
<string name="app_name" translatable="false">Binary Eye</string>
<string name="url_hint" translatable="false">http://example.com?content=</string>
<string name="url_hint" translatable="false">http://example.com/</string>
<string name="url_hint_add_content" translatable="false">http://example.com/?content=</string>
<string name="project_url" translatable="false">https://github.com/markusfisch/BinaryEye</string>
</resources>

View File

@ -47,8 +47,7 @@
<PreferenceCategory android:title="@string/send_category">
<de.markusfisch.android.binaryeye.preference.UrlPreference
android:key="send_scan_url"
android:title="@string/send_scan_url"
android:summary="@string/url_hint"/>
android:title="@string/send_scan_url"/>
<ListPreference
android:key="send_scan_type"
android:title="@string/send_scan_type"
@ -74,7 +73,6 @@
android:summary="@string/show_hex_dump_summary"/>
<de.markusfisch.android.binaryeye.preference.UrlPreference
android:key="open_with_url"
android:title="@string/open_with_url"
android:summary="@string/url_hint"/>
android:title="@string/open_with_url"/>
</PreferenceCategory>
</PreferenceScreen>