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
import android.animation.Animator | |
import android.animation.AnimatorListenerAdapter | |
import android.annotation.TargetApi | |
import android.os.Build | |
import android.view.View | |
import android.view.ViewAnimationUtils | |
/** | |
* Animation. |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 switchRelay(String key, Boolean value) { | |
try { | |
for (Relay relay : relays) { | |
if (relay.getId().equals(key)) { | |
relay.getGpio().setValue(value); | |
} | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
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
// Uploading relays | |
try { | |
for (Relay relay : relays) { | |
RelayDto relayDto = new RelayDto(relay.getLabel(), relay.getGpio().getValue()); | |
relayReference.child(relay.getId()).setValue(relayDto); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
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 initializeHardware() { | |
// Create peripheralManagerService and get GPIO list | |
PeripheralManagerService peripheralManagerService = new PeripheralManagerService(); | |
List<String> portList = peripheralManagerService.getGpioList(); | |
if (!portList.isEmpty()) { | |
try { | |
// Initialize GPIOs | |
initializeGpios(peripheralManagerService, portList, portList.size() < MAX_RELAYS ? portList.size() : MAX_RELAYS); | |
} catch (IOException e) { | |
view.showError("An error has ocurred"); |
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
createMapCircle: function(latitude, longitude){ | |
var latitudeRadius = this.getRadiusInLatitudeDegrees(this.radius); | |
var longuitudeRadius = this.getRadiusInLongitudeDegrees(this.radius, latitude); | |
for (var i = 0; i < 360; i++) { | |
var angle = i * (3.141516/180); | |
this.push('points', { | |
latitude: latitude + latitudeRadius * Math.sin(angle), | |
longitude: longitude + longuitudeRadius * Math.cos(angle), | |
}); |
NewerOlder