From 71bc0623a542e6c04c3330716ec362047a0ad23a Mon Sep 17 00:00:00 2001 From: Fawkes100 Date: Sat, 18 Jan 2025 19:02:48 +0100 Subject: [PATCH] Implement Swipe Info --- .../ui/sheetdisplay/NoteSheetDisplayActivity.java | 9 +++++++++ app/src/main/res/layout/activity_note_sheet_viewer.xml | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/stormtales/notevault/ui/sheetdisplay/NoteSheetDisplayActivity.java b/app/src/main/java/com/stormtales/notevault/ui/sheetdisplay/NoteSheetDisplayActivity.java index 843a6fc..f75a985 100644 --- a/app/src/main/java/com/stormtales/notevault/ui/sheetdisplay/NoteSheetDisplayActivity.java +++ b/app/src/main/java/com/stormtales/notevault/ui/sheetdisplay/NoteSheetDisplayActivity.java @@ -4,6 +4,8 @@ import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.viewpager2.widget.ViewPager2; +import com.google.android.material.tabs.TabLayout; +import com.google.android.material.tabs.TabLayoutMediator; import com.stormtales.notevault.R; import java.util.Arrays; @@ -16,6 +18,9 @@ public class NoteSheetDisplayActivity extends AppCompatActivity { setContentView(R.layout.activity_note_sheet_viewer); // Erstelle eine Layout-Datei ViewPager2 imageView = findViewById(R.id.viewPager); // Angenommen, du hast ein ImageView + TabLayout tabLayout = findViewById(R.id.tabLayout); + + // Die URI aus dem Intent erhalten Intent intent = getIntent(); @@ -24,6 +29,10 @@ public class NoteSheetDisplayActivity extends AppCompatActivity { List uriList = Arrays.asList(imageUris); ImagePagerAdapter adapter = new ImagePagerAdapter(this, uriList); imageView.setAdapter(adapter); // Setze die URI in das ImageView + + new TabLayoutMediator(tabLayout, imageView, + (tab, position) -> tab.setText("Sheet " + (position + 1)) // Hier kannst du auch andere Labels verwenden + ).attach(); } else { throw new NullPointerException(); } diff --git a/app/src/main/res/layout/activity_note_sheet_viewer.xml b/app/src/main/res/layout/activity_note_sheet_viewer.xml index d771ad9..a523b28 100644 --- a/app/src/main/res/layout/activity_note_sheet_viewer.xml +++ b/app/src/main/res/layout/activity_note_sheet_viewer.xml @@ -2,7 +2,13 @@ - + +