From: Soren Stoutner Date: Wed, 25 Sep 2024 19:08:00 +0000 (-0700) Subject: Add a context menu option to copy link text. https://redmine.stoutner.com/issues... X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=e898b37fa2dcc4e750038aa01a615110143f7977;p=PrivacyBrowserAndroid.git Add a context menu option to copy link text. https://redmine.stoutner.com/issues/1111 --- diff --git a/app/build.gradle b/app/build.gradle index c2f97b40..b81126cb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -82,7 +82,7 @@ android { dependencies { // Include the following AndroidX libraries. - implementation "androidx.activity:activity-ktx:1.9.1" + implementation "androidx.activity:activity-ktx:1.9.2" implementation 'androidx.arch.core:core-common:2.2.0' implementation 'androidx.arch.core:core-runtime:2.2.0' implementation 'androidx.appcompat:appcompat:1.7.0' @@ -90,15 +90,15 @@ dependencies { implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0' implementation 'androidx.core:core-ktx:1.13.1' implementation 'androidx.drawerlayout:drawerlayout:1.2.0' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.6' implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'androidx.viewpager:viewpager:1.0.0' - implementation 'androidx.webkit:webkit:1.11.0' + implementation 'androidx.webkit:webkit:1.12.0' // Include the Kotlin standard library. This should be the same version number listed in project build.gradle. implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.20' // Include the Google material library. - implementation 'com.google.android.material:material:1.13.0-alpha05' + implementation 'com.google.android.material:material:1.13.0-alpha06' } diff --git a/app/src/main/assets/fr/about_changelog.html b/app/src/main/assets/fr/about_changelog.html index 6716a513..f1da42af 100644 --- a/app/src/main/assets/fr/about_changelog.html +++ b/app/src/main/assets/fr/about_changelog.html @@ -33,7 +33,7 @@

3.18.1 (version du code 75)

22 Juillet 2024 - API minimale : 26, API optimale : 34

3.18 (version du code 74)

diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index 8c44ac15..45731697 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -2449,6 +2449,15 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Set the target URL as the context menu title. contextMenu.setHeaderTitle(linkUrl) + // Get a new message from the WebView handler. + val hrefMessage = currentWebView!!.handler.obtainMessage() + + // Request the focus node href. + currentWebView!!.requestFocusNodeHref(hrefMessage) + + // Get the link text from the href message. + val linkText = hrefMessage.data.getString("title") + // Add an open in new tab entry. contextMenu.add(R.string.open_in_new_tab).setOnMenuItemClickListener { // Load the link URL in a new tab and move to it. @@ -2530,6 +2539,20 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook true } + // Add a Copy Text entry if the link text is not null. + if (linkText != null) { + contextMenu.add(R.string.copy_text).setOnMenuItemClickListener { + // Save the link URL in a clip data. + val srcAnchorTypeTextClipData = ClipData.newPlainText(getString(R.string.copy_text), linkText) + + // Set the clip data as the clipboard's primary clip. + clipboardManager.setPrimaryClip(srcAnchorTypeTextClipData) + + // Consume the event. + true + } + } + // Add an empty cancel entry, which by default closes the context menu. contextMenu.add(R.string.cancel) } @@ -2794,6 +2817,15 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Set the target URL as the title of the context menu. contextMenu.setHeaderTitle(linkUrl) + // Get a new message from the WebView handler. + val hrefMessage = currentWebView!!.handler.obtainMessage() + + // Request the focus node href. + currentWebView!!.requestFocusNodeHref(hrefMessage) + + // Get the link text from the href message. + val linkText = hrefMessage.data.getString("title") + // Add a write email entry. contextMenu.add(R.string.write_email).setOnMenuItemClickListener { // Use `ACTION_SENDTO` instead of `ACTION_SEND` so that only email programs are launched. @@ -2829,6 +2861,20 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook true } + // Add a Copy Text entry if the link text is not null. + if (linkText != null) { + contextMenu.add(R.string.copy_text).setOnMenuItemClickListener { + // Save the link URL in a clip data. + val srcEmailTypeTextClipData = ClipData.newPlainText(getString(R.string.copy_text), linkText) + + // Set the clip data as the clipboard's primary clip. + clipboardManager.setPrimaryClip(srcEmailTypeTextClipData) + + // Consume the event. + true + } + } + // Add an empty cancel entry, which by default closes the context menu. contextMenu.add(R.string.cancel) } diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 98c7c554..9ea9f5a1 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -674,6 +674,8 @@ Mostrar iconos adicionales en la barra de aplicación Mostrar iconos en la barra de aplicaciones para refrescar el WebView y, si hay espacio, para abrir el cajón de marcadores y cambiar las cookies. Al cambiar esta configuración se reiniciará Navegador Privado. + Ordenar favoritos alfabéticamente + Ordenar los favoritos alfabéticamente, mostrando las carpetas encima de los favoritos. Esto desactiva la ordenación manual de los favoritos. Tema de la app Por defecto del sistema diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 0bc640e2..a26b4301 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -671,6 +671,8 @@ Icônes supplémentaires dans la barre d\'applications Afficher les icônes dans la barre des applications pour actualiser WebView et, s\'il y a de la place, pour ouvrir les signets et la gestion des cookies. La modification de ce paramètre entraîne le redémarrage de Privacy Browser. + Trier les favoris par ordre alphabétique + Trier les favoris par ordre alphabétique, avec les dossiers affichés avant les favoris. Cela désactive le tri manuel des favoris. Thème de l\'application Par défaut diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 07d8d8d3..3d509991 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -674,6 +674,9 @@ Mostra icone addizionali nella barra dell\'applicazione Mostra nella barra dell\'applicazione le icone per l\'aggiornamento della pagina e, se lo spazio è disponibile, per aprire i preferiti e per abilitare o disabilitare i cookie. La modifica di questa impostazione provocherà il riavvio di Privacy Browser. + Elenca i segnalibri alfabeticamente + Elenca i segnalibri in ordine alfabetico, con le cartelle mostrate al di sopra dei segnalibri. + Questo disabilita l\'ordinamento manuale dei segnalibri. Tema Applicazione Predefinito diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index ece18585..59ef4304 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -670,6 +670,8 @@ Отображать дополнительные значки на панели приложения Показывать в панели приложения значки для обновления WebView и, если есть место, для открытия окна закладок и переключения cookie. Изменение этой настройки приведет к перезапуску Privacy Browser. + Сортировка закладок по алфавиту + Отсортировать закладки в алфавитном порядке с отображением папок над закладками. Это отключит ручное упорядочивание закладок. Тема приложения По умолчанию diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 230916f6..eeaa5a23 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -184,6 +184,7 @@ Open Image in New Tab Share Image Copy URL + Copy Text Email Address Copy Email Address Write Email diff --git a/build.gradle b/build.gradle index 28ca9f77..027a715d 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.5.2' + classpath 'com.android.tools.build:gradle:8.6.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20" // NOTE: Do not place your application dependencies here; they belong diff --git a/fastlane/metadata/android/fr-FR/changelogs/75.txt b/fastlane/metadata/android/fr-FR/changelogs/75.txt new file mode 100644 index 00000000..c6f7ee2c --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/75.txt @@ -0,0 +1 @@ +• Correction d'un bug avec les éléments du tiroir de navigation qui ne s'affichaient pas correctement lorsqu'ils étaient activés. \ No newline at end of file