ADDED: Login, Registration, Navigation, Location-Retrieving
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>findMe</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,5 @@
|
||||
#Sun Mar 20 19:06:34 CET 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.architects.findme"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:name=".FindMe"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".Registration"
|
||||
android:label="Registration"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
<activity android:name=".Login"
|
||||
android:label="Login"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
<activity android:name=".Nearby"
|
||||
android:label="Nearby"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
<activity android:name=".Friends"
|
||||
android:label="Friends"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
<activity android:name=".Chat"
|
||||
android:label="Chat"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
<activity android:name=".Search"
|
||||
android:label="Search"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
</manifest>
|
||||
@@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
@@ -0,0 +1,74 @@
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package com.architects.findme;
|
||||
|
||||
public final class R {
|
||||
public static final class array {
|
||||
public static final int userStatusList=0x7f040000;
|
||||
}
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int background=0x7f020000;
|
||||
public static final int background_dark=0x7f020001;
|
||||
public static final int background_row=0x7f020002;
|
||||
public static final int background_row_dark=0x7f020003;
|
||||
public static final int ic_tab_artists_grey=0x7f020004;
|
||||
public static final int ic_tab_artists_white=0x7f020005;
|
||||
public static final int ic_tab_friends=0x7f020006;
|
||||
public static final int icon=0x7f020007;
|
||||
public static final int logo=0x7f020008;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int ButtonFriends=0x7f070008;
|
||||
public static final int ButtonLoginUser=0x7f070004;
|
||||
public static final int ButtonNearby=0x7f070007;
|
||||
public static final int ButtonRegisterUser=0x7f07000e;
|
||||
public static final int ButtonSearch=0x7f070009;
|
||||
public static final int ButtonUpdate=0x7f07000a;
|
||||
public static final int ButtonUserRegistration=0x7f070006;
|
||||
public static final int EditTextLoginMail=0x7f070000;
|
||||
public static final int EditTextLoginPassword=0x7f070001;
|
||||
public static final int EditTextRegistrationMail=0x7f07000c;
|
||||
public static final int EditTextRegistrationName=0x7f07000b;
|
||||
public static final int EditTextRegistrationPassword=0x7f07000d;
|
||||
public static final int SpinnerLoginUserStatus=0x7f070003;
|
||||
public static final int TextViewTitle=0x7f070002;
|
||||
public static final int icon=0x7f07000f;
|
||||
public static final int icontext=0x7f070011;
|
||||
public static final int test_image=0x7f070005;
|
||||
public static final int text=0x7f070010;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int login=0x7f030000;
|
||||
public static final int main=0x7f030001;
|
||||
public static final int nearby=0x7f030002;
|
||||
public static final int registration=0x7f030003;
|
||||
public static final int tabs=0x7f030004;
|
||||
}
|
||||
public static final class menu {
|
||||
public static final int menu=0x7f060000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f050000;
|
||||
public static final int main_login=0x7f050001;
|
||||
public static final int main_register=0x7f050002;
|
||||
public static final int navigation_chat=0x7f05000a;
|
||||
public static final int navigation_friends=0x7f050008;
|
||||
/** Navigation
|
||||
*/
|
||||
public static final int navigation_nearby=0x7f050007;
|
||||
public static final int navigation_search=0x7f050009;
|
||||
/** Current User Status
|
||||
*/
|
||||
public static final int userStatus1=0x7f050003;
|
||||
public static final int userStatus2=0x7f050004;
|
||||
public static final int userStatus3=0x7f050005;
|
||||
public static final int userStatus4=0x7f050006;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
-optimizationpasses 5
|
||||
-dontusemixedcaseclassnames
|
||||
-dontskipnonpubliclibraryclasses
|
||||
-dontpreverify
|
||||
-verbose
|
||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||||
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||
-keep public class * extends android.preference.Preference
|
||||
-keep public class com.android.vending.licensing.ILicensingService
|
||||
|
||||
-keepclasseswithmembernames class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
-keepclasseswithmembernames class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keepclasseswithmembernames class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
|
After Width: | Height: | Size: 364 KiB |
|
After Width: | Height: | Size: 504 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 791 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- When selected, use grey -->
|
||||
<item android:drawable="@drawable/ic_tab_artists_grey"
|
||||
android:state_selected="true" />
|
||||
<!-- When not selected, use white-->
|
||||
<item android:drawable="@drawable/ic_tab_artists_white" />
|
||||
</selector>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/background_dark"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="20px">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/EditTextLoginMail"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="E-Mail"
|
||||
android:inputType="textEmailAddress"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_marginTop="80dip">
|
||||
</EditText>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/EditTextLoginPassword"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="***********"
|
||||
android:inputType="textPassword"
|
||||
android:layout_width="fill_parent"
|
||||
android:password="true">
|
||||
</EditText>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextViewTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Status:"
|
||||
android:textSize="7pt"
|
||||
android:textColor="#39525f"
|
||||
android:layout_marginTop="5dip"
|
||||
android:layout_marginBottom="2dip">
|
||||
</TextView>
|
||||
<Spinner
|
||||
android:id="@+id/SpinnerLoginUserStatus"
|
||||
android:layout_height="wrap_content"
|
||||
android:prompt="@string/userStatus1"
|
||||
android:layout_width="150dip"
|
||||
android:entries="@array/userStatusList">
|
||||
</Spinner>
|
||||
|
||||
<Button
|
||||
android:id="@+id/ButtonLoginUser"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Login"
|
||||
android:onClick="loginUserHandler"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_marginTop="50dip">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/test_image"
|
||||
android:src="@drawable/logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|center_vertical"
|
||||
android:layout_marginBottom="40dip"
|
||||
/>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/ButtonLoginUser"
|
||||
android:text="@string/main_login"
|
||||
android:onClick="drawLoginHandler"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20px"
|
||||
android:layout_marginRight="20px">
|
||||
</Button>
|
||||
<Button
|
||||
android:id="@+id/ButtonUserRegistration"
|
||||
android:text="@string/main_register"
|
||||
android:onClick="drawRegistrationHandler"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20px"
|
||||
android:layout_marginLeft="20px"
|
||||
android:layout_marginRight="20px">
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingLeft="20px"
|
||||
android:paddingRight="20px">
|
||||
|
||||
<Button
|
||||
android:id="@+id/ButtonNearby"
|
||||
android:text="@string/navigation_nearby"
|
||||
android:onClick="drawNearbyHandler"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|left"
|
||||
android:layout_marginBottom="20px">
|
||||
</Button>
|
||||
<Button
|
||||
android:id="@+id/ButtonFriends"
|
||||
android:text="@string/navigation_friends"
|
||||
android:onClick="drawFriendsHandler"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|left"
|
||||
android:layout_marginBottom="20px">
|
||||
</Button>
|
||||
<!--<Button
|
||||
android:id="@+id/ButtonChat"
|
||||
android:text="@string/navigation_chat"
|
||||
android:onClick="drawChatHandler"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|left"
|
||||
android:layout_marginBottom="20px">
|
||||
</Button>-->
|
||||
<Button
|
||||
android:id="@+id/ButtonSearch"
|
||||
android:text="@string/navigation_search"
|
||||
android:onClick="drawSearchHandler"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|left"
|
||||
android:layout_marginBottom="20px">
|
||||
</Button>
|
||||
<Button
|
||||
android:id="@+id/ButtonUpdate"
|
||||
android:text="O"
|
||||
android:onClick="updateLocationHandler"
|
||||
android:layout_width="20px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|left"
|
||||
android:layout_marginBottom="20px">
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/background_dark"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="20px">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextViewTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Information:"
|
||||
android:textSize="7pt"
|
||||
android:textColor="#39525f"
|
||||
android:layout_marginTop="80dip"
|
||||
android:layout_marginBottom="2dip">
|
||||
</TextView>
|
||||
<EditText
|
||||
android:id="@+id/EditTextRegistrationName"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Your name"
|
||||
android:inputType="textPersonName"
|
||||
android:layout_width="fill_parent"
|
||||
android:textSize="7pt">
|
||||
</EditText>
|
||||
<EditText
|
||||
android:id="@+id/EditTextRegistrationMail"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="E-Mail"
|
||||
android:inputType="textEmailAddress"
|
||||
android:layout_width="fill_parent">
|
||||
</EditText>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextViewTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Password:"
|
||||
android:textSize="7pt"
|
||||
android:textColor="#39525f"
|
||||
android:layout_marginTop="5dip"
|
||||
android:layout_marginBottom="2dip">
|
||||
</TextView>
|
||||
<EditText
|
||||
android:id="@+id/EditTextRegistrationPassword"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="***********"
|
||||
android:inputType="textPassword"
|
||||
android:layout_width="fill_parent"
|
||||
android:password="true">
|
||||
</EditText>
|
||||
|
||||
<Button
|
||||
android:id="@+id/ButtonRegisterUser"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Register"
|
||||
android:onClick="registerUserHandler"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_marginTop="50dip">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="5dp">
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</TabWidget>
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="5dp" />
|
||||
</LinearLayout>
|
||||
</TabHost>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/icon"
|
||||
android:icon="@drawable/icon" />
|
||||
<item android:id="@+id/text"
|
||||
android:title="Text" />
|
||||
<item android:id="@+id/icontext"
|
||||
android:title="Icon and text"
|
||||
android:icon="@drawable/icon" />
|
||||
</menu>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="userStatusList">
|
||||
<item>@string/userStatus1</item>
|
||||
<item>@string/userStatus2</item>
|
||||
<item>@string/userStatus3</item>
|
||||
<item>@string/userStatus4</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">findMe</string>
|
||||
<string name="main_login">I\'m already a findMe user</string>
|
||||
<string name="main_register">I\'m new to findMe</string>
|
||||
|
||||
<!-- Current User Status -->
|
||||
<string name="userStatus1">Online</string>
|
||||
<string name="userStatus2">Busy</string>
|
||||
<string name="userStatus3">Away</string>
|
||||
<string name="userStatus4">Invisible</string>
|
||||
|
||||
<!-- Navigation -->
|
||||
<string name="navigation_nearby">Nearby</string>
|
||||
<string name="navigation_friends">Friends</string>
|
||||
<string name="navigation_search">Search</string>
|
||||
<string name="navigation_chat">Chat</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Chat extends Activity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
TextView textview = new TextView(this);
|
||||
textview.setText("Chat");
|
||||
setContentView(textview);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import com.architects.findme.R;
|
||||
import com.architects.findme.R.id;
|
||||
import com.architects.findme.R.layout;
|
||||
import com.architects.findme.R.menu;
|
||||
import com.architects.helper.StateHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class FindMe extends Activity
|
||||
{
|
||||
public StateHelper phoneState = new StateHelper();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.icon: Toast.makeText(this, "You pressed the icon!", Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case R.id.text: Toast.makeText(this, "You pressed the text!", Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case R.id.icontext: Toast.makeText(this, "You pressed the icon and text!", Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// VIEWS
|
||||
public void drawRegistrationHandler(View button)
|
||||
{
|
||||
Intent myIntent = new Intent(button.getContext(), Registration.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
public void drawLoginHandler(View button)
|
||||
{
|
||||
Intent myIntent = new Intent(button.getContext(), Login.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Friends extends Activity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
TextView textview = new TextView(this);
|
||||
textview.setText("Friends");
|
||||
setContentView(textview);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.architects.findme.R;
|
||||
import com.architects.helper.AccountHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Login extends Activity
|
||||
{
|
||||
private static final String TAG = "test";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.login);
|
||||
}
|
||||
|
||||
public String login(String[] str)
|
||||
{
|
||||
JSONObject j = new JSONObject();
|
||||
try
|
||||
{
|
||||
j.put("mail", str[0]);
|
||||
j.put("password", AccountHelper.createHashMd5(str[1]));
|
||||
j.put("status", str[2]);
|
||||
|
||||
return AccountHelper.doHttpPost("login_user.php", j);
|
||||
}
|
||||
catch (JSONException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void loginUserHandler(View button)
|
||||
{
|
||||
String loginData[] = new String[3];
|
||||
|
||||
final EditText mailField = (EditText) findViewById(R.id.EditTextLoginMail);
|
||||
loginData[0] = mailField.getText().toString();
|
||||
|
||||
final EditText passwordField = (EditText) findViewById(R.id.EditTextLoginPassword);
|
||||
loginData[1] = passwordField.getText().toString();
|
||||
|
||||
final Spinner statusSpinner = (Spinner) findViewById(R.id.SpinnerLoginUserStatus);
|
||||
loginData[2] = statusSpinner.getSelectedItem().toString();
|
||||
|
||||
String response = login(loginData).trim();
|
||||
Log.v(TAG, response);
|
||||
|
||||
if(response.compareTo("01") == 0)
|
||||
{
|
||||
Intent myIntent = new Intent(button.getContext(), Nearby.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
else Toast.makeText(this, response, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import com.architects.findme.R;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Nearby extends Activity {
|
||||
|
||||
private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in Meters
|
||||
private static final long MINIMUM_TIME_BETWEEN_UPDATES = 100; // in Milliseconds
|
||||
|
||||
private static final String TAG = "test";
|
||||
protected LocationManager locationManager;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.nearby);
|
||||
|
||||
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.GPS_PROVIDER,
|
||||
MINIMUM_TIME_BETWEEN_UPDATES,
|
||||
MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
|
||||
new MyLocationListener()
|
||||
);
|
||||
}
|
||||
|
||||
public void updateLocationHandler(View button)
|
||||
{
|
||||
showCurrentLocation();
|
||||
}
|
||||
|
||||
protected void showCurrentLocation() {
|
||||
|
||||
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
|
||||
if (location != null) {
|
||||
String message = String.format(
|
||||
"Current Location \n Longitude: %1$s \n Latitude: %2$s",
|
||||
location.getLongitude(), location.getLatitude()
|
||||
);
|
||||
Toast.makeText(Nearby.this, message,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private class MyLocationListener implements LocationListener {
|
||||
|
||||
public void onLocationChanged(Location location) {
|
||||
String message = String.format(
|
||||
"New Location \n Longitude: %1$s \n Latitude: %2$s",
|
||||
location.getLongitude(), location.getLatitude()
|
||||
);
|
||||
Toast.makeText(Nearby.this, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public void onStatusChanged(String s, int i, Bundle b) {
|
||||
Toast.makeText(Nearby.this, "Provider status changed",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public void onProviderDisabled(String s) {
|
||||
Toast.makeText(Nearby.this,
|
||||
"Provider disabled by the user. GPS turned off",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public void onProviderEnabled(String s) {
|
||||
Toast.makeText(Nearby.this,
|
||||
"Provider enabled by the user. GPS turned on",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// VIEWS
|
||||
public void drawNearbyHandler(View button)
|
||||
{
|
||||
Intent myIntent = new Intent(button.getContext(), Nearby.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
public void drawFriendsHandler(View button)
|
||||
{
|
||||
Intent myIntent = new Intent(button.getContext(), Friends.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
public void drawChatHandler(View button)
|
||||
{
|
||||
Intent myIntent = new Intent(button.getContext(), Chat.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
public void drawSearchHandler(View button)
|
||||
{
|
||||
Intent myIntent = new Intent(button.getContext(), Search.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.architects.findme.R;
|
||||
import com.architects.findme.R.id;
|
||||
import com.architects.findme.R.layout;
|
||||
import com.architects.helper.AccountHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Registration extends Activity
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.registration);
|
||||
}
|
||||
|
||||
|
||||
public String register(String[] str)
|
||||
{
|
||||
JSONObject j = new JSONObject();
|
||||
try
|
||||
{
|
||||
j.put("name", str[0]);
|
||||
j.put("mail", str[1]);
|
||||
j.put("password", AccountHelper.createHashMd5(str[2]));
|
||||
|
||||
return AccountHelper.doHttpPost("register_user.php", j);
|
||||
}
|
||||
catch (JSONException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void registerUserHandler(View button)
|
||||
{
|
||||
String registrationData[] = new String[3];
|
||||
|
||||
final EditText nameField = (EditText) findViewById(R.id.EditTextRegistrationName);
|
||||
registrationData[0] = nameField.getText().toString();
|
||||
|
||||
final EditText mailField = (EditText) findViewById(R.id.EditTextRegistrationMail);
|
||||
registrationData[1] = mailField.getText().toString();
|
||||
|
||||
final EditText passwordField = (EditText) findViewById(R.id.EditTextRegistrationPassword);
|
||||
registrationData[2] = passwordField.getText().toString();
|
||||
|
||||
String response = register(registrationData);
|
||||
Toast.makeText(this, response, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Search extends Activity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
TextView textview = new TextView(this);
|
||||
textview.setText("Search");
|
||||
setContentView(textview);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class TabView extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.tabs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.architects.findme;
|
||||
|
||||
import android.app.TabActivity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html.TagHandler;
|
||||
import android.util.Log;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TabWidget;
|
||||
|
||||
public class Tabs extends TabActivity {
|
||||
private static final String TAG = "test";
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
Log.v(TAG, "sicher");
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.tabs);
|
||||
Resources res = getResources(); // Resource object to get Drawables
|
||||
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost); // The activity TabHost
|
||||
TabHost.TabSpec spec; // Resusable TabSpec for each tab
|
||||
Intent intent; // Reusable Intent for each tab
|
||||
|
||||
Log.v(TAG, "01");
|
||||
|
||||
// Create an Intent to launch an Activity for the tab (to be reused)
|
||||
intent = new Intent().setClass(this, Friends.class);
|
||||
|
||||
// Initialize a TabSpec for each tab and add it to the TabHost
|
||||
spec = tabHost.newTabSpec("friends").setIndicator("Friends").setContent(intent);
|
||||
tabHost.addTab(spec);
|
||||
|
||||
Log.v(TAG, "01.5");
|
||||
|
||||
// Do the same for the other tabs
|
||||
intent = new Intent().setClass(this, Chat.class);
|
||||
spec = tabHost.newTabSpec("chat").setIndicator("Chat").setContent(intent);
|
||||
tabHost.addTab(spec);
|
||||
|
||||
intent = new Intent().setClass(this, Search.class);
|
||||
spec = tabHost.newTabSpec("search").setIndicator("Search").setContent(intent);
|
||||
tabHost.addTab(spec);
|
||||
|
||||
Log.v(TAG, "02");
|
||||
|
||||
tabHost.setCurrentTab(2);
|
||||
|
||||
Log.v(TAG, "03");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.architects.helper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.params.HttpConnectionParams;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class AccountHelper
|
||||
{
|
||||
public static String doHttpPost(String url_end, JSONObject j)
|
||||
{
|
||||
String url = "http://www.artistandarchitects.at/findme/" + url_end;
|
||||
|
||||
HttpClient client = new DefaultHttpClient();
|
||||
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);
|
||||
HttpResponse response;
|
||||
|
||||
try
|
||||
{
|
||||
HttpPost post = new HttpPost(url);
|
||||
|
||||
post.setHeader("json", j.toString());
|
||||
|
||||
StringEntity se = new StringEntity(j.toString());
|
||||
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
|
||||
post.setEntity(se);
|
||||
|
||||
response = client.execute(post);
|
||||
if (response != null)
|
||||
{
|
||||
InputStream in = response.getEntity().getContent();
|
||||
return AccountHelper.convertStreamToString(in);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String createHashMd5(String str)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create MD5 Hash
|
||||
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
|
||||
digest.update(str.getBytes());
|
||||
byte messageDigest[] = digest.digest();
|
||||
|
||||
// Create Hex String
|
||||
StringBuffer hexString = new StringBuffer();
|
||||
for (int i=0; i<messageDigest.length; i++)
|
||||
{
|
||||
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
|
||||
}
|
||||
return hexString.toString();
|
||||
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String convertStreamToString(InputStream is)
|
||||
{
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
String line = null;
|
||||
try
|
||||
{
|
||||
while ((line = reader.readLine()) != null)
|
||||
{
|
||||
sb.append(line + "\n");
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.architects.helper;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class LocationCalculation {
|
||||
Timer timer1;
|
||||
LocationManager lm;
|
||||
LocationResult locationResult;
|
||||
boolean gps_enabled=false;
|
||||
boolean network_enabled=false;
|
||||
|
||||
public boolean getLocation(Context context, LocationResult result)
|
||||
{
|
||||
//I use LocationResult callback class to pass location value from MyLocation to user code.
|
||||
locationResult=result;
|
||||
if(lm==null)
|
||||
lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
//exceptions will be thrown if provider is not permitted.
|
||||
try{gps_enabled=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){}
|
||||
try{network_enabled=lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){}
|
||||
|
||||
//don't start listeners if no provider is enabled
|
||||
if(!gps_enabled && !network_enabled)
|
||||
return false;
|
||||
|
||||
if(gps_enabled)
|
||||
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListenerGps);
|
||||
if(network_enabled)
|
||||
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListenerNetwork);
|
||||
timer1=new Timer();
|
||||
timer1.schedule(new GetLastLocation(), 20000);
|
||||
return true;
|
||||
}
|
||||
|
||||
LocationListener locationListenerGps = new LocationListener() {
|
||||
public void onLocationChanged(Location location) {
|
||||
timer1.cancel();
|
||||
locationResult.gotLocation(location);
|
||||
lm.removeUpdates(this);
|
||||
lm.removeUpdates(locationListenerNetwork);
|
||||
}
|
||||
public void onProviderDisabled(String provider) {}
|
||||
public void onProviderEnabled(String provider) {}
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
};
|
||||
|
||||
LocationListener locationListenerNetwork = new LocationListener() {
|
||||
public void onLocationChanged(Location location) {
|
||||
timer1.cancel();
|
||||
locationResult.gotLocation(location);
|
||||
lm.removeUpdates(this);
|
||||
lm.removeUpdates(locationListenerGps);
|
||||
}
|
||||
public void onProviderDisabled(String provider) {}
|
||||
public void onProviderEnabled(String provider) {}
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
};
|
||||
|
||||
class GetLastLocation extends TimerTask {
|
||||
@Override
|
||||
public void run() {
|
||||
lm.removeUpdates(locationListenerGps);
|
||||
lm.removeUpdates(locationListenerNetwork);
|
||||
|
||||
Location net_loc=null, gps_loc=null;
|
||||
if(gps_enabled)
|
||||
gps_loc=lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
if(network_enabled)
|
||||
net_loc=lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
|
||||
//if there are both values use the latest one
|
||||
if(gps_loc!=null && net_loc!=null){
|
||||
if(gps_loc.getTime()>net_loc.getTime())
|
||||
locationResult.gotLocation(gps_loc);
|
||||
else
|
||||
locationResult.gotLocation(net_loc);
|
||||
return;
|
||||
}
|
||||
|
||||
if(gps_loc!=null){
|
||||
locationResult.gotLocation(gps_loc);
|
||||
return;
|
||||
}
|
||||
if(net_loc!=null){
|
||||
locationResult.gotLocation(net_loc);
|
||||
return;
|
||||
}
|
||||
locationResult.gotLocation(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class LocationResult{
|
||||
public abstract void gotLocation(Location location);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.architects.helper;
|
||||
|
||||
import com.architects.findme.Nearby;
|
||||
|
||||
import android.R;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class LocationHelper extends Activity {
|
||||
|
||||
private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in Meters
|
||||
private static final long MINIMUM_TIME_BETWEEN_UPDATES = 1000; // in Milliseconds
|
||||
|
||||
protected LocationManager locationManager;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
//setContentView(R.layout.main);
|
||||
|
||||
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.GPS_PROVIDER,
|
||||
MINIMUM_TIME_BETWEEN_UPDATES,
|
||||
MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
|
||||
new MyLocationListener()
|
||||
);
|
||||
}
|
||||
|
||||
public void updateLocationHandler(View button)
|
||||
{
|
||||
showCurrentLocation();
|
||||
}
|
||||
|
||||
protected void showCurrentLocation() {
|
||||
|
||||
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
|
||||
if (location != null) {
|
||||
String message = String.format(
|
||||
"Current Location \n Longitude: %1$s \n Latitude: %2$s",
|
||||
location.getLongitude(), location.getLatitude()
|
||||
);
|
||||
Toast.makeText(LocationHelper.this, message,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private class MyLocationListener implements LocationListener {
|
||||
|
||||
public void onLocationChanged(Location location) {
|
||||
String message = String.format(
|
||||
"New Location \n Longitude: %1$s \n Latitude: %2$s",
|
||||
location.getLongitude(), location.getLatitude()
|
||||
);
|
||||
Toast.makeText(LocationHelper.this, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public void onStatusChanged(String s, int i, Bundle b) {
|
||||
Toast.makeText(LocationHelper.this, "Provider status changed",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public void onProviderDisabled(String s) {
|
||||
Toast.makeText(LocationHelper.this,
|
||||
"Provider disabled by the user. GPS turned off",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public void onProviderEnabled(String s) {
|
||||
Toast.makeText(LocationHelper.this,
|
||||
"Provider enabled by the user. GPS turned on",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.architects.helper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
|
||||
|
||||
public class StateHelper extends Activity
|
||||
{
|
||||
public String isOnline()
|
||||
{
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm.getActiveNetworkInfo().isConnectedOrConnecting())
|
||||
return "CONNECTED";
|
||||
else return "NOT CONNECTED";
|
||||
}
|
||||
}
|
||||