Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
bellerbrock committed Aug 16, 2023
2 parents d720cbe + a67cf49 commit 56b45c0
Show file tree
Hide file tree
Showing 60 changed files with 4,906 additions and 2,613 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ gradlew.bat
# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

Expand Down
15 changes: 5 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ private Integer makeVersionCode() {
}

private String makeVersionName() {
if (ext.buildNumber) {
return "${ext.majorVersion}.${ext.minorVersion}.${ext.patchVersion}.${ext.buildNumber}"
}

return "${ext.majorVersion}.${ext.minorVersion}.${ext.patchVersion}"
}

Expand Down Expand Up @@ -72,17 +68,16 @@ android {
buildTypes {

release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
// signingConfig signingConfigs.playStoreConfig //Add your own signing config
minifyEnabled false
debuggable false
//signingConfig signingConfigs.playStoreConfig //Add your own signing config
}

debug {
clean
debuggable true
manifestPlaceholders = [crashlyticsCollectionEnabled: "false"]
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Expand Down Expand Up @@ -146,7 +141,7 @@ dependencies {

implementation 'com.google.zxing:core:3.3.3'

implementation('com.github.phenoapps:phenolib:v0.9.48')
implementation('com.github.phenoapps:phenolib:v0.9.49')

implementation 'com.google.android.exoplayer:exoplayer:2.17.0'
implementation 'com.arthenica:ffmpeg-kit-min:5.1.LTS'
Expand Down
2 changes: 2 additions & 0 deletions app/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-keep public class com.fieldbook.tracker.**

Binary file modified app/src/main/assets/database/sample.db
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/assets/field_import/training_sample.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plot_id,row,column,plot,replicate,germplasm_name,pedigree
plot_id,row,column,plot,replicate,germplasm,pedigree
23TRN010_0101,1,1,0101,1,Barrie,"BW429, CPSR1//CNR17/3/NI98133/SALWIN"
23TRN010_0102,1,2,0102,1,Oahe,Ransom/SD96240-3-1
23TRN010_0103,1,3,0103,1,Jet,MS Chancellor/SD004072
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
import com.fieldbook.tracker.BuildConfig;
import com.fieldbook.tracker.R;
import com.fieldbook.tracker.preferences.GeneralKeys;
import com.michaelflisar.changelog.ChangelogBuilder;
import com.michaelflisar.changelog.classes.ImportanceChangelogSorter;
import com.michaelflisar.changelog.internal.ChangelogDialogFragment;
import com.mikepenz.aboutlibraries.LibsBuilder;

import java.io.BufferedReader;
Expand Down Expand Up @@ -81,29 +78,18 @@ public MaterialAboutList getMaterialAboutList(@NonNull Context c) {

appCardBuilder.addItem(updateCheckItem);

appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.changelog_title))
.icon(R.drawable.ic_about_changelog)
.setOnClickAction(new MaterialAboutItemOnClickAction() {
@Override
public void onClick() {
showChangelog(false, false);
}
})
.build());
appCardBuilder.addItem(ConvenienceBuilder.createWebsiteActionItem(c,
getResources().getDrawable(R.drawable.book_open_variant),
getString(R.string.about_manual_title),
false,
Uri.parse("https://docs.fieldbook.phenoapps.org/en/latest/field-book.html")));

appCardBuilder.addItem(ConvenienceBuilder.createRateActionItem(c,
getResources().getDrawable(R.drawable.ic_about_rate),
getString(R.string.about_rate),
null
));

appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.about_help_translate_title)
.icon(R.drawable.ic_about_help_translate)
.setOnClickAction(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://osij6hx.oneskyapp.com/collaboration/project?id=28259")))
.build());

MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
authorCardBuilder.title(getString(R.string.about_project_lead_title));

Expand All @@ -120,32 +106,22 @@ public void onClick() {
getString(R.string.about_developer_trife_email),
"Field Book Question"));

authorCardBuilder.addItem(ConvenienceBuilder.createWebsiteActionItem(c,
getResources().getDrawable(R.drawable.ic_about_website),
"PhenoApps.org",
false,
Uri.parse("http://phenoapps.org/")));

MaterialAboutCard.Builder contributorsCardBuilder = new MaterialAboutCard.Builder();
contributorsCardBuilder.title(getString(R.string.about_contributors_title));
contributorsCardBuilder.title(getString(R.string.about_support_title));


contributorsCardBuilder.addItem(ConvenienceBuilder.createWebsiteActionItem(c,
getResources().getDrawable(R.drawable.ic_about_contributors),
getString(R.string.about_contributors_developers_title),
getString(R.string.about_contributors_title),
false,
Uri.parse("https://github.com/PhenoApps/Field-Book/graphs/contributors")));
Uri.parse("https://github.com/PhenoApps/Field-Book#-contributors")));

contributorsCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.about_translators_title))
.subText(getString(R.string.about_translators_text))
.icon(R.drawable.ic_about_translators)
.build());
contributorsCardBuilder.addItem(ConvenienceBuilder.createWebsiteActionItem(c,
getResources().getDrawable(R.drawable.ic_about_funding),
getString(R.string.about_contributors_funding_title),
false,
Uri.parse("https://github.com/PhenoApps/Field-Book#-funding")));

contributorsCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.about_contributors_funding_title))
.subText(getString(R.string.about_contributors_funding_text))
.icon(R.drawable.ic_about_funding)
.build());

MaterialAboutCard.Builder technicalCardBuilder = new MaterialAboutCard.Builder();
technicalCardBuilder.title(getString(R.string.about_technical_title));
Expand All @@ -171,15 +147,15 @@ public void onClick() {
final int libStyleId = styleId;

technicalCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.libraries_title)
.text(R.string.about_libraries_title)
.icon(R.drawable.ic_about_libraries)
.setOnClickAction(new MaterialAboutItemOnClickAction() {
@Override
public void onClick() {
new LibsBuilder()
.withActivityTheme(libStyleId)
.withAutoDetect(true)
.withActivityTitle(getString(R.string.libraries_title))
.withActivityTitle(getString(R.string.about_libraries_title))
.withLicenseShown(true)
.withVersionShown(true)
.start(getApplicationContext());
Expand All @@ -190,23 +166,18 @@ public void onClick() {
MaterialAboutCard.Builder otherAppsCardBuilder = new MaterialAboutCard.Builder();
otherAppsCardBuilder.title(getString(R.string.about_title_other_apps));

otherAppsCardBuilder.addItem(ConvenienceBuilder.createWebsiteActionItem(c,
getResources().getDrawable(R.drawable.ic_about_website),
"PhenoApps.org",
false,
Uri.parse("http://phenoapps.org/")));

otherAppsCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Coordinate")
.icon(R.drawable.other_ic_coordinate)
.setOnClickAction(openAppOrStore("org.wheatgenetics.coordinate", c))
.build());

otherAppsCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Inventory")
.icon(R.drawable.other_ic_inventory)
.setOnClickAction(openAppOrStore("org.wheatgenetics.inventory", c))
.build());

otherAppsCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Verify")
.icon(R.drawable.other_ic_verify)
.build());

otherAppsCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Intercross")
.icon(R.drawable.other_ic_intercross)
Expand Down Expand Up @@ -335,18 +306,6 @@ private boolean isNewerVersion(String currentVersion, String latestVersion) {
return false;
}

private void showChangelog(Boolean managedShow, Boolean rateButton) {
ChangelogDialogFragment builder = new ChangelogBuilder()
.withUseBulletList(true) // true if you want to show bullets before each changelog row, false otherwise
.withManagedShowOnStart(managedShow) // library will take care to show activity/dialog only if the changelog has new infos and will only show this new infos
.withRateButton(rateButton) // enable this to show a "rate app" button in the dialog => clicking it will open the play store; the parent activity or target fragment can also implement IChangelogRateHandler to handle the button click
.withSummary(false, true) // enable this to show a summary and a "show more" button, the second paramter describes if releases without summary items should be shown expanded or not
.withTitle(getString(R.string.changelog_title)) // provide a custom title if desired, default one is "Changelog <VERSION>"
.withOkButtonLabel(getString(android.R.string.ok)) // provide a custom ok button text if desired, default one is "OK"
.withSorter(new ImportanceChangelogSorter())
.buildAndShowDialog(this, false); // second parameter defines, if the dialog has a dark or light theme
}

@Override
protected CharSequence getActivityTitle() {
return getString(R.string.mal_title_about);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ private void initToolbars() {
barcodeInput.setOnClickListener(v -> {
triggerTts(barcodeTts);
new IntentIntegrator(CollectActivity.this)
.setPrompt(getString(R.string.main_barcode_text))
.setPrompt(getString(R.string.barcode_scanner_text))
.setBeepEnabled(false)
.setRequestCode(BARCODE_COLLECT_CODE)
.initiateScan();
Expand Down Expand Up @@ -1511,7 +1511,7 @@ public void onClick(DialogInterface dialog, int which) {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new IntentIntegrator(CollectActivity.this)
.setPrompt(getString(R.string.main_barcode_text))
.setPrompt(getString(R.string.barcode_scanner_text))
.setBeepEnabled(false)
.setRequestCode(BARCODE_SEARCH_CODE)
.initiateScan();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private void loadScreen() {
barcodeSearchFab = findViewById(R.id.act_config_search_fab);
barcodeSearchFab.setOnClickListener(v -> {
new IntentIntegrator(this)
.setPrompt(getString(R.string.main_barcode_text))
.setPrompt(getString(R.string.barcode_scanner_text))
.setBeepEnabled(false)
.setRequestCode(REQUEST_BARCODE)
.initiateScan();
Expand Down Expand Up @@ -853,12 +853,14 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
@AfterPermissionGranted(PERMISSIONS_REQUEST_EXPORT_DATA)
private void exportPermission() {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(this, perms)) {
showSaveDialog();
} else {
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_export),
PERMISSIONS_REQUEST_EXPORT_DATA, perms);
}
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
if (EasyPermissions.hasPermissions(this, perms)) {
showSaveDialog();
} else {
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_export),
PERMISSIONS_REQUEST_EXPORT_DATA, perms);
}
} else showSaveDialog();
}

@AfterPermissionGranted(PERMISSIONS_REQUEST_TRAIT_DATA)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.location.Location;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.OpenableColumns;
Expand Down Expand Up @@ -270,15 +271,16 @@ public void loadCloud() {

@AfterPermissionGranted(PERMISSIONS_REQUEST_STORAGE)
public void loadLocalPermission() {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(this, perms)) {
loadLocal();
} else {
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_import),
PERMISSIONS_REQUEST_STORAGE, perms);
}

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(this, perms)) {
loadLocal();
} else {
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_import),
PERMISSIONS_REQUEST_STORAGE, perms);
}
} else loadLocal();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.content.SharedPreferences.Editor;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
Expand Down Expand Up @@ -489,31 +490,40 @@ public void onClick(DialogInterface dialog, int which) {

@AfterPermissionGranted(PERMISSIONS_REQUEST_STORAGE_IMPORT)
public void loadTraitFilePermission() {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(this, perms)) {
if (ep.getBoolean(GeneralKeys.TRAITS_EXPORTED, false)) {
showFileDialog();

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(this, perms)) {
if (ep.getBoolean(GeneralKeys.TRAITS_EXPORTED, false)) {
showFileDialog();
} else {
checkTraitExportDialog();
}
} else {
checkTraitExportDialog();
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_import),
PERMISSIONS_REQUEST_STORAGE_IMPORT, perms);
}
} else if (ep.getBoolean(GeneralKeys.TRAITS_EXPORTED, false)) {
showFileDialog();
} else {
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_import),
PERMISSIONS_REQUEST_STORAGE_IMPORT, perms);
checkTraitExportDialog();
}

}

@AfterPermissionGranted(PERMISSIONS_REQUEST_STORAGE_EXPORT)
public void exportTraitFilePermission() {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(this, perms)) {
showExportDialog();
} else {
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_export),
PERMISSIONS_REQUEST_STORAGE_EXPORT, perms);
}

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(this, perms)) {
showExportDialog();
} else {
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.permission_rationale_storage_export),
PERMISSIONS_REQUEST_STORAGE_EXPORT, perms);
}
} else showExportDialog();
}

private void showImportDialog() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
brapiServerBarcode.setOnPreferenceClickListener(preference -> {

new IntentIntegrator(getActivity())
.setPrompt(getString(R.string.main_barcode_text))
.setPrompt(getString(R.string.barcode_scanner_text))
.setBeepEnabled(true)
.setRequestCode(IntentIntegrator.REQUEST_CODE)
.initiateScan();
Expand Down Expand Up @@ -263,14 +263,14 @@ public void onDisplayPreferenceDialog(Preference preference) {
//change request code for brapi url vs oidc url
if (preference.getKey().equals(brapiURLPreference.getKey())) {
new IntentIntegrator(getActivity())
.setPrompt(getString(R.string.main_barcode_text))
.setPrompt(getString(R.string.barcode_scanner_text))
.setBeepEnabled(false)
.setRequestCode(REQUEST_BARCODE_SCAN_BASE_URL)
.initiateScan();
} else {
prefMgr.getSharedPreferences().edit().putBoolean(GeneralKeys.BRAPI_EXPLICIT_OIDC_URL, true).apply();
new IntentIntegrator(getActivity())
.setPrompt(getString(R.string.main_barcode_text))
.setPrompt(getString(R.string.barcode_scanner_text))
.setBeepEnabled(false)
.setRequestCode(REQUEST_BARCODE_SCAN_OIDC_URL)
.initiateScan();
Expand Down
Loading

0 comments on commit 56b45c0

Please sign in to comment.