Skip to content

Instantly share code, notes, and snippets.

@tony-albanese
tony-albanese / CoworkerListFragment.kt
Created May 6, 2019 18:55
The function to setup the adapter.
fun initializeCoworkerRecyclerView() {
//Setup the query.
val query = db.collection(COLLECTION_USERS).orderBy("name")
val options = FirestoreRecyclerOptions.Builder<AppUser>().setQuery(query, AppUser::class.java).build()
adapter = CoworkerListAdapter(options)
val recyclerView = activity!!.findViewById<RecyclerView>(R.id.coworker_recycler_view)
recyclerView.setHasFixedSize(true)
recyclerView.layoutManager = LinearLayoutManager(context)
@tony-albanese
tony-albanese / CoworkerListAdapter.kt
Created May 6, 2019 18:57
The implementation of the FirestoreRecyclerAdapter
package albanese.tony.com.go4lunch.Adapters
import albanese.tony.com.go4lunch.DataModels.AppUser
import albanese.tony.com.go4lunch.R
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.firebase.ui.firestore.FirestoreRecyclerAdapter
import com.firebase.ui.firestore.FirestoreRecyclerOptions
@tony-albanese
tony-albanese / Utilities.java
Created January 27, 2020 17:04
Writing to an object and reading from an object in Android.
public static void writeFile(Context context){
teamMap = generateHashMap();
try{
FileOutputStream outputStream = context.openFileOutput(FILENAME, Context.MODE_PRIVATE);
ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
objectOutputStream.writeObject(teamMap);
System.out.println(teamMap.size());
} catch (FileNotFoundException e) {
e.printStackTrace();
Toast.makeText(context, "File not found.", Toast.LENGTH_SHORT).show();
@tony-albanese
tony-albanese / nav_bar.html
Last active January 12, 2023 12:28
Navbar for LoveRunning
<nav id="menu">
<ul>
<li>
<a href="index.html">Home Page</a>
</li>
<li>
<a href="gallery.html" class="active">Gallery</a>
</li>
<li>
<a href="#">Signup</a>
@tony-albanese
tony-albanese / q_objects.py
Created January 12, 2023 08:27
Using Q Objects
def perform_search(request):
list = request.POST.getlist('genres')
genre_query = Q()
author_query = Q()
title_query = Q()
description_query = Q()
liked_books = []
for gen in list:
@tony-albanese
tony-albanese / nav.html
Created January 12, 2023 12:39
My Navbar
<section id="hero-outer">
<div id="hero-image"></div>
<div id="cover-text">
<h2>Love Running</h2>
<h3>Dublin Docklands & Phoenix Park </h3>
</div>
</section>