diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..7bc01d9
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..1035107
--- /dev/null
+++ b/.project
@@ -0,0 +1,33 @@
+
+
+ BusTO
+
+
+
+
+
+ com.android.ide.eclipse.adt.ResourceManagerBuilder
+
+
+
+
+ com.android.ide.eclipse.adt.PreCompilerBuilder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ com.android.ide.eclipse.adt.ApkBuilder
+
+
+
+
+
+ com.android.ide.eclipse.adt.AndroidNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..f646c26
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ic_launcher-web.png b/ic_launcher-web.png
new file mode 100644
index 0000000..ee4df6a
Binary files /dev/null and b/ic_launcher-web.png differ
diff --git a/proguard-project.txt b/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# 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 *;
+#}
diff --git a/project.properties b/project.properties
new file mode 100644
index 0000000..4ab1256
--- /dev/null
+++ b/project.properties
@@ -0,0 +1,14 @@
+# 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 edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-19
diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a65b7f8
Binary files /dev/null and b/res/drawable-hdpi/ic_launcher.png differ
diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..ceb18b7
Binary files /dev/null and b/res/drawable-mdpi/ic_launcher.png differ
diff --git a/res/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..54e514f
Binary files /dev/null and b/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/res/drawable-xxhdpi/ic_launcher.png b/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..c0080d2
Binary files /dev/null and b/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
new file mode 100644
index 0000000..e8f1666
--- /dev/null
+++ b/res/layout/activity_main.xml
@@ -0,0 +1,7 @@
+
diff --git a/res/layout/fragment_main.xml b/res/layout/fragment_main.xml
new file mode 100644
index 0000000..6218a87
--- /dev/null
+++ b/res/layout/fragment_main.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/menu/main.xml b/res/menu/main.xml
new file mode 100644
index 0000000..2da0f96
--- /dev/null
+++ b/res/menu/main.xml
@@ -0,0 +1,12 @@
+
diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml
new file mode 100644
index 0000000..a4a95bc
--- /dev/null
+++ b/res/values-v11/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml
new file mode 100644
index 0000000..664f4f1
--- /dev/null
+++ b/res/values-v14/styles.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/res/values-w820dp/dimens.xml b/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..f3e7020
--- /dev/null
+++ b/res/values-w820dp/dimens.xml
@@ -0,0 +1,10 @@
+
+
+
+ 64dp
+
+
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
new file mode 100644
index 0000000..55c1e59
--- /dev/null
+++ b/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+
+ 16dp
+ 16dp
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100644
index 0000000..324ac85
--- /dev/null
+++ b/res/values/strings.xml
@@ -0,0 +1,11 @@
+
+
+
+ BusTO
+ Hello world!
+ Settings
+ Search
+ Please insert the number of the bus stop.
+ Network Error. Is network available?
+
+
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 0000000..845fb57
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/it/reyboz/bustorino/AsyncWget.java b/src/it/reyboz/bustorino/AsyncWget.java
new file mode 100644
index 0000000..a649b34
--- /dev/null
+++ b/src/it/reyboz/bustorino/AsyncWget.java
@@ -0,0 +1,58 @@
+package it.reyboz.bustorino;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import android.os.AsyncTask;
+import android.util.Log;
+
+public class AsyncWget extends AsyncTask {
+ protected String doInBackground(String... uri) {
+ Log.d("miao", "Async in backgroundo: " + uri[0]);
+
+ HttpURLConnection urlConnection = null;
+ StringBuilder result = null;
+
+ try {
+ URL url = new URL(uri[0]);
+ urlConnection = (HttpURLConnection) url.openConnection();
+ InputStream in = new BufferedInputStream(urlConnection.getInputStream());
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ result = new StringBuilder();
+ String line;
+ while ((line = reader.readLine()) != null) {
+ result.append(line);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ urlConnection.disconnect();
+ }
+ return result.toString();
+ }
+
+ protected void onProgressUpdate(Integer... progress) {
+
+ }
+
+ protected void onPostExecute(String result) {
+ Log.d("miao", result.toString());
+ super.onPostExecute(result);
+ }
+}
diff --git a/src/it/reyboz/bustorino/MainActivity.java b/src/it/reyboz/bustorino/MainActivity.java
new file mode 100644
index 0000000..f4c5bde
--- /dev/null
+++ b/src/it/reyboz/bustorino/MainActivity.java
@@ -0,0 +1,74 @@
+package it.reyboz.bustorino;
+
+import android.support.v7.app.ActionBarActivity;
+import android.support.v4.app.Fragment;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+
+public class MainActivity extends ActionBarActivity {
+
+ public EditText bus_stop_number;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ if (savedInstanceState == null) {
+ getSupportFragmentManager().beginTransaction()
+ .add(R.id.container, new PlaceholderFragment()).commit();
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+ if (id == R.id.action_settings) {
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ /**
+ * A placeholder fragment containing a simple view.
+ */
+ public static class PlaceholderFragment extends Fragment {
+
+ public PlaceholderFragment() {
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_main, container,
+ false);
+ return rootView;
+ }
+ }
+
+ public void searchClick(View v) {
+ if (!NetworkTools.isConnected(this)) {
+ NetworkTools.showNetworkError(this);
+ return;
+ }
+ bus_stop_number = (EditText)findViewById(R.id.bus_stop_number_editText);
+ String value = bus_stop_number.getText().toString();
+ Log.d("miao", "clicked " + value);
+ new AsyncWget().execute("http://www.5t.torino.it/5t/trasporto/StopPointCtrl.js.jsp?action=search&shortName=" + value);
+ }
+}
diff --git a/src/it/reyboz/bustorino/NetworkTools.java b/src/it/reyboz/bustorino/NetworkTools.java
new file mode 100644
index 0000000..edbacb5
--- /dev/null
+++ b/src/it/reyboz/bustorino/NetworkTools.java
@@ -0,0 +1,21 @@
+package it.reyboz.bustorino;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.widget.Toast;
+
+public class NetworkTools {
+
+ // Check network connection
+ public static boolean isConnected(Context c){
+ ConnectivityManager connMgr = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
+ return networkInfo != null && networkInfo.isConnected();
+ }
+
+ // «Turn on WiFi!»
+ public static void showNetworkError(Context c) {
+ Toast.makeText(c, R.string.network_error, Toast.LENGTH_SHORT).show();
+ }
+}
\ No newline at end of file