Skip to content

Instantly share code, notes, and snippets.

View Elvis10ten's full-sized avatar

Elvis Chidera Elvis10ten

View GitHub Profile
private const val CACHE_TTL_SECONDS: Short = 30 * 60
private const val INET_BROADCAST_INTERVAL_SECONDS: Short = 30 * 60
class Dscp(
private val inetServer: InetServer,
private val addressProvider: AddressProvider,
private val bleAdvertiser: BleAdvertiser,
private val bleScanner: BleScanner,
private val inetBroadcaster: InetBroadcaster,
private val timer: Timer
@Elvis10ten
Elvis10ten / color_blob_detection_surface_view.xml
Created June 25, 2018 19:12
OpenCv Sample: ColorBlob main layout
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.android.JavaCameraView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/color_blob_detection_activity_surface_view" />
@Elvis10ten
Elvis10ten / ColorBlobDetector.java
Created June 25, 2018 19:09
OpenCv Sample: ColorBlob Detector
package com.mobymagic.opencvproject;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
@Elvis10ten
Elvis10ten / MainActivity.java
Created June 25, 2018 19:09
OpenCv Sample: ColorBlob MainActivity
package com.mobymagic.opencvproject;
import java.util.List;
import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Core;
import org.opencv.core.CvType;
@Elvis10ten
Elvis10ten / AndroidManifest.xml
Created June 25, 2018 19:07
OpenCV Sample: ColorBlob permissions
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
Container _getListItemWidget(Map currency, MaterialColor color) {
// Returns a container widget that has a card child and a top margin of 5.0
return new Container(
margin: const EdgeInsets.only(top: 5.0),
child: new Card(
child: _getListTile(currency, color),
),
);
}
ListTile _getListTile(Map currency, MaterialColor color) {
return new ListTile(
leading: _getLeadingWidget(currency['name'], color),
title: _getTitleWidget(currency['name']),
subtitle: _getSubtitleWidget(
currency['price_usd'], currency['percent_change_1h']),
isThreeLine: true,
);
}
Text _getTitleWidget(String currencyName) {
return new Text(
currencyName,
style: new TextStyle(fontWeight: FontWeight.bold),
);
}
Text _getSubtitleWidget(String priceUsd, String percentChange1h) {
return new Text('\$$priceUsd\n1 hour: $percentChange1h%');
}
@Elvis10ten
Elvis10ten / coin_market_cap_api_response.json
Last active March 5, 2018 13:43
Sample response from the CoinMarketCap API
[
{
"name": "Bitcoin",
"price_usd": "11525.7",
"percent_change_1h": "-0.18",
...
},
...
]
CircleAvatar _getLeadingWidget(String currencyName, MaterialColor color) {
return new CircleAvatar(
backgroundColor: color,
child: new Text(currencyName[0]),
);
}