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.1'
Browse files Browse the repository at this point in the history
* release/v2.1: (36 commits)
  Updated binaries
  Added units for export log
  Updated model in ready html
  Fixed crash with pre 2.0 data
  Added delivery unit to plant list
  Updated build tools version
  Set drawer version
  Added binaries
  Updated icon
  Updated read with new screenshots
  Updated icon
  Bump version code
  Added missing delivery unit for additives
  Reduced margin from date
  Tidied margins and paddings to give overflow larger hit aera
  Added additive validation
  Corrected defaults
  Updated action adapter and watering fragment for new delivery unit
  Fixed renamed method and implemented Unit methods
  Corrected setting summary on change
  ...
  • Loading branch information
7LPdWcaW committed Nov 17, 2016
2 parents 2302650 + 9a40517 commit bfbf8f7
Show file tree
Hide file tree
Showing 38 changed files with 605 additions and 123 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

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) de708f0b7905ea193b6f414eedc7b3e4 v2.0](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-production-release.apk)
[Latest APK: (MD5) 57ff9134cb517200a8ebffac5bff2b8a v2.1](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-production-release.apk)

[Latest APK (Discrete): (MD5) 07fd56b31391b955f6321396d77ef115 v2.0](https://github.com/7LPdWcaW/GrowTracker-Android/raw/master/app/app-discrete-release.apk)
[Latest APK (Discrete): (MD5) db92a90c3bcd596e3bc10316180808b1 v2.1](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.
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

## How to install

Expand All @@ -35,6 +35,7 @@ The app requires no permissions except for external storage (for caching plant d
[![action filters](screenshots/9-thumb.png)](screenshots/9.png)
[![action options](screenshots/10-thumb.png)](screenshots/10.png)
[![settings](screenshots/11-thumb.png)](screenshots/11.png)
[![measurements](screenshots/12-thumb.png)](screenshots/12.png)

# About the app

Expand Down Expand Up @@ -87,7 +88,7 @@ Water action for waterings
"ph": <Double>,
"ppm": <Long>,
"runoff": <Double>,
"amount": <Integer>,
"amount": <Double>,
"date": 1431268453111,
"type": "Water",
"temp": <Integer>
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.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ repositories {

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
buildToolsVersion "24.0.3"

defaultConfig {
applicationId "me.anon.grow"
minSdkVersion 15
targetSdkVersion 24
versionCode 6
versionName "2.0"
versionCode 7
versionName "2.1"
}

lintOptions {
Expand Down
Binary file modified app/src/discrete/res/mipmap-hdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/discrete/res/mipmap-mdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/discrete/res/mipmap-xhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/discrete/res/mipmap-xxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/discrete/res/mipmap-xxxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
android:theme="@style/AppTheme"
android:name=".MainApplication"
>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"
/>
</provider>

<activity android:name=".BootActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h3>Action object (water)</h3>
"ph": &lt;Double&gt;,
"ppm": &lt;Long&gt;,
"runoff": &lt;Double&gt;,
"amount": &lt;Integer&gt;,
"amount": &lt;Double&gt;,
"date": 1431268453111,
"type": "Water"
}
Expand Down
30 changes: 26 additions & 4 deletions app/src/main/java/me/anon/controller/adapter/ActionAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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.model.Action;
import me.anon.model.Additive;
Expand All @@ -31,6 +32,8 @@
import me.anon.model.Water;
import me.anon.view.ActionHolder;

import static me.anon.lib.Unit.ML;

/**
* // TODO: Add class description
*
Expand All @@ -50,6 +53,7 @@ public interface OnActionSelectListener

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

@Override public ActionHolder onCreateViewHolder(ViewGroup viewGroup, int i)
{
Expand All @@ -60,6 +64,16 @@ public interface OnActionSelectListener
{
final Action action = actions.get(i);

if (measureUnit == null)
{
measureUnit = Unit.getSelectedMeasurementUnit(viewHolder.itemView.getContext());
}

if (deliveryUnit == null)
{
deliveryUnit = Unit.getSelectedDeliveryUnit(viewHolder.itemView.getContext());
}

if (action == null) return;

DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(viewHolder.getDate().getContext());
Expand Down Expand Up @@ -117,8 +131,9 @@ public interface OnActionSelectListener
if (((Water)action).getAmount() != null)
{
waterStr.append("<b>Amount: </b>");
waterStr.append(((Water)action).getAmount());
waterStr.append("ml, ");
waterStr.append(ML.to(deliveryUnit, ((Water)action).getAmount()));
waterStr.append(deliveryUnit.getLabel());
waterStr.append(", ");
}

if (((Water)action).getTemp() != null)
Expand All @@ -138,11 +153,18 @@ public interface OnActionSelectListener

for (Additive additive : ((Water)action).getAdditives())
{
if (additive == null || additive.getAmount() == null) continue;

double converted = ML.to(measureUnit, additive.getAmount());
String amountStr = converted == Math.floor(converted) ? String.valueOf((int)converted) : String.valueOf(converted);

waterStr.append("<br/>&nbsp;&nbsp;&nbsp;&nbsp;• ");
waterStr.append(additive.getDescription());
waterStr.append(" - ");
waterStr.append(additive.getAmount());
waterStr.append("ml/l");
waterStr.append(amountStr);
waterStr.append(measureUnit.getLabel());
waterStr.append("/");
waterStr.append(deliveryUnit.getLabel());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import me.anon.grow.PlantDetailsActivity;
import me.anon.grow.R;
import me.anon.lib.DateRenderer;
import me.anon.lib.Unit;
import me.anon.lib.helper.TimeHelper;
import me.anon.lib.manager.PlantManager;
import me.anon.model.Action;
Expand All @@ -30,6 +31,8 @@
import me.anon.model.Water;
import me.anon.view.PlantHolder;

import static me.anon.lib.Unit.ML;

/**
* // TODO: Add class description
*
Expand All @@ -41,10 +44,14 @@ public class PlantAdapter extends RecyclerView.Adapter<PlantHolder> implements I
{
@Getter private List<Plant> plants = new ArrayList<>();
private Context context;
@Getter private Unit measureUnit, deliveryUnit;

public PlantAdapter(Context context)
{
this.context = context;

measureUnit = Unit.getSelectedMeasurementUnit(context);
deliveryUnit = Unit.getSelectedDeliveryUnit(context);
}

public void setPlants(List<Plant> plants)
Expand Down Expand Up @@ -117,7 +124,7 @@ public void setPlants(List<Plant> plants)

if (lastWater.getAmount() != null)
{
summary += "<b>" + lastWater.getAmount() + "ml</b>";
summary += "<b>" + ML.to(deliveryUnit, lastWater.getAmount()) + deliveryUnit.getLabel() + "</b>";
}
}
}
Expand Down
25 changes: 23 additions & 2 deletions app/src/main/java/me/anon/grow/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
Expand Down Expand Up @@ -66,8 +68,18 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On

if (savedInstanceState == null)
{
navigation.getMenu().findItem(R.id.all).setChecked(true);
onNavigationItemSelected(navigation.getMenu().findItem(R.id.all));
int defaultGarden = PreferenceManager.getDefaultSharedPreferences(this).getInt("default_garden", -1);

if (defaultGarden == -1)
{
navigation.getMenu().findItem(R.id.all).setChecked(true);
onNavigationItemSelected(navigation.getMenu().findItem(R.id.all));
}
else
{
navigation.getMenu().findItem(100 + defaultGarden).setChecked(true);
onNavigationItemSelected(navigation.getMenu().findItem(100 + defaultGarden));
}
}
else
{
Expand Down Expand Up @@ -110,6 +122,15 @@ public void setNavigationView()
{
item.setChecked(true);
}

try
{
navigation.getMenu().findItem(R.id.version).setTitle("Version " + getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
}
catch (PackageManager.NameNotFoundException e)
{
e.printStackTrace();
}
}

@Subscribe public void onGargenChangeEvent(GardenChangeEvent event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import lombok.Setter;
import me.anon.grow.R;
import me.anon.lib.Unit;
import me.anon.lib.Views;
import me.anon.model.Additive;

Expand Down Expand Up @@ -52,33 +53,23 @@ public AddAdditiveDialogFragment()
View view = getActivity().getLayoutInflater().inflate(R.layout.additives_dialog_view, null, false);
Views.inject(this, view);

final Unit selectedUnit = Unit.getSelectedMeasurementUnit(getActivity());

amount.setHint(selectedUnit.getLabel());

if (additive != null)
{
double converted = Unit.ML.to(selectedUnit, additive.getAmount());
String amountStr = converted == Math.floor(converted) ? String.valueOf((int)converted) : String.valueOf(converted);

description.setText(additive.getDescription());
amount.setText(String.valueOf(additive.getAmount()));
amount.setText(amountStr);
}

final AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setTitle("Additive")
.setView(view)
.setPositiveButton("Ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton)
{
Additive additive = new Additive();

String desc = TextUtils.isEmpty(description.getText()) ? null : description.getText().toString();
Double amt = TextUtils.isEmpty(amount.getText()) ? 0 : Double.valueOf(amount.getText().toString());

additive.setDescription(desc);
additive.setAmount(amt);

if (onAdditiveSelectedListener != null)
{
onAdditiveSelectedListener.onAdditiveSelected(additive);
}
}
})
.setPositiveButton("Ok", null)
.setNeutralButton("Delete", new DialogInterface.OnClickListener()
{
@Override public void onClick(DialogInterface dialog, int which)
Expand All @@ -102,6 +93,34 @@ public void onClick(DialogInterface dialog, int whichButton)
@Override public void onShow(DialogInterface dialogInterface)
{
dialog.getButton(Dialog.BUTTON_NEUTRAL).setVisibility(additive == null ? View.GONE : View.VISIBLE);
dialog.getButton(Dialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener()
{
@Override public void onClick(View v)
{
description.setError(null);

Additive additive = new Additive();

String desc = TextUtils.isEmpty(description.getText()) ? null : description.getText().toString();
Double amt = TextUtils.isEmpty(amount.getText()) ? 0 : Double.valueOf(amount.getText().toString());

if (desc == null)
{
description.setError("Field is required");
return;
}

additive.setDescription(desc);
additive.setAmount(selectedUnit.to(Unit.ML, amt));

if (onAdditiveSelectedListener != null)
{
onAdditiveSelectedListener.onAdditiveSelected(additive);
}

dialog.dismiss();
}
});
}
});

Expand Down
Loading

0 comments on commit bfbf8f7

Please sign in to comment.