Skip to content

Commit

Permalink
released version 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
akhil committed Oct 24, 2016
1 parent 9a8d6a5 commit 788e18c
Show file tree
Hide file tree
Showing 45 changed files with 1,384 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Built application files
*.apk
*.ap_

*.DS_Store
# Files for the ART/Dalvik VM
*.dex

Expand All @@ -12,7 +12,9 @@
bin/
gen/
out/

.idea
.idea/**
build/**
# Gradle files
.gradle/
build/
Expand Down
1 change: 1 addition & 0 deletions android-easylocation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
58 changes: 58 additions & 0 deletions android-easylocation/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apply plugin: 'com.android.library'
ext {
bintrayRepo = 'com.akhgupta'
bintrayName = 'Android-EasyLocation'

publishedGroupId = 'com.akhgupta'
libraryName = 'Android-EasyLocation'
artifact = 'android-easylocation'

libraryDescription = 'Library for requesting GPS,Network location using google play services on Android'

siteUrl = 'https://github.com/akhgupta/Android-EasyLocation'
gitUrl = 'https://github.com/akhgupta/Android-EasyLocation.git'

libraryVersion = '0.8.0'

developerId = 'akhgupta'
developerName = 'Akhil Gupta'
developerEmail = 'akhilgupta.me@gmail.com'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
//noinspection GroovyMissingReturnStatement
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"

defaultConfig {
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "0.8.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.google.android.gms:play-services-location:9.2.0"

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
17 changes: 17 additions & 0 deletions android-easylocation/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/akhil/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.akhgupta.easylocation;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.akhgupta.easylocation.test", appContext.getPackageName());
}
}
14 changes: 14 additions & 0 deletions android-easylocation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.akhgupta.easylocation">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application android:allowBackup="true" android:label="@string/app_name"
android:supportsRtl="true">
<service android:name="com.akhgupta.easylocation.LocationBgService"
android:exported="false"
/>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.akhgupta.easylocation;

class AppConstants {
public static final int SINGLE_FIX = 1;
public static final int CONTINUOUS_LOCATION_UPDATES = 2;
public static final String ACTION_LOCATION_FETCH_START = "location.fetch.start";
public static final String ACTION_LOCATION_FETCH_STOP = "location.fetch.stop";
public static final String INTENT_LOCATION_RECEIVED = "intent.location.received";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.akhgupta.easylocation;

import android.location.Location;

class EasyLocation {
private final Location location;

public EasyLocation(Location location) {
this.location = location;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EasyLocation that = (EasyLocation) o;
return location != null ? location.equals(that.location) : that.location == null;

}

@Override
public int hashCode() {
return location != null ? location.hashCode() : 0;
}

@Override
public String toString() {
return location.getLatitude() +","+location.getLongitude();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.akhgupta.easylocation;

import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.NonNull;


public abstract class EasyLocationActivity extends Activity implements EasyLocationListener {
private EasyLocationDelegate easyLocationDelegate;

protected Location getLastKnownLocation() {
return easyLocationDelegate.getLastKnownLocation();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
easyLocationDelegate = new EasyLocationDelegate(this,this);
easyLocationDelegate.onCreate();
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
easyLocationDelegate.onActivityResult(requestCode);
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
easyLocationDelegate.onRequestPermissionsResult(requestCode, grantResults);
}

@Override
protected void onDestroy() {
super.onDestroy();
easyLocationDelegate.onDestroy();
}

protected void requestLocationUpdates(EasyLocationRequest easyLocationRequest) {
easyLocationDelegate.requestLocationUpdates(easyLocationRequest);
}


protected void requestSingleLocationFix(EasyLocationRequest easyLocationRequest) {
easyLocationDelegate.requestSingleLocationFix(easyLocationRequest);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.akhgupta.easylocation;

import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.NonNull;


public abstract class EasyLocationAppCompatActivity extends Activity implements EasyLocationListener {
private EasyLocationDelegate easyLocationDelegate;

protected Location getLastKnownLocation() {
return easyLocationDelegate.getLastKnownLocation();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
easyLocationDelegate = new EasyLocationDelegate(this,this);
easyLocationDelegate.onCreate();
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
easyLocationDelegate.onActivityResult(requestCode);
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
easyLocationDelegate.onRequestPermissionsResult(requestCode, grantResults);
}

@Override
protected void onDestroy() {
super.onDestroy();
easyLocationDelegate.onDestroy();
}

protected void requestLocationUpdates(EasyLocationRequest easyLocationRequest) {
easyLocationDelegate.requestLocationUpdates(easyLocationRequest);
}


protected void requestSingleLocationFix(EasyLocationRequest easyLocationRequest) {
easyLocationDelegate.requestSingleLocationFix(easyLocationRequest);
}
}
Loading

0 comments on commit 788e18c

Please sign in to comment.