-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Android application to locate places of interest the user - by location . using google places API.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.dt.project" | ||
minSdkVersion 15 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.1.1' | ||
compile 'com.android.support:support-v4:23.1.1' | ||
compile 'com.android.support:design:23.1.1' | ||
compile 'com.google.android.gms:play-services:8.4.0' | ||
compile 'com.android.support:recyclerview-v7:23.1.1' | ||
compile 'com.android.support:cardview-v7:23.1.1' | ||
compile 'com.squareup.picasso:picasso:2.3.2' | ||
} |
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 D:\Programs\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,13 @@ | ||
package com.dt.project; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.dt.project"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
<uses-permission android:name="android.permission.CALL_PHONE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<meta-data | ||
android:name="com.google.android.geo.API_KEY" | ||
android:value="AIzaSyBQCOCS4hEaBH7cM2_q8IWb4mOs1g4JzNc" /> | ||
|
||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<receiver android:name=".Receiver.PhoneReceiver"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" /> | ||
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<activity | ||
android:name=".Phone.InfoPlaceActivity" | ||
android:theme="@android:style/Theme.Translucent.NoTitleBar" /> | ||
<activity | ||
android:name=".Phone.MapAndInfoPhoneActivity" | ||
android:label="@string/title_activity_map_and_info" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity android:name=".Tablet.TabletPlaceInfo"/> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package com.dt.project.AsyncTasks; | ||
|
||
import android.os.AsyncTask; | ||
import java.io.BufferedReader; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
|
||
|
||
//Start an asynctask the bring all the information on the user options when he types | ||
public class AutoCompleteAsyncTask extends AsyncTask<URL, Void, String> { | ||
|
||
private Callbacks callbacks; | ||
private String errorMessage = null; | ||
|
||
public AutoCompleteAsyncTask(Callbacks callbacks) { | ||
this.callbacks = callbacks; | ||
} | ||
|
||
protected String doInBackground(URL... params) { | ||
|
||
try { | ||
|
||
URL url = params[0]; | ||
|
||
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); | ||
|
||
int httpStatusCode = connection.getResponseCode(); | ||
|
||
if (httpStatusCode == HttpURLConnection.HTTP_BAD_REQUEST) { | ||
errorMessage = "No Such Symbol"; | ||
return null; | ||
} | ||
if (httpStatusCode != HttpURLConnection.HTTP_OK) { | ||
errorMessage = connection.getResponseMessage(); | ||
return null; | ||
} | ||
|
||
InputStream inputStream = connection.getInputStream(); | ||
InputStreamReader inputStreamReader = new InputStreamReader(inputStream); | ||
BufferedReader bufferedReader = new BufferedReader(inputStreamReader); | ||
|
||
String result = ""; | ||
|
||
String oneLine = bufferedReader.readLine(); | ||
|
||
while (oneLine != null) { | ||
result += oneLine + "\n"; | ||
oneLine = bufferedReader.readLine(); | ||
} | ||
bufferedReader.close(); | ||
inputStreamReader.close(); | ||
inputStream.close(); | ||
|
||
return result; | ||
|
||
} catch (Exception ex) { | ||
errorMessage = ex.getMessage(); | ||
return null; | ||
} | ||
} | ||
|
||
protected void onPostExecute(String result) { | ||
|
||
if (errorMessage != null) { | ||
callbacks.onError(errorMessage); | ||
} else { | ||
try { | ||
callbacks.onSuccessWords(result); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
|
||
public interface Callbacks { | ||
|
||
void onSuccessWords(String result); | ||
|
||
void onError(String errorMessage); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.dt.project.AsyncTasks; | ||
|
||
|
||
import android.graphics.Bitmap; | ||
import android.graphics.BitmapFactory; | ||
import android.os.AsyncTask; | ||
import android.util.Log; | ||
import java.io.InputStream; | ||
|
||
//Taking url String and preform AsyncTask in order to show the image | ||
public class DownloadImageAsyncTask extends AsyncTask<String, Void, Bitmap> { | ||
|
||
private Callbacks callbacks; | ||
|
||
public DownloadImageAsyncTask(Callbacks callbacks) { | ||
this.callbacks = callbacks; | ||
} | ||
|
||
protected Bitmap doInBackground(String... urls) { | ||
String url = urls[0]; | ||
Bitmap mIcon11 = null; | ||
try { | ||
InputStream in = new java.net.URL(url).openStream(); | ||
mIcon11 = BitmapFactory.decodeStream(in); | ||
} catch (Exception ex) { | ||
Log.e("Error", ex.getMessage()); | ||
ex.printStackTrace(); | ||
} | ||
|
||
return mIcon11; | ||
} | ||
|
||
protected void onPostExecute(Bitmap result) { | ||
callbacks.onSuccess(result); | ||
} | ||
public interface Callbacks{ | ||
void onSuccess(Bitmap result); | ||
} | ||
} |