Feature complete, now w/ energy saving

master
kaqu 1 year ago
parent f112251190
commit d1719ff95e
  1. 2
      .flutter-plugins-dependencies
  2. 10
      README.md
  3. 2
      android/app/build.gradle
  4. 2
      android/app/src/debug/AndroidManifest.xml
  5. 4
      android/app/src/main/AndroidManifest.xml
  6. 2
      android/app/src/main/java/com/example/nmmcsend/MainActivity.java
  7. 2
      android/app/src/profile/AndroidManifest.xml
  8. 2
      ios/Flutter/flutter_export_environment.sh
  9. 6
      ios/Runner.xcodeproj/project.pbxproj
  10. 2
      ios/Runner/Info.plist
  11. 57
      lib/main.dart
  12. 7
      pubspec.lock
  13. 5
      pubspec.yaml

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"wakelock","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.3+3/","dependencies":[]}],"android":[{"name":"wakelock","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.3+3/","dependencies":[]}],"macos":[{"name":"wakelock_macos","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock_macos-0.1.0+2/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"wakelock_web","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock_web-0.2.0+2/","dependencies":[]}]},"dependencyGraph":[{"name":"wakelock","dependencies":["wakelock_macos","wakelock_web"]},{"name":"wakelock_macos","dependencies":[]},{"name":"wakelock_web","dependencies":[]}],"date_created":"2021-08-26 18:28:17.702264","version":"2.6.0-1.0.pre.59"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"screen_brightness","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/screen_brightness-0.0.4/","dependencies":[]},{"name":"wakelock","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.3+3/","dependencies":[]}],"android":[{"name":"screen_brightness","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/screen_brightness-0.0.4/","dependencies":[]},{"name":"wakelock","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.3+3/","dependencies":[]}],"macos":[{"name":"wakelock_macos","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock_macos-0.1.0+2/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"wakelock_web","path":"/home/kaqu/development/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock_web-0.2.0+2/","dependencies":[]}]},"dependencyGraph":[{"name":"screen_brightness","dependencies":[]},{"name":"wakelock","dependencies":["wakelock_macos","wakelock_web"]},{"name":"wakelock_macos","dependencies":[]},{"name":"wakelock_web","dependencies":[]}],"date_created":"2021-08-27 12:51:56.991512","version":"2.6.0-1.0.pre.59"}

@ -1,3 +1,9 @@
# BicycLED2
# BicycLED
The BicycLED indicator control app,
now featuring:
- rotation lock
- screen keep-alive
- screen energy saving
The BicycLED2 control for Android (now featuring screen keep-alive & rotation lock)

@ -33,7 +33,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.BicycLED2"
applicationId "com.example.BicycLED"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.BicycLED2">
package="com.example.BicycLED">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.BicycLED2">
package="com.example.BicycLED">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
@ -13,7 +13,7 @@
Removed below for V2 android:name="io.flutter.app.FlutterApplication" -->
<application
android:label="BicycLED2"
android:label="BicycLED"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="flutterEmbedding"

@ -1,4 +1,4 @@
package com.example.BicycLED2;
package com.example.BicycLED;
import io.flutter.embedding.android.FlutterActivity;

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.BicycLED2">
package="com.example.BicycLED">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

@ -1,7 +1,7 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/home/kaqu/development/flutter"
export "FLUTTER_APPLICATION_PATH=/home/kaqu/AndroidStudioProjects/BicycLED2"
export "FLUTTER_APPLICATION_PATH=/home/kaqu/AndroidStudioProjects/BicycLED"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"

@ -323,7 +323,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.BicycLED2;
PRODUCT_BUNDLE_IDENTIFIER = com.example.BicycLED;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
@ -448,7 +448,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.BicycLED2;
PRODUCT_BUNDLE_IDENTIFIER = com.example.BicycLED;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
@ -471,7 +471,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.BicycLED2;
PRODUCT_BUNDLE_IDENTIFIER = com.example.BicycLED;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};

@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>BicycLED2</string>
<string>BicycLED</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>

@ -1,5 +1,5 @@
//
// BicycLED2 dart project (main.dart)
// BicycLED dart project (main.dart)
//
// History:
// --------
@ -10,6 +10,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wakelock/wakelock.dart';
import 'package:screen_brightness/screen_brightness.dart';
int rcMC = 0;
RawDatagramSocket sG;
@ -17,14 +18,14 @@ InternetAddress multicastAddress; //= new InternetAddress('238.255.255.250');
int multicastPort = 1337;
int iCodeValue = 1; // Indicator type: 1=regular, 2=big scroller
void main() => runApp(BicycLED2App());
void main() => runApp(BicycLEDApp());
class BicycLED2App extends StatefulWidget {
class BicycLEDApp extends StatefulWidget {
@override
_BicycLED2AppState createState() => _BicycLED2AppState();
_BicycLEDAppState createState() => _BicycLEDAppState();
}
class _BicycLED2AppState extends State<BicycLED2App> {
class _BicycLEDAppState extends State<BicycLEDApp> {
Color currentColor = Color(0xffff5F00);
int _counter = 0;
String sMsg;
@ -33,6 +34,7 @@ class _BicycLED2AppState extends State<BicycLED2App> {
@override
void dispose() {
ScreenBrightness.resetScreenBrightness(); // Cleanup before leave ...
super.dispose();
}
@ -43,7 +45,16 @@ class _BicycLED2AppState extends State<BicycLED2App> {
print("ARGB($alpha,$red,$green,$blue)");
}
void restartBrightnessTimer() {
ScreenBrightness.resetScreenBrightness(); // Brighter now ...
Future.delayed(Duration(seconds: 5), () {
ScreenBrightness.setScreenBrightness(0.02); // And back to energy saving
});
}
void swapIndicatorCode() {
// Swap indicator style
restartBrightnessTimer();
if (iCodeValue == 1)
iCodeValue = 2;
else
@ -78,19 +89,23 @@ class _BicycLED2AppState extends State<BicycLED2App> {
}
void _onLeftIndicatorPressed() {
print("onLeftIndicatorPressed()");
//print("onLeftIndicatorPressed()");
restartBrightnessTimer();
sMsg = "L";
_incrementCounter();
}
void _onRightIndicatorPressed() {
print("onRightIndicatorPressed()");
//print("onRightIndicatorPressed()");
restartBrightnessTimer();
print("Brightness reset");
sMsg = "R";
_incrementCounter();
}
void _onStopIndicatorPressed() {
print("onStopIndicatorPressed()");
//print("onStopIndicatorPressed()");
restartBrightnessTimer();
sMsg = "S";
_incrementCounter();
}
@ -98,9 +113,9 @@ class _BicycLED2AppState extends State<BicycLED2App> {
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp // Permit only regular position
DeviceOrientation.portraitUp // Permit only regular upright position
]);
Wakelock.enable();
Wakelock.enable(); // Block lock screen
if (multicastAddress == null) {
multicastAddress = new InternetAddress('238.255.255.250');
RawDatagramSocket.bind(InternetAddress.anyIPv4, 0)
@ -118,15 +133,16 @@ class _BicycLED2AppState extends State<BicycLED2App> {
});
sMsg = "S";
}
restartBrightnessTimer();
return MaterialApp(
title: "BicycLED2 Control",
title: "BicycLED Control",
theme: ThemeData(
primarySwatch: Colors.grey,
scaffoldBackgroundColor: Colors.black,
),
home: Scaffold(
appBar: AppBar(
title: Text("BicycLED2 Control"),
title: Text("BicycLED Control"),
),
body: Align(
alignment: Alignment.center, //topCenter,
@ -210,31 +226,20 @@ class _BicycLED2AppState extends State<BicycLED2App> {
inactiveColor: Colors.grey[900],
onChanged: (double newValue) {
setState(() {
dalpha = newValue;
restartBrightnessTimer();
dalpha = newValue; // Adjust brightness (additive)
alpha = dalpha.truncate();
_incrementCounter();
});
},
),
//SizedBox(width: 20, height: 10),
],
),
// Lineage 7.1.1 bug ...
/*
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('XXXX', textScaleFactor: 1),
//SizedBox(height: 10),
],
),
*/
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: swapIndicatorCode,
onPressed: swapIndicatorCode, // Swap indicator style
tooltip: 'Swap indicator style',
backgroundColor: Colors.grey[900],
foregroundColor: Colors.amber[900],

@ -107,6 +107,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
screen_brightness:
dependency: "direct main"
description:
name: screen_brightness
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4"
sky_engine:
dependency: transitive
description: flutter

@ -1,5 +1,5 @@
name: BicycLED2
description: The BicycLED2 control for Android
name: BicycLED
description: The BicycLED control for Android
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
@ -26,6 +26,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
screen_brightness: ^0.0.4
dev_dependencies:
flutter_test:

Loading…
Cancel
Save