Skip to content

Instantly share code, notes, and snippets.

Avatar
📱
Working

Yang Hui kyze8439690

📱
Working
View GitHub Profile
@cyrilmottier
cyrilmottier / gist:3788097
Created Sep 26, 2012
ViewPager in a ListView
View gist:3788097
private OnPageChangeListener mOnPageChangeListener = new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// Do whatever you wan't to do. It's up to you ... not me :)
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// Do whatever you wan't to do. It's up to you ... not me :)
}
@rupertbates
rupertbates / WebviewArticlePresenter.java
Last active Dec 25, 2016
Work out the maximum scroll extent of an Android WebView
View WebviewArticlePresenter.java
int maxScrollExtent = (int) ((mOverlayTop.getContentHeight() * mOverlayTop.getScale()) - mOverlayTop.getHeight());
@imhoff
imhoff / EllipsizingTextView.java
Last active Dec 10, 2018
Androd Ellipsizing Multiline TextView. Taken from http://stackoverflow.com/a/6763689 and extended to supported the ellipsize modes START, END, MIDDLE
View EllipsizingTextView.java
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.text.Layout;
import android.text.Layout.Alignment;
import android.text.StaticLayout;
import android.text.TextUtils.TruncateAt;
View Makeup
package trikke.gists;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
@wuyisheng
wuyisheng / FileDownloadUtil.java
Last active Mar 4, 2019
A HttpURLConnection download example for android
View FileDownloadUtil.java
package org.yeshen.download;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.annotation.WorkerThread;
import android.util.Log;
View DividerItemDecoration.java
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@Antarix
Antarix / UrlImageParser.java
Created Nov 29, 2012
UrlImage Parser for android TextView to load Html Image tag
View UrlImageParser.java
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import android.content.Context;
import android.graphics.Canvas;
@lopezjurip
lopezjurip / README.md
Last active Feb 11, 2020
Write to NTFS on OSX Yosemite and El Capitan
View README.md

OUTDATED, see comments below

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew formulae:

brew update
@christopherperry
christopherperry / CheckableLinearLayout
Created Sep 18, 2012
A LinearLayout that implements the Checkable interface, allowing a LinearLayout to be put into a checked state.
View CheckableLinearLayout
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.LinearLayout;
@n1lesh
n1lesh / LinearGradientDrawable.java
Last active Aug 28, 2020
Android Gradient Toolbar and Statusbar
View LinearGradientDrawable.java
RelativeLayout layout = (RelativeLayout) findViewById(R.id.rel);
GradientDrawable drawable = new GradientDrawable();
drawable.setColors(new int[] {
Color.parseColor("#FFF6B7"),
Color.parseColor("#F6416C")
});
drawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
drawable.setOrientation(GradientDrawable.Orientation.LEFT_RIGHT);