Skip to content

Instantly share code, notes, and snippets.

View farbodsz's full-sized avatar

Farbod Salamat-Zadeh farbodsz

View GitHub Profile
@farbodsz
farbodsz / SimpleListAdapter.java
Last active December 17, 2015 22:30
A RecyclerView Adapter for a simple list in Android
package com.yourcompany.yourapp.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.yourcompany.yourapp.R;
@farbodsz
farbodsz / ViewGroupAdapter.java
Created August 25, 2015 16:49
An easy way to add list items to a ViewGroup.
/*
* Copyright 2015 Farbod Salamat-Zadeh
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@farbodsz
farbodsz / color_file_converter.py
Last active August 3, 2017 16:12
Python script to convert color resource values in an Android project's `colors.xml` so they instead reference values from my MaterialDesignUtils library - see https://github.com/FarbodSalamat-Zadeh/MaterialDesignUtils
# coding utf-8
# Copyright 2016 Farbod Salamat-Zadeh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@farbodsz
farbodsz / LabelledSpinner.md
Last active August 3, 2017 16:15
A Spinner component with a floating label for Android, similar to EditText components wrapped in a TextInputLayout.

Moved to an Android library...

This Gist has been discontinued and will be updated on a GitHub project here. The files I have removed from this Gist can be found there. Please feel free to open issues, pull requests, etc, so that I can change and improve the library how you like.

If you are already using the Gist, delete the layout XML, values XML, and Java files (the ones I have removed from this Gist), and instead add the following in your app module's build.gradle dependencies:

compile 'com.satsuware.lib:usefulviews:+'

Make sure to change your imports as well in the files that you are using the LabelledSpinner component.

@farbodsz
farbodsz / ExampleAdapter.java
Last active June 5, 2020 11:40
A basic example to demonstrate how RecyclerViews can be used
/*
* Copyright 2016 Farbod Salamat-Zadeh
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software