Skip to content

Commit 0520bc0

Browse files
author
Oleg Muraveyko
committed
RawBT 7.0 changes
1 parent 6a9ed84 commit 0520bc0

File tree

10 files changed

+20
-63
lines changed

10 files changed

+20
-63
lines changed

.idea/misc.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
[Use full API](https://github.com/402d/RawbtAPI)
22

33
# Demo RawBtPrinter
44
**How print to esc/pos printer from android**

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 34
4+
compileSdk 34
55
defaultConfig {
66
applicationId "ru.a402d.demorawbt"
77
minSdkVersion 19

app/src/androidTest/java/ru/a402d/demorawbt/ExampleInstrumentedTest.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
<queries>
1010
<package android:name="ru.a402d.rawbtprinter" />
11+
<intent>
12+
<action android:name="ru.a402d.rawbtprinter.action.PRINT_RAWBT" />
13+
<category android:name="android.intent.category.DEFAULT" />
14+
</intent>
1115
</queries>
1216

1317
<application

app/src/main/java/ru/a402d/demorawbt/MainActivity.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.app.Activity;
55
import android.app.AlertDialog;
66
import android.content.Context;
7-
import android.content.DialogInterface;
87
import android.content.Intent;
98
import android.content.pm.PackageInfo;
109
import android.content.pm.PackageManager;
@@ -108,13 +107,11 @@ protected void sendToPrint(Intent intent) {
108107
image.setImageResource(R.drawable.baseline_print_black_48);
109108
builder.setMessage(R.string.dialog_message)
110109
.setView(image).setCustomTitle(title);
111-
builder.setPositiveButton(R.string.btn_install, new DialogInterface.OnClickListener() {
112-
public void onClick(DialogInterface dialog, int id) {
113-
try {
114-
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
115-
} catch (android.content.ActivityNotFoundException anfe) {
116-
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
117-
}
110+
builder.setPositiveButton(R.string.btn_install, (dialog, id) -> {
111+
try {
112+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
113+
} catch (android.content.ActivityNotFoundException anfe) {
114+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
118115
}
119116
});
120117
AlertDialog dialog = builder.create();
@@ -490,13 +487,13 @@ public void test13(Button button) {
490487
*/
491488
@OnClick(R.id.test14)
492489
public void test14(Button button) {
493-
/**
490+
/*
494491
* It is better to make this class universal.
495492
* delegete computePageCount() & drawPage() into class Render.
496493
*/
497494
class DemoDocumentAdapter extends PrintDocumentAdapter {
498495

499-
private Activity mParentActivity;
496+
private final Activity mParentActivity;
500497
private PrintAttributes currentAttributes;
501498
public void setCurrentAttributes(PrintAttributes currentAttributes) {
502499
this.currentAttributes = currentAttributes;
@@ -802,7 +799,7 @@ public void test15(Button button) {
802799
Intent intent = new Intent("ru.a402d.rawbtprinter.action.PRINT_RAWBT");
803800
intent.putExtra("ru.a402d.rawbtprinter.extra.DATA",textToPrint);
804801
intent.setPackage("ru.a402d.rawbtprinter");
805-
startService(intent);
802+
startActivity(intent);
806803
button.setText("x");
807804
}
808805
@OnClick(R.id.test16)
@@ -821,7 +818,7 @@ public void test16(Button button) {
821818
Intent intent = new Intent("ru.a402d.rawbtprinter.action.PRINT_RAWBT");
822819
intent.putExtra("ru.a402d.rawbtprinter.extra.DATA",base64ToPrint);
823820
intent.setPackage("ru.a402d.rawbtprinter");
824-
startService(intent);
821+
startActivity(intent);
825822
button.setText("x");
826823
}
827824

app/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
android:layout_width="match_parent"
193193
android:layout_height="wrap_content"
194194
android:padding="8pt"
195-
android:text="RawBT as service (new 2.80)"
195+
android:text="RawBT as service not working from v7.0"
196196
tools:ignore="HardcodedText"
197197
android:textSize="18sp"
198198
android:textStyle="bold" />
@@ -201,7 +201,7 @@
201201
android:id="@+id/test15"
202202
android:layout_width="match_parent"
203203
android:layout_height="wrap_content"
204-
android:text="15. Start Service "
204+
android:text="15. Fast fix run it as startActivity "
205205
tools:ignore="HardcodedText" />
206206
<Button
207207
android:id="@+id/test16"

app/src/test/java/ru/a402d/demorawbt/ExampleUnitTest.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
jcenter()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:8.0.2'
10+
classpath 'com.android.tools.build:gradle:8.4.0'
1111

1212

1313
// NOTE: Do not place your application dependencies here; they belong

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip

0 commit comments

Comments
 (0)