Skip to content

Commit

Permalink
修改打印文字
Browse files Browse the repository at this point in the history
  • Loading branch information
song.chao committed Jan 24, 2024
1 parent 8b96c54 commit 9492713
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;



import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.EventChannel.EventSink;
import io.flutter.plugin.common.EventChannel.StreamHandler;
Expand Down Expand Up @@ -63,7 +65,8 @@ public class IminPrinterPlugin implements FlutterPlugin, MethodCallHandler, Stre
private static final String ACTION_PRITER_STATUS = "status";
private static final String TAG = "IminPrinterPlugin";
private BroadcastReceiver chargingStateChangeReceiver;



@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "imin_printer");
Expand Down Expand Up @@ -992,9 +995,7 @@ public void onPrintResult(int code, String msg) throws RemoteException {
if (iminPrintUtils == null) {
int textBitmapStyle = call.argument("style");
Log.d("setTextBitmapStyle", "setTextBitmapStyle: " + textBitmapStyle);
if (iminPrintUtils != null) {
PrinterHelper.getInstance().setTextBitmapStyle(textBitmapStyle);
}
PrinterHelper.getInstance().setTextBitmapStyle(textBitmapStyle);
}
result.success(true);
break;
Expand Down Expand Up @@ -1130,7 +1131,6 @@ public void onPrintResult(int code, String msg) throws RemoteException {
}
result.success(true);
break;

default:
result.notImplemented();
break;
Expand Down
17 changes: 16 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')

if (localPropertiesFile.exists()) {

localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
Expand Down Expand Up @@ -34,7 +41,14 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.imin.printer.imin_printer_example"
Expand All @@ -52,6 +66,7 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
// signingConfig signingConfigs.release
}
}
}
Expand Down

0 comments on commit 9492713

Please sign in to comment.