Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
/*
|
|
|
|
* Copyright 2009 ZXing authors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.google.zxing.integration.android;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <p>Encapsulates the result of a barcode scan invoked through {@link IntentIntegrator}.</p>
|
|
|
|
*
|
|
|
|
* @author Sean Owen
|
|
|
|
*/
|
|
|
|
public final class IntentResult {
|
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
private final String contents;
|
|
|
|
private final String formatName;
|
|
|
|
private final byte[] rawBytes;
|
|
|
|
private final Integer orientation;
|
|
|
|
private final String errorCorrectionLevel;
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
IntentResult() {
|
|
|
|
this(null, null, null, null, null);
|
|
|
|
}
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
IntentResult(String contents,
|
|
|
|
String formatName,
|
|
|
|
byte[] rawBytes,
|
|
|
|
Integer orientation,
|
|
|
|
String errorCorrectionLevel) {
|
|
|
|
this.contents = contents;
|
|
|
|
this.formatName = formatName;
|
|
|
|
this.rawBytes = rawBytes;
|
|
|
|
this.orientation = orientation;
|
|
|
|
this.errorCorrectionLevel = errorCorrectionLevel;
|
|
|
|
}
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
/**
|
|
|
|
* @return raw content of barcode
|
|
|
|
*/
|
|
|
|
public String getContents() {
|
|
|
|
return contents;
|
|
|
|
}
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
/**
|
|
|
|
* @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
|
|
|
|
*/
|
|
|
|
public String getFormatName() {
|
|
|
|
return formatName;
|
|
|
|
}
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
/**
|
|
|
|
* @return raw bytes of the barcode content, if applicable, or null otherwise
|
|
|
|
*/
|
|
|
|
public byte[] getRawBytes() {
|
|
|
|
return rawBytes;
|
|
|
|
}
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
/**
|
|
|
|
* @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
|
|
|
|
*/
|
|
|
|
public Integer getOrientation() {
|
|
|
|
return orientation;
|
|
|
|
}
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
/**
|
|
|
|
* @return name of the error correction level used in the barcode, if applicable
|
|
|
|
*/
|
|
|
|
public String getErrorCorrectionLevel() {
|
|
|
|
return errorCorrectionLevel;
|
|
|
|
}
|
2015-10-08 17:05:17 +02:00
|
|
|
|
2015-10-08 21:41:38 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
|
|
|
|
return "Format: " + formatName + '\n' + "Contents: " + contents + '\n' + "Raw bytes: (" + rawBytesLength + " bytes)\n" + "Orientation: " + orientation + '\n' + "EC level: " + errorCorrectionLevel + '\n';
|
|
|
|
}
|
Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.
Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.
In the process, I also commented out the "It's not working" button.
2014-08-04 08:02:12 +09:30
|
|
|
|
|
|
|
}
|