Skip to content

Instantly share code, notes, and snippets.

Avatar

Umar Hussain umarhussain15

View GitHub Profile
@umarhussain15
umarhussain15 / build.gradle
Created Oct 23, 2018
gradle script using global properties in signing config
View build.gradle
// ...
android {
signingConfigs {
release {
if (project.hasProperty('RELEASE_STORE_FILE')) {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
@umarhussain15
umarhussain15 / gradle.properties
Created Oct 23, 2018
global gradle.properties sample
View gradle.properties
# Global gradle properties
# CREDENTIALS
RELEASE_STORE_FILE=release.jks
RELEASE_KEY_ALIAS=umarproductionkey
RELEASE_STORE_PASSWORD=someComplexPassword
RELEASE_KEY_PASSWORD=someComplexPassword
# Project 2 jks
RELEASE_STORE_FILE=app2release.jks
@umarhussain15
umarhussain15 / build.gradle
Created Oct 23, 2018
gradle configuration using a local properties files to load credentials
View build.gradle
//...
def keystorePropertiesFile = file("../keystore.properties");
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
signingConfigs {
release {
storeFile = file(keystoreProperties['storeFile'])
storePassword = keystoreProperties['storePassword']
keyAlias = keystoreProperties['keyAlias']
@umarhussain15
umarhussain15 / build.gradle
Created Oct 23, 2018
app gradle file using environment variables.
View build.gradle
android {
signingConfigs {
release {
storeFile = file(System.getenv('KEYSTORE_FILE_NAME'))
storePassword = System.getenv('KEYSTORE_PASSWORD')
keyAlias = System.getenv('KEYSTORE_ALIAS_NAME')
keyPassword = System.getenv('KEYSTORE_KEY_PASSWORD')
}
debug {
storeFile = file(System.getenv('KEYSTORE_FILE_NAME'))
@umarhussain15
umarhussain15 / build.gradle
Created Oct 23, 2018
Sample app gradle file signing config
View build.gradle
android {
signingConfigs {
release {
storeFile = file('release.keystore')
storePassword = 'actualReleasePassword'
keyAlias = 'keyAliasName'
keyPassword = 'actualReleaseKeyPassword'
}
debug {
storeFile = file('debug.keystore')
View build.gradle
android {
signingConfigs {
release {
storeFile = file('release.keystore')
storePassword = 'actualReleasePassword'
keyAlias = 'keyAliasName'
keyPassword = 'actualReleaseKeyPassword'
}
debug {
storeFile = file('debug.keystore')
@umarhussain15
umarhussain15 / Connectivity.java
Created Dec 20, 2017 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
View Connectivity.java
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
@umarhussain15
umarhussain15 / SquareRelativeLayoutByHeight.java
Created Aug 30, 2017
Making square relative layouts based on height or width of layout.
View SquareRelativeLayoutByHeight.java
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
/**
* A RelativeLayout that will always be square -- same width and height,
* where the width is based off the height.
*/
@umarhussain15
umarhussain15 / SwipeDisabledViewPager.java
Created Aug 30, 2017
Android: Disabling Swipes on View Pager
View SwipeDisabledViewPager.java
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
public class SwipeDisabledViewPager extends ViewPager {
public SwipeDisabledViewPager(Context context) {
super(context);
}