Skip to content

Commit

Permalink
Added tip info button in WatchListFragment.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
debz-g committed Dec 9, 2022
1 parent cd6e9c8 commit e53bf11
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/src/main/java/dev/refox/anitrack/ui/WatchListFragment.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dev.refox.anitrack.ui

import android.app.Dialog
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
Expand All @@ -8,6 +11,7 @@ import android.view.ViewGroup
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import dev.refox.anitrack.R
import dev.refox.anitrack.adapters.AnimeWatchListAdapter
import dev.refox.anitrack.database.*
import dev.refox.anitrack.databinding.FragmentWatchListBinding
Expand Down Expand Up @@ -53,6 +57,17 @@ class WatchListFragment : Fragment() {
animeWatchListAdapter.notifyDataSetChanged()
})

binding.btnInfo.setOnClickListener {
val dialogBinding = layoutInflater.inflate(R.layout.info_dialog, null)
val dialog = Dialog(requireContext())

dialog.setContentView(dialogBinding)
dialog.setCancelable(true)
dialog.setCanceledOnTouchOutside(true)
dialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
dialog.show()
}



return binding.root
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_baseline_info_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#59C683"
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="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/layout/fragment_watch_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@

</com.google.android.material.card.MaterialCardView>

<ImageView
android:id="@+id/btnInfo"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_baseline_info_24"
android:layout_marginLeft="15dp"
app:layout_constraintBottom_toBottomOf="@+id/materialCardText"
app:layout_constraintStart_toEndOf="@+id/materialCardText"
app:layout_constraintTop_toTopOf="@id/materialCardText" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvWatchList"
android:layout_width="match_parent"
Expand Down
40 changes: 40 additions & 0 deletions app/src/main/res/layout/info_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto">

<com.google.android.material.card.MaterialCardView
android:id="@+id/btnAdd"
android:layout_width="300dp"
android:layout_height="100dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:cardCornerRadius="10dp"
android:backgroundTint="@color/card_color2"
app:layout_constraintEnd_toEndOf="parent"
android:orientation="horizontal"
>

<TextView
android:id="@+id/tvAddtoLib"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:fontFamily="@font/sofiaprosoftbold"
android:text="@string/tip"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="16sp"
android:layout_gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />




</com.google.android.material.card.MaterialCardView>

</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<string name="second_fragment_label">Second Fragment</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="tip">Tip: \n\n Press and hold and click Add to Library in the Search Section to add an anime to Watchlist</string>

<string name="hello_first_fragment">Hello first fragment</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
Expand Down

0 comments on commit e53bf11

Please sign in to comment.