Skip to content

Commit

Permalink
Replaced lots of words with icons
Browse files Browse the repository at this point in the history
Fixed an issue where default trait value wasn't being saved
Added a dialog when importing trait lists and current list hasn't been exported
Added location trait
Changed trait button shapes
Added a button for missing values
  • Loading branch information
trife authored and trife committed Feb 19, 2017
1 parent cd6f9d6 commit 9574dd2
Show file tree
Hide file tree
Showing 34 changed files with 1,274 additions and 884 deletions.
4 changes: 2 additions & 2 deletions 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="325"
android:versionName="3.2.5">
android:versionCode="330"
android:versionName="3.0.0">

<uses-feature android:name="android.hardware.location" android:required="false"/>

Expand Down
95 changes: 79 additions & 16 deletions app/src/main/java/com/fieldbook/tracker/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.graphics.PorterDuff;
import android.provider.Settings;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
Expand Down Expand Up @@ -765,12 +766,36 @@ public boolean onLongClick(View v) {
rustDelim.setOnClickListener(this);
rustClear.setOnClickListener(this);

String primaryName = ep.getString("ImportFirstName", getString(R.string.range)) + ":";
String secondaryName = ep.getString("ImportSecondName", getString(R.string.plot)) + ":";
String primaryName = ep.getString("ImportFirstName", getString(R.string.range));
String secondaryName = ep.getString("ImportSecondName", getString(R.string.plot));

if(primaryName.length()>10) {
primaryName = primaryName.substring(0,9) + ":";
}

if(secondaryName.length()>10) {
secondaryName = secondaryName.substring(0,9) + ":";
}

rangeName.setText(primaryName);
plotName.setText(secondaryName);

rangeName.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
makeToast(ep.getString("ImportFirstName", getString(R.string.range)));
return false;
}
});

plotName.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
makeToast(ep.getString("ImportSecondName", getString(R.string.range)));
return false;
}
});

clearPercent.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -1508,6 +1533,31 @@ public void onClick(View arg0) {
traitType.setSelection(pos);
}
});

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.missingData);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateTrait(currentTrait.trait, currentTrait.format, "NA");

tNum.setText("NA");
eNum.setText("NA");
pNum.setText("NA");

if (currentTrait.format.equals("date")) {
month.setText("");
day.setText("NA");
}

if (currentTrait.format.equals("photo")) {

}

if (currentTrait.format.equals("counter")) {
counterTv.setText("NA");
}
}
});
}

private void setupDrawer() {
Expand Down Expand Up @@ -1623,10 +1673,10 @@ private void setCategoricalButtons(Button[] buttonList, Button choice) {
for (Button aButtonList : buttonList) {
if (aButtonList == choice) {
aButtonList.setTextColor(Color.parseColor(displayColor));
aButtonList.getBackground().setColorFilter(getResources().getColor(R.color.button_pressed), PorterDuff.Mode.SRC);
aButtonList.setBackgroundColor(getResources().getColor(R.color.button_pressed));
} else {
aButtonList.setTextColor(Color.BLACK);
aButtonList.getBackground().setColorFilter(getResources().getColor(R.color.button_normal), PorterDuff.Mode.SRC);
aButtonList.setBackgroundColor(getResources().getColor(R.color.button_normal));
}
}
}
Expand Down Expand Up @@ -1993,6 +2043,7 @@ public void onItemSelected(AdapterView<?> arg0, View arg1,
ErrorLog("DropdownError.txt", "" + e.getMessage());
e.printStackTrace();
}

}

@Override
Expand Down Expand Up @@ -2023,8 +2074,8 @@ public void onItemSelected(AdapterView<?> arg0, View arg1,
} catch (Exception e) {
ErrorLog("DropdownError.txt", "" + e.getMessage());
e.printStackTrace();

}

}

@Override
Expand Down Expand Up @@ -2267,7 +2318,7 @@ public void run() {
eNum.removeTextChangedListener(eNumUpdate);
eNum.setEnabled(false);

if (newTraits.containsKey(currentTrait.trait)) {
if (newTraits.containsKey(currentTrait.trait) && !newTraits.get(currentTrait.trait).toString().equals("NA")) {

pNum.setTextColor(Color.BLACK);

Expand Down Expand Up @@ -2305,6 +2356,9 @@ public void run() {

seekBar.setOnSeekBarChangeListener(seekListener);

} else if (newTraits.containsKey(currentTrait.trait) && newTraits.get(currentTrait.trait).toString().equals("NA")) {
pNum.setText("NA");
pNum.setTextColor(Color.parseColor(displayColor));
} else {
seekBar.setOnSeekBarChangeListener(null);

Expand All @@ -2323,7 +2377,6 @@ public void run() {
}

updateTrait(currentTrait.trait, "percent", String.valueOf(seekBar.getProgress()));

seekBar.setOnSeekBarChangeListener(seekListener);
}

Expand All @@ -2349,7 +2402,7 @@ public void run() {
final Calendar c = Calendar.getInstance();
date = dateFormat.format(c.getTime());

if (newTraits.containsKey(currentTrait.trait)) {
if (newTraits.containsKey(currentTrait.trait) && !newTraits.get(currentTrait.trait).toString().equals("NA")) {
if(newTraits.get(currentTrait.trait).toString().length() < 4 && newTraits.get(currentTrait.trait).toString().length() > 0) {
Calendar calendar = Calendar.getInstance();

Expand Down Expand Up @@ -2396,6 +2449,9 @@ public void run() {
month.setTextColor(Color.parseColor(displayColor));
day.setTextColor(Color.parseColor(displayColor));
}
} else if(newTraits.containsKey(currentTrait.trait) && newTraits.get(currentTrait.trait).toString().equals("NA")) {
month.setText("");
day.setText("NA");
} else {
month.setTextColor(Color.BLACK);
day.setTextColor(Color.BLACK);
Expand Down Expand Up @@ -2448,12 +2504,12 @@ public void run() {
buttonArray[i].setVisibility(Button.VISIBLE);
buttonArray[i].setText(cat[i]);
buttonArray[i].setTextColor(Color.parseColor(displayColor));
buttonArray[i].getBackground().setColorFilter(getResources().getColor(R.color.button_pressed), PorterDuff.Mode.SRC);
buttonArray[i].setBackgroundColor(getResources().getColor(R.color.button_pressed));
} else {
buttonArray[i].setVisibility(Button.VISIBLE);
buttonArray[i].setText(cat[i]);
buttonArray[i].setTextColor(Color.BLACK);
buttonArray[i].getBackground().setColorFilter(getResources().getColor(R.color.button_normal), PorterDuff.Mode.SRC);
buttonArray[i].setBackgroundColor(getResources().getColor(R.color.button_normal));
}
}
} else if (currentTrait.format.equals("boolean")) {
Expand Down Expand Up @@ -2515,13 +2571,12 @@ public void run() {
eNum.setVisibility(EditText.GONE);

if (!newTraits.containsKey(currentTrait.trait)) {
//doRecord.setText(getString(R.string.record));
doRecord.setImageResource(R.drawable.ic_audio);
tNum.setText("");
//tNum.setText(R.string.nodata);
} else if(newTraits.containsKey(currentTrait.trait) && newTraits.get(currentTrait.trait).toString().equals("NA")) {
tNum.setText("NA");
} else {
mRecordingLocation = new File(newTraits.get(currentTrait.trait).toString());
//doRecord.setText(getString(R.string.play));
doRecord.setImageResource(R.drawable.ic_play_arrow);
tNum.setText(getString(R.string.stored));
}
Expand Down Expand Up @@ -2555,11 +2610,10 @@ public void run() {
photoLocation = dt.getPlotPhotos(cRange.plot_id);

for (int i = 0; i < photoLocation.size(); i++) {
drawables.add(new BitmapDrawable(displayScaledSavedPhoto(photoLocation.get(i))));
drawables.add(new BitmapDrawable(displayScaledSavedPhoto(photoLocation.get(i))));
}

photoAdapter = new GalleryImageAdapter(MainActivity.this, drawables);

photo.setAdapter(photoAdapter);
photo.setSelection(photo.getCount() - 1);
photo.setOnItemClickListener(new AdapterView.OnItemClickListener() {
Expand Down Expand Up @@ -2709,7 +2763,6 @@ public long getItemId(int position) {
public View getView(int position, View convertView, ViewGroup parent) {
final Button newButton = (Button) LayoutInflater.from(MainActivity.this).inflate(R.layout.multicat_button, null);
newButton.setText(cat[position]);

newButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -3241,6 +3294,14 @@ public void onResume() {
String primaryName = ep.getString("ImportFirstName", getString(R.string.range)) + ":";
String secondaryName = ep.getString("ImportSecondName", getString(R.string.plot)) + ":";

if(primaryName.length()>8) {
primaryName = primaryName.substring(0,7) + ":";
}

if(secondaryName.length()>8) {
secondaryName = secondaryName.substring(0,7) + ":";
}

rangeName.setText(primaryName);
plotName.setText(secondaryName);

Expand Down Expand Up @@ -4289,6 +4350,8 @@ else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) {

catch (IOException e) {
Log.e(TAG, "-- Error in setting image");
Bitmap emptyBmp = BitmapFactory.decodeResource(getResources(), R.drawable.photo_missing);
return emptyBmp;
}

catch(OutOfMemoryError oom) {
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/drawable/round_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#d9d9d9"/>
</shape>
</item>
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#969696"/>
</shape>
</item>
</selector>
23 changes: 23 additions & 0 deletions app/src/main/res/drawable/rounded_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#d9d9d9"/>
<corners android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp"
android:topRightRadius="8dp"
android:topLeftRadius="8dp"/>
</shape>
</item>
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#969696"/>
<corners android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp"
android:topRightRadius="8dp"
android:topLeftRadius="8dp"/>
</shape>
</item>
</selector>
Loading

0 comments on commit 9574dd2

Please sign in to comment.