nothing_glyph_interface 0.0.5 copy "nothing_glyph_interface: ^0.0.5" to clipboard
nothing_glyph_interface: ^0.0.5 copied to clipboard

PlatformAndroid

Plugin to control the glyph interface of Nothing Phones for Flutter Android applications.

Nothing Glyph Interface #

pub package pub points package publisher

Flutter implementation of the Glyph Developer Kit from Nothing.

I don't stand in any connection with Nothing and own any rights to their physical and digital products. The included jar file is the property of Nothing.

Note #

For this plugin to work properly on physical Nothing devices, the glyph debugging must be enabled first:

adb shell settings put global nt_glyph_interface_debug_enable 1

The debugging mode will be automatically disabled after 48 hours to prevent misuse of the SDK.

For later publication, reach out to Nothing for a proper API key and add it to your AndroidManifest.xml.

<!-- This tag should be added in application tag -->
<meta-data android:name="NothingKey" android:value="{Your APIKey}" />

Usage #

In general, this plugin is implemented in the same way as the Glyph Developer Kit.

General #

Create a NothingGlyphInterface instance:

NothingGlyphInterface _nothingGlyphInterface = NothingGlyphInterface();

Check if the Android device is a Nothing Phone 1 or Phone 2:

bool isPhone1 = await _nothingGlyphInterface.is20111();
bool isPhone2 = await _nothingGlyphInterface.is22111();
bool isPhone2a = await _nothingGlyphInterface.is23111();

Listen to the Glyph connection stream. The plugin should automatically try to connect to the Glyph interface during the app start and close its connection when the app ends.

_nothingGlyphInterface.onServiceConnection.listen((bool connected) {
    print("connected: $connected");
});

Get the current state of the glyph interface:

int? period = await _glyphInterfacePlugin.getPeriod();
int? cycles = await _glyphInterfacePlugin.getCycles();
int? interval = await _glyphInterfacePlugin.getInterval();
List<int>? channel = await _glyphInterfacePlugin.getChannel();

Trigger the Glyph Interface #

Please use the provided GlyphFrameBuilder to create Glyph frames:

// basic example
await _glyphInterfacePlugin.buildGlyphFrame(GlyphFrameBuilder()
    .buildChannelA()
    .build()
);

// more complex example
await _glyphInterfacePlugin.buildGlyphFrame(GlyphFrameBuilder()
    .buildChannelA()
    .buildChannel(NothingPhone2.c3)
    .buildPeriod(2000)
    .buildCycles(3)
    .buildInterval(1000)
    .build()
);

After building a Glyph frame it must be triggered for the interface to light up:

// used to enable/disable the channels set in the GlyphFrame.
await _glyphInterfacePlugin.toggle();

// used for animating a breathing animation using the parameters of channels, period, and interval set in the GlyphFrame.
await _glyphInterfacePlugin.animate();

// used to display a progress value on C1 / D1.
await _glyphInterfacePlugin.displayProgress();

// used to simultaneously toggle all Glyphs except C1 / D1 and display the progress value on C1 / D1.
await _glyphInterfacePlugin.displayProgressAndToggle();
2
likes
160
pub points
29%
popularity

Publisher

verified publisherjaykaycooperations.com

Plugin to control the glyph interface of Nothing Phones for Flutter Android applications.

Repository (GitHub)
View/report issues

Topics

#glyph #nothing

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on nothing_glyph_interface