Skip to content

Instantly share code, notes, and snippets.

View sreereddymenon's full-sized avatar

Sree Reddy Menon sreereddymenon

  • Chicago
View GitHub Profile
@sreereddymenon
sreereddymenon / 0_reuse_code.js
Created April 21, 2014 10:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// This is OLD way of usnig Handler which shows an warning.
private Handler oldHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// Handle a message as you want.
}
}
/*
* Copyright 2014 Chris Banes
*
* 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
// in the performFiltering method which runs on a background thread:
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults filterResults = new FilterResults();
ArrayList<String> queryResults;
if (constraint != null || constraint.length() == 0) {
queryResults = autocomplete(constraint);
} else {
queryResults = new ArrayList<String>(); // empty list/no suggestions showing ig there's no constraint
}
<activity android:name=".SearchableActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<!-- note: this is needed to show a keyboard with proposals -->
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
package com.psrivastava.deviceframegenerator.widget;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
@sreereddymenon
sreereddymenon / BBChatViewHost.java
Last active September 3, 2015 18:08 — forked from creativepsyco/BBChatViewHost.java
How to scroll Android Listview to the bottom always
public void scrollBottom() {
// scroll bottom requires posting a runnable to the listView
// in the case of items loading by themselves dynamically
// there may be sync issues and scrolling won't be proper
m_bNeedScrollToBottom = false;
if (m_listView.getLastVisiblePosition()-m_listView.getFirstVisiblePosition() <= m_listView.getCount())
m_listView.setStackFromBottom(false);
else
m_listView.setStackFromBottom(true);
BBUILoop.getInstance().delayPost(new Runnable() {
@sreereddymenon
sreereddymenon / byte-sizetuts.md
Created September 26, 2015 12:28 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.
@sreereddymenon
sreereddymenon / RestClient.java
Created October 21, 2015 15:27 — forked from Axxiss/RestClient.java
Restful client
public class RestClient {
private static final String TAG = "RestClient";
private static final String USER_AGENT = "VisioStorm Android";
/** Methods supported by RestClient */
public enum RequestMethod {
GET, POST
}
@sreereddymenon
sreereddymenon / Readme.md
Created February 9, 2016 13:27 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example: