Skip to content

Commit

Permalink
Merge branch 'release/v2.5'
Browse files Browse the repository at this point in the history
* release/v2.5: (27 commits)
  Updates readme for new binaries
  Bumps versioncode
  Updates readme and moves screenshots
  Adds reverse plant list order setting
  Fixes issue with landscape stats view and adds seedling time
  Adds seedling stage
  Fixes incorrect calculations for stage dates
  Adds stage time to photo lightbox
  Fixes issue with action text getting cut off
  Links planted action with plant date
  Adds backup size limit setting
  Adds null catch for decrypt stream
  Replaces checkbox with switch pref and adds support for restoring from encrypted files
  Prevent backup in failsafe mode and file extension for encrypted files
  Adds boolean extentions
  Adds overrides
  Prevents backing up after failed restore
  Adds backup size to selector and adds null/empty check
  Fixes issue with layout text overlaying
  Makes export a service
  ...
  • Loading branch information
7LPdWcaW committed Jun 22, 2019
2 parents 2336b65 + eaae13d commit 17ff5e8
Show file tree
Hide file tree
Showing 76 changed files with 1,180 additions and 624 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

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) 0afd3816fd71d77282f2a48efa265b71 v2.4.1](https://github.com/7LPdWcaW/GrowTracker-Android/releases/download/v2.4.1/v2.4.1-production.apk)
[Latest APK: (MD5) aa3496894c364a766145a576122e3ee6 v2.5](https://github.com/7LPdWcaW/GrowTracker-Android/releases/download/v2.5/v2.5-production.apk)

[Latest APK (Discrete): (MD5) 075a079e1e7697db54cf86180fc56e58 v2.4.1](https://github.com/7LPdWcaW/GrowTracker-Android/releases/download/v2.4.1/v2.4.1-discrete.apk)
[Latest APK (Discrete): (MD5) 0f68525415eb2fc3c77184cdb3c51443 v2.5](https://github.com/7LPdWcaW/GrowTracker-Android/releases/download/v2.5/v2.5-discrete.apk)

[Get it on F-Droid with automatic updates](https://f-droid.org/packages/me.anon.grow/)

Expand Down Expand Up @@ -32,27 +32,27 @@ You can either elect to update manually, or get notified on releases by installi

# Screenshots

[![install](screenshots/install-thumb.png)](screenshots/install.png)
[![plant list](screenshots/1-thumb.png)](screenshots/1.png)
[![discrete plant list](screenshots/1b-thumb.png)](screenshots/1b.png)
[![discrete plant list](screenshots/1c-thumb.png)](screenshots/1c.png)
[![discrete plant list](screenshots/1d-thumb.png)](screenshots/1d.png)
[![discrete plant list](screenshots/1e-thumb.png)](screenshots/1e.png)
[![plant details](screenshots/2-thumb.png)](screenshots/2.png)
[![feeding](screenshots/3-thumb.png)](screenshots/3.png)
[![nutrients](screenshots/4-thumb.png)](screenshots/4.png)
[![nutrients](screenshots/4b-thumb.png)](screenshots/4b.png)
[![actions](screenshots/5-thumb.png)](screenshots/5.png)
[![pictures](screenshots/6-thumb.png)](screenshots/6.png)
[![statistics](screenshots/7-thumb.png)](screenshots/7.png)
[![past actions](screenshots/8-thumb.png)](screenshots/8.png)
[![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)
[![schedules](screenshots/13-thumb.png)](screenshots/13.png)
[![schedule details](screenshots/14-thumb.png)](screenshots/14.png)
[![schedule date](screenshots/15-thumb.png)](screenshots/15.png)
[![install](metadata/images/phoneScreenshotsThumbs/install-thumb.png)](metadata/images/phoneScreenshots/install.png)
[![plant list](metadata/images/phoneScreenshotsThumbs/1-thumb.png)](metadata/images/phoneScreenshots/1.png)
[![discrete plant list](metadata/images/phoneScreenshotsThumbs/1b-thumb.png)](metadata/images/phoneScreenshots/1b.png)
[![discrete plant list](metadata/images/phoneScreenshotsThumbs/1c-thumb.png)](metadata/images/phoneScreenshots/1c.png)
[![discrete plant list](metadata/images/phoneScreenshotsThumbs/1d-thumb.png)](metadata/images/phoneScreenshots/1d.png)
[![discrete plant list](metadata/images/phoneScreenshotsThumbs/1e-thumb.png)](metadata/images/phoneScreenshots/1e.png)
[![plant details](metadata/images/phoneScreenshotsThumbs/2-thumb.png)](metadata/images/phoneScreenshots/2.png)
[![feeding](metadata/images/phoneScreenshotsThumbs/3-thumb.png)](metadata/images/phoneScreenshots/3.png)
[![nutrients](metadata/images/phoneScreenshotsThumbs/4-thumb.png)](metadata/images/phoneScreenshots/4.png)
[![nutrients](metadata/images/phoneScreenshotsThumbs/4b-thumb.png)](metadata/images/phoneScreenshots/4b.png)
[![actions](metadata/images/phoneScreenshotsThumbs/5-thumb.png)](metadata/images/phoneScreenshots/5.png)
[![pictures](metadata/images/phoneScreenshotsThumbs/6-thumb.png)](metadata/images/phoneScreenshots/6.png)
[![statistics](metadata/images/phoneScreenshotsThumbs/7-thumb.png)](metadata/images/phoneScreenshots/7.png)
[![past actions](metadata/images/phoneScreenshotsThumbs/8-thumb.png)](metadata/images/phoneScreenshots/8.png)
[![action filters](metadata/images/phoneScreenshotsThumbs/9-thumb.png)](metadata/images/phoneScreenshots/9.png)
[![action options](metadata/images/phoneScreenshotsThumbs/10-thumb.png)](metadata/images/phoneScreenshots/10.png)
[![settings](metadata/images/phoneScreenshotsThumbs/11-thumb.png)](metadata/images/phoneScreenshots/11.png)
[![measurements](metadata/images/phoneScreenshotsThumbs/12-thumb.png)](metadata/images/phoneScreenshots/12.png)
[![schedules](metadata/images/phoneScreenshotsThumbs/13-thumb.png)](metadata/images/phoneScreenshots/13.png)
[![schedule details](metadata/images/phoneScreenshotsThumbs/14-thumb.png)](metadata/images/phoneScreenshots/14.png)
[![schedule date](metadata/images/phoneScreenshotsThumbs/15-thumb.png)](metadata/images/phoneScreenshots/15.png)

# About the app

Expand Down Expand Up @@ -88,7 +88,7 @@ One of,

One of,

`PLANTED`, `GERMINATION`, `CUTTING`, `VEGETATION`, `FLOWER`, `DRYING`, `CURING`, `HARVESTED`
`PLANTED`, `GERMINATION`, `SEEDLING`, `CUTTING`, `VEGETATION`, `FLOWER`, `DRYING`, `CURING`, `HARVESTED`

### Action object (feeding)

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "me.anon.grow"
minSdkVersion 17
targetSdkVersion 28
versionCode 20
versionName "2.4.1"
versionCode 21
versionName "2.5"

javaCompileOptions {
annotationProcessorOptions {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/>
</provider>

<service android:name=".service.ExportService" android:enabled="true" android:exported="false" />
<receiver android:name="me.anon.controller.receiver.BackupService" />

<receiver android:name="me.anon.controller.provider.PlantWidgetProvider">
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 @@ -33,7 +33,7 @@ <h3>Medium (ENUM)</h3>
<p>One of, <pre>SOIL, HYDRO</pre></p>

<h3>Plant Stage (ENUM)</h3>
<p>One of, <pre>PLANTED, GERMINATION, CUTTING, VEGETATION, FLOWER, CURING, HARVESTED</pre></p>
<p>One of, <pre>PLANTED, GERMINATION, SEEDLING, CUTTING, VEGETATION, FLOWER, CURING, HARVESTED</pre></p>

<h3>Action object (feeding)</h3>
<p>Temperature measured in ºC</p>
Expand Down
51 changes: 21 additions & 30 deletions app/src/main/java/me/anon/controller/adapter/ActionAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import me.anon.model.EmptyAction;
import me.anon.model.NoteAction;
import me.anon.model.Plant;
import me.anon.model.PlantStage;
import me.anon.model.StageChange;
import me.anon.model.Water;
import me.anon.view.ActionHolder;
Expand Down Expand Up @@ -152,6 +153,12 @@ public void setActions(@Nullable Plant plant, ArrayList<Action> actions, ArrayLi
Collections.reverse(actions);
for (Action item : actions)
{
// force planted stage to use plant date
if (item instanceof StageChange && ((StageChange)item).getNewStage() == PlantStage.PLANTED)
{
item.setDate(plant.getPlantDate());
}

if (plant != null)
{
ArrayList<String> groupedImages = new ArrayList<>();
Expand Down Expand Up @@ -451,47 +458,31 @@ else if (item.getItemId() == R.id.delete)
dateDay.setText(Html.fromHtml(dateDayStr));

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

StageChange lastChange = null;
StageChange currentChange = new StageChange();
currentChange.setDate(action.getDate());

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

if (plant != null)
{
int totalDays = (int)TimeHelper.toDays(Math.abs(action.getDate() - plant.getPlantDate()));
stageDayStr += totalDays;
int totalDays = (int)TimeHelper.toDays(Math.abs(action.getDate() - plant.getPlantDate()));
stageDayStr += (totalDays == 0 ? 1 : totalDays);

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

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

stageDay.setText(stageDayStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import me.anon.grow.MainApplication;
import me.anon.grow.R;
import me.anon.grow.fragment.ImageLightboxDialog;
import me.anon.lib.manager.PlantManager;
import me.anon.model.Plant;
import me.anon.view.ImageHolder;

/**
Expand All @@ -28,6 +30,7 @@
*/
public class ImageAdapter extends RecyclerView.Adapter<ImageHolder>
{
public Plant plant = null;
private List<String> images = new ArrayList<>();
private List<Integer> selected = new ArrayList<>();
private View.OnLongClickListener onLongClickListener;
Expand Down Expand Up @@ -75,6 +78,7 @@ public void setImages(List<String> images)
if (!inActionMode)
{
Intent details = new Intent(v.getContext(), ImageLightboxDialog.class);
details.putExtra("plant_index", PlantManager.getInstance().getPlants().indexOf(plant));
details.putExtra("images", (String[])images.toArray(new String[getItemCount()]));
details.putExtra("image_position", position);
v.getContext().startActivity(details);
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/me/anon/grow/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
Expand Down Expand Up @@ -90,10 +91,17 @@ public static boolean isTablet()
return isTablet;
}

private static Context context;
public static SharedPreferences getDefaultPreferences()
{
return PreferenceManager.getDefaultSharedPreferences(context);
}

@Override public void onCreate()
{
super.onCreate();

context = this;
ExceptionHandler.getInstance().register(this);

encrypted = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("encrypt", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import me.anon.grow.R;
import me.anon.lib.Views;
import me.anon.model.Action;
import me.anon.view.ActionHolder;
import me.anon.view.ImageActionHolder;

/**
Expand Down Expand Up @@ -57,7 +58,15 @@ public ActionSelectDialogFragment(ArrayList<Action> actions)
{
super.onBindViewHolder(vh, index);
int padding = (int)getResources().getDimension(R.dimen.padding_8dp);
vh.itemView.setPadding(padding, padding, padding, padding);
vh.itemView.setPadding(0, 0, 0, 0);
vh.itemView.findViewById(R.id.date_container).setVisibility(View.GONE);
((View)vh.itemView.findViewById(R.id.content_container).getParent()).setPadding(0, 0, 0, 0);

if (vh instanceof ActionHolder)
{
((ActionHolder)vh).getCard().setBackgroundResource(0);
((ActionHolder)vh).getCard().setContentPadding(padding, padding, padding * 2, (int)(padding * 2.5));
}
}
};

Expand All @@ -66,7 +75,6 @@ public ActionSelectDialogFragment(ArrayList<Action> actions)
adapter.setActions(null, actions, exclude);
}


@SuppressLint("ValidFragment")
public ActionSelectDialogFragment()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import me.anon.model.EmptyAction;
import me.anon.model.NoteAction;
import me.anon.model.Plant;
import me.anon.model.PlantStage;
import me.anon.model.StageChange;
import me.anon.model.Water;
import me.anon.view.ActionHolder;
Expand Down Expand Up @@ -436,6 +437,11 @@ else if (action instanceof StageChange)
{
@Override public void onStageUpdated(final StageChange action)
{
if (action.getNewStage() == PlantStage.PLANTED)
{
plant.setPlantDate(action.getDate());
}

plant.getActions().set(originalIndex, action);
PlantManager.getInstance().upsert(plantIndex, plant);
setActions();
Expand Down
41 changes: 38 additions & 3 deletions app/src/main/java/me/anon/grow/fragment/ImageLightboxDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@
import me.anon.grow.R;
import me.anon.lib.DateRenderer;
import me.anon.lib.Views;
import me.anon.lib.helper.TimeHelper;
import me.anon.lib.manager.PlantManager;
import me.anon.model.Action;
import me.anon.model.Plant;
import me.anon.model.StageChange;

@Views.Injectable
public class ImageLightboxDialog extends Activity
{
private String[] imageUrls = {};
private Plant plant;

@Views.InjectView(R.id.pager) public ViewPager pager;
private int pagerPosition = 0;
Expand All @@ -61,6 +67,7 @@ public class ImageLightboxDialog extends Activity
imageUrls = getIntent().getExtras().getStringArray("images");
}

plant = PlantManager.getInstance().getPlants().get(getIntent().getIntExtra("plant_index", -1));
pagerPosition = getIntent().getExtras().getInt("image_position", 0);
}
else
Expand All @@ -71,6 +78,7 @@ public class ImageLightboxDialog extends Activity

if (savedInstanceState != null)
{
plant = PlantManager.getInstance().getPlants().get(getIntent().getIntExtra("plant_index", -1));
pagerPosition = savedInstanceState.getInt("image_position");
}

Expand All @@ -82,6 +90,7 @@ public class ImageLightboxDialog extends Activity

@Override protected void onSaveInstanceState(Bundle outState)
{
outState.putInt("plant_index", PlantManager.getInstance().getPlants().indexOf(plant));
outState.putInt("image_position", pager.getCurrentItem());
super.onSaveInstanceState(outState);
}
Expand Down Expand Up @@ -169,10 +178,36 @@ private void forceHideKeyboard(ViewGroup view)
DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(view.getContext());
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
String[] parts = images[position].split("/");
String date = parts[parts.length - 1].split("\\.")[0];
String fileDate = parts[parts.length - 1].split("\\.")[0];
Date date = new Date(Long.parseLong(fileDate));

String dateStr = dateFormat.format(new Date(Long.parseLong(date))) + " " + timeFormat.format(new Date(Long.parseLong(date)));
((TextView)imageLayout.findViewById(R.id.taken)).setText(Html.fromHtml("<b>Image taken</b>: " + dateStr + " (" + new DateRenderer().timeAgo(Long.parseLong(date)).formattedDate + " ago)"));
StageChange lastChange = null;
StageChange currentChange = new StageChange();
currentChange.setDate(date.getTime());

for (int index = plant.getActions().size() - 1; index >= 0; index--)
{
Action action = plant.getActions().get(index);
if (action instanceof StageChange)
{
if (action.getDate() < date.getTime() && lastChange == null)
{
lastChange = (StageChange)action;
break;
}
}
}

String stageDayStr = "";
if (lastChange != null)
{
int currentDays = (int)TimeHelper.toDays(Math.abs(currentChange.getDate() - lastChange.getDate()));
currentDays = (currentDays == 0 ? 1 : currentDays);
stageDayStr += " [" + currentDays + lastChange.getNewStage().getPrintString().substring(0, 1).toLowerCase() + "]";
}

String dateStr = dateFormat.format(date) + " " + timeFormat.format(date);
((TextView)imageLayout.findViewById(R.id.taken)).setText(Html.fromHtml("<b>Image taken</b>: " + dateStr + stageDayStr + " (" + new DateRenderer().timeAgo(date.getTime()).formattedDate + " ago)"));

try
{
Expand Down
Loading

0 comments on commit 17ff5e8

Please sign in to comment.