Skip to content

Commit

Permalink
Mises à jour
Browse files Browse the repository at this point in the history
  • Loading branch information
Celestial04 committed May 25, 2024
1 parent 808c935 commit 3e4633d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/src/main/java/com/hugdev/webapper/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected void onCreate(Bundle savedInstanceState) {
Button bottomButton = findViewById(R.id.bottomButton);
Button leftButton = findViewById(R.id.leftButton);
Button rightButton = findViewById(R.id.rightButton);
HorizontalScrollView scroll = findViewById(R.id.scroll);
LinearLayout linearLayout2 = findViewById(R.id.scrollvv);
scroll.fullScroll(View.FOCUS_DOWN);
WebView webView = findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
Expand All @@ -108,30 +108,35 @@ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request
topButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scroll.scrollTo(0, 0); // Scroll to left
// Scroll to the top
scroll.fullScroll(View.FOCUS_UP);
}
});

bottomButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scroll.scrollTo(0, scroll.getChildAt(0).getHeight()); // Scroll to right
// Scroll to the bottom
scroll.fullScroll(View.FOCUS_DOWN);
}
});

leftButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scroll.scrollTo(0, 0); // Scroll to top
// Scroll to the left
scroll.fullScroll(View.FOCUS_LEFT);
}
});

rightButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scroll.scrollTo(scroll.getChildAt(0).getWidth(), 0); // Scroll to bottom
// Scroll to the right
scroll.fullScroll(View.FOCUS_RIGHT);
}
});

Button soundButton = findViewById(R.id.soundButton);
soundButton.setOnClickListener(v -> {
// Créer une boîte de dialogue avec trois options
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
tools:context=".MainActivity">

<LinearLayout
android:id="@+id/scrollvv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
Expand Down

0 comments on commit 3e4633d

Please sign in to comment.