Skip to content

Instantly share code, notes, and snippets.

View tom4i's full-sized avatar
🐍
2025

Tom Zhu tom4i

🐍
2025
View GitHub Profile
package com.blargh.android.utils;
import java.util.logging.Logger;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.Gravity;
@kamikat
kamikat / layout.xml
Last active September 1, 2021 17:40
NestedScrollView + SwipeRefreshLayout + RecyclerView
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
@scottroemeschke
scottroemeschke / IntentBuilder.java
Last active July 20, 2016 10:22
IntentBuilder- Extras (Decompile-Deepdive: Medium)
public IntentBuilder withExtra(String paramString, String[] paramArrayOfString) {
intent.putExtra(paramString, paramArrayOfString);
return this;
}
public IntentBuilder withJsonExtra(String paramString, JsonSerializable paramJsonSerializable) {
try {
intent.putExtra(paramString, mapper.writeValueAsString(paramJsonSerializable));
return this;
} catch (JsonProcessingException paramJsonSerializable) {
@li2
li2 / AndroidSpannableStringExample.java
Last active May 18, 2018 14:21
SpannableString class to implement text with foreground color, background color, underline, strikethrough, bold & italic style, relative font size, superscript, subscript, URLs, clickable, text composed with image, and so on. #tags: android-view
/**
* Created by weiyi on 3/28/16.
* http://li2.me/2016/03/android-spannablestring-example.html
* https://github.com/li2/Learning_Android_Open_Source/tree/master/AndroidTextSample
*/
public class SpannableStringApiActivity extends AppCompatActivity {
@Bind(R.id.textView) TextView mTextView;
@Bind(R.id.spannableForegroundColor) TextView mForegroundColorTextView;
@Bind(R.id.spannableBackgroundColor) TextView mBackgroundColorTextView;
@pepebe
pepebe / gist:2955410
Created June 19, 2012 17:25
Ubuntu: Convert psd files with imagemagick
Source: http://superuser.com/questions/360434/any-way-to-save-all-psd-layers-separately
Imagemagick will by default convert a psd to multiple images:
convert file.psd file.png
will result in file-0.png, file-1.png etc for each layer. If you wanted a single image, use the flatten switch:
convert file.psd -flatten file.png
Imagemagick is available on osx, windows and linux. And iOS somehow.