This file contains hidden or 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
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics()); |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# A script to create a review on crucible based on the current git branch and | |
# youtrack ticket. | |
# | |
# To configure settings, create a file named .code-review in your home directory | |
# The format should be: | |
# ------------------------------------------------------------------------------ | |
# crucible: | |
# url: <crucible url> | |
# username: <username> |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'net/http' | |
require 'json' | |
OS = case RbConfig::CONFIG['host_os'] | |
when /linux/ | |
:linux | |
when /darwin/ |
This file contains hidden or 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
/** | |
* Correctly sets the left padding between the drawable and text in a CheckBox. This is | |
* necessary because the behavior of setPadding() changed in 4.2 | |
* | |
* @param checkBox the checkbox to pad | |
* @param buttonWidth the width in pixels of the button drawable used in the CheckBox | |
* @param paddingLeft the padding in pixels between the drawable and the text | |
*/ | |
@SuppressLint("NewApi") | |
public static void setCheckboxPaddingLeft(CheckBox checkBox, int buttonWidth, int paddingLeft) { |
This file contains hidden or 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
OkHttpClient client = new OkHttpClient(); | |
Proxy proxy = new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved("192.168.1.105", 8081); | |
client.setProxy(proxy); |
This file contains hidden or 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 interface OnBackPressed { | |
boolean onBackPressed(); | |
} | |
// ---------------------------------------------------------- | |
public class DelegateBackPressActivity extends Acitivity { | |
@Override | |
public void onBackPressed() { | |
for (Fragment f : getFragmentManager().getFragments()) { |
This file contains hidden or 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 ResizeTransformation extends Transformation { | |
@Override public | |
Bitmap transform(Bitmap source) { | |
int targetWidth = getScreenWidth(); // Implementation left as an exercise for the reader. | |
if (targetWidth < source.getWidth()) { | |
double aspectRatio = (double) source.getHeight() / (double) source.getWidth(); | |
int targetHeight = (int) (targetWidth * aspectRatio); | |
Bitmap result = Bitmap.createScaledBitmap(source, targetWidth, targetHeight, false); | |
if (result != source) { | |
// Same bitmap is returned if sizes are the same |
This file contains hidden or 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 me.tatarka.nofragment.view; | |
import android.support.v4.util.SparseArrayCompat; | |
import android.support.v4.view.PagerAdapter; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains hidden or 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 Wtf { | |
public static abstract class Foo<V> { // Removing this type parameter allows it to compile | |
public <T> T bad(Class<T> fooClass) { | |
return null; | |
} | |
} | |
public static class Bar { | |
} |
This file contains hidden or 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
import android.content.res.Resources; | |
import android.os.Parcel; | |
import android.os.Parcelable; | |
import android.support.annotation.Nullable; | |
import android.support.annotation.PluralsRes; | |
import android.support.annotation.StringRes; | |
import android.widget.TextView; | |
import java.util.Arrays; |
OlderNewer