Skip to content

Android 1.x

Cohen Adair edited this page Oct 10, 2021 · 1 revision

Contents

  • Start Android Studio
  • Open an existing project
  • Select the anglers-log/android/ directory
  • Let Gradle sync
  • Build
  • New private instance variables and mutators

  • For complex subclasses, override and/or update the

    • getContentValues() method to include the new properties
    • toJson() method to include the new properties
    • toKeywordsString() method to include the new properties
  • Make sure JSON importing and exporting work by adding new assertions to JsonTest.java

  • Add new properties to the cloning constructor

    Note that if a property is a subclass of UserDefineObject, the ClassName(ClassName obj, keepId) must be called with keepId = true in the object's cloning constructor

  • If some data is of type UserDefineObject and linked to a separate database table, create manipulation methods for that data rather than create a new instance variable

  • The cloning constructor and getContentValues() should manipulate the same number of properties

  • Be sure to include all constructor variations from UserDefineObject.java

  • Add the UserDefineObject(JSONObject jsonObject) constructor for importing
  • Add required code to JsonImporter.java to create the new objects from a JSONObject
  • Add required code to JsonExporter.java
  • Create new tests if needed
  • Update backup tests for new properties added
  • Create or update a Cursor subclass for the new UserDefineObject subclasses
  • LogbookSchema requires a new table scheme
  • LogbookHelper requires new or updated table creation
  • Add manipulation methods to Logbook (see Catch methods as an example)
  • If there is a one-to-many relationship (see below), add a removeDatabaseProperties() (see Catch.removeDatabaseProperties()), and call this method in the Logbook.remove*() method
  • If the new object has an associated photo(s),
    • Add it to QueryHelper.queryPhotos().
    • Add it to PhotoUtils.convertAllPngToJpg(). This probably isn't necessary, but should be done for completeness.

SQLite doesn't directly support storing an array in a single column. For UserDefineObject subclasses that require a collection of some sort (i.e. Catch requires a collection of images and a collection of FishingMethod objects), a new table should be created and accessed by the UserDefineObject

Example

The Catch class does not have an instance variable for its fishing methods. Instead, its getFishingMethods() and setFishingMethods() methods interact directly with the SQLite database. It reads from a table with catchId-fishingMethodId pairs to get all the fishing methods associated with a given catch.

This is the preferred method over concatenating FishingMethod id's in a String.

  • Download icons from Google Icons and copy to the corresponding res/ directory
  • If there are no suitable icon on Google, use Icons8 and the action_bar_maker.sh in tools/ to create the correct icon sizes
  • Add the new item to the correct group
  • Add LAYOUT_ constant
  • Add case for the new constant to layoutSpec(Context, int)
  • Add the get method for the new layout. Follow patterns from similar layouts
  • Create a master fragment for the new layout (at minimum)
  • Create a detail fragment for the new layout (optional)