Code Monkey home page Code Monkey logo

openfoodfacts-androidapp's Introduction

Open Food Facts - Legacy Android app (still used for Open Beauty, Pet Food and Products Facts)

Open Food Facts is collaborative food products database made by everyone, for everyone. Open Food Facts contributors gathers information and data on food products from around the world, using mobile apps.


⚠️ WARNING

The new Open Food Facts app is located HERE

Note: This codebase is currently only deployed for Open Beauty Facts, Open Pet Food Facts and Open Products Facts apps.

Project Status Quality Gate Crowdin Build Open Source Helpers

What is Open Food Facts?

A food products database

Open Food Facts is a database of food products with ingredients, allergens, nutrition facts… which allow us to compute scores like Nutri-Score, NOVA groups and Eco-Score.

Made by everyone

Open Food Facts is a non-profit association of volunteers. 25000+ contributors like you have added 3M+ products from 150 countries using our Android or iPhone apps to scan barcodes and upload pictures of products and their labels.

For everyone

Data about food is of public interest and has to be open. The complete database is published as open data and can be reused by anyone.

User flows

Visual documentation of the App on Figma

Documentation of the source code

The documentation is generated automatically from the source code and your improvements to code documentation are published automatically. Code documentation on GitHub pages

Helping with our next release

Here are issues and feature requests you can work on:

What can I work on ?

Open Food Facts on Android has 0,5M users and 1,6M products. Each contribution you make will have a large impact on food transparency worldwide. Finding the right issue or feature will help you have even more more impact. Feel free to ask for feedback on the #android channel before you start work, and to document what you intend to code.

If you don't have time to contribute code, you're very welcome to

Help translate Open Food Facts in your language

You can help translate Open Food Facts and the app at (no technical knowledge required, takes a minute to signup):
https://translate.openfoodfacts.org

Installation

Choose the right flavor Install steps
* Download the latest Android Studio stable build.
* If you are running the app for the first time, Android Studio will ask you to install the Gradle dependencies.
* If you are a new contributor to open-source, we recommend you read our Setup Guidelines
* In Android Studio, make sure to select OFF as the default flavor for Open Food Facts (OBF is Open Beauty Facts, OPF - Open Products Facts, OPFF - Open Pet Food Facts)
* You should be able to install Open Food Facts on your phone using an USB cable, or run it in an emulator.
* The package name on the Play Store is org.openfoodfacts.scanner. For historic reasons, it's openfoodfacts.github.scrachx.openfood in the code and on F-Droid.

Running a Fastlane lane

The project uses Fastlane to automate release and screenshots generation.

Who do I talk to?

Contributing

If you're new to open-source, we recommend to checkout our Contributing Guidelines. Feel free to fork the project and send a pull request.

Libraries Used

We use the following libraries, and we're not closed to changes where relevant :-)

If you spot any libraries we added or we don't use anymore, feel free to update this list using a Pull Request.

  • Dagger 2 - A fast dependency injector for Android and Java
  • Retrofit - Retrofit turns your REST API into a Java interface
  • OkHttp - An HTTP+SPDY client for Android and Java applications
  • Mockito - Most popular Mocking framework for unit tests written in Java
  • Apache - The Apache Commons IO library contains utility classes, stream implementations, file filters, file comparators, endian transformation classes, and much more.
  • Kotlin Coroutines - A coroutine is a concurrency design pattern that you can use on Android to simplify code that executes asynchronously.
  • Hilt - Hilt is a dependency injection library for Android that reduces the boilerplate of doing manual dependency injection in your project.
  • Dagger - Manual dependency injection or service locators in an Android app can be problematic depending on the size of your project. You can limit your project's complexity as it scales up by using Dagger to manage dependencies. Dagger automatically generates code that mimics the code you would otherwise have hand-written.
  • Jackson - Core part of Jackson that defines Streaming API as well as basic shared abstractions
  • journeyapps/zxing-android-embedded - Barcode scanner library for Android, based on the ZXing decoder
  • GreenDao
  • mikepenz/MaterialDrawer - The flexible, easy to use, all in one drawer library for your Android project.

Big thanks to their contributors!

Copyright and License

Copyright 2016-2022 Open Food Facts

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and 
limitations under the License.



Contributors

The project was initially started by Scot Scriven, other contributors include:



openfoodfacts-androidapp's People

Contributors

balaji-ramavathu avatar brandenfung avatar deniger avatar dependabot-preview[bot] avatar dependabot[bot] avatar dobriseb avatar g123k avatar github-actions[bot] avatar herau avatar huzaifaiftikhar avatar iml-v avatar itchix avatar jaindiv26 avatar jaztriumph avatar karljoones avatar kartikaysharma01 avatar mrudultora avatar mustaqmustu avatar naivekook avatar philippeauriach avatar prajwalm2212 avatar prashantkh19 avatar rajavamsi11 avatar raphael0202 avatar ripetrescu avatar ross-holloway94 avatar shubham-vish avatar subhanjansaha avatar teolemon avatar vaiton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openfoodfacts-androidapp's Issues

Clone and play

Hi, i juste want to mention that Android Studio packages must be updated by just clicking on install packages in package manager, to let the VCS cloning from the app or the forked app on github then to have it installed and in work on the virtual android device.
thanks

Support for Open Beauty Facts

As Open Beauty Facts gets off the ground, it would be nice to be able to choose which project you want to contribute to.
Possibilites:

  • 2 separate apps
  • a global switch for the application
  • a switch on product send, and "magic" for product read

create a 'credit' page

it would be nice to have a place where you could take credit for your work, maybe put a link to OFF and a word on the licence the picture endup as.

App crash on offline edit Nexus 4

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:591)
at openfoodfacts.github.scrachx.openfood.fragments.OfflineEditFragment$FillAdapter.doInBackground(OfflineEditFragment.java:207)
at openfoodfacts.github.scrachx.openfood.fragments.OfflineEditFragment$FillAdapter.doInBackground(OfflineEditFragment.java:184)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more

scanning a bar code when no internet connection available

One get the following error:
screenshot_2015-05-10-21-13-00
The image of the scan product stays on until the user is triggering something.

I'm not sure what is the best way to go about it.
probably retrying (with a message letting the user know it is retrying)
or providing a way to retry (like a button),
or simply going forward with adding the product are

login is not displaying that well

The confirmation pop up icon (green icon),is not fully visible, same for the button (hidden under my virtual keyboard).
the text base confirmation is not visible
screenshot_2015-05-10-21-03-32

Layout for search by name

Aligning layout for search by name on scan barcode would make the view clean.
Full width button below the search field.
Going from
screenshot_20160418-110513
to
screenshot_20160418-110526

(

Adding Moodstock image recognition as an option at build time

The new app is going to be distributed on FDroid, which doesn't allow binary blobs.
At the same time, the Moodstock image recognition is a wow effect when showing off OFF :-)

Adding Moodstock image recognition as an option at build time would enable to have a version with the Moostock binary parts and behaviour, and another Free as in beer version for F-Droid.

When scan a product

java.lang.RuntimeException: Unable to start activity ComponentInfo{openfoodfacts.github.scrachx.openfood/openfoodfacts.github.scrachx.openfood.views.ProductActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.isEmpty()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.isEmpty()' on a null object reference
at openfoodfacts.github.scrachx.openfood.fragments.SummaryProductFragment.onCreateView(SummaryProductFragment.java:49)
at android.app.Fragment.performCreateView(Fragment.java:2053)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:894)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.app.BackStackRecord.run(BackStackRecord.java:834)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
at android.app.Activity.performStart(Activity.java:6005)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)
... 10 more

Null pointer

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.compareToIgnoreCase(java.lang.String)' on a null object reference
at openfoodfacts.github.scrachx.openfood.fragments.NutritionProductFragment.getImageLevel(NutritionProductFragment.java:94)
at openfoodfacts.github.scrachx.openfood.fragments.NutritionProductFragment.onCreateView(NutritionProductFragment.java:62)
at android.app.Fragment.performCreateView(Fragment.java:2053)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:894)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.app.BackStackRecord.run(BackStackRecord.java:834)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:447)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Make scanning more visible

Can you make scanning more visible ? Either a button on the home screen or a paperfab with a scan icon ?

Offline product lookup

A lot of apps like this I use on my tablet.
And it's on Wi-Fi some of the time but it's usually offline..
Having the ability to save single items, groups of items if not the entire database for extended periods
Of time would be fantastic..

Apps like this can help everyone eat better.And sadly a lot of the people who are challenged the most in proper nutrition don't have regular internet access.

Camera capture fails

The Scanner feature is broken due to bad camera capture. The sight appears, but the image is scrambled. Screenshot: https://i.imgur.com/MkyfXST.jpg
Barcode scanner (which uses ZXing too) works as expected on the same device

OpenFood v0.1.7 - F-droid version
Device: Galaxy Player 4.0
CyanogenMod 11

Let a user edit an existing product

Enable a user to edit an existing product, in a native way, while avoiding edition conflict with other users.

  • Let the user edit fields that are empty (get the user to edit the field, validate input, and perform diff a that moment)
  • Let the user edit fields that are not empty (get the user to edit the field, validate input, and perform diff a that moment)

Allow anonymous contribution

The Open Food Facts server allows anonymous contributions. Some users don't want to create accounts.
Let users create new products anonymously

Speech synthesis of food data

The application could be used as an accessibility aid for people who can't easily read the (usually very small) ingredient lists or other data on food labels.
This possibility would be enabled, or at least improved, if the app had support for speaking out ingredients and other data after scanning a barcode, using Android's TTS API in the appropriate language.

Add more images to existing products

Add a button on the product page to add fresher or missing images to an existing product.
Here's a mockup of how it would ideally work: a button on each tab, with a language dropdown. It allows the user to direct an image to a function (ingredient/nutrition/front) and a language (product can have up to 20 languages)

The current photo of the ingredients (for example) would be display, or an informative text (There is no photo of ingredients in French)

image

A button in each tab to add a photo if no picture is available

  • one in the main tab for the front image and additional images
  • one button for the ingredient photo
  • one for the nutrition photo

Behaviour:

  • if a front/ingredients/nutrition image is already selected for this language, show "Add more images" and upload images without selecting them
  • if no front/ingredients/nutrition image is selected for this language, show "Add images" and upload images without selecting them (the server will do the job)

Fix depdencies

Highest version for 21.x support libs is 21.0.3, not 21.1.1.

Material-dialogs is no longer in jcenter, but only in jitpack. First replace it with

compile('com.github.afollestad.material-dialogs:commons:0.8.5.7@aar') {
transitive = true
}

and you have to add jitpack to the allprojects repo list.

Also it would be good to pull as much dependecies from central repos and dont use jar files at all.

App crashes when opening offline edit before any product has been added

FATAL EXCEPTION: main
Process: openfoodfacts.github.scrachx.openfood, PID: 24844
android.database.sqlite.SQLiteException: no such table: SEND_PRODUCT (code 1): , while compiling: SELECT * FROM SEND_PRODUCT
   at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
   at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:891)
   at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:502)
   at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
   at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
   at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
   at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
   at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316)
   at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1163)
   at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1034)
   at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1240)
   at com.orm.SugarRecord.find(SugarRecord.java:201)
   at com.orm.SugarRecord.listAll(SugarRecord.java:127)
   at openfoodfacts.github.scrachx.openfood.fragments.OfflineEditFragment$FillAdapter.onPreExecute(OfflineEditFragment.java:188)
   at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:591)
   at android.os.AsyncTask.execute(AsyncTask.java:539)
   at openfoodfacts.github.scrachx.openfood.fragments.OfflineEditFragment.onResume(OfflineEditFragment.java:181)
   at android.app.Fragment.performResume(Fragment.java:2096)
   at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:928)
   at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
   at android.app.BackStackRecord.run(BackStackRecord.java:834)
   at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
   at android.app.FragmentManagerImpl$1.run(FragmentManager.java:447)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:135)
   at android.app.ActivityThread.main(ActivityThread.java:5294)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

Store the whole database (or a subset) locally

Would be great for contributors if they could

  • know the state of a product when they're offline or in a foreign country (to contribute)
  • read about the product offline (no 3G, poor 3G, or expensive data - either in supermarkets, or in 3G less countries or areas)

Offline edition explanation

On first use, there should be a little text to explain offline edition

You can scan products when you're offline to add them to Open Food Facts later. All the products you scan will appear here, and you'll be able to send them using the button below.

Make fields clickable on product page

One of the killer things on Open Food Facts web version is being able to browse from product to product by clicking on the fields (eg: Poissons panés or Findus)
It would be great to leverage the new API by letting users navigate using the App

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.