I hereby claim:
- I am alexfu on github.
- I am alexfu (https://keybase.io/alexfu) on keybase.
- I have a public key whose fingerprint is 2AB9 0B76 0A73 7277 00C2 42FB 92A7 CCF0 9D47 5005
To claim this, I am signing this object:
private void fetchImageFromNetwork() { | |
InputStream input = null; | |
OutputStream output = null; | |
HttpURLConnection urlConnection = null; | |
byte[] buffer = new byte[100*1024]; | |
try { | |
URL url = new URL(imageUrl); | |
urlConnection = (HttpURLConnection) url.openConnection(); | |
input = urlConnection.getInputStream(); | |
output = new FileOutputStream(path); |
/* | |
* Copyright (C) 2006 The Android Open Source Project | |
* | |
* 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 |
<?xml version="1.0" encoding="utf-8"?> | |
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
android:color="@color/mycolor"> | |
<item android:id="@+id/mask"> | |
<color android:color="@android:color/white" /> | |
</item> | |
</ripple> |
import Foundation | |
import UIKit | |
class UIErrorTextField : UITextField { | |
private let bgView = UIView() | |
private var textFieldHeight = CGFloat(40) | |
private var errorTextHeight = CGFloat(12) | |
private let errorTextPadding = CGFloat(2) | |
var errorFont = UIFont.systemFontOfSize(12) { |
I hereby claim:
To claim this, I am signing this object:
public class MyActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
if(windowActionBarOverlay()) { | |
// Do something | |
} | |
} | |
/* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2015 Alex Fu | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
import android.content.Context; | |
import android.content.ContextWrapper; | |
import android.content.res.AssetManager; | |
import android.content.res.Configuration; | |
import android.content.res.Resources; | |
import android.graphics.drawable.Drawable; | |
import android.util.DisplayMetrics; | |
import android.util.Log; | |
/** |
/** | |
* This file would be located under /path/to/project/app/build.gradle | |
*/ | |
apply plugin: 'com.android.application' | |
android { | |
// Usual stuff | |
} |
/** | |
* A {@link FrameLayout} that can show different states one at a time. | |
*/ | |
public class StateFrameLayout extends ViewAnimator { | |
public static final String STATE_LOADING = "loading"; | |
public static final String STATE_EMPTY = "empty"; | |
public static final String STATE_ERROR = "error"; | |
private static final String STATE_DEFAULT = "default"; | |
private SimpleArrayMap<String, View> stateViewMap; |