feat : add genre card and begin fragment

main
DJYohann 2 years ago
parent 7131f13c79
commit c9ca71b7a0

@ -13,7 +13,7 @@
android:theme="@style/Theme.AlloMovies"
tools:targetApi="31">
<activity
android:name=".ui.activity.GenreListActivity"
android:name=".ui.activity.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

@ -1,4 +1,4 @@
package fr.yobreuil.allomovies.data
package fr.yobreuil.allomovies.data.entities
import androidx.room.Entity;
import androidx.room.PrimaryKey

@ -1,4 +1,4 @@
package fr.yobreuil.allomovies.data
package fr.yobreuil.allomovies.data.entities
import androidx.room.Entity;
import androidx.room.PrimaryKey

@ -0,0 +1,12 @@
package fr.yobreuil.allomovies.ui.activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import fr.yobreuil.allomovies.R
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}

@ -0,0 +1,32 @@
package fr.yobreuil.allomovies.ui.fragment
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import fr.yobreuil.allomovies.R
/**
* A simple [Fragment] subclass.
* Use the [GenreListFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class GenreListFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_genre_list, container, false)
}
companion object {
}
}

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activity.MainActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

@ -6,14 +6,23 @@
android:layout_height="match_parent"
card_view:cardUseCompatPadding="true">
<ImageView
<LinearLayout
android:id="@+id/card_genre_component"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/card_genre_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Genre name"/>
<ImageView
android:id="@+id/card_genre_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher_foreground"/>
<TextView
android:id="@+id/card_genre_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Genre's name"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.fragment.GenreListFragment">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:listitem="@layout/card_genre">
</androidx.recyclerview.widget.RecyclerView>
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save