Skip to content

Instantly share code, notes, and snippets.

View yishai-glide's full-sized avatar

thepoosh yishai-glide

  • Glide
  • Jerusalem IL
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/my_nine_patch"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
@yishai-glide
yishai-glide / MyJsonArrayRequest.java
Created April 14, 2015 18:16
a class that inherits JsonArrayRequest but allows storing POST data
package com.android.volley.toolbox;
import org.json.JSONArray;
import android.text.TextUtils;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
public class MyJsonArrayRequest extends JsonArrayRequest {
public class MyAsyncTask extends AsyncTask {
WeakReference<MyActivityInterface> mCaller;
public MyAsyncTask(MyActivityInterface caller) {
mCaller = caller;
}
// here comes code
public void onPostExecute(Object result) {
foo(View source){
if(source == null) {
return;
}
View container = source.getParent();
getColorAnimation(container, true);
}
static ValueAnimator getColorAnimation(final View view, boolean shouldReverse)
{
@yishai-glide
yishai-glide / activity.java
Created May 28, 2015 10:30
toolbar searchview
private void configureSearchView(Menu menu) {
MenuItem searchItem = menu.findItem(R.id.action_search);
searchViewAction = (SearchView) MenuItemCompat.getActionView(searchItem);
searchViewAction.setOnQueryTextListener(this);
searchViewAction.setOnCloseListener(this);
searchViewAction.setSubmitButtonEnabled(false);
searchViewAction.setIconifiedByDefault(true);
EditText editText = (EditText) searchViewAction.findViewById(android.support.v7.appcompat.R.id.search_src_text);
editText.addTextChangedListener(new TextWatcher() {
<item
android:id="@+id/action_search"
android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
android:title="@string/fragment_search_text"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="always|collapseActionView"/>
mScheduler = new ScheduledThreadPoolExecutor(1, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread th = Executors.defaultThreadFactory().newThread(r);
th.setPriority(Process.THREAD_PRIORITY_BACKGROUND);
th.setName("presence_thread");
return th;
}
});
<receiver
android:name="com.thepoosh.pooshmeister.InstallReferrerReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
public void parseString(String str) {
if(TextUtils.isEmpty(str)) {
// nothing here
return;
}
String[] words = str.split(" ");
StringBuilder sentence = new StringBuilder(str.length());
int l_integer;
double l_double;
private static UncaughtExceptionHandler exceptionHandler = new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
ex.printStackTrace();
Runnable onPostExecute = new Runnable() {
@Override