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; |
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
package com.survivingwithandroid.weathertest; | |
import android.support.v7.app.ActionBarActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.Menu; | |
import android.view.MenuItem; | |
import com.survivingwithandroid.weather.lib.WeatherClient; | |
import com.survivingwithandroid.weather.lib.client.okhttp.WeatherDefaultClient; |
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
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 22 | |
buildToolsVersion "22.0.1" | |
defaultConfig { | |
applicationId "com.survivingwithandroid.weathertest" | |
minSdkVersion 19 | |
targetSdkVersion 22 |
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
/* | |
* Copyright (C) 2014 Francesco Azzola | |
* Surviving with Android (http://www.survivingwithandroid.com) | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
NewerOlder