Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event list improvements #963

Merged
merged 10 commits into from
Sep 5, 2020
Merged

Event list improvements #963

merged 10 commits into from
Sep 5, 2020

Conversation

lucasnz
Copy link
Contributor

@lucasnz lucasnz commented Aug 29, 2020

change event list to better take advantage of gifs. Improved event list loading. Click notifications in montage view applies filter so only new events are displayed.

@welcome
Copy link

welcome bot commented Aug 29, 2020

💖 Thanks for opening this pull request! 💖

Copy link
Member

@pliablepixels pliablepixels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What build errors were you getting? I don't seem to have an issue with portrait and landscape splash entries

Copy link
Member

@pliablepixels pliablepixels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you summarize what has been done here? A lot of changes were were

@lucasnz
Copy link
Contributor Author

lucasnz commented Aug 29, 2020

Build error did not seem to effect the app at all. So it may not matter. Or maybe it's something with my environment setup?

C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-land-hdpi\screen.png: Error: The drawable "screen" in drawable-land-hdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-land-ldpi\screen.png: Error: The drawable "screen" in drawable-land-ldpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-land-mdpi\screen.png: Error: The drawable "screen" in drawable-land-mdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-land-xhdpi\screen.png: Error: The drawable "screen" in drawable-land-xhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-land-xxhdpi\screen.png: Error: The drawable "screen" in drawable-land-xxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-land-xxxhdpi\screen.png: Error: The drawable "screen" in drawable-land-xxxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-port-hdpi\screen.png: Error: The drawable "screen" in drawable-port-hdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-port-ldpi\screen.png: Error: The drawable "screen" in drawable-port-ldpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-port-mdpi\screen.png: Error: The drawable "screen" in drawable-port-mdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-port-xhdpi\screen.png: Error: The drawable "screen" in drawable-port-xhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-port-xxhdpi\screen.png: Error: The drawable "screen" in drawable-port-xxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\Development\zmNinja\platforms\android\app\src\main\res\drawable-port-xxxhdpi\screen.png: Error: The drawable "screen" in drawable-port-xxxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]

Explanation for issues of type "MissingDefaultResource":
If a resource is only defined in folders with qualifiers like -land or -en,
and there is no default declaration in the base folder (layout or values
etc), then the app will crash if that resource is accessed on a device
where the device is in a configuration missing the given qualifier.

As a special case, drawables do not have to be specified in the base
folder; if there is a match in a density folder (such as drawable-mdpi)
that image will be used and scaled. Note however that if you only specify
a drawable in a folder like drawable-en-hdpi, the app will crash in
non-English locales.

There may be scenarios where you have a resource, such as a -fr drawable,
which is only referenced from some other resource with the same qualifiers
(such as a -fr style), which itself has safe fallbacks. However, this still
makes it possible for somebody to accidentally reference the drawable and
crash, so it is safer to create a default dummy fallback in the base
folder. Alternatively, you can suppress the issue by adding
tools:ignore="MissingDefaultResource" on the element.

(This scenario frequently happens with string translations, where you might
delete code and the corresponding resources, but forget to delete a
translation. There is a dedicated issue id for that scenario, with the id
ExtraTranslation.)

12 errors, 0 warnings

@pliablepixels
Copy link
Member

Hmm I thought I was leaving comments in the code. Not sure how they showed up here. Let me try again.

@lucasnz
Copy link
Contributor Author

lucasnz commented Aug 29, 2020

Happy to talk though any of the changes – I was just going to make some small tweaks, but they kept getting bigger and bigger. Sorry, I’ll try and make any future commits more manageable. It may be worth simply compiling the changes and checking out the events list (it’s mostly UI changes despite the large amount of code change), and the new behaviour when you click a notification on the montage view.
Unfortunately, the commits are partly dependent on each other, so they probably need to be accepted as a group. There are two key commits:

  1. "increase image size in event list, improve layout and loading code"
    This is where most of the changes are in the Event List view. This change includes:
    a) increasing the image size in the event list (changes in js and html)
    b) There was some code duplication for a new page load and extending the page. I merged this into one group of functions (this makes the change look bigger)
    c) fixing the several minor issues with page loading – main one being introducing a delay before more items are loaded on initial page load, thus resolving the issue where two pages are loaded when starting the event list view
    d) Added “static” variable maxEventsToLoad so that only 5 new items are displayed at a time – this improves memory utilisation and load time with lots of gifs. Page load still pulls 100 entries from the server and stores them to be added to on scroll page scroll (so the 5 limit has minimal impact from a user perspective, as we’re simply adding to the end of the view).
    e) Improved the scroll loading logic

  2. "when click notification in montage, filter event view to only display events since last notification click"
    This change helps the user by filtering the event list to only new events since they last click the notification icon (in the montage view). I’d like to extend this to the other notification types (TODO).

www/js/NVR.js Outdated
if (versionCompare(success.data.version, '1.32.0') != -1) {
if (versionCompare(success.data.version, '1.34.0') != -1) {
debug("objdetect supported in image.php");
snapshotFrame = 'objdetect';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be controlled by a dial in dev settings? If objdetect shows gif by default it may be quite heavy even if gif animation is being generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agree. I can add this if you like

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please

Copy link
Member

@pliablepixels pliablepixels Aug 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things to think about:
a) This will only show gif if gif animation is enabled. If not, it will show the detected object frame - which is lower res than original frames.
b) I noticed elsewhere that when you enable this, I think you are limiting loaded entries to 5? Incase animation is disabled, it may slow UX down

"-" + nolangTo);

NVR.getEvents($scope.id, currEventsPage, "", nolangFrom, nolangTo, false, $rootScope.monitorsFilter)
.then(function (data) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general a lot of changes made to EventCtrl/events.html. The code here is ugly (i.e. the stuff I wrote) and its been a while since I looked at it. Can you summarize what you did and why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was changing the height of the image, I found the height of various sections was hardcoded. Most of the changes in the html change the sections to "dynamic" height (fit contents).

"&height=" + event.Event.thumbHeight * 2;
snapshotFrame+"&eid="+event.Event.Id +
"&width=" + event.Event.thumbWidth +
"&height=" + event.Event.thumbHeight;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason it was *2 was that if zM scaled it exactly to the resolution, they would show up jaggy on mobile devices

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - I might have to play with this. I suspect you are right. The previews a do not look "smooth" (i.e. they are jaggy). I guess I thought it was ok (just a preview). But I think I was changing it to support the larger images, not to change the image quality - so I may have this wrong. I'll test this and may add an additional commit to add back the *2.

@pliablepixels
Copy link
Member

Could you also resolve the small merge conflicts in the next push. Ver has been bumped up to 1.5 in my master. I replaced push plugin with firebasex and cordova versions have been upgraded due ot that.

@lucasnz
Copy link
Contributor Author

lucasnz commented Aug 29, 2020

Could you also resolve the small merge conflicts in the next push. Ver has been bumped up to 1.5 in my master. I replaced push plugin with firebasex and cordova versions have been upgraded due ot that.

Should I merge all changes in the dev branch?

@pliablepixels
Copy link
Member

I've already merged dev to master, so continue with master (that is why we got a merge conflict)

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 1, 2020

By way of update, when I do the merge I have trouble "compiling". Has this moved from Android SDK 7 to 8? Is the ionic version and other items still the same? I think the problem relates to the new notification plugin - but I can't figure it out. Any tips would be appreciated or at least any indication on build environment changes from the previous version. I'll probably figure it out eventually, but it may take little while (can't afford too many late nights at the moment and still have a day job) :-)

@pliablepixels
Copy link
Member

They’ve changed. See updated build from source instructions on versions.

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 2, 2020

I should have mentioned, I did look at the updated build from source instructions. I was confused as it says to use
npm install -g [email protected] ionic

but the 'ionic info' output shows;
Cordova CLI : 9.0.0 ([email protected])

@pliablepixels
Copy link
Member

Yup should be 9.0. Did you resolve your build issue?

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 2, 2020

Yes, looks like I have a working build. In terms of your build instructions these are the steps I followed to get it going. The commands are based on a Windows 10 environment, but I think they are largely transferable to other systems;
node-v12.18.3-x64.msi
rubyinstaller-devkit-2.6.6-1-x64.exe

npm install -g [email protected] @ionic/cli
npm install @ionic/v1-toolkit --save-dev

npm i -g cordova-res
gem install cocoapods

cd C:\Development\

git clone https://github.com/pliablepixels/zmNinja.git

cd zmNinja

npm install
ionic cordova platform add android
cordova prepare

pliablepixels added a commit that referenced this pull request Sep 2, 2020
Enables selection of different thumbnail types.
If gif is selected limit the number of events returned to 5 to improve load time.
@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 5, 2020

Merge conflicts resolved. modified the "enableThumbs" dev option to select different thumb types. Looks to be working fine. Took a bit longer, as I need to upgrade ES to make sure it was all working :)

pliablepixels added a commit that referenced this pull request Sep 6, 2020
pliablepixels added a commit that referenced this pull request Sep 6, 2020
maymaymay added a commit to maymaymay/zmNinja that referenced this pull request Sep 6, 2020
pliablepixels added a commit that referenced this pull request Sep 6, 2020
pliablepixels added a commit that referenced this pull request Sep 6, 2020
pliablepixels added a commit that referenced this pull request Sep 6, 2020
@pliablepixels
Copy link
Member

pliablepixels commented Sep 6, 2020

Okay, I have things in a stable state across desktop/iOS/Android. Have tested small/large/none in portrait and landscape mode. Basically, in small I go to a 2 col format, in large a single col format and went back to collection-repeat to get back the performance.

One thing I noticed is that on Montage, if I tap on the bell button, it takes me to the events view with a filter on, which is correct based on the feature you added. However, I think in this case, we should clear the filter when the view exits. Otherwise, when I go to events later, the filter will be on and will not make sense because I did not go from Montage. Note that this is different from me manually setting a filter - then I know I did it.(I just did a commit for that)

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 7, 2020

RE: collection-repeat vs ng-repeat - Now that I've read up on the difference, I see I shouldn't have made this change. I think I made the change to fix the problems I was having with dynamic height of event

. Thanks for resolving this. This should also mean that the limit (5) for object_gif is not required. Furthermore, that the code that applies this limit can be removed (this will simplify loadMore() - let me test and make sure it resolves the issue (the view was sluggish with 100 animated gifs - but that was probably ng-repeat and it sounds like collaction-repeat should fix that).

@pliablepixels
Copy link
Member

I think the 5 (or so) for GIF may still be needed. GIF may take up much more resources.

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 7, 2020

The change to clear the filter when leaving the view, means when you click filter by date/time it does not display the current filter (which it should really). It's also throwing an exception when entering this view when entering the filter screen after clicking the alert in the montage view (which it wasn't doing before).

Looking at things now, I think I had changed to ng-repeat as this didn't require a static height to be specified for each item. But, given the performance improvements it seems better to leverage collection-repeat (and thus deal with managing the rowHeight).

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 7, 2020

I'm pretty happy with how the updates above look with small thumbnails, but I see I have an issue with the large thumbs (at least on Android - images are too wide and disappear of the screen). I'll fix it tomorrow, I need to go to bed - have work tomorrow :)

pliablepixels added a commit that referenced this pull request Sep 7, 2020
 #963 show filter text properly, also indicate selective monitors
pliablepixels added a commit that referenced this pull request Sep 7, 2020
#963 allow size selection of thumbs
@pliablepixels
Copy link
Member

pliablepixels commented Sep 7, 2020

The change to clear the filter when leaving the view, means when you click filter by date/time it does not display the current filter (which it should really).

Please make sure you are using the latest master. In my case, manually selecting a filter does show the filter icon

It's also throwing an exception when entering this view when entering the filter screen after clicking the alert in the montage view (which it wasn't doing before).

I am not seeing this, at least with master.

at least on Android - images are too wide and disappear of the screen

Which android OS and device? Not happening on my device

I'm pretty happy with how the updates above look with small thumbnails,

Have you made any changes I should be looking to merge? If so, please make it on master and an updated PR. I don't see any PRs

maymaymay added a commit to maymaymay/zmNinja that referenced this pull request Sep 7, 2020
pliablepixels added a commit that referenced this pull request Sep 7, 2020
#963 show filter text properly, also indicate selective monitors
@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 7, 2020

The change to clear the filter when leaving the view, means when you click filter by date/time it does not display the current filter (which it should really).

Please make sure you are using the latest master. In my case, manually selecting a filter does show the filter icon

I believe I merged with the latest master before testing. I will take another look tonight - haven't tried to investigate this yet.

It's also throwing an exception when entering this view when entering the filter screen after clicking the alert in the montage view (which it wasn't doing before).

This is in the browser during testing

I am not seeing this, at least with master.

at least on Android - images are too wide and disappear of the screen

Which android OS and device? Not happening on my device

I'm pretty happy with how the updates above look with small thumbnails,

Have you made any changes I should be looking to merge? If so, please make it on master and an updated PR. I don't see any PRs

Yes, is tagging the PR not the right thing to do?. See:
https://github.com/lucasnz/zmNinja/commit/20ba719625f7cd2b3cb15d0eb73bb95bf0d91ae3
https://github.com/lucasnz/zmNinja/commit/9cb8dbb450d1af53333ecddefe321d8a35f4811f
https://github.com/lucasnz/zmNinja/commit/187bbf5f78824069ca4b1937b5a227745937719a

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 7, 2020

I resolved the Android image size issue I mentioned earlier (problem I introduced with the above commits).
https://github.com/lucasnz/zmNinja/commit/34a9f8cbc79b958bc2d730cc3fead34a69fc63ba
https://github.com/lucasnz/zmNinja/commit/eb5a3766818122810f49c372501c5937f86de604

I'll look into the filter thing tonight.

@pliablepixels
Copy link
Member

pliablepixels commented Sep 7, 2020

You'll have to do a new PR. Tagging doesn't make it pullable.
You may want to merge master from my repo (your remote) into your dev branch and do a push and a PR.

If you are referring to an exception related to isNative of null or similar, it is coming from the infinite scroll code. I haven't looked at all the changes made, but simplification may be a good idea

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 7, 2020

Created a new PR.
In terms of the filter exception. It occurs when you enter the filter screen with a filter applied. It used to populate the filter screen with the current filter (from montage alert). I think clearing the filter when leaving the event view has caused this. As far as I can tell, the error seems to only occur after clicking a montage alert...

Just testing now, there seems to be a problem with row height after applying a filter too. I'm happy to dig into both after work...

@pliablepixels
Copy link
Member

Ok, let me know what you find in the filter part. I don't see any exception in your situation, but please post the exact results (also testing on a browser).

@pliablepixels
Copy link
Member

I've made a commit that addresses the filter concern (I think). The expected behavior:

Case 1:
a) If you are in montage and you tap on the "bell" icon, you go into events view with filter on
b) If you then get out of events, filter is reset (this is a temporary filter)

Case 2:
a) If you are in montage and you tap on the "bell" icon, you go into events view with filter on
b) If inside events, you go to events filter view, the filter persists
c) Now that you have gone inside event filter view, this temporary filter becomes persistent as well
d) If you get out and come back, the filter persists till you reset

Note that I am still seeing an occasional exception in event scrolling which is being triggered with the loadMore() code. Need to get into it.

@lucasnz
Copy link
Contributor Author

lucasnz commented Sep 8, 2020

I don't know where I was seeing that exception on the event filter (it's gone now). But the event filter is loading wasn't working for me NVR.debug ("removing montage temporary filter") was being called eveytime. I found a work around for this in my other PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants