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
75 changes: 66 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,96 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Build the app
run: ./gradlew build

- name: Sign debug apk with debug key
uses: ilharp/sign-android-release@v1
if: ${{ env.KEGBOT_DEBUG_KEYSTORE != '' }}
uses: ilharp/sign-android-release@v2
id: sign_debug_apk
with:
releaseDir: kegtab/build/outputs/apk/debug
signingKey: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
keyAlias: kegbot-debug
keyStorePassword: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}
env:
KEGBOT_DEBUG_KEYSTORE: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
ANDROID_SIGNING_KEY: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
ANDROID_KEY_ALIAS: kegbot-debug
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}
ANDROID_KEY_PASSWORD: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}

- name: Archive debug APK
uses: actions/upload-artifact@v3
- name: Archive signed debug APK
if: ${{ env.KEGBOT_DEBUG_KEYSTORE != '' }}
uses: actions/upload-artifact@v4
env:
KEGBOT_DEBUG_KEYSTORE: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
with:
name: kegtab-debug
name: kegtab-debug-signed
path: ${{ steps.sign_debug_apk.outputs.signedFile }}

- name: Archive unsigned debug APK
if: ${{ env.KEGBOT_DEBUG_KEYSTORE == '' }}
uses: actions/upload-artifact@v4
env:
KEGBOT_DEBUG_KEYSTORE: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
with:
name: kegtab-debug-unsigned
path: kegtab/build/outputs/apk/debug/*.apk

- name: Sign release apk with debug key
uses: ilharp/sign-android-release@v1
if: ${{ env.KEGBOT_DEBUG_KEYSTORE != '' }}
uses: ilharp/sign-android-release@v2
id: sign_release_apk
with:
releaseDir: kegtab/build/outputs/apk/release
signingKey: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
keyAlias: kegbot-debug
keyStorePassword: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}
env:
KEGBOT_DEBUG_KEYSTORE: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
ANDROID_SIGNING_KEY: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
ANDROID_KEY_ALIAS: kegbot-debug
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}
ANDROID_KEY_PASSWORD: ${{ secrets.KEGBOT_DEBUG_KEYSTORE_PASSWORD }}

- name: Archive release APK
uses: actions/upload-artifact@v3
- name: Archive signed release APK
if: ${{ env.KEGBOT_DEBUG_KEYSTORE != '' }}
uses: actions/upload-artifact@v4
env:
KEGBOT_DEBUG_KEYSTORE: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
with:
name: kegtab-release
name: kegtab-release-signed
path: ${{ steps.sign_release_apk.outputs.signedFile }}

- name: Archive unsigned release APK
if: ${{ env.KEGBOT_DEBUG_KEYSTORE == '' }}
uses: actions/upload-artifact@v4
env:
KEGBOT_DEBUG_KEYSTORE: ${{ secrets.KEGBOT_DEBUG_KEYSTORE }}
with:
name: kegtab-release-unsigned
path: kegtab/build/outputs/apk/release/*.apk
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ local.properties
proguard/

kegtab/crashlytics.properties
.vscode
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,29 @@ Home page: http://kegbot.org/
Developers: Quick Setup Instructions
------------------------------------

Bear with us as better develop documentation is coming!

In the meantime, here are quick and dirty steps:

- Clone the kegbot-android repo
### Prerequisites

- Java 17 or higher (required for Android Gradle Plugin 8.x)
- Android SDK
- Android Studio or compatible IDE

### Setup Steps

1. Clone the kegbot-android repo
2. Copy `local.properties.template` to `local.properties`
3. Edit `local.properties` to set your Android SDK path:
```
sdk.dir=/path/to/your/android/sdk
```
4. Set up Java 17:
- **Option A**: Set `JAVA_HOME` environment variable to your Java 17 installation
- **Option B**: Add `org.gradle.java.home=/path/to/your/java17` to `local.properties`
5. Build the project:
```bash
./gradlew build
```

### For Eclipse Users (Legacy)
- Eclipse: Import -> Existing Projects into Workspace.
- Import the projects (Kegtab, KegtabTest)

Expand All @@ -39,4 +57,3 @@ LICENSE.txt for the full license.

The Kegbot name and logo are trademarks of the Kegbot project; please don't
reuse them without our permission.

5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ buildscript {
repositories {
mavenCentral()
google()
maven {
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.android.tools.build:gradle:8.1.0'
}
}

Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
android.enableJetifier=true
android.useAndroidX=true

# Set Gradle to use Java 17 for Android Gradle Plugin 8.x compatibility
# Configure JAVA_HOME environment variable or set org.gradle.java.home in your local gradle.properties
# Example: org.gradle.java.home=/path/to/your/java17/installation
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
16 changes: 11 additions & 5 deletions kegtab/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.android.tools.build:gradle:8.1.0'
}
}

Expand All @@ -40,21 +40,26 @@ repositories {
}

android {
compileSdkVersion 30
namespace 'org.kegbot.app'
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 17
targetSdkVersion 30
targetSdkVersion 33
multiDexEnabled true

testApplicationId "org.kegbot.app.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}

buildFeatures {
buildConfig = true
}

lintOptions {
checkReleaseBuilds true
abortOnError false
Expand Down Expand Up @@ -96,15 +101,16 @@ dependencies {
implementation 'com.squareup.okhttp:okhttp:2.0.0'
implementation 'com.squareup:otto:1.3.4'
implementation 'com.google.guava:guava:31.1-android'
implementation 'com.jakewharton:butterknife:4.0.1'
annotationProcessor 'com.jakewharton:butterknife:4.0.1'
implementation 'com.jakewharton:butterknife:6.1.0'
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
implementation 'com.github.kevinsawicki:http-request:5.6'
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.7.4'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.google.protobuf:protobuf-java:3.12.0'
implementation 'joda-time:joda-time:2.3'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'commons-codec:commons-codec:1.13'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'

androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.1'
androidTestImplementation 'org.mockito:mockito-core:1.9.5'
Expand Down
2 changes: 1 addition & 1 deletion kegtab/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
4 changes: 3 additions & 1 deletion kegtab/proguard-project.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
-dontwarn org.codehaus.jackson.** # jackson
-dontwarn android.net.http.**
-dontwarn org.joda.**
-dontwarn javax.lang.model.**
-dontwarn javax.annotation.processing.**
-dontwarn com.google.errorprone.annotations.**

-dontwarn butterknife.internal.**
-dontwarn com.squareup.okhttp.**
Expand All @@ -45,4 +48,3 @@
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

32 changes: 16 additions & 16 deletions kegtab/src/main/java/org/kegbot/app/CoreActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,22 @@ public boolean onCreateOptionsMenu(Menu menu) {

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Intent intent = new Intent(this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
case R.id.alertUpdate:
Intent marketIntent = new Intent(Intent.ACTION_VIEW);
marketIntent.setData(Uri.parse("market://details?id=org.kegbot.app"));
PinActivity.startThroughPinActivity(this, marketIntent);
return true;
case R.id.alertGeneral:
AlertActivity.showDialogs(this);
return true;
default:
return super.onOptionsItemSelected(item);
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
Intent intent = new Intent(this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
} else if (itemId == R.id.alertUpdate) {
Intent marketIntent = new Intent(Intent.ACTION_VIEW);
marketIntent.setData(Uri.parse("market://details?id=org.kegbot.app"));
PinActivity.startThroughPinActivity(this, marketIntent);
return true;
} else if (itemId == R.id.alertGeneral) {
AlertActivity.showDialogs(this);
return true;
} else {
return super.onOptionsItemSelected(item);
}
}

Expand Down
27 changes: 13 additions & 14 deletions kegtab/src/main/java/org/kegbot/app/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,19 @@ protected void onPause() {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final int itemId = item.getItemId();
switch (itemId) {
case R.id.settings:
SettingsActivity.startSettingsActivity(this);
return true;
case R.id.manageTaps:
TapListActivity.startActivity(this);
return true;
case R.id.bugreport:
BugreportActivity.startBugreportActivity(this);
return true;
case android.R.id.home:
return true;
default:
return super.onOptionsItemSelected(item);
if (itemId == R.id.settings) {
SettingsActivity.startSettingsActivity(this);
return true;
} else if (itemId == R.id.manageTaps) {
TapListActivity.startActivity(this);
return true;
} else if (itemId == R.id.bugreport) {
BugreportActivity.startBugreportActivity(this);
return true;
} else if (itemId == android.R.id.home) {
return true;
} else {
return super.onOptionsItemSelected(item);
}
}

Expand Down
19 changes: 19 additions & 0 deletions kegtab/src/main/java/org/kegbot/app/config/AppConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,23 @@ public int getNetworkControllerPort() {
return Integer.valueOf(get(ConfigKey.NETWORK_CONTROLLER_PORT)).intValue();
}

public String getMqttServer() {
return get(ConfigKey.MQTT_SERVER);
}

public int getMqttPort() {
return Integer.valueOf(get(ConfigKey.MQTT_PORT)).intValue();
}

public String getMqttUsername() {
return get(ConfigKey.MQTT_USERNAME);
}

public String getMqttPassword() {
return get(ConfigKey.MQTT_PASSWORD);
}

public String getMqttTopicPrefix() {
return get(ConfigKey.MQTT_TOPIC_PREFIX);
}
}
8 changes: 6 additions & 2 deletions kegtab/src/main/java/org/kegbot/app/config/ConfigKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ enum ConfigKey {
LAST_USED_KEG_SIZE(""),

NETWORK_CONTROLLER_HOST(""),
NETWORK_CONTROLLER_PORT("8321");
NETWORK_CONTROLLER_PORT("8321"),

MQTT_SERVER(""),
MQTT_PORT("1883"),
MQTT_USERNAME(""),
MQTT_PASSWORD(""),
MQTT_TOPIC_PREFIX("kegbot");

private final String mDefaultValue;

Expand All @@ -90,4 +95,3 @@ String getDefault() {
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,12 @@ public String validate() {
final RadioGroup group = ButterKnife.findById(mView, R.id.backend_group);
final int checkedId = group.getCheckedRadioButtonId();

switch (checkedId) {
case R.id.radio_backend_local:
prefs.setIsLocalBackend(true);
break;
case R.id.radio_backend_server:
prefs.setIsLocalBackend(false);
break;
default:
return "Please select one of the backend modes.";
if (checkedId == R.id.radio_backend_local) {
prefs.setIsLocalBackend(true);
} else if (checkedId == R.id.radio_backend_server) {
prefs.setIsLocalBackend(false);
} else {
return "Please select one of the backend modes.";
}

return "";
Expand Down
Loading