-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
akhil
committed
Oct 24, 2016
1 parent
9a8d6a5
commit 788e18c
Showing
45 changed files
with
1,384 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/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
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' |
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
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 *; | ||
#} |
26 changes: 26 additions & 0 deletions
26
...-easylocation/src/androidTest/java/com/akhgupta/easylocation/ExampleInstrumentedTest.java
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
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()); | ||
} | ||
} |
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
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> |
9 changes: 9 additions & 0 deletions
9
android-easylocation/src/main/java/com/akhgupta/easylocation/AppConstants.java
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
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"; | ||
} |
30 changes: 30 additions & 0 deletions
30
android-easylocation/src/main/java/com/akhgupta/easylocation/EasyLocation.java
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
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(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
android-easylocation/src/main/java/com/akhgupta/easylocation/EasyLocationActivity.java
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
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); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...d-easylocation/src/main/java/com/akhgupta/easylocation/EasyLocationAppCompatActivity.java
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
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); | ||
} | ||
} |
Oops, something went wrong.