Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:8.11.1'
}
}

plugins {
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}
Comment on lines +12 to +14
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these lines to suppress Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found error.


subprojects {
repositories {
google()
Expand All @@ -19,6 +23,6 @@ subprojects {
version = '4.3.0'
group = 'com.journeyapps'

ext.androidTargetSdk = 30
ext.androidTargetSdk = 35
ext.zxingCore = 'com.google.zxing:core:3.4.1'
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android'

android {
compileSdkVersion project.androidTargetSdk
Expand Down Expand Up @@ -64,6 +65,7 @@ android {
// called context.getMainProject() during module analysis.
disable 'UsingOnClickInXml'
}
namespace 'example.zxing'
}


Expand Down
6 changes: 3 additions & 3 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.zxing">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".SampleApplication"
Expand All @@ -10,7 +9,8 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:exported="true">
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting Android 12, exproted="true" is needed explicitly.

<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
2 changes: 1 addition & 1 deletion zxing-android-embedded/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.zxing.client.android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package in AndroidManifest is deprecated.


<uses-permission android:name="android.permission.CAMERA"/>

Expand Down
8 changes: 6 additions & 2 deletions zxing-android-embedded/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if (secretPropsFile.exists()) {
dependencies {
api project.zxingCore

implementation 'androidx.activity:activity:1.8.0'
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.fragment:fragment:1.3.6'

Expand All @@ -41,6 +42,7 @@ dependencies {
}

android {
namespace 'com.journeyapps.barcodescanner'
resourcePrefix 'zxing_'
compileSdkVersion project.androidTargetSdk

Expand Down Expand Up @@ -73,11 +75,13 @@ android {

defaultConfig {
minSdkVersion 19
aarMetadata {
minCompileSdk 19
}
}

buildTypes {
debug {
versionNameSuffix ".debug"
resValue "string", "app_version", "${defaultConfig.versionName}${versionNameSuffix}"
}
release {
Expand All @@ -87,7 +91,7 @@ android {
}

task sourceJar(type: Jar) {
classifier = 'sources'
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import android.os.Vibrator;
import android.util.Log;

import com.journeyapps.barcodescanner.R;

import java.io.IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.google.zxing.DecodeHintType;
import com.google.zxing.ResultPoint;
import com.google.zxing.client.android.R;

import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import android.view.ViewGroup;
import android.view.WindowManager;

import com.google.zxing.client.android.R;
import com.journeyapps.barcodescanner.camera.CameraInstance;
import com.journeyapps.barcodescanner.camera.CameraParametersCallback;
import com.journeyapps.barcodescanner.camera.CameraSettings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
package com.journeyapps.barcodescanner;

import android.app.Activity;
import android.os.Bundle;

import androidx.activity.ComponentActivity;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import android.view.KeyEvent;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.google.zxing.client.android.R;
import android.view.KeyEvent;
import android.view.ViewGroup;

/**
*
*/
public class CaptureActivity extends Activity {
public class CaptureActivity extends ComponentActivity {
private CaptureManager capture;
private DecoratedBarcodeView barcodeScannerView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);

barcodeScannerView = initializeContent();

ViewCompat.setOnApplyWindowInsetsListener(barcodeScannerView.getStatusView(), (view, windowInsets) -> {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());

ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
mlp.bottomMargin = insets.bottom;
barcodeScannerView.getStatusView().setLayoutParams(mlp);

return WindowInsetsCompat.CONSUMED;
});

capture = new CaptureManager(this, barcodeScannerView);
capture.initializeFromIntent(getIntent(), savedInstanceState);
capture.decode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.google.zxing.client.android.BeepManager;
import com.google.zxing.client.android.InactivityTimer;
import com.google.zxing.client.android.Intents;
import com.google.zxing.client.android.R;

import java.io.File;
import java.io.FileOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.google.zxing.LuminanceSource;
import com.google.zxing.Result;
import com.google.zxing.ResultPoint;
import com.google.zxing.client.android.R;
import com.journeyapps.barcodescanner.camera.CameraInstance;
import com.journeyapps.barcodescanner.camera.PreviewCallback;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.google.zxing.client.android.DecodeFormatManager;
import com.google.zxing.client.android.DecodeHintManager;
import com.google.zxing.client.android.Intents;
import com.google.zxing.client.android.R;
import com.journeyapps.barcodescanner.camera.CameraParametersCallback;
import com.journeyapps.barcodescanner.camera.CameraSettings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import android.view.View;

import com.google.zxing.ResultPoint;
import com.google.zxing.client.android.R;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.util.Log;
import android.view.SurfaceHolder;

import com.google.zxing.client.android.R;
import com.journeyapps.barcodescanner.R;
import com.journeyapps.barcodescanner.Size;
import com.journeyapps.barcodescanner.Util;

Expand Down