by alexander white ©
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
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
Example:
OlderNewer