Skip to content

Instantly share code, notes, and snippets.

View umarhussain15's full-sized avatar

Umar Hussain umarhussain15

View GitHub Profile
@umarhussain15
umarhussain15 / SwipeDisabledViewPager.java
Created August 30, 2017 11:04
Android: Disabling Swipes on View Pager
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);
}
@umarhussain15
umarhussain15 / SquareRelativeLayoutByHeight.java
Created August 30, 2017 11:11
Making square relative layouts based on height or width of layout.
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 / Connectivity.java
Created December 20, 2017 08:42 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
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
android {
signingConfigs {
release {
storeFile = file('release.keystore')
storePassword = 'actualReleasePassword'
keyAlias = 'keyAliasName'
keyPassword = 'actualReleaseKeyPassword'
}
debug {
storeFile = file('debug.keystore')
@umarhussain15
umarhussain15 / build.gradle
Created October 23, 2018 17:23
Sample app gradle file signing config
android {
signingConfigs {
release {
storeFile = file('release.keystore')
storePassword = 'actualReleasePassword'
keyAlias = 'keyAliasName'
keyPassword = 'actualReleaseKeyPassword'
}
debug {
storeFile = file('debug.keystore')
@umarhussain15
umarhussain15 / build.gradle
Created October 23, 2018 17:30
app gradle file using environment variables.
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 October 23, 2018 17:33
gradle configuration using a local properties files to load credentials
//...
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 / gradle.properties
Created October 23, 2018 17:41
global gradle.properties sample
# 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 October 23, 2018 17:45
gradle script using global properties in signing config
// ...
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 / Adhan.yaml
Created June 21, 2024 10:53
🔊 Adhan Announcement V2 - Play the adhan on selected speakers while also pausing media players of your choice. You can also add islamic month sensor to play suhoor and iftar dua. You can also optionally disable specific adhans.
blueprint:
name: 🔊 Adhan Announcement V2
description: Play the adhan on selected speakers while also pausing media players of your choice. You can also add islamic month sensor to play suhoor and iftar dua. You can also optionally disable specific adhans.
domain: automation
input:
play_media_player:
name: Media players to play
description: The Media players to play the Adhan on
selector:
target: