Skip to content

Commit

Permalink
Field name is listed in the navigation drawer on the main screen
Browse files Browse the repository at this point in the history
Location exports as null if not set
Fixed a bug related to audio and rust traits
Updated dialogs with titles
Updated icons in FileExploreActivity and on toolbar
FileExploreActivity can now include/exclude file extensions
New multicategorical trait
Added ability to overwrite previously exported files
  • Loading branch information
trife authored and trife committed Nov 29, 2015
1 parent 57e78be commit 50c164c
Show file tree
Hide file tree
Showing 233 changed files with 4,487 additions and 1,019 deletions.
4 changes: 2 additions & 2 deletions Field Book/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fieldbook.tracker"
android:versionCode="300"
android:versionName="3.0.0">
android:versionCode="310"
android:versionName="3.1.0">

<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down
13 changes: 13 additions & 0 deletions Field Book/app/src/main/java/com/fieldbook/tracker/ColumnData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.fieldbook.tracker;

public class ColumnData
{
String header;
String value;

public ColumnData()
{
header = "";
value = "";
}
}
828 changes: 445 additions & 383 deletions Field Book/app/src/main/java/com/fieldbook/tracker/ConfigActivity.java

Large diffs are not rendered by default.

63 changes: 36 additions & 27 deletions Field Book/app/src/main/java/com/fieldbook/tracker/DataHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void close() {
try {
db.close();
} catch (Exception e) {
Log.e(TAG,e.getMessage());
Log.e(TAG, e.getMessage());
}
}

Expand All @@ -191,7 +191,7 @@ public void open() {
this.insertTraits = db.compileStatement(INSERTTRAITS);
this.insertUserTraits = db.compileStatement(INSERTUSERTRAITS);
} catch (Exception e) {
Log.e(TAG,e.getMessage());
Log.e(TAG, e.getMessage());
}
}

Expand Down Expand Up @@ -248,7 +248,7 @@ private String arrayToLikeString(String[] visibleTrait) {

for (int i = 0; i < visibleTrait.length; i++) {
value += "user_traits.parent like \"" + visibleTrait[i] + "\"";
if(i!=visibleTrait.length-1) {
if (i != visibleTrait.length - 1) {
value += " or ";
}
}
Expand Down Expand Up @@ -738,9 +738,9 @@ public void deleteTraitByValue(String rid, String parent, String value) {

try {
db.delete(USER_TRAITS, "rid like ? and parent like ? and userValue = ?",
new String[] { rid, parent, value });
new String[]{rid, parent, value});
} catch (Exception e) {
Log.e(TAG,e.getMessage());
Log.e(TAG, e.getMessage());
}
}

Expand All @@ -750,13 +750,13 @@ public void deleteTraitByValue(String rid, String parent, String value) {

public ArrayList<String> getPlotPhotos(String plot) {
try {
Cursor cursor = db.query(USER_TRAITS, new String[]{"userValue"},"rid like ? and trait like ?", new String[]{plot,"photo"},
Cursor cursor = db.query(USER_TRAITS, new String[]{"userValue"}, "rid like ? and trait like ?", new String[]{plot, "photo"},
null, null, null);

ArrayList<String> photoList = new ArrayList<String>();
Log.d("Field",Integer.toString(cursor.getCount()));
Log.d("Field", Integer.toString(cursor.getCount()));

if(cursor.moveToFirst()) {
if (cursor.moveToFirst()) {
do {
photoList.add(cursor.getString(0));
}
Expand All @@ -782,10 +782,9 @@ public String[] getDropDownRange(String trait, String plotId) {
if (trait.length() == 0)
return null;

try
{
Cursor cursor = db.query(RANGE, new String[] { trait },
ep.getString("ImportUniqueName", "") + " like ? ", new String[] { plotId },
try {
Cursor cursor = db.query(RANGE, new String[]{trait},
ep.getString("ImportUniqueName", "") + " like ? ", new String[]{plotId},
null, null, null);

String[] myList = null;
Expand All @@ -807,9 +806,7 @@ public String[] getDropDownRange(String trait, String plotId) {
}

return myList;
}
catch (Exception e)
{
} catch (Exception e) {
return null;
}
}
Expand Down Expand Up @@ -879,7 +876,7 @@ public void deleteTrait(String rid, String parent) {
db.delete(USER_TRAITS, "rid like ? and parent like ?",
new String[]{rid, parent});
} catch (Exception e) {
Log.e(TAG,e.getMessage());
Log.e(TAG, e.getMessage());
}
}

Expand All @@ -892,7 +889,7 @@ public void deleteTrait(String id) {
db.delete(TRAITS, "id = ?",
new String[]{id});
} catch (Exception e) {
Log.e(TAG,e.getMessage());
Log.e(TAG, e.getMessage());
}
}

Expand All @@ -903,7 +900,7 @@ public void deleteTable(String table) {
try {
db.delete(table, null, null);
} catch (Exception e) {
Log.e(TAG,e.getMessage());
Log.e(TAG, e.getMessage());
}
}

Expand Down Expand Up @@ -1113,17 +1110,29 @@ public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE android_metadata (locale TEXT)");
db.execSQL("INSERT INTO android_metadata(locale) VALUES('en_US')");
} catch (Exception e) {
Log.e(TAG,e.getMessage());
Log.e(TAG, e.getMessage());
}
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w("FieldBook",
"Upgrading database, this will drop tables and recreate.");
db.execSQL("DROP TABLE IF EXISTS " + RANGE);
db.execSQL("DROP TABLE IF EXISTS " + TRAITS);
db.execSQL("DROP TABLE IF EXISTS " + USER_TRAITS);

if (oldVersion < 5) {
db.execSQL("DROP TABLE IF EXISTS " + RANGE);
db.execSQL("DROP TABLE IF EXISTS " + TRAITS);
db.execSQL("DROP TABLE IF EXISTS " + USER_TRAITS);
}

if (oldVersion == 5 & newVersion == 6) {
// add columns to tables

// make table for all fields

// move current range table to a new table

}

onCreate(db);
}
Expand Down Expand Up @@ -1156,8 +1165,8 @@ public void importDatabase(String filename) throws IOException {
File oldSp = new File(internalSpPath);

try {
copyFile(newDb,oldDb);
copyFile(newSp,oldSp);
copyFile(newDb, oldDb);
copyFile(newSp, oldSp);
} catch (IOException e) {
e.printStackTrace();
}
Expand All @@ -1178,7 +1187,7 @@ public void exportDatabase(String filename) throws IOException {
File newSp = new File(Constants.BACKUPPATH + "/" + filename + "_sharedpref.xml");
File oldSp = new File(internalSpPath);

copyFile(oldDb,newDb);
copyFile(oldDb, newDb);
copyFile(oldSp, newSp);
} catch (IOException e) {
Log.e(TAG, e.getMessage());
Expand Down Expand Up @@ -1302,8 +1311,8 @@ private String getDatabasePath(Context context) {
public boolean isTableExists(String tableName) {

Cursor cursor = db.rawQuery("select DISTINCT tbl_name from sqlite_master where tbl_name = '" + tableName + "'", null);
if(cursor!=null) {
if(cursor.getCount()>0) {
if (cursor != null) {
if (cursor.getCount() > 0) {
cursor.close();
return true;
}
Expand Down
Loading

0 comments on commit 50c164c

Please sign in to comment.