nicods96 / recipes-se Goto Github PK
View Code? Open in Web Editor NEWa recipes search engine
a recipes search engine
Describe the bug
An error shows when the app starts:
E/Google Maps Android API: Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIzaSyC7uc8dUyn5YQUeLfDvjqpEUXJJAUMqzf4
Android Application (<cert_fingerprint>;<package_name>): 03:75:70:B2:53:8F:7B:AA:05:E8:F6:62:EF:D3:97:24:19:2D:D6:8F;com.example.recipeSE
To Reproduce
Steps to reproduce the behavior:
Smartphone (please complete the following information):
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.recipeSE, PID: 18810
java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
at com.example.recipeSE.search.utils.SearchResultsAdapter.getItemCount(SearchResultsAdapter.java:108)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4044)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3849)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1915)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1780)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1546)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at androidx.appcompat.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:446)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:761)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2496)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2212)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Describe the bug
There is a bug when reading shared preferences, namely the default shared preference is null
instead of beeing new HashSet<String>
.
Example:
actual version
HashSet<String> list = (HashSet<String>) sharedPref.getStringSet(key, new HashSet<String>);
Must be:
HashSet<String> list = (HashSet<String>) sharedPref.getStringSet(key, new HashSet<String>);
this will lead to app crash whenever e add a new ingredient and there are not already saved ingredients.
To Reproduce
Steps to reproduce the behavior:
1.Delete all the saved ingredients
2. Close the app
3. open the app
4. search something
5. tap on an ingredient and the app crashes
Exception
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.recipeSE, PID: 9282 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.HashSet.add(java.lang.Object)' on a null object reference at com.example.recipeSE.search.utils.SearchResultsAdapter.appendToSharedPreference(SearchResultsAdapter.java:206) at com.example.recipeSE.search.utils.SearchResultsAdapter.addToShoppinglist(SearchResultsAdapter.java:193) at com.example.recipeSE.search.utils.SearchResultsAdapter.access$100(SearchResultsAdapter.java:30) at com.example.recipeSE.search.utils.SearchResultsAdapter$3.onClick(SearchResultsAdapter.java:181) at android.view.View.performClick(View.java:6597) at android.view.View.performClickInternal(View.java:6574) at android.view.View.access$3100(View.java:778) at android.view.View$PerformClick.run(View.java:25885) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Smartphone (please complete the following information):
2020-06-03 17:16:31.000 20436-20436/com.example.recipeSE D/ViewRootImpl@5b36b6c[MainActivity]: ViewPostIme pointer 0
2020-06-03 17:16:31.061 20436-20436/com.example.recipeSE D/ViewRootImpl@5b36b6c[MainActivity]: ViewPostIme pointer 1
2020-06-03 17:16:31.126 20436-20436/com.example.recipeSE W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@99902a3
2020-06-03 17:16:31.149 20436-20436/com.example.recipeSE D/PhoneWindow: forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4268 com.android.internal.policy.DecorView.updateColorViews:1510 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3246 android.view.Window.setFlags:1148 com.android.internal.policy.PhoneWindow.generateLayout:2474
2020-06-03 17:16:31.149 20436-20436/com.example.recipeSE I/MultiWindowDecorSupport: updateCaptionType >> DecorView@988ba91[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
2020-06-03 17:16:31.150 20436-20436/com.example.recipeSE D/MultiWindowDecorSupport: setCaptionType = 0, DecorView = DecorView@988ba91[]
2020-06-03 17:16:31.203 20436-20436/com.example.recipeSE D/ViewRootImpl@a12fce1[FacebookActivity]: setView = com.android.internal.policy.DecorView@988ba91 TM=true MM=false
2020-06-03 17:16:31.204 20436-20436/com.example.recipeSE D/ViewRootImpl@5b36b6c[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
2020-06-03 17:16:31.204 20436-20436/com.example.recipeSE D/InputMethodManager: prepareNavigationBarInfo() DecorView@2d97b93[MainActivity]
2020-06-03 17:16:31.204 20436-20436/com.example.recipeSE D/InputMethodManager: getNavigationBarColor() -855310
2020-06-03 17:16:31.223 20436-20436/com.example.recipeSE D/ViewRootImpl@a12fce1[FacebookActivity]: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)0 dur=6 res=0x7 s={true 498439655424} ch=true
2020-06-03 17:16:31.223 20436-20515/com.example.recipeSE D/OpenGLRenderer: createReliableSurface : 0x7407bdc780(0x740d519000)
2020-06-03 17:16:31.224 20436-20515/com.example.recipeSE I/mali_winsys: new_window_surface() [1080x2400] return: 0x3000
2020-06-03 17:16:31.231 20436-20515/com.example.recipeSE D/OpenGLRenderer: makeCurrent EglSurface : 0x73a5e88880 -> 0x73a5e88a00
2020-06-03 17:16:31.239 20436-20515/com.example.recipeSE D/OpenGLRenderer: makeCurrent EglSurface : 0x73a5e88a00 -> 0x73a5e88880
2020-06-03 17:16:31.241 20436-20436/com.example.recipeSE D/ViewRootImpl@a12fce1[FacebookActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
2020-06-03 17:16:31.241 20436-20436/com.example.recipeSE D/InputMethodManager: prepareNavigationBarInfo() DecorView@988ba91[FacebookActivity]
2020-06-03 17:16:31.241 20436-20436/com.example.recipeSE D/InputMethodManager: getNavigationBarColor() -855310
2020-06-03 17:16:31.243 20436-20436/com.example.recipeSE D/InputMethodManager: prepareNavigationBarInfo() DecorView@988ba91[FacebookActivity]
2020-06-03 17:16:31.243 20436-20436/com.example.recipeSE D/InputMethodManager: getNavigationBarColor() -855310
2020-06-03 17:16:31.243 20436-20436/com.example.recipeSE V/InputMethodManager: Starting input: tba=com.example.recipeSE ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
2020-06-03 17:16:31.243 20436-20436/com.example.recipeSE D/InputMethodManager: startInputInner - Id : 0
2020-06-03 17:16:31.243 20436-20436/com.example.recipeSE I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-06-03 17:16:31.249 20436-20515/com.example.recipeSE D/OpenGLRenderer: makeCurrent EglSurface : 0x73a5e88880 -> 0x73a5e88a00
2020-06-03 17:16:31.250 20436-20436/com.example.recipeSE D/InputTransport: Input channel destroyed: 'ClientS', fd=89
2020-06-03 17:16:31.254 20436-20436/com.example.recipeSE D/ViewRootImpl@a12fce1[FacebookActivity]: MSG_RESIZED: frame=(0,0,1080,2400) ci=(0,93,0,0) vi=(0,93,0,0) or=1
2020-06-03 17:16:31.450 20436-20436/com.example.recipeSE D/ViewRootImpl@a12fce1[FacebookActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
2020-06-03 17:16:31.450 20436-20436/com.example.recipeSE D/InputMethodManager: prepareNavigationBarInfo() DecorView@988ba91[FacebookActivity]
2020-06-03 17:16:31.451 20436-20436/com.example.recipeSE D/InputMethodManager: getNavigationBarColor() -855310
2020-06-03 17:16:31.650 20436-20436/com.example.recipeSE D/InputTransport: Input channel destroyed: 'ClientS', fd=102
2020-06-03 17:16:34.832 20436-20436/com.example.recipeSE I/com.example.recipeSE.MainActivity: facebook login Error
2020-06-03 17:16:34.833 20436-20436/com.example.recipeSE I/com.example.recipeSE.MainActivity: SERVER_ERROR: [code] 1349195 [message]: L'hash chiave non corrisponde a nessuno degli hash chiave memorizzati. Accedi a https://developers.facebook.com/docs/facebook-login/android per ulteriori informazioni. [extra]:
at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:219)
at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:174)
at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:91)
at com.example.recipeSE.MainActivity.onActivityResult(MainActivity.java:161)
at android.app.Activity.dispatchActivityResult(Activity.java:8294)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5230)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5278)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2220)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8019)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
2020-06-03 17:16:34.834 20436-20436/com.example.recipeSE D/ViewRootImpl@5b36b6c[MainActivity]: stopped(false) old=false
2020-06-03 17:16:34.843 20436-20436/com.example.recipeSE D/ViewRootImpl@5b36b6c[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
2020-06-03 17:16:34.843 20436-20436/com.example.recipeSE D/InputMethodManager: prepareNavigationBarInfo() DecorView@2d97b93[MainActivity]
2020-06-03 17:16:34.843 20436-20436/com.example.recipeSE D/InputMethodManager: getNavigationBarColor() -855310
2020-06-03 17:16:34.845 20436-20436/com.example.recipeSE D/InputMethodManager: prepareNavigationBarInfo() DecorView@2d97b93[MainActivity]
2020-06-03 17:16:34.845 20436-20436/com.example.recipeSE D/InputMethodManager: getNavigationBarColor() -855310
2020-06-03 17:16:34.846 20436-20436/com.example.recipeSE V/InputMethodManager: Starting input: tba=com.example.recipeSE ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
2020-06-03 17:16:34.846 20436-20436/com.example.recipeSE D/InputMethodManager: startInputInner - Id : 0
2020-06-03 17:16:34.846 20436-20436/com.example.recipeSE I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-06-03 17:16:34.861 20436-20515/com.example.recipeSE D/OpenGLRenderer: makeCurrent EglSurface : 0x73a5e88a00 -> 0x73a5e88880
2020-06-03 17:16:34.866 20436-20436/com.example.recipeSE D/ViewRootImpl@a12fce1[FacebookActivity]: stopped(true) old=false
2020-06-03 17:16:34.879 20436-20515/com.example.recipeSE D/OpenGLRenderer: destroyEglSurface : 0x73a5e88a00
2020-06-03 17:16:34.879 20436-20515/com.example.recipeSE I/mali_egl: eglDestroySurface() in
2020-06-03 17:16:34.881 20436-20515/com.example.recipeSE I/mali_winsys: delete_surface() [1080x2400] return
2020-06-03 17:16:34.881 20436-20515/com.example.recipeSE I/mali_egl: eglDestroySurface() out
2020-06-03 17:16:34.881 20436-20515/com.example.recipeSE W/libEGL: EGLNativeWindowType 0x7407bdc790 disconnect failed
2020-06-03 17:16:34.881 20436-20515/com.example.recipeSE D/OpenGLRenderer: ~ReliableSurface : 0x7407bdc780
2020-06-03 17:16:34.881 20436-20436/com.example.recipeSE D/ViewRootImpl@a12fce1[FacebookActivity]: dispatchDetachedFromWindow
2020-06-03 17:16:34.884 20436-20436/com.example.recipeSE D/InputTransport: Input channel destroyed: '755457d', fd=98
Describe the bug
Whan clicking on search buttons (in both the fragment DisplayRecipesFragment, SearchBarFragment) the progress bar in the layout is not showing even if the method to make it visible are correctly called (can be seen with checkpoints from the debugger)
To Reproduce
Steps to reproduce the behavior in searchBarFragment:
Steps to reproduce the behavior in DisplayRecipesFragment:
Expected behavior
Smartphone (please complete the following information):
Additional context
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Expected behavior
Dialog/error message saying "please insert a valid query"
Smartphone (please complete the following information):
Exception
I/System.out: req: {"ingredients":[""]}
I/System.out: []
W/System.err: java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
W/System.err: at java.util.concurrent.FutureTask.report(FutureTask.java:123)
at java.util.concurrent.FutureTask.get(FutureTask.java:193)
W/System.err: at com.example.recipeSE.search.utils.SharedViewModel.loadRecipes(SharedViewModel.java:56)
W/System.err: at com.example.recipeSE.search.utils.SharedViewModel.getRecipes(SharedViewModel.java:32)
at com.example.recipeSE.search.DisplayRecipesFragment$2.onClick(DisplayRecipesFragment.java:99)
W/System.err: at android.view.View.performClick(View.java:6597)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:967)
at android.view.View.performClickInternal(View.java:6574)
W/System.err: at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
W/System.err: at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err: at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
W/System.err: Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
W/System.err: at java.util.ArrayList.get(ArrayList.java:437)
W/System.err: at com.example.recipeSE.search.utils.AsynkQuery.call(AsynkQuery.java:66)
at com.example.recipeSE.search.utils.AsynkQuery.call(AsynkQuery.java:18)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.