diff --git a/app/src/main/java/core/notevault/ui/home/HomeFragment.java b/app/src/main/java/core/notevault/ui/home/HomeFragment.java index 7ee13eb..96714dc 100644 --- a/app/src/main/java/core/notevault/ui/home/HomeFragment.java +++ b/app/src/main/java/core/notevault/ui/home/HomeFragment.java @@ -17,6 +17,7 @@ import androidx.lifecycle.ViewModelProvider; import com.google.android.material.floatingactionbutton.FloatingActionButton; import core.notevault.R; import core.notevault.databinding.FragmentHomeBinding; +import core.notevault.ui.metadatadialog.MetaDataDialog; public class HomeFragment extends Fragment { @@ -51,6 +52,8 @@ public class HomeFragment extends Fragment { private void handleFile(Uri uri) { // Hier kannst du die Logik zum Speichern oder Anzeigen der Datei implementieren + MetaDataDialog metaDataDialog = new MetaDataDialog(); + metaDataDialog.show(getParentFragmentManager(), MetaDataDialog.TAG); homeViewModel.addNote(uri); // Speichere die URI im ViewModel Toast.makeText(getActivity(), "Datei ausgewählt: " + uri.getPath(), Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/core/notevault/ui/home/HomeViewModel.java b/app/src/main/java/core/notevault/ui/home/HomeViewModel.java index 009ad9b..7bb2267 100644 --- a/app/src/main/java/core/notevault/ui/home/HomeViewModel.java +++ b/app/src/main/java/core/notevault/ui/home/HomeViewModel.java @@ -4,6 +4,7 @@ import android.net.Uri; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; +import core.notevault.ui.metadatadialog.MetaDataDialog; public class HomeViewModel extends ViewModel { @@ -19,6 +20,6 @@ public class HomeViewModel extends ViewModel { } public void addNote(Uri uri) { - System.out.println("Added file: " + uri.toString()); + } } \ No newline at end of file diff --git a/app/src/main/java/core/notevault/ui/metadatadialog/MetaDataDialog.java b/app/src/main/java/core/notevault/ui/metadatadialog/MetaDataDialog.java new file mode 100644 index 0000000..2cd88a0 --- /dev/null +++ b/app/src/main/java/core/notevault/ui/metadatadialog/MetaDataDialog.java @@ -0,0 +1,23 @@ +package core.notevault.ui.metadatadialog; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.os.Bundle; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; +import core.notevault.R; + +public class MetaDataDialog extends DialogFragment { + + @NonNull + @Override + public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { + return new AlertDialog.Builder(requireContext()) + .setMessage("Import-Einstellungen") + .setPositiveButton("Speichern", (dialog, which) -> {} ) + .create(); + } + + public static String TAG = "MetaDataDialog"; +} diff --git a/app/src/main/res/layout/fragment_metadata_dialog.xml b/app/src/main/res/layout/fragment_metadata_dialog.xml new file mode 100644 index 0000000..264cffe --- /dev/null +++ b/app/src/main/res/layout/fragment_metadata_dialog.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file