Skip to content

Instantly share code, notes, and snippets.

View shannah's full-sized avatar

Steve Hannah shannah

View GitHub Profile
@shannah
shannah / pom-snippet.xml
Created December 10, 2021 13:31
Kotlin profile for common/pom.xml file
<profile>
<id>kotlin</id>
<activation>
<file>
<!-- To enable Kotlin, add the following file to the project base dir -->
<exists>${basedir}/src/main/kotlin</exists>
</file>
</activation>
<properties>
<kotlin.version>1.4.32</kotlin.version>
@shannah
shannah / GoogleMapsDemo.java
Created December 6, 2021 14:25
Adapted from https://github.com/shannah/googlemaps-maven-demo but with changes to test reported NPE in addPath
package com.codename1.demos.googlemaps;
import com.codename1.components.FloatingActionButton;
import com.codename1.components.InteractionDialog;
import com.codename1.components.ToastBar;
import com.codename1.googlemaps.MapContainer;
import com.codename1.googlemaps.MapContainer.MapObject;
import com.codename1.io.Util;
import com.codename1.maps.BoundingBox;
import com.codename1.maps.Coord;
@shannah
shannah / bcversions.sh
Created October 8, 2021 13:37
A bash script for printing out classes in a jar file with version greater than some value
#!/bin/bash
JARPATH="$1"
MIN="$2"
if [[ "$JARPATH" == "" ]] || [[ "$MIN" == "" ]]; then
echo 'This script will scan the classes in a jar file, and print the ones whose '
echo 'bytecode versions are greater than a given value.'
echo ''
echo 'Usage bash bcversions.sh JARPATH MAXVERSION'
@shannah
shannah / InfiniteProgressContainer.java
Created September 1, 2021 13:41
Lighter-weight InfiniteProgress dialog in Codename One
package com.example.materialtheme;
import com.codename1.components.InfiniteProgress;
import com.codename1.ui.CN;
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.Form;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.plaf.Border;
@shannah
shannah / HomePage.xml
Created June 27, 2021 15:30
Twitter clone example after adding global navigation tabs
<?xml version="1.0"?>
<border view-controller="com.example.tweetapp.controllers.HomePageViewController"
xsi:noNamespaceSchemaLocation="HomePage.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<title hidden="true"/>
<use-taglib class="com.codename1.twitterui.TagLibrary"/>
<import>
import com.example.tweetapp.providers.NewsFeedProvider;
</import>
@shannah
shannah / Tweetapp.java
Created June 26, 2021 14:23
Application controller for TweetApp after adding alternate control flow if user is logged in already
package com.example.tweetapp;
import static com.codename1.rad.util.NonNull.with;
import static com.codename1.ui.CN.*;
import com.codename1.rad.controllers.ControllerEvent;
import com.codename1.rad.nodes.ActionNode;
import com.codename1.rad.ui.ActionStyle;
import com.codename1.twitterui.models.TWTUserProfile;
import com.codename1.twitterui.models.TWTUserProfileImpl;
@shannah
shannah / LoginPageViewController.java
Created June 26, 2021 14:16
LoginPageViewController with hard-coded user profile on login
package com.example.tweetapp.controllers;
import com.codename1.components.InfiniteProgress;
import com.codename1.components.ToastBar;
import com.codename1.rad.controllers.Controller;
import com.codename1.rad.controllers.ViewController;
import com.codename1.rad.nodes.ActionNode;
import com.codename1.rad.util.NonNull;
import com.codename1.twitterui.models.TWTUserProfile;
import com.codename1.twitterui.models.TWTUserProfileImpl;
@shannah
shannah / TweetAppClient.java
Created June 26, 2021 14:13
TweetAppClient storing logged in status in preferences
package com.example.tweetapp.services;
import com.codename1.io.Preferences;
import com.codename1.rad.util.NonNull;
import com.codename1.util.AsyncResource;
import java.util.Date;
/**
* A client for interacting with the server.
@shannah
shannah / LoginPage.xml
Created June 24, 2021 16:15
Twitter Clone tutorial sources related to the Login page
<?xml version="1.0"?>
<border view-controller="com.example.tweetapp.controllers.LoginPageViewController"
uiid="SignupPage"
safeArea="true"
componentForm.formBottomPaddingEditingMode="true"
xsi:noNamespaceSchemaLocation="LoginPage.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<define-category name="LOGIN"/>
@shannah
shannah / SignupPage.xml
Created June 24, 2021 13:47
TwitterClone state after adding the Signup Page
<?xml version="1.0"?>
<border view-controller="com.example.tweetapp.controllers.SignupPageViewController"
uiid="SignupPage"
safeArea="true"
xsi:noNamespaceSchemaLocation="SignupPage.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<define-category name="NEXT"/>
<define-category name="USE_PHONE"/>
<define-category name="USE_EMAIL"/>