diff --git a/app/src/main/java/com/bouillie/web/MainActivity.java b/app/src/main/java/com/bouillie/web/MainActivity.java
index 42c1c45..66a8024 100644
--- a/app/src/main/java/com/bouillie/web/MainActivity.java
+++ b/app/src/main/java/com/bouillie/web/MainActivity.java
@@ -4,6 +4,8 @@
import static android.app.DownloadManager.Request;
import static android.app.usage.UsageEvents.Event.NONE;
+import static com.boullie.web.R.*;
+
import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.content.DialogInterface;
@@ -106,6 +108,28 @@ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request
});
+ Button changeUrlButton = findViewById(R.id.changeUrlButton);
+ changeUrlButton.setOnClickListener(v -> {
+ String currentUrl = webView.getUrl();
+ AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
+ builder.setTitle("Change URL");
+
+ final EditText input = new EditText(MainActivity.this);
+ input.setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_URI);
+ input.setText(currentUrl);
+ builder.setView(input);
+
+ builder.setPositiveButton("OK", (dialog, which) -> {
+ String newUrl = input.getText().toString();
+ webView.loadUrl(newUrl);
+ });
+
+ builder.setNegativeButton("Cancel", (dialog, which) -> dialog.cancel());
+
+ builder.show();
+ });
+
+
Button soundButton = findViewById(R.id.soundButton);
soundButton.setOnClickListener(v -> {
// Créer une boîte de dialogue avec trois options
@@ -311,17 +335,9 @@ private void showNextDialog() {
ProgressBar myProgressBar = findViewById(R.id.progressBar);
- EditText urlcontent = findViewById(R.id.UrlContent);
+ TextView urlContent = findViewById(R.id.textView);;
ImageView secureimage = findViewById(R.id.SecureImage);
- urlcontent.setImeOptions(EditorInfo.IME_ACTION_GO);
- urlcontent.setOnEditorActionListener((v, actionId, event) -> {
- if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_SEARCH) {
- String url = urlcontent.getText().toString();
- webView.loadUrl(url);
- return true;
- }
- return false;
- });
+
webView.setWebViewClient(new WebViewClient() {
@@ -332,7 +348,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
@Override
public void onPageFinished(WebView view, String url) {
- urlcontent.setText(url);
+ urlContent.setText(url);
// Masquer la barre de progression
myProgressBar.setVisibility(View.GONE);
@@ -521,6 +537,8 @@ private void showStartDialog() {
finish();
}
+
+
private void FirstStart() {
SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
@@ -611,3 +629,4 @@ public void setAlert2(AlertDialog alert2) {
}
}
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 9c79ed5..81ad62c 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -33,18 +33,11 @@
android:layout_height="35dp"
app:srcCompat="@android:drawable/ic_menu_info_details" />
-
+ android:layout_height="match_parent"
+ android:text="TextView" />
@@ -85,17 +78,22 @@
+ android:text="Changer l'URL"
+ app:icon="@android:drawable/ic_menu_preferences" />
@@ -116,6 +115,7 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/SizeMenu"
android:layout_marginEnd="10dp"
+ android:text="Favoris enregistrés"
app:icon="@drawable/baseline_bookmarks_24"
app:iconGravity="textEnd"
app:iconPadding="0dp"
@@ -127,6 +127,7 @@
android:layout_height="@dimen/SizeMenu"
android:layout_marginEnd="10dp"
android:contentDescription="@string/favorite_button_add"
+ android:text="Ajouter un favoris"
app:icon="@drawable/baseline_bookmark_add_24"
app:iconPadding="0dp"
app:iconSize="@dimen/SizeMenubtn" />
@@ -137,6 +138,7 @@
android:layout_height="@dimen/SizeMenu"
android:layout_marginEnd="10dp"
android:contentDescription="@string/delete_fav_button"
+ android:text="Supprimer un favoris"
app:icon="@drawable/baseline_bookmark_remove_24"
app:iconPadding="0dp"
app:iconSize="@dimen/SizeMenubtn" />
@@ -147,6 +149,7 @@
android:layout_height="@dimen/SizeMenu"
android:layout_marginEnd="10dp"
android:contentDescription="@string/changer_la_couleur"
+ android:text="Changer le thème (INSTABLE)"
app:icon="@drawable/baseline_palette_24"
app:iconPadding="0dp"
app:iconSize="@dimen/SizeMenubtn" />
@@ -156,6 +159,7 @@
android:layout_height="@dimen/SizeMenu"
android:contentDescription="@string/delete_data_button"
android:onClick='onDeleteDataClick'
+ android:text="Supprimer toutes les données"
app:icon="@drawable/baseline_delete_forever_24"
app:iconPadding="0dp"
app:iconSize="@dimen/SizeMenubtn" />