Open Dialog after selecting MusicNoteFile
This commit is contained in:
parent
2b7215b61c
commit
39463c8df3
@ -17,6 +17,7 @@ import androidx.lifecycle.ViewModelProvider;
|
|||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import core.notevault.R;
|
import core.notevault.R;
|
||||||
import core.notevault.databinding.FragmentHomeBinding;
|
import core.notevault.databinding.FragmentHomeBinding;
|
||||||
|
import core.notevault.ui.metadatadialog.MetaDataDialog;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
@ -51,6 +52,8 @@ public class HomeFragment extends Fragment {
|
|||||||
|
|
||||||
private void handleFile(Uri uri) {
|
private void handleFile(Uri uri) {
|
||||||
// Hier kannst du die Logik zum Speichern oder Anzeigen der Datei implementieren
|
// 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
|
homeViewModel.addNote(uri); // Speichere die URI im ViewModel
|
||||||
Toast.makeText(getActivity(), "Datei ausgewählt: " + uri.getPath(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "Datei ausgewählt: " + uri.getPath(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import android.net.Uri;
|
|||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
import core.notevault.ui.metadatadialog.MetaDataDialog;
|
||||||
|
|
||||||
public class HomeViewModel extends ViewModel {
|
public class HomeViewModel extends ViewModel {
|
||||||
|
|
||||||
@ -19,6 +20,6 @@ public class HomeViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Uri uri) {
|
public void addNote(Uri uri) {
|
||||||
System.out.println("Added file: " + uri.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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";
|
||||||
|
}
|
7
app/src/main/res/layout/fragment_metadata_dialog.xml
Normal file
7
app/src/main/res/layout/fragment_metadata_dialog.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/metadata_dialog">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user