Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
James Taylor committed Mar 26, 2020
0 parents commit 0bad185
Show file tree
Hide file tree
Showing 43 changed files with 2,014 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
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
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions README.md
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)
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
36 changes: 36 additions & 0 deletions app/build.gradle
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'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
32 changes: 32 additions & 0 deletions app/release/output.json
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"
}
]
}
28 changes: 28 additions & 0 deletions app/src/main/AndroidManifest.xml
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 app/src/main/java/com/jmzsoft/buddyscanner/Internet.java
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");
}
}
41 changes: 41 additions & 0 deletions app/src/main/java/com/jmzsoft/buddyscanner/Item.java
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;
}
}

0 comments on commit 0bad185

Please sign in to comment.