Skip to content

Instantly share code, notes, and snippets.

View btle.c
#include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <util/delay.h>
#define PIN_CE 1 //Output
#define PIN_nCS 2 //Output
View conversion_form.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
View gist:8964220
@CalatravaPage(name = "conversionForm")
public class ConversionForm extends WebViewActivity
View gist:8964230
@CalatravaPage(name = "conversionForm")
public class ConversionForm extends com.calatrava.bridge.RegisteredActivity
View gist:8964245
@Override
public String getFieldValue(String field){
return "";
}
@Override
public void render(final String json){
}
View gist:8964780
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.conversion_form);
}
View gist:8964793
- (id)valueForField:(NSString *)field
{
if ([field isEqualToString:@"in_currency"]) {
return [[_inCurrencyData objectAtIndex:[inCurrencyPicker selectedRowInComponent:0]] objectForKey:@"code"];
} else if ([field isEqualToString:@"out_currency"]) {
return [[_outCurrencyData objectAtIndex:[outCurrencyPicker selectedRowInComponent:0]] objectForKey:@"code"];
} else if ([field isEqualToString:@"in_amount"]) {
return [inAmount text];
}
return nil;
View gist:8964802
@Override
public String getFieldValue(String field){
if(field.equalsIgnoreCase("in_currency")){
return "USD";
}else if(field.equalsIgnoreCase("out_currency")){
return "AUD";
}else if(field.equalsIgnoreCase("in_amount")){
return ((EditText) findViewById(R.id.unconvertedEditText)).getText().toString();
}
View gist:8964808
public void convert(View v) {
this.triggerEvent("convert", new String[] {});
}
View gist:8964813
- (void)render:(NSDictionary *)jsViewObject
{
for (NSString *key in jsViewObject)
{
id value = [jsViewObject objectForKey:key];
if ([key isEqualToString:@"inCurrencies"]) {
[self renderCurrencyPicker:inCurrencyPicker usingData:value to:_inCurrencyData];
} else if ([key isEqualToString:@"outCurrencies"]) {
[self renderCurrencyPicker:outCurrencyPicker usingData:value to:_outCurrencyData];
} else if ([key isEqualToString:@"in_amount"]) {