Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Put song title text view into a horizontal scrollview so you can see the full song title on songs with longer song titles #160

Open
wants to merge 108 commits into
base: master
Choose a base branch
from

Conversation

theduffster
Copy link
Collaborator

There's not a lot of room for the song title in the current song view, which means the song title gets cut off most of the time and it's hard to figure out what the full name of the song is without going into the song details dialog. All of this is very annoying. Putting the textview into a horizontal scroll view is an elegant solution because it doesn't compromise any existing functionality, it doesn't change anything and it is very easy for the user to interact with.

full song title on songs with longer song titles
@theduffster theduffster requested a review from kabouzeid May 31, 2017 21:13
@niririke
Copy link

niririke commented Jun 7, 2017

I think I found a problem. Playing a song from e.g. album or playlist does not work sometimes with this change. I think it is because when you tap song's title it tries to scroll it horizontally. This happens even if the title is not long and can't actually be scrolled. Maybe we can use separate xml for current song view because the same file (item_list.xml) is used in both current song view and in playlists and albums (do I understand this correctly?). Though pressing song's title in current song view does not open queue now too.

@theduffster
Copy link
Collaborator Author

You're more then right. Actually, it seems like you can't play any song without clicking something that's not the textview. I'll have to see how I can fix this.

Making the text scrollable took away the ripple animations and it’s
ability to field the onclicklistener, so I had to recreate and
implement ripple animations and on touch from scratch. It works,
although not as smoothly as I’d like. Test it out and let me know your
thoughts. I’m not sure there’s an easier way to do this, but someone
can try and find one.
@theduffster
Copy link
Collaborator Author

theduffster commented Jun 8, 2017

Making the text scrollable took away the ripple animations and it’s ability to field the onclicklistener, so I had to recreate and implement ripple animations and on touch from scratch. It works, although it would be better if there was a simple way to make a scrollview not mess with the onclicklistener for the rest of the view. Test it out and let me know your thoughts. I’m not sure there’s an easier way to do this, but someone can try and find one.

@niririke
Copy link

niririke commented Jun 8, 2017

It surely works now! But there is a little (around half a second I guess) delay before ripple animation and actual song playback when I press song's title. Pressing anywhere else works fine (fast) though. It's not that big a deal I guess, but it is still perceptible.

@theduffster
Copy link
Collaborator Author

@niririke I agree. I don't think we should merge this until we get it so it's seamless. I am going to try to figure out what's slowing it down.

@arkon
Copy link
Collaborator

arkon commented Jun 8, 2017

I imagine it's something to do with it trying to register what type of touch it was (i.e. Was it actually a double touch? Better wait a split second to be sure.). Is it possible to add a listener to the ScrollView so that if the scrolling motion is under a certain threshold, it just dispatches the event (tap) to the underlying view instead?

@theduffster
Copy link
Collaborator Author

@arkon that's exactly what I'm trying right now.

@theduffster
Copy link
Collaborator Author

I GOT IT! Should be up and working soon. Had to create a custom FrameLayout class and intercept the touch event and control whether it gets passed to the scrollview or not.

Added a custom FrameLayout view that intercepts touch events and
decides whether to consume them or pass on the touch events to it's
children. This gives us control over if the FramLayout or the
HorizontalScrollView is the one getting the touch event.
@theduffster
Copy link
Collaborator Author

theduffster commented Jun 9, 2017

Touch handling in Android is terrible… Anyway, it should work smoothly now, as if there's no difference other then that the text scrolls horizontally (because as far as I can tell there is no difference). I'll merge it in a couple days once a couple people have reviewed it.

@theduffster
Copy link
Collaborator Author

So it seems that if you click on the 3 dots to open the menu sometimes the click also registers on the framelayout and opens the song. Gonna have to figure that out tomorrow.

.gitignore Outdated
@@ -40,3 +40,7 @@ captures/

# Mac
.DS_Store

*.gradle
Copy link
Collaborator

Choose a reason for hiding this comment

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

These shouldn't be in the gitignore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

noted

build.gradle Outdated
@@ -1,9 +1,13 @@
buildscript {
repositories {
jcenter()
maven {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should just leave this out of this PR for now.

@@ -1,6 +1,6 @@
#Tue Apr 11 17:46:33 SGT 2017
#Wed Jun 07 15:02:52 EDT 2017
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should just leave this out of this PR for now.

@@ -20,7 +20,16 @@
android:tintMode="src_in"
tools:ignore="ContentDescription" />

<View
Copy link
Collaborator

Choose a reason for hiding this comment

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

So is this just a dummy view for intercepting touches?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just a regular framelayout, but I've Overrided onInterceptTouch so I can delegate any touches to the right views. In this case either the HorizontalScrollView or this FrameLayout.

@theduffster
Copy link
Collaborator Author

It's now 100% working with no drawbacks compared to how the app performs without the scrolling textviews. However, if you test it let me know if you find anything wrong.

@arkon
Copy link
Collaborator

arkon commented Jun 9, 2017

I think I'm expecting it to register as a regular tap (or other things like long pressing) if I just tap directly on the scrolling textview, but it doesn't. Seems like an unexpected behaviour?

@theduffster
Copy link
Collaborator Author

It should just register as a regular tap, no different then if you were to touch another part of the screen. It should only not register a tap if you start scrolling and using the scrollview. That certainly it weird, on my end it seems to be working. @arkon what activity are you in?

@arkon
Copy link
Collaborator

arkon commented Jun 9, 2017

@theduffmaster It seems to happen everywhere (e.g. album view, songs list, now playing queue).

@theduffster
Copy link
Collaborator Author

@arkon so when you tap on the scrolling textview nothing happens? No animation, no click?

@kabouzeid
Copy link
Owner

I'll have a look at this now too

@theduffster
Copy link
Collaborator Author

That would be much appreciated @kabouzeid

@arkon
Copy link
Collaborator

arkon commented Jun 9, 2017

@theduffmaster Here's a video.

@theduffster
Copy link
Collaborator Author

theduffster commented Jun 9, 2017

@arkon Thanks for the video, it helps alot. If that's how it is on you side, then we have a big problem. That's not how it's supposed to act at all. That's how it acted back on the first commit. Are you sure you've synced the most recent commits?

Copy link
Owner

@kabouzeid kabouzeid left a comment

Choose a reason for hiding this comment

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

I don't quite understand what the purpose of this whole thing is. It seems to be some kind of a workaround?

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
Copy link
Owner

Choose a reason for hiding this comment

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

Not yet in the production branch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right. My git configuration got messed up, I'll remove these

build.gradle Outdated
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
Copy link
Owner

Choose a reason for hiding this comment

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

Not yet in the production branch

@theduffster
Copy link
Collaborator Author

theduffster commented Aug 1, 2017

@arkon I removed the invisible view (they were originally there for testing) and changed the text view name to AutoTruncateTextView, I agree a much more suitable name. It seems like at some point the text setting was broken and it now occasionally sets the text in the recyclerview as the previous truncated text. I'm on vacation, but when I get a chance I'll look into this. It wasn't happening before so I wonder what broke it. Scroll something in the songs tab and then scroll up and down and you'll see that same song title appear where other songs should be.

Edit: I think I fixed it
Edit: Nope

@theduffster
Copy link
Collaborator Author

theduffster commented Aug 1, 2017 via email

@arkon
Copy link
Collaborator

arkon commented Aug 2, 2017

I'm noticing the occasional wrong string too.

@arkon
Copy link
Collaborator

arkon commented Aug 3, 2017

@theduffmaster I committed something that I think is a better fix for it. Let me know if you still see the issue.

}
this.truncatedText = truncatedText;

final TouchInterceptHorizontalScrollView scrollView = getTouchInterceptHorizontalScrollView();
Copy link
Collaborator Author

@theduffster theduffster Aug 3, 2017

Choose a reason for hiding this comment

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

As long as the scrollview never shows up as null, which I don't think it will because the mParent flag should be set after onMeasure, this will do even better. Good work!

@theduffster theduffster dismissed arkon’s stale review August 3, 2017 03:18

I think that's everything right?

@theduffster
Copy link
Collaborator Author

theduffster commented Aug 5, 2017

@arkon After a couple days of testing your fix seems to work! Thanks again. Pending a couple more days of testing I think this is about done!

AdrienPoupa added a commit to VinylMusicPlayer/VinylMusicPlayer that referenced this pull request Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants