-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Taylor
committed
Mar 26, 2020
0 parents
commit 0bad185
Showing
43 changed files
with
2,014 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
.idea |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Buddy Scanner | ||
|
||
I created this as an open source alternative to options on the Play Store filled with ads | ||
This will work with Barcode Buddy after making the change listed here: | ||
https://github.com/Forceu/barcodebuddy/issues/22#issuecomment-602178931 | ||
|
||
# Install | ||
|
||
Just allow unknown sources and install the apk from the latest release. Top right of app has settings where you can set your Barcode Buddy URL. Just need the domain, not index.php with it. | ||
|
||
# Donate | ||
|
||
I'm just doing this for fun and prolly won't do much more with this as it just works for its purpose. Depending on if I continue to use Grocy or not will determine if I expand this app. | ||
|
||
[![paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/jmztaylor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdkVersion 29 | ||
buildToolsVersion "29.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.jmzsoft.buddyscanner" | ||
minSdkVersion 24 | ||
targetSdkVersion 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.1.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | ||
implementation 'com.google.android.material:material:1.1.0' | ||
implementation 'com.journeyapps:zxing-android-embedded:4.1.0' | ||
implementation 'androidx.recyclerview:recyclerview:1.1.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"version": 2, | ||
"artifactType": { | ||
"type": "APK", | ||
"kind": "Directory" | ||
}, | ||
"applicationId": "com.jmzsoft.buddyscanner", | ||
"variantName": "processReleaseResources", | ||
"elements": [ | ||
{ | ||
"type": "SINGLE", | ||
"filters": [], | ||
"properties": [ | ||
{ | ||
"key": "packageId", | ||
"value": "com.jmzsoft.buddyscanner" | ||
}, | ||
{ | ||
"key": "split", | ||
"value": "" | ||
}, | ||
{ | ||
"key": "minSdkVersion", | ||
"value": "24" | ||
} | ||
], | ||
"versionCode": 1, | ||
"versionName": "1.0", | ||
"outputFile": "app-release.apk" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.jmzsoft.buddyscanner"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="com.journeyapps.barcodescanner.CaptureActivity" | ||
android:screenOrientation="portrait" | ||
tools:replace="screenOrientation" /> | ||
</application> | ||
|
||
</manifest> |
101 changes: 101 additions & 0 deletions
101
app/src/main/java/com/jmzsoft/buddyscanner/Internet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Buddy Scanner | ||
* | ||
* Authors: James Taylor <james.taylor@jmzsoft.com> | ||
* | ||
* Copyright (C) 2020 James Taylor | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.jmzsoft.buddyscanner; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.content.Context; | ||
import android.util.Log; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
|
||
import javax.net.ssl.HttpsURLConnection; | ||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.TrustManager; | ||
import javax.net.ssl.X509TrustManager; | ||
|
||
public class Internet { | ||
|
||
public static void disableSslChecks(Context ctx) { | ||
TrustManager[] trustAllCerts = new TrustManager[]{ | ||
new X509TrustManager() { | ||
public java.security.cert.X509Certificate[] getAcceptedIssuers() { | ||
return null; | ||
} | ||
|
||
@SuppressLint("TrustAllX509TrustManager") | ||
public void checkClientTrusted( | ||
java.security.cert.X509Certificate[] certs, String authType) { | ||
} | ||
|
||
@SuppressLint("TrustAllX509TrustManager") | ||
public void checkServerTrusted( | ||
java.security.cert.X509Certificate[] certs, String authType) { | ||
} | ||
} | ||
}; | ||
|
||
try { | ||
SSLContext sc = SSLContext.getInstance("SSL"); | ||
sc.init(null, trustAllCerts, new java.security.SecureRandom()); | ||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); | ||
} catch (Exception e) { | ||
Log.e(ctx.getPackageName(), e.toString()); | ||
} | ||
} | ||
|
||
public static Boolean queryApi(String apiUrl, String upc) { | ||
HttpURLConnection connection = null; | ||
BufferedReader reader = null; | ||
StringBuilder buffer = new StringBuilder(); | ||
try { | ||
URL url = new URL(apiUrl + "/index.php?text=" + upc); | ||
connection = (HttpURLConnection) url.openConnection(); | ||
connection.connect(); | ||
InputStream stream = connection.getInputStream(); | ||
reader = new BufferedReader(new InputStreamReader(stream)); | ||
String line; | ||
while ((line = reader.readLine()) != null) { | ||
buffer.append(line).append("\n"); | ||
} | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} finally { | ||
if (connection != null) { | ||
connection.disconnect(); | ||
} | ||
try { | ||
if (reader != null) { | ||
reader.close(); | ||
} | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
return buffer.toString().trim().equals("OK"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Buddy Scanner | ||
* | ||
* Authors: James Taylor <james.taylor@jmzsoft.com> | ||
* | ||
* Copyright (C) 2020 James Taylor | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.jmzsoft.buddyscanner; | ||
|
||
public class Item { | ||
|
||
private String itemId; | ||
private String value; | ||
|
||
public Item(String _itemId, String _value) { | ||
itemId = _itemId; | ||
value = _value; | ||
} | ||
|
||
public String getItemId() { | ||
return itemId; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
} |
Oops, something went wrong.