Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into issue/632/config_barc…
Browse files Browse the repository at this point in the history
…ode_button

# Conflicts:
#	app/src/main/java/com/fieldbook/tracker/activities/CollectActivity.java
  • Loading branch information
chaneylc committed Jul 10, 2023
2 parents 68afe56 + d7b3603 commit 3b6f4ba
Show file tree
Hide file tree
Showing 26 changed files with 879 additions and 319 deletions.
12 changes: 11 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,17 @@
"avatar_url": "https://avatars.githubusercontent.com/u/10454330?v=4",
"profile": "https://github.com/joegage",
"contributions": [
"bug"
"bug",
"code"
]
},
{
"login": "mobreza",
"name": "mobreza",
"avatar_url": "https://avatars.githubusercontent.com/u/712974?v=4",
"profile": "https://github.com/mobreza",
"contributions": [
"code"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ Development of Field Book has been supported by the [Collaborative Crop Research
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/HMS17"><img src="https://avatars.githubusercontent.com/u/84345306?v=4?s=100" width="100px;" alt="HMS17"/><br /><sub><b>HMS17</b></sub></a><br /><a href="https://github.com/PhenoApps/Field-Book/commits?author=HMS17" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/zrm22"><img src="https://avatars.githubusercontent.com/u/54960003?v=4?s=100" width="100px;" alt="zrm22"/><br /><sub><b>zrm22</b></sub></a><br /><a href="https://github.com/PhenoApps/Field-Book/commits?author=zrm22" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/joegage"><img src="https://avatars.githubusercontent.com/u/10454330?v=4?s=100" width="100px;" alt="Joe Gage"/><br /><sub><b>Joe Gage</b></sub></a><br /><a href="https://github.com/PhenoApps/Field-Book/issues?q=author%3Ajoegage" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/joegage"><img src="https://avatars.githubusercontent.com/u/10454330?v=4?s=100" width="100px;" alt="Joe Gage"/><br /><sub><b>Joe Gage</b></sub></a><br /><a href="https://github.com/PhenoApps/Field-Book/issues?q=author%3Ajoegage" title="Bug reports">🐛</a> <a href="https://github.com/PhenoApps/Field-Book/commits?author=joegage" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mobreza"><img src="https://avatars.githubusercontent.com/u/712974?v=4?s=100" width="100px;" alt="mobreza"/><br /><sub><b>mobreza</b></sub></a><br /><a href="https://github.com/PhenoApps/Field-Book/commits?author=mobreza" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ dependencies {
implementation 'com.github.breeding-insight:brapi:2.0.3'
implementation("com.squareup.okhttp3:okhttp:4.9.3")
implementation("com.squareup.okhttp3:logging-interceptor:4.9.3")
implementation("io.gsonfire:gson-fire:1.8.4") //required v1

implementation 'org.jsoup:jsoup:1.8.1'
implementation 'net.sourceforge.jexcelapi:jxl:2.6.10'
Expand All @@ -173,7 +174,7 @@ dependencies {
implementation "com.github.skydoves:colorpickerpreference:2.0.4"
implementation 'com.github.evrencoskun:TableView:v0.8.9.4'

implementation 'net.openid:appauth:0.9.0'
implementation 'net.openid:appauth:0.11.1'
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' //google messed up some packages, this package is temporary until the issue is fixed (Feb 2021)

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
Expand Down Expand Up @@ -246,4 +247,3 @@ repositories {

task prepareKotlinBuildScriptModel {}

android.defaultConfig.manifestPlaceholders = ['appAuthRedirectScheme': 'fieldbook' ]
28 changes: 23 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,25 @@
android:launchMode="singleTop"
android:screenOrientation="portrait" />

<!-- Handles BrAPI server authentication, shows a progress circle -->
<activity
android:name=".activities.brapi.BrapiAuthActivity"
android:configChanges="orientation|keyboardHidden|screenSize|locale"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:exported="true">
android:exported="true"
tools:node="replace">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host=""
android:scheme="fieldbook"
tools:ignore="AppLinkUrlError" /> <!-- https://stackoverflow.com/questions/48093833/deeplink-empty-path-error-androidpath-cannot-be-empty -->
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

Expand All @@ -165,16 +174,25 @@
android:scheme="https"
tools:ignore="AppLinkUrlError" /> <!-- https://stackoverflow.com/questions/48093833/deeplink-empty-path-error-androidpath-cannot-be-empty -->
</intent-filter>
</activity>

<!-- Handles BrAPI server authentication, shows a progress circle -->
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
android:configChanges="orientation|keyboardHidden|screenSize|locale"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:exported="true"
tools:node="replace">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host=""
android:host="app"
android:scheme="fieldbook"
tools:ignore="AppLinkUrlError" /> <!-- https://stackoverflow.com/questions/48093833/deeplink-empty-path-error-androidpath-cannot-be-empty -->
android:path="/auth" />
</intent-filter>
</activity>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import androidx.appcompat.widget.Toolbar;
import androidx.documentfile.provider.DocumentFile;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.fieldbook.tracker.R;
Expand All @@ -48,6 +49,7 @@
import com.fieldbook.tracker.database.models.ObservationUnitModel;
import com.fieldbook.tracker.objects.FieldObject;
import com.fieldbook.tracker.objects.GeoNavHelper;
import com.fieldbook.tracker.objects.InfoBarModel;
import com.fieldbook.tracker.objects.RangeObject;
import com.fieldbook.tracker.objects.TraitObject;
import com.fieldbook.tracker.objects.VerifyPersonHelper;
Expand All @@ -57,6 +59,7 @@
import com.fieldbook.tracker.traits.LayoutCollections;
import com.fieldbook.tracker.traits.PhotoTraitLayout;
import com.fieldbook.tracker.utilities.CategoryJsonUtil;
import com.fieldbook.tracker.utilities.InfoBarHelper;
import com.fieldbook.tracker.utilities.LocationCollectorUtil;
import com.fieldbook.tracker.utilities.SnackbarUtils;
import com.fieldbook.tracker.utilities.TapTargetUtil;
Expand Down Expand Up @@ -103,7 +106,8 @@ public class CollectActivity extends ThemedActivity
implements UsbCameraInterface, SummaryFragment.SummaryOpenListener,
com.fieldbook.tracker.interfaces.CollectController,
com.fieldbook.tracker.interfaces.CollectRangeController,
com.fieldbook.tracker.interfaces.CollectTraitController {
com.fieldbook.tracker.interfaces.CollectTraitController,
InfoBarAdapter.InfoBarController {

public static final int REQUEST_FILE_EXPLORER_CODE = 1;
public static final int BARCODE_COLLECT_CODE = 99;
Expand All @@ -118,6 +122,10 @@ public class CollectActivity extends ThemedActivity
@Inject
VerifyPersonHelper verifyPersonHelper;

//used to query for infobar prefix/value pairs and building InfoBarModels
@Inject
InfoBarHelper infoBarHelper;

public static boolean searchReload;
public static String searchRange;
public static String searchPlot;
Expand All @@ -139,13 +147,16 @@ public class CollectActivity extends ThemedActivity
private String inputPlotId = "";
private AlertDialog goToId;
private final Object lock = new Object();

/**
* Main screen elements
*/
private Menu systemMenu;
private InfoBarAdapter infoBarAdapter;
private TraitBoxView traitBox;
private RangeBoxView rangeBox;
private RecyclerView infoBarRv;

/**
* Trait-related elements
*/
Expand Down Expand Up @@ -405,16 +416,46 @@ private void loadScreen() {

//lock = new Object();

infoBarAdapter = new InfoBarAdapter(this, ep.getInt(GeneralKeys.INFOBAR_NUMBER, 2), (RecyclerView) findViewById(R.id.selectorList));

traitLayouts = new LayoutCollections(this);
rangeBox = findViewById(R.id.act_collect_range_box);
traitBox = findViewById(R.id.act_collect_trait_box);
traitBox.connectRangeBox(rangeBox);
rangeBox.connectTraitBox(traitBox);

//setup infobar recycler view ui
infoBarRv = findViewById(R.id.act_collect_infobar_rv);
infoBarRv.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));

initCurrentVals();

Log.d(TAG, "Load screen.");

refreshInfoBarAdapter();
}

/**
* Updates the infobar adapter with the new plot information.
*/
public void refreshInfoBarAdapter() {

Log.d(TAG, "Refreshing info bar adapter.");

try {

infoBarAdapter = new InfoBarAdapter(this);

infoBarRv.setAdapter(infoBarAdapter);

List<InfoBarModel> models = infoBarHelper.getInfoBarData();

infoBarAdapter.submitList(models);

} catch (Exception e) {

e.printStackTrace();

Log.d(TAG, "Error: info bar adapter loading.");
}
}

@Override
Expand All @@ -423,6 +464,8 @@ public void refreshMain() {
rangeBox.refresh();
traitBox.setNewTraits(rangeBox.getPlotID());

Log.d(TAG, "Refresh main.");

initWidgets(true);

refreshLock();
Expand Down Expand Up @@ -585,8 +628,10 @@ public void initWidgets(final boolean rangeSuppress) {
// Reset dropdowns

if (!database.isRangeTableEmpty()) {
String plotID = rangeBox.getPlotID();
infoBarAdapter.configureDropdownArray(plotID);

Log.d(TAG, "init widgets refreshing info bar");

refreshInfoBarAdapter();
}

traitBox.initTraitDetails();
Expand Down Expand Up @@ -708,7 +753,9 @@ private void moveToResultCore(int j) {

String pid = rangeBox.getPlotID();

traitBox.setNewTraits(rangeBox.getPlotID());
traitBox.setNewTraits(pid);

Log.d(TAG, "Move to result core: " + j);

initWidgets(false);
}
Expand All @@ -730,6 +777,8 @@ private void moveToResultCore(int j, int traitIndex) {

traitBox.setSelection(traitIndex);

Log.d(TAG, "Move to result core: " + j);

initWidgets(false);
}

Expand Down Expand Up @@ -833,6 +882,8 @@ public void onResume() {
rangeBox.reload();
traitBox.setPrefixTraits();

Log.d(TAG, "On resume load data.");

initWidgets(false);
traitBox.setSelection(0);

Expand All @@ -847,6 +898,9 @@ public void onResume() {
partialReload = false;
rangeBox.display();
traitBox.setPrefixTraits();

Log.d(TAG, "On resume partial reload data.");

initWidgets(false);

} else if (searchReload) {
Expand Down Expand Up @@ -975,8 +1029,7 @@ public void updateObservation(String traitName, String traitFormat, String value
}

//update the info bar in case a variable is used
infoBarAdapter.notifyItemRangeChanged(0, infoBarAdapter.getItemCount());

refreshInfoBarAdapter();
refreshRepeatedValuesToolbarIndicator();
}

Expand Down Expand Up @@ -1110,7 +1163,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case helpId:
TapTargetSequence sequence = new TapTargetSequence(this)
.targets(collectDataTapTargetView(R.id.selectorList, getString(R.string.tutorial_main_infobars_title), getString(R.string.tutorial_main_infobars_description), R.color.main_primary_dark,200),
.targets(collectDataTapTargetView(R.id.act_collect_infobar_rv, getString(R.string.tutorial_main_infobars_title), getString(R.string.tutorial_main_infobars_description), R.color.main_primary_dark,200),
collectDataTapTargetView(R.id.traitLeft, getString(R.string.tutorial_main_traits_title), getString(R.string.tutorial_main_traits_description), R.color.main_primary_dark,60),
collectDataTapTargetView(R.id.traitType, getString(R.string.tutorial_main_traitlist_title), getString(R.string.tutorial_main_traitlist_description), R.color.main_primary_dark,80),
collectDataTapTargetView(R.id.rangeLeft, getString(R.string.tutorial_main_entries_title), getString(R.string.tutorial_main_entries_description), R.color.main_primary_dark,60),
Expand Down Expand Up @@ -1192,8 +1245,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
*/
case geonavId:

Log.d(GEOTAG, "Menu item clicked.");

geoNavHelper.setMGeoNavActivated(!geoNavHelper.getMGeoNavActivated());
MenuItem navItem = systemMenu.findItem(R.id.action_act_collect_geonav_sw);
if (geoNavHelper.getMGeoNavActivated()) {
Expand Down Expand Up @@ -1996,4 +2047,11 @@ public void inflateTrait(@NonNull BaseTraitLayout layout) {
layout.init(this);
v.setVisibility(View.VISIBLE);
}

@Override
public void onInfoBarClicked(int position) {

infoBarHelper.showInfoBarChoiceDialog(position);

}
}
Loading

0 comments on commit 3b6f4ba

Please sign in to comment.