Skip to content

Instantly share code, notes, and snippets.

View e4basil's full-sized avatar
🎯
Focusing

Basi e4basil

🎯
Focusing
View GitHub Profile
@e4basil
e4basil / Connectivity.java
Created February 11, 2016 07:10 — 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
@e4basil
e4basil / LocalBroadcastExampleActivity.java
Created August 20, 2016 09:47 — forked from Antarix/LocalBroadcastExampleActivity.java
Simple Example of using LocalBroadcastManager in Android
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
@e4basil
e4basil / starting_library_project_AS.md
Created August 29, 2016 07:16 — forked from daniellevass/starting_library_project_AS.md
Getting Started with a library project in Android Studio

Getting Started with a library project in Android Studio

So we're working on creating Android Material Awesome, a library which will hopefully incorperate the benefits of Material Design, Twitter's Bootstrap, and FontAwesome. What we really wanted is a project other people can easily include into their projects using gradle dependencies. To do this we needed to create a standalone library project so we could make it as lightweight as possible for including as a dependency, and a sample app that would use it for testing. These are the steps we took to get started in Android Studio (version 1.1).

Create Projects

The first thing we needed to do was to create two new projects, with all the default settings (Blank Activity etc). One for our sample app, and one for our library. We added both of ours into the same GitHub repo, however you can save them wherever you like.

Fix Up Library Project

apply plugin: 'com.jfrog.bintray'
version = libraryVersion
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
apply plugin: 'com.jfrog.bintray'
version = libraryVersion
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
apply plugin: 'com.github.dcendents.android-maven'
group = publishedGroupId // Maven Group ID for the artifact
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
@e4basil
e4basil / README.md
Created November 1, 2016 07:24 — forked from lopspower/README.md
Publish AAR to jCenter and Maven Central

Publish AAR to jCenter and Maven Central

Twitter

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView

  2. In the library folder(module) I have the lib code abovementioned. And applying in the build.gradle of this folder apply plugin: 'com.android.library' I got as output an .aar in the build/outputs/aar/ directory of the module's directory

@e4basil
e4basil / introrx.md
Created November 10, 2016 19:16 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing