Skip to content

Commit

Permalink
Added search fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mys7erio committed Apr 15, 2024
1 parent 3ea7ff0 commit 33dbb87
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 5 deletions.
7 changes: 6 additions & 1 deletion app/src/main/java/com/example/moviemate/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import android.view.MenuItem
import androidx.fragment.app.Fragment
import com.example.moviemate.fragments.HomeFragment
import com.example.moviemate.fragments.ProfileFragment
import com.example.moviemate.fragments.SearchFragment
import com.example.moviemate.fragments.WatchedFragment
import com.example.moviemate.fragments.WatchlistFragment
import com.google.firebase.auth.FirebaseAuth
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.firebase.firestore.FirebaseFirestore


class MainActivity : AppCompatActivity() {
Expand Down Expand Up @@ -71,6 +71,11 @@ class MainActivity : AppCompatActivity() {
return true
}

R.id.navitem_search -> {
replaceFragment(SearchFragment())
return true
}

else -> {
Toast.makeText(this, "Invalid Option Selected", Toast.LENGTH_SHORT).show()
return false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.moviemate.fragments

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.moviemate.R

class SearchFragment : 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
val view = inflater.inflate(R.layout.fragment_search, container, false)
return view
}

}
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_search_outlined.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="800dp" android:viewportHeight="24" android:viewportWidth="24" android:width="800dp">

<path android:fillColor="#00000000" android:pathData="M15.795,15.811L21,21M18,10.5C18,14.642 14.642,18 10.5,18C6.358,18 3,14.642 3,10.5C3,6.358 6.358,3 10.5,3C14.642,3 18,6.358 18,10.5Z" android:strokeColor="#ffffff" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="3"/>

</vector>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.SearchFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />

</FrameLayout>
14 changes: 10 additions & 4 deletions app/src/main/res/menu/bottom_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/navitem_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_home_filled"
android:id="@+id/navitem_home"
android:title="@string/menuitem_home" />
<item
android:id="@+id/navitem_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_bookmark_filled"
android:icon="@drawable/ic_search_outlined"
android:title="@string/search" />
<item
android:id="@+id/navitem_watchlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_bookmark_filled"
android:title="@string/menuitem_watchlist" />
<item
android:id="@+id/navitem_watched"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_watched_filled"
android:id="@+id/navitem_watched"
android:title="@string/menuitem_watched" />
<item
android:id="@+id/navitem_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_user_circle_filled"
android:id="@+id/navitem_profile"
android:title="@string/menuitem_profile" />
</menu>
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 @@ -50,5 +50,6 @@
<string name="done_watching">Done Watching</string>
<string name="save_to_watch_later">Save to Watch Later</string>
<string name="your_watchlist">Your Watchlist</string>
<string name="search">Search</string>

</resources>

0 comments on commit 33dbb87

Please sign in to comment.