This file contains hidden or 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
Form hi = new Form("Bubble"); | |
Button showBubble = new Button("+"); | |
showBubble.setName("BubbleButton"); | |
Style buttonStyle = showBubble.getAllStyles(); | |
buttonStyle.setBorder(Border.createEmpty()); | |
buttonStyle.setFgColor(0xffffff); | |
buttonStyle.setBgPainter((g, rect) -> { | |
g.setColor(0xff); | |
int actualWidth = rect.getWidth(); | |
int actualHeight = rect.getHeight(); |
This file contains hidden or 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
Form hi = new Form("Floating Hint", BoxLayout.y()); | |
TextField first = new TextField("", "First Field"); | |
TextField second = new TextField("", "Second Field"); | |
hi.add(new FloatingHint(first)). | |
add(new FloatingHint(second)). | |
add(new Button("Go")); | |
hi.show(); |
This file contains hidden or 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 Label createForFont(Font fnt, String s) { | |
Label l = new Label(s); | |
l.getUnselectedStyle().setFont(fnt); | |
return l; | |
} | |
public void showForm() { | |
GridLayout gr = new GridLayout(5); | |
gr.setAutoFit(true); | |
Form hi = new Form("Fonts", gr); |
This file contains hidden or 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
Form hi = new Form("Shape"); | |
// We create a 50 x 100 shape, this is arbitrary since we can scale it easily | |
GeneralPath path = new GeneralPath(); | |
path.moveTo(20,0); | |
path.lineTo(30, 0); | |
path.lineTo(30, 100); | |
path.lineTo(20, 100); | |
path.lineTo(20, 15); | |
path.lineTo(5, 40); |
This file contains hidden or 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
Boolean can = Display.getInstance().canExecute("imdb:///find?q=godfather"); | |
if(can != null && can) { | |
Display.getInstance().execute("imdb:///find?q=godfather"); | |
} else { | |
Display.getInstance().execute("http://www.imdb.com"); | |
} |
This file contains hidden or 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
Form hi = new Form("Pull To Refresh", BoxLayout.y()); | |
hi.getContentPane().addPullToRefresh(() -> { | |
hi.add("Pulled at " + L10NManager.getInstance().formatDateTimeShort(new Date())); | |
}); | |
hi.show(); |
This file contains hidden or 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
Form hi = new Form("Capture", BoxLayout.y()); | |
hi.setToolbar(new Toolbar()); | |
Style s = UIManager.getInstance().getComponentStyle("Title"); | |
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_MIC, s); | |
FileSystemStorage fs = FileSystemStorage.getInstance(); | |
String recordingsDir = fs.getAppHomePath() + "recordings/"; | |
fs.mkdir(recordingsDir); | |
try { | |
for(String file : fs.listFiles(recordingsDir)) { |
This file contains hidden or 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
public MyListener implements LocationListener { | |
public void locationUpdated(Location location) { | |
// update UI etc. | |
} | |
public void providerStateChanged(int newState) { | |
// handle status changes/errors appropriately | |
} | |
} | |
LocationManager.getLocationManager().setLocationListener(new MyListener()); |
This file contains hidden or 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
Location position = LocationManager.getLocationManager().getCurrentLocationSync(); |
This file contains hidden or 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
public class GeofenceListenerImpl implements GeofenceListener { | |
@Override | |
public void onExit(String id) { | |
} | |
@Override | |
public void onEntered(String id) { | |
if(Display.getInstance().isMinimized()) { | |
Display.getInstance().callSerially(() -> { | |
Dialog.show("Welcome", "Thanks for arriving", "OK", null); |