This file contains 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.Context; | |
import android.support.annotation.NonNull; | |
import android.widget.ImageView; | |
import com.bumptech.glide.Glide; | |
import com.bumptech.glide.Priority; | |
import com.bumptech.glide.load.data.DataFetcher; | |
import com.bumptech.glide.load.model.stream.StreamModelLoader; |
This file contains 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
#! /bin/bash | |
mkdir -p ./backgrounds | |
function get_google_device_art { | |
local device=$1 | |
# Get the Google Device backgrounds | |
curl "https://developer.android.com/distribute/marketing-tools/device-art-resources/$1/port_back.png" > "./backgrounds/$1_port_back.png" | |
curl "https://developer.android.com/distribute/marketing-tools/device-art-resources/$1/port_fore.png" > "./backgrounds/$1_port_fore.png" |
This file contains 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
Dave Thomas: All programming is maintenance programming, because you are rarely writing original code. | |
If you look at the actual time you spend programming, you write a bit here and then you go back and make a change. | |
Or you go back and fix a bug. Or you rip it out altogether and replace it with something else. | |
But you are very quickly maintaining code even if it's a brand new project with a fresh source file. | |
You spend most of your time in maintenance mode. So you may as well just bite the bullet and say, | |
"I'm maintaining from day one." | |
The disciplines that apply to maintenance should apply globally. | |
https://sriramramani.wordpress.com/2015/05/06/custom-viewgroups/ customview | |
http://www.javaworld.com/article/2073649/core-java/why-extends-is-evil.html |
This file contains 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
Creating certificate from remote URL and writing to file (mycertfile.pem) | |
openssl s_client -showcerts -connect gist.github.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem | |
Generating SHA256 hash of public key from a certificate (mycertfile.pem) | |
openssl x509 -in mycertfile.pem -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 |
This file contains 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 DualProgressView extends View { | |
private int mSize; | |
private Paint mPaint; | |
private RectF mRect; | |
private float mIndeterminateSweep; | |
private float mstartAngle; | |
public DualProgressView(Context context) { | |
super(context); | |
init(); |
This file contains 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 DualProgressView extends View { | |
private int mSize; | |
private Paint mPaint; | |
private RectF mRect; | |
public DualProgressView(Context context) { | |
super(context); | |
init(); | |
} |
This file contains 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 DualProgressView extends View { | |
public DualProgressView(Context context) { | |
super(context); | |
} | |
public DualProgressView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public DualProgressView(Context context, AttributeSet attrs, int defStyleAttr) { |
This file contains 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
https://github.com/pollux-/android-classyshark |
This file contains 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
/** | |
* Force the connection to use only TLS v.1.2 avoiding the fallback to older version to avoid vulnerabilities | |
* | |
*/ | |
final ConnectionSpec.Builder connectionSpec = | |
new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS); | |
connectionSpec.tlsVersions(TlsVersion.TLS_1_2).build(); |
This file contains 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
/** | |
* Enable TLS specific version V.1.2 | |
* Issue Details : https://github.com/square/okhttp/issues/1934 | |
*/ | |
TLSSocketFactory tlsSocketFactory; | |
try { | |
tlsSocketFactory = new TLSSocketFactory(); | |
httpBuilder.sslSocketFactory(tlsSocketFactory, tlsSocketFactory.systemDefaultTrustManager()); |
NewerOlder