Implemented navigation component; deleting an entry now shows a snack bar that allows for undo; edited several layouts

This commit is contained in:
denizk0461
2023-05-15 15:18:47 +02:00
parent e0e7a4cbe0
commit a7356bc97d
15 changed files with 288 additions and 198 deletions
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_shortAnimTime">
<translate
android:fromYDelta="20%"
android:toYDelta="0"
android:interpolator="@android:anim/decelerate_interpolator"
/>
<alpha
android:fromAlpha="0"
android:toAlpha="1"
android:interpolator="@android:anim/decelerate_interpolator"
/>
<scale
android:fromXScale="100%"
android:fromYScale="100%"
android:toXScale="100%"
android:toYScale="100%"
android:pivotX="50%"
android:pivotY="50%"
android:interpolator="@android:anim/decelerate_interpolator"
/>
</set>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation
xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/item_animation_fall_down"
android:delay="15%"
android:animationOrder="normal"/>
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M11,18c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2 0.9,-2 2,-2 2,0.9 2,2zM9,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM9,4c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM15,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM15,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM15,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>
+26 -81
View File
@@ -1,89 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="8dp"
tools:context=".activity.MainActivity"
android:orientation="vertical"
android:backgroundTint="?attr/colorTintBackground">
android:fitsSystemWindows="true"
tools:context=".activity.MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment_content_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:navGraph="@navigation/main_nav_graph"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/nav_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/app_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="26sp"
android:textColor="?attr/colorPrimary"
android:layout_marginVertical="8dp"
android:fontFamily="@font/mono_bold_italic"
android:layout_gravity="center_horizontal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:menu="@menu/nav_items"
app:labelVisibilityMode="selected"
app:itemTextColor="?attr/colorOnSurfaceVariant"
android:layout_gravity="bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/button_backup_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cloud_upload"
android:padding="4dp"
android:layout_marginEnd="16dp"
app:layout_constraintTop_toTopOf="@id/app_title"
app:layout_constraintBottom_toBottomOf="@id/app_title"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"/>
<ImageView
android:id="@+id/button_backup_download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cloud_download"
android:padding="4dp"
android:layout_marginStart="16dp"
app:layout_constraintTop_toTopOf="@id/app_title"
app:layout_constraintBottom_toBottomOf="@id/app_title"
app:layout_constraintStart_toStartOf="parent"
android:visibility="gone"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/nav_items"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:labelVisibilityMode="selected"/>
<!-- android:background="?attr/colorPrimary"-->
<!-- app:itemIconTint="@color/bottom_nav_color"-->
<!-- app:itemTextColor="@color/bottom_nav_color"-->
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/bottom_nav"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+37 -19
View File
@@ -1,34 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/quote_constraint_layout"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
tools:context=".fragment.QuoteFragment">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<TextView
android:id="@+id/app_title_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/quote_fragment_title"
android:textSize="28sp"
android:fontFamily="@font/mono_bold_italic"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/quote_scroller"
android:layout_width="0dp"
android:layout_height="0dp"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:paddingBottom="84dp"
android:clipToPadding="false"
android:layout_marginHorizontal="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
android:scrollbarStyle="outsideOverlay"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layoutAnimation="@anim/layout_animation_fall_down"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_fab"
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_add_quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_gravity="bottom|end"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:backgroundTint="?attr/colorOnPrimary"
android:src="@drawable/add"
app:tint="?attr/colorPrimary"/>
android:text="@string/quote_fragment_fab_add"
app:icon="@drawable/add"/>
<!-- app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlayExtended"-->
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+37 -12
View File
@@ -3,39 +3,64 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp">
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="4dp">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp">
<!-- android:backgroundTint="?attr/colorSecondary"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginVertical="8dp"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/quote"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_layout_quote"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:textCursorDrawable="@null"
android:hint="@string/enter_text"/>
<!-- android:theme="@style/ThemeOverlay.AppTheme.TextInputEditText.Outlined"-->
android:hint="@string/quote_entry_text_input_hint"
app:boxStrokeColor="@color/selector_text_input"
app:hintTextColor="@color/selector_text_input">
<androidx.appcompat.widget.AppCompatImageButton
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_quote"
style="@style/ThemeOverlay.Material3.TextInputEditText.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnSurfaceVariant" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/delete_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/delete"
android:background="@null"
app:icon="@drawable/delete"
android:minWidth="0dp"
app:iconPadding="0dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="4dp"/>
<!-- android:tint="?attr/colorOnPrimary"-->
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.IconButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
app:icon="@drawable/drag_indicator"
android:minWidth="0dp"
app:iconPadding="0dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="2dp"/>
</LinearLayout>
+1 -1
View File
@@ -3,7 +3,7 @@
<item
android:id="@+id/quotes"
android:icon="@drawable/pen_outlined"
android:title="@string/edit"
android:title="@string/nav_items_entries"
android:enabled="true"/>
<item
android:id="@+id/guide"
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation 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:id="@+id/main_nav_graph"
app:startDestination="@id/quotes">
<fragment
android:id="@+id/quotes"
android:name="com.denizd.textbasic.fragment.QuoteFragment"
android:label="QuoteFragment"
tools:layout="@layout/fragment_quote"/>
<fragment
android:id="@+id/guide"
android:name="com.denizd.textbasic.fragment.GuideFragment"
tools:layout="@layout/fragment_guide"
android:label="GuideFragment"/>
<fragment
android:id="@+id/settings"
android:name="com.denizd.textbasic.fragment.SettingsFragment"
android:label="SettingsFragment"
tools:layout="@layout/fragment_settings"/>
</navigation>
+8 -1
View File
@@ -2,7 +2,8 @@
<resources>
<string name="app_name">Text Basic</string>
<string name="enter_text">Gib etwas ein…</string>
<string name="example_text">Dies ist ein Beispieltext</string>
<string name="quote_entry_text_input_hint">Eintrag</string>
<string name="example_text">Beispieltext</string>
<string name="text_size">Textgröße</string>
<string name="text_opacity">Textopazität</string>
<string name="bg_opacity">Hintergrundopazität</string>
@@ -15,7 +16,13 @@
<string name="snack_backup_download">Daten werden wiederhergestellt…</string>
<string name="snack_backup_upload">Deine Daten werden innerhalb der nächsten Stunde gesichert</string>
<string name="quote_fragment_title">Deine Einträge</string>
<string name="quote_fragment_fab_add">Eintrag hinzufügen</string>
<string name="quote_fragment_snack_text">Eintrag wurde gelöscht</string>
<string name="quote_fragment_snack_undo">Rückgängig</string>
<string name="edit">Text bearbeiten</string>
<string name="nav_items_entries">Einträge</string>
<string name="guide">Anleitung</string>
<string name="settings">Einstellungen</string>
+8 -1
View File
@@ -1,7 +1,8 @@
<resources>
<string name="app_name">Text Basic</string>
<string name="enter_text">Enter something…</string>
<string name="example_text">This is an example text</string>
<string name="quote_entry_text_input_hint">Entry</string>
<string name="example_text">Sample text</string>
<string name="text_size">text size</string>
<string name="text_opacity">text opacity</string>
<string name="bg_opacity">bg opacity</string>
@@ -14,7 +15,13 @@
<string name="snack_backup_download">Restoring your data…</string>
<string name="snack_backup_upload">Your data will be backed up within the next hour</string>
<string name="quote_fragment_title">Your Entries</string>
<string name="quote_fragment_fab_add">Add entry</string>
<string name="quote_fragment_snack_text">Entry has been deleted</string>
<string name="quote_fragment_snack_undo">Undo</string>
<string name="edit">Edit Text</string>
<string name="nav_items_entries">Entries</string>
<string name="guide">Guide</string>
<string name="settings">Settings</string>