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
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" | |
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> | |
<android.support.v7.widget.Toolbar | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" |
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
void loop() { | |
EthernetClient client = server.available(); // Is there a client (Our Android smartphone) | |
// Read temp | |
int sensorVal = analogRead(3); | |
float vSens = (sensorVal /1024.0) * 5.0; | |
//Serial.println(vSens); | |
float temp = (vSens - 0.5) * 100; |
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
<proxy name="AndroidService" | |
transports="https http" | |
startOnLoad="true" | |
trace="disable" | |
statistics="enable"> | |
<description/> | |
<target> | |
<inSequence> | |
<log> | |
<property name="Message Flow" value="Arduino API"/> |
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
private void getWeather() { | |
weatherclient.getCurrentCondition(new WeatherRequest(currentCity.getId()), | |
new WeatherClient.WeatherEventListener() { | |
@Override | |
public void onWeatherRetrieved(CurrentWeather currentWeather) { | |
// We have the current weather now | |
// Update subtitle toolbar | |
toolbar.setSubtitle(currentWeather.weather.currentCondition.getDescr()); | |
tempView.setText(String.format("%.0f",currentWeather.weather.temperature.getTemp())); | |
pressView.setText(String.valueOf(currentWeather.weather.currentCondition.getPressure())); |
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
private void getWeather() { | |
weatherclient.getCurrentCondition(new WeatherRequest(currentCity.getId()), | |
new WeatherClient.WeatherEventListener() { | |
@Override | |
public void onWeatherRetrieved(CurrentWeather currentWeather) { | |
// We have the current weather now | |
// Update subtitle toolbar | |
toolbar.setSubtitle(currentWeather.weather.currentCondition.getDescr()); | |
tempView.setText(String.format("%.0f",currentWeather.weather.temperature.getTemp())); | |
pressView.setText(String.valueOf(currentWeather.weather.currentCondition.getPressure())); |
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
private Dialog createDialog() { | |
AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
LayoutInflater inflater = this.getLayoutInflater(); | |
View v = inflater.inflate(R.layout.select_city_dialog, null); | |
builder.setView(v); | |
EditText et = (EditText) v.findViewById(R.id.ptnEdit); | |
.... | |
et.addTextChangedListener(new TextWatcher() { | |
.... |
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
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="@string/dialog.city.header" | |
style="@style/Theme.AppCompat.Dialog"/> |
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
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".WeatherActivity" | |
android:orientation="vertical"> | |
<android.support.v7.widget.Toolbar | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/my_toolbar" |
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
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
compile 'com.android.support:appcompat-v7:21.0.+' | |
compile 'com.mcxiaoke.volley:library:1.0.6@aar' | |
compile 'com.survivingwithandroid:weatherlib:1.5.3' | |
compile 'com.survivingwithandroid:weatherlib_volleyclient:1.5.3' | |
} |
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
#include <spi.h> | |
#include <ethernet.h> | |
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; | |
IPAddress ip(192, 168, 1, 130); // Arduino IP Add | |
EthernetServer server(80); // Web server | |
// Http data | |
String reqData; // Request from Smartphone | |
String header; |
NewerOlder