package com.example.newflashcard;

import static com.google.android.material.internal.ContextUtils.getActivity;

import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.appcompat.widget.SearchView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    private RecyclerView recyclerView;
    private FlashcardAdapter adapter;
    private ArrayList<Flashcard> flashcardList;
    private SharedPreferencesManager sharedPreferencesManager;

    private FloatingActionButton fab;

    private Menu menu; // Add this line at the top of your MainActivity class

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        sharedPreferencesManager = new SharedPreferencesManager(this);
        sharedPreferencesManager.applyNightMode();

        recyclerView = findViewById(R.id.recyclerView);
        fab = findViewById(R.id.fab);
        flashcardList = new ArrayList<>();
        adapter = new FlashcardAdapter(flashcardList);
        recyclerView.setAdapter(adapter);

        // Layout manager'ı ayarla
        applyRecyclerViewLayout();

        MaterialToolbar toolbar = findViewById(R.id.materialToolbar);
        setSupportActionBar(toolbar);

        // Flashcard'ları okuma örneği
        FirebaseManager.getInstance().getFlashcards(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                flashcardList.clear();
                for (DataSnapshot dataSnapshot : snapshot.getChildren()) {
                    Flashcard flashcard = dataSnapshot.getValue(Flashcard.class);
                    flashcardList.add(flashcard);
                }
                adapter.filter(""); // Filtresiz listeleme
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {
                Toast.makeText(MainActivity.this, "Failed to load data.", Toast.LENGTH_SHORT).show();
            }
        });

        // FAB tıklama olayı
        fab.setOnClickListener(view -> {
            fragment_add_flashcard addFlashcardFragment = new fragment_add_flashcard();
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(R.id.fragment_container, addFlashcardFragment);
            transaction.addToBackStack(null);
            transaction.commit();
            fab.hide();
            toolbar.setVisibility(View.GONE); // Hide the activity toolbar
        });
        recyclerView.addOnItemTouchListener(new RecyclerTouchListener(this, recyclerView, new RecyclerTouchListener.ClickListener() {
            @Override
            public void onClick(View view, int position) {

                //FirebaseManager.getInstance().deleteFlashcard(flashcardList.get(position).getId());
                //Toast.makeText(MainActivity.this, "Flashcard Deleted.", Toast.LENGTH_SHORT).show();

                fragment_add_or_edit addorEditNoteFragment = new fragment_add_or_edit();

                Bundle bundle = new Bundle();
                bundle.putString("category", flashcardList.get(position).getCategory());
                bundle.putString("title", flashcardList.get(position).getTitle());
                bundle.putString("content", flashcardList.get(position).getContent());
                bundle.putString("timestamp", String.valueOf(flashcardList.get(position).getTimestamp()));
                bundle.putBoolean("isPinned", flashcardList.get(position).isPinned());
                bundle.putBoolean("isFavorite", flashcardList.get(position).isFavorite());
                int color = ContextCompat.getColor(MainActivity.this, R.color.backgroundColor);
                bundle.putInt("backgroundColor", flashcardList.get(position).getBackgroundColor().isEmpty() ? color : Color.parseColor(flashcardList.get(position).getBackgroundColor()));
                addorEditNoteFragment.setArguments(bundle);
                FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                transaction.replace(R.id.fragment_container, addorEditNoteFragment);
                transaction.addToBackStack(null);
                transaction.commit();

                toolbar.setVisibility(View.GONE); // Hide the activity toolbar

            }

            @Override
            public void onLongClick(View view, int position) {
                // Uzun tıklama işlemleri
            }
        }));

        // Geri tuşu için callback
        OnBackPressedCallback callback = new OnBackPressedCallback(true) {
            @Override
            public void handleOnBackPressed() {
                Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
                if (fragment instanceof OnBackPressedListener) {
                    ((OnBackPressedListener) fragment).onBackPressed();
                } else {
                    if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
                        fab.show();
                        getSupportFragmentManager().popBackStack();
                        MaterialToolbar toolbar = findViewById(R.id.materialToolbar);
                        toolbar.setVisibility(View.VISIBLE); // Show again when returning
                    } else {
                        finish();
                    }
                }
            }
        };
        getOnBackPressedDispatcher().addCallback(this, callback);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.options_menu, menu);
        this.menu = menu;
        MenuItem searchItem = menu.findItem(R.id.action_search);
        SearchView searchView = (SearchView) searchItem.getActionView();
        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                adapter.filter(newText);
                return true;
            }
        });

        // Menü öğesinin ikonunu başlangıç durumuna göre ayarla
        updateMenuIcon(menu);

        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();

        if (id == R.id.action_search) {
            return true;
        }

        if (id == R.id.action_night_mode) {
            toggleNightMode();
            return true;
        }

        if (id == R.id.action_change_recycleview_layout) {
            // Mevcut görünüm türünü al
            SharedPreferencesManager.ViewType currentViewType = sharedPreferencesManager.getRecyclerViewLayout();

            // Yeni görünüm türünü belirle
            SharedPreferencesManager.ViewType newViewType;
            switch (currentViewType) {
                case LIST:
                    newViewType = SharedPreferencesManager.ViewType.GRID;
                    break;
                case GRID:
                    newViewType = SharedPreferencesManager.ViewType.STAGGERED_GRID;
                    break;
                case STAGGERED_GRID:
                default:
                    newViewType = SharedPreferencesManager.ViewType.LIST;
                    break;
            }
            // Yeni görünüm türünü ayarla
            sharedPreferencesManager.setRecyclerViewLayout(newViewType);

            // Menüdeki ikonları güncelle
            updateMenuIcon(menu); // Değiştirilen ikonları güncelle

            // RecyclerView layout'unu uygula
            applyRecyclerViewLayout();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    public void startActionMode(final int position) {
        AppCompatActivity activity = this;
        activity.startActionMode(new ActionMode.Callback() {
            @Override
            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                mode.getMenuInflater().inflate(R.menu.contextual_menu, menu);
                return true;
            }

            @Override
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            @Override
            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                int id = item.getItemId(); // Menü item kimliğini alın

                if (id == R.id.action_delete) {
                    // Silme işlemi
                    flashcardList.remove(position);
                    adapter.notifyItemRemoved(position);
                    mode.finish();
                    return true;
                } else if (id == R.id.action_edit) {
                    // Düzenleme işlemi
                    mode.finish();
                    return true;
                } else {
                    return false;
                }
            }

            @Override
            public void onDestroyActionMode(ActionMode mode) {
                // İşlem bittiğinde temizleme yapılabilir
            }
        });
    }
    private void toggleNightMode() {
        sharedPreferencesManager.toggleNightMode();
        recreate();
    }

    private void updateMenuIcon(Menu menu) {
        // Menü öğesinin ikonunu görünüm türüne göre ayarla
        SharedPreferencesManager.ViewType currentViewType = sharedPreferencesManager.getRecyclerViewLayout();
        MenuItem item = menu.findItem(R.id.action_change_recycleview_layout);
        switch (currentViewType) {
            case LIST:
                item.setIcon(R.drawable.ic_vertical_list_icon);
                break;
            case GRID:
                item.setIcon(R.drawable.ic_gridview_icon);
                break;
            case STAGGERED_GRID:
                item.setIcon(R.drawable.ic_staggeredgridview_icon); // Staggered grid için ikon ekle
                break;
        }
    }

    private void applyRecyclerViewLayout() {
        SharedPreferencesManager.ViewType currentViewType = sharedPreferencesManager.getRecyclerViewLayout();
        switch (currentViewType) {
            case LIST:
                recyclerView.setLayoutManager(new LinearLayoutManager(this));
                break;
            case GRID:
                recyclerView.setLayoutManager(new GridLayoutManager(this, 2)); // 2 sütunlu grid
                break;
            case STAGGERED_GRID:
                recyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)); // 2 sütunlu staggered grid
                break;
        }
        adapter.notifyDataSetChanged(); // Notify the adapter of data changes
    }

    public interface OnBackPressedListener {
        void onBackPressed();
    }
}
 package com.example.newflashcard;

import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import com.google.android.material.appbar.MaterialToolbar;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;


public class fragment_add_or_edit extends Fragment {


    private EditText editTextCategory;
    private EditText editTextTitle;
    private EditText editTextContent;
    private TextView editTextTimeStamp;

    private boolean isPinned;
    private boolean isFavorite;
    private int backgroundColor;
    private boolean pinStateChanged = false;
    private boolean favoriteStateChanged = false;
    private boolean colorChanged = false;
    private boolean noteDeleted = false;

    private String originalTitle;
    private String originalCategory;
    private String originalContent;


    public fragment_add_or_edit() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);

        // Get the original values from arguments or savedInstanceState
        if (getArguments() != null) {
            originalCategory = getArguments().getString("category");
            originalTitle = getArguments().getString("title");
            originalContent = getArguments().getString("content");
            isPinned = getArguments().getBoolean("isPinned");
            isFavorite = getArguments().getBoolean("isFavorite");
            backgroundColor = getArguments().getInt("backgroundColor");
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_add_or_edit, container, false);


        MaterialToolbar toolbar = view.findViewById(R.id.materialToolbarFrag);
        ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

        //toolbar.setTitle("");


        editTextCategory = view.findViewById(R.id.editTextCategory);
        editTextTitle = view.findViewById(R.id.editTextTitle);
        editTextContent = view.findViewById(R.id.editTextContent);
        editTextTimeStamp =view.findViewById(R.id.textViewTimestamp);

        if (getArguments() != null) {
            editTextTitle.setText(originalTitle);
            editTextCategory.setText(originalCategory);
            editTextContent.setText(originalContent);

            String timestamp = getArguments().getString("timestamp");
            long timeInMillis = Long.parseLong(timestamp);
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.getDefault());
            String formattedDate = sdf.format(new Date(timeInMillis));
            editTextTimeStamp.setText(formattedDate);

            view.setBackgroundColor(backgroundColor);


        }
        return view;
    }
    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.add_or_edit_fragment_options_menu, menu);
        super.onCreateOptionsMenu(menu, inflater);

        MenuItem pinItem = menu.findItem(R.id.action_pin);
        MenuItem favoriteItem = menu.findItem(R.id.action_fav);

        pinItem.setIcon(isPinned ? R.drawable.ic_pin_filled : R.drawable.ic_pin_outlined);
        favoriteItem.setIcon(isFavorite ? R.drawable.ic_favorite_filled : R.drawable.ic_favorite_outlined);
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();

        if (id == R.id.action_delete) {
            noteDeleted = true;
            if (getActivity() != null) {
                getActivity().onBackPressed();
            }
            return true;
        }

        if (id == R.id.action_changecolor) {
            showColorPaletteDialog();
            return true;
        }

        if (id == R.id.action_pin) {
            isPinned = !isPinned;
            item.setIcon(isPinned ? R.drawable.ic_pin_filled : R.drawable.ic_pin_outlined);
            pinStateChanged = true;
            return true;
        }

        if (id == R.id.action_fav) {
            isFavorite = !isFavorite;
            item.setIcon(isFavorite ? R.drawable.ic_favorite_filled : R.drawable.ic_favorite_outlined);
            favoriteStateChanged = true;
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    public void showColorPaletteDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        View dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.color_picker_dialog, null);
        builder.setView(dialogView);

        GridLayout colorGrid = dialogView.findViewById(R.id.colorGrid);

        final int[] colors = {
                R.drawable.ic_clear_color,
                0xFFB71C1C, 0xFF880E4F, 0xFF4A148C, 0xFF311B92, 0xFF1A237E,
                0xFF0D47A1, 0xFF01579B, 0xFF006064, 0xFF004D40, 0xFF1B5E20,
                0xFF33691E, 0xFF827717, 0xFFF57F17, 0xFFFF6F00, 0xFFE65100
        };

        AlertDialog dialog = builder.create();

        // İlk renk öğesi (renk kaldırma)
        View firstColorItem = LayoutInflater.from(getActivity()).inflate(R.layout.color_item, null);
        ImageView firstColorIcon = firstColorItem.findViewById(R.id.colorIcon);
        firstColorIcon.setImageResource(colors[0]);
        firstColorItem.setOnClickListener(v -> {
            //updateFlashcardColor(0, false);
            dialog.dismiss();
        });
        colorGrid.addView(firstColorItem, 0);

        // Diğer renkler
        for (int i = 1; i < colors.length; i++) {
            final int color = colors[i];
            View itemView = LayoutInflater.from(getActivity()).inflate(R.layout.color_item, null);
            ImageView colorIcon = itemView.findViewById(R.id.colorIcon);
            colorIcon.setBackgroundColor(color);

            itemView.setOnClickListener(v -> {
                updateFlashcardColor(color, true);
                dialog.dismiss();
            });

            colorGrid.addView(itemView);
        }

        dialog.show();
    }

    private void updateFlashcardColor(int color, boolean hasColor) {
        String hexColor = "";
        int themecolor=0;
        if (hasColor) {
            hexColor = String.format("#%06X", (0xFFFFFF & color));
            getView().setBackgroundColor(Color.parseColor(hexColor));
        } else {
            hexColor = "";

            themecolor = AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES
                    ? ContextCompat.getColor(requireContext(), R.color.backgroundColor)
                    : ContextCompat.getColor(requireContext(), R.color.backgroundColor);

            getView().setBackgroundColor(themecolor);
        }

        backgroundColor = hasColor ? color : themecolor;
        colorChanged = true;
    }

    @Override
    public void onDetach() {
        super.onDetach();
        // Restore activity toolbar
        MaterialToolbar activityToolbar = getActivity().findViewById(R.id.materialToolbar);
        if (activityToolbar != null) {
            ((AppCompatActivity) getActivity()).setSupportActionBar(activityToolbar);
        }
        invalidateOptionsMenu(); // Request activity to reset its menu
    }
    private void invalidateOptionsMenu() {
        if (getActivity() != null) {
            getActivity().invalidateOptionsMenu();
        }
    }

//    @Override
//    public void onDestroyView() {
//        super.onDestroyView();
//
//        if (noteDeleted && getActivity() instanceof FavoritesActivity) {
//            ((FavoritesActivity) getActivity()).deleteFlashcard(originalTitle);
//            return;
//        }
//
//        String updatedTitle = titleTextView.getText().toString();
//        String updatedCategory = categoryTextView.getText().toString();
//        String updatedContent = contentEditText.getText().toString();
//        long updatedTimestamp = System.currentTimeMillis();
//
//        boolean contentChanged = !originalTitle.equals(updatedTitle) ||
//                !originalCategory.equals(updatedCategory) ||
//                !originalContent.equals(updatedContent);
//
//        if (contentChanged || pinStateChanged || favoriteStateChanged || colorChanged) {
//            if (getActivity() instanceof FavoritesActivity) {
//                FavoritesActivity activity = (FavoritesActivity) getActivity();
//
//                if (contentChanged) {
//                    activity.updateFlashcard(originalTitle, updatedTitle, updatedCategory, updatedContent, updatedTimestamp);
//                }
//
//                if (pinStateChanged) {
//                    activity.updateFlashcardState(originalTitle, "pinned", isPinned);
//                }
//
//                if (favoriteStateChanged) {
//                    activity.updateFlashcardState(originalTitle, "favorite", isFavorite);
//                }
//
//                if (colorChanged) {
//                    String colorHex = backgroundColor == Color.TRANSPARENT ? "" : String.format("#%06X", (0xFFFFFF & backgroundColor));
//                    activity.updateFlashcardColor(originalTitle, colorHex);
//                }
//            }
//            if (getActivity() instanceof FullNotesActivity) {
//                FullNotesActivity activity = (FullNotesActivity) getActivity();
//
//                if (contentChanged) {
//                    activity.updateFlashcard(originalTitle, updatedTitle, updatedCategory, updatedContent, updatedTimestamp);
//                }
//
//                if (pinStateChanged) {
//                    activity.updateFlashcardState(originalTitle, "pinned", isPinned);
//                }
//
//                if (favoriteStateChanged) {
//                    activity.updateFlashcardState(originalTitle, "favorite", isFavorite);
//                }
//
//                if (colorChanged) {
//                    String colorHex = backgroundColor == Color.TRANSPARENT ? "" : String.format("#%06X", (0xFFFFFF & backgroundColor));
//                    activity.updateFlashcardColor(originalTitle, colorHex);
//                }
//            }
//        }
//    }
}

//        buttonAddFlashcard.setOnClickListener(new View.OnClickListener() {
//        @Override
//        public void onClick(View v) {
//            String category = editTextCategory.getText().toString();
//            String title = editTextTitle.getText().toString();
//            String content = editTextContent.getText().toString();
//
//            if (!category.isEmpty() && !title.isEmpty() && !content.isEmpty()) {
//                String id = FirebaseManager.getInstance().getUniqueKey(); // Benzersiz bir anahtar oluşturur
//                boolean favorite = false; // Varsayılan olarak false (isteğe bağlı)
//                boolean pinned = false; // Varsayılan olarak false (isteğe bağlı)
//                String backgroundColor = "#FFFFFF"; // Varsayılan renk (isteğe bağlı)
//                long timestamp = System.currentTimeMillis(); // Şu anki zaman
//
//                Flashcard flashcard = new Flashcard(id, category, title, content, favorite, pinned, backgroundColor, timestamp);
//                FirebaseManager.getInstance().addFlashcard(flashcard);
//
//                Toast.makeText(getActivity(), "Flashcard added", Toast.LENGTH_SHORT).show();
//                getActivity().getSupportFragmentManager().popBackStack();
//            } else {
//                Toast.makeText(getActivity(), "Please fill in all fields", Toast.LENGTH_SHORT).show();
//            }
//        }
//    });<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/backgroundColor"
    android:focusable="true"
    android:clickable="true">

    <!-- Toolbar at the top -->
    <com.google.android.material.appbar.MaterialToolbar
        android:id="@+id/materialToolbarFrag"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:theme="?attr/actionBarTheme"
        app:navigationIcon="@drawable/ic_arrow_back" />

    <!-- Content Area -->
    <!-- Scroll içeriği için NestedScrollView -->
    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <!-- İçerik alanı -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <!-- Kategori, başlık ve içerik gibi öğeler -->
            <EditText
                android:id="@+id/editTextCategory"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Category"
                android:singleLine="true" />

            <EditText
                android:id="@+id/editTextTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Title"
                android:singleLine="true" />

            <EditText
                android:id="@+id/editTextContent"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Content"
                android:inputType="textMultiLine"
                android:maxLines="10"
                android:singleLine="false" />

            <!-- Diğer içerikler buraya gelebilir -->

        </LinearLayout>
    </androidx.core.widget.NestedScrollView>

    <!-- BottomAppBar kaydırıldığında gizlenecek -->
    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:backgroundTint="?attr/colorPrimary"
        app:hideOnScroll="true"
        tools:ignore="BottomAppBar">

    <!-- CoordinatorLayout kullanarak ortadaki alanı dolduruyoruz -->
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center">

        <!-- Ortadaki TimeStamp TextView -->
        <TextView
            android:id="@+id/textViewTimestamp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="12:45 PM"
            android:textColor="@android:color/white"
            android:textSize="18sp" />

    </RelativeLayout>
    </com.google.android.material.bottomappbar.BottomAppBar>

</LinearLayout>Ana aktiviteden Note Ekleme fragmentini açtığımda iki toolbar aynı anda görüntüleniyor bu sorunuçöz -> package com.example.newflashcard;