Skip to content
This repository has been archived by the owner on Feb 13, 2025. It is now read-only.

Commit

Permalink
Merge branch 'release/v2.2'
Browse files Browse the repository at this point in the history
* release/v2.2: (64 commits)
  Updated readme
  Added release binaries
  Updated copyright
  Bump version
  Fixed addon category/action
  Updated addon spec
  Updated read min requirements
  Updated screenshots
  Added duplicate feature
  Added imeoption and hide keyboard functionality
  Tidied layout
  Added basic image description functionality
  Updated dependencies and build tools
  New icon
  Removed icon sketch file
  Send update broadcast on activity resume
  Set base activity
  Added app type meta data for GrowUpdater
  Added custom addon action for GrowUpdater (optional addon)
  Created alpha1 binaries
  ...
  • Loading branch information
7LPdWcaW committed Feb 24, 2017
2 parents bfbf8f7 + 86d0c90 commit 7fd60a8
Show file tree
Hide file tree
Showing 79 changed files with 1,915 additions and 245 deletions.
56 changes: 56 additions & 0 deletions ADDONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Addons

Grow tracker has a basic implementation for addons via the use of Broadcast Intents.

## Meta data

You should provide the following meta-data tags for your addon application

|key|type|description|
|---|---|---|
|`me.anon.grow.ADDON_NAME`|String|Name of your application addon|
|`me.anon.grow.ADDON_VERSION`|String|Version of your application addon|

## Available broadcasts

Currently the available broadcasts you can listen for include

### `me.anon.grow.ACTION_SAVE_PLANTS`

This broadcast action is called when the plant list json is saved, an image has been saved, or when an image has been deleted.

Data is provided with the broadcast intent via the bundle

|key|type|description|
|---|---|---|
|`me.anon.grow.PLANT_LIST`|String|Full json-encoded array of plants and its data.|
|`me.anon.grow.ENCRYPTED`|Boolean|If this is true, `me.anon.grow.PLANT_LIST` will be encrypted and base64 encoded, images will be encrypted on disk|
|`me.anon.grow.IMAGE_ADDED`|String|Path to image added|
|`me.anon.grow.IMAGE_DELETED`|String|Path to deleted image|

Example receiver:

```xml
<receiver android:name=".CloudSyncBroadcastReceiver" android:exported="true" android:enabled="true">
<intent-filter>
<action android:name="me.anon.grow.ACTION_SAVE_PLANTS" />
</intent-filter>
</receiver>
```

`Note:` you must include the `android:exported="true"` and `android:enabled="true"` parameters.

## Configuring your addon

You can register an activity with the receiver for configuration purposes by using the `me.anon.grow.ADDON_CONFIGURATION` intent-filter category.

`Note:` The `action` for the intent-filter must be the action of the intent-filter of the addon (e.g. `me.anon.grow.ACTION_SAVE_PLANTS`)

```xml
<activity android:name=".ConfigureActivity">
<intent-filter>
<action android:name="me.anon.grow.ACTION_SAVE_PLANTS" />
<category android:name="me.anon.grow.ADDON_CONFIGURATION" />
</intent-filter>
</activity>
```
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@

Welcome to grow tracker. This app was created to help record data about growing plants in order to monitor the growing conditions to help make the plants grow better, and identify potential issues during the grow process.

[Latest APK: (MD5) 57ff9134cb517200a8ebffac5bff2b8a v2.1](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-production-release.apk)
[Latest APK: (MD5) 494a35112fa7e46403ff169f94fda9ab v2.2](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-production-release.apk)

[Latest APK (Discrete): (MD5) db92a90c3bcd596e3bc10316180808b1 v2.1](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-discrete-release.apk)
[Latest APK (Discrete): (MD5) 3b2e3a2664777b2032ca09da2771241b v2.2](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-discrete-release.apk)

# Installation

The app requires no permissions except for external storage (for caching plant data and images) which you can see [here](https://github.com/7LPdWcaW/GrowTracker-Android/blob/develop/app/src/main/AndroidManifest.xml) in order for users to maintain anonymity, and a minimum Android version of `4.0.3` and above
The app requires no permissions except for external storage (for caching plant data and images) which you can see [here](https://github.com/7LPdWcaW/GrowTracker-Android/blob/develop/app/src/main/AndroidManifest.xml) in order for users to maintain anonymity, and a minimum Android version of `4.2` and above

# Addons

On documentation on creating addons, please see [ADDONS.md](ADDONS.md)

## How to install

1. Follow [this guide](https://gameolith.uservoice.com/knowledgebase/articles/76902-android-4-0-tablets-allowing-app-installs-from) to enable unknown sources
2. Download the APK from [here](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-release.apk)
2. Download the APK from [here](https://github.com/7LPdWcaW/GrowTracker-Android/releases)
3. Click on downloaded app and install

**For updates, do not uninstall first, you will lose your existing plant data**
Expand Down Expand Up @@ -150,7 +154,7 @@ You can decrypt your files using your passphrase either by writing a script that

#License

Copyright 2014-2016 7LPdWcaW
Copyright 2014-2017 7LPdWcaW

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Binary file modified app/app-discrete-release.apk
Binary file not shown.
Binary file modified app/app-production-release.apk
Binary file not shown.
30 changes: 20 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ repositories {
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
applicationId "me.anon.grow"
minSdkVersion 15
targetSdkVersion 24
versionCode 7
versionName "2.1"
minSdkVersion 17
targetSdkVersion 25
versionCode 9
versionName "2.2"
}

lintOptions {
Expand All @@ -23,20 +23,30 @@ android {
productFlavors {
production {
buildConfigField "Boolean", "DISCRETE", "false"

manifestPlaceholders = [
"appType": "original"
]
}

discrete {
buildConfigField "Boolean", "DISCRETE", "true"

manifestPlaceholders = [
"appType": "discrete"
]
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile "com.android.support:exifinterface:25.1.0"

compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup:otto:1.3.8'
compile 'com.kennyc:snackbar:2.0.2'
Expand Down
22 changes: 21 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,31 @@
/>
</provider>

<receiver android:name="me.anon.controller.provider.PlantWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_RESIZE" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/plant_widget"
/>
</receiver>

<activity android:name=".BootActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

<activity android:name=".PlantSelectActivity" android:theme="@style/Theme.Transparent">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>

<activity android:name=".MainActivity" />
<activity android:name=".AddPlantActivity" />
<activity android:name=".AddWateringActivity" />
Expand All @@ -39,7 +57,9 @@
<activity android:name=".EventsActivity" />
<activity android:name=".StatisticsActivity" />
<activity android:name=".SettingsActivity" />
<activity android:name=".fragment.ImageLightboxDialog" android:theme="@style/fullscreen" />
<activity android:name=".fragment.ImageLightboxDialog" android:theme="@style/fullscreen" android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".PlantDetailsActivity" android:windowSoftInputMode="stateAlwaysHidden" />

<meta-data android:name="me.anon.grow.APP_TYPE" android:value="${appType}" />
</application>
</manifest>
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 85 additions & 2 deletions app/src/main/java/me/anon/controller/adapter/ActionAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,25 @@

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;

import lombok.Getter;
import lombok.Setter;
import me.anon.grow.R;
import me.anon.lib.DateRenderer;
import me.anon.lib.Unit;
import me.anon.lib.helper.ModelHelper;
import me.anon.lib.helper.TimeHelper;
import me.anon.model.Action;
import me.anon.model.Additive;
import me.anon.model.EmptyAction;
import me.anon.model.NoteAction;
import me.anon.model.Plant;
import me.anon.model.StageChange;
import me.anon.model.Water;
import me.anon.view.ActionHolder;
Expand All @@ -52,9 +57,16 @@ public interface OnActionSelectListener
}

@Setter private OnActionSelectListener onActionSelectListener;
@Getter @Setter private List<Action> actions = new ArrayList<>();
@Getter private Plant plant;
@Getter private List<Action> actions = new ArrayList<>();
@Getter private Unit measureUnit, deliveryUnit;

public void setActions(Plant plant, List<Action> actions)
{
this.plant = plant;
this.actions = actions;
}

@Override public ActionHolder onCreateViewHolder(ViewGroup viewGroup, int i)
{
return new ActionHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.action_item, viewGroup, false));
Expand All @@ -79,9 +91,80 @@ public interface OnActionSelectListener
DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(viewHolder.getDate().getContext());
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(viewHolder.getDate().getContext());

String fullDateStr = dateFormat.format(new Date(action.getDate())) + " " + timeFormat.format(new Date(action.getDate()));
Date actionDate = new Date(action.getDate());
Calendar actionCalendar = GregorianCalendar.getInstance();
actionCalendar.setTime(actionDate);
String fullDateStr = dateFormat.format(actionDate) + " " + timeFormat.format(actionDate);
String dateStr = "<b>" + new DateRenderer().timeAgo(action.getDate()).formattedDate + "</b> ago";

String dateDayStr = actionCalendar.get(Calendar.DAY_OF_MONTH) + " " + actionCalendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault());

if (viewHolder.getDateDay() != null)
{
String lastDateStr = "";

if (i - 1 >= 0)
{
Date lastActionDate = new Date(actions.get(i - 1).getDate());
Calendar lastActionCalendar = GregorianCalendar.getInstance();
lastActionCalendar.setTime(lastActionDate);
lastDateStr = lastActionCalendar.get(Calendar.DAY_OF_MONTH) + " " + lastActionCalendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault());
}

if (!lastDateStr.equalsIgnoreCase(dateDayStr))
{
viewHolder.getDateDay().setText(Html.fromHtml(dateDayStr));

String stageDay = "";
StageChange current = null;
StageChange previous = null;

for (int actionIndex = i; actionIndex < actions.size(); actionIndex++)
{
if (actions.get(actionIndex) instanceof StageChange)
{
if (current == null)
{
current = (StageChange)actions.get(actionIndex);
}
else if (previous == null)
{
previous = (StageChange)actions.get(actionIndex);
}
}
}

int totalDays = (int)TimeHelper.toDays(Math.abs(action.getDate() - plant.getPlantDate()));
stageDay += totalDays;

if (previous == null)
{
previous = current;
}

if (current != null)
{
if (action == current)
{
int currentDays = (int)TimeHelper.toDays(Math.abs(current.getDate() - previous.getDate()));
stageDay += "/" + currentDays + previous.getNewStage().getPrintString().substring(0, 1).toLowerCase();
}
else
{
int currentDays = (int)TimeHelper.toDays(Math.abs(action.getDate() - current.getDate()));
stageDay += "/" + currentDays + current.getNewStage().getPrintString().substring(0, 1).toLowerCase();
}
}

viewHolder.getStageDay().setText(stageDay);
}
else
{
viewHolder.getDateDay().setText("");
viewHolder.getStageDay().setText("");
}
}

if (i > 0)
{
long difference = actions.get(i - 1).getDate() - action.getDate();
Expand Down
Loading

0 comments on commit 7fd60a8

Please sign in to comment.