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
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
85b2aab
Put song title text view into a horizontal scrollview so you can see the
theduffster May 31, 2017
7ad72c5
Merge remote-tracking branch 'kabouzeid/master' into song_name_scroll
theduffster Jun 7, 2017
989d086
fixed textview not being clickable and made album titles scrollable
theduffster Jun 8, 2017
f405353
Added custom FrameLayout to control Touch Events
theduffster Jun 9, 2017
c33623d
fixed formatting and removed debugging
theduffster Jun 9, 2017
b232b39
fixed formatting
theduffster Jun 9, 2017
1d990f8
Fix Menu Item Click being stolen by parent view
theduffster Jun 9, 2017
f07d337
Fixed Longclick not firing in every spot in the view
theduffster Jun 9, 2017
5e92a74
Reverted gradle changes and changed "get" to "set"
theduffster Jun 9, 2017
dc7b7b2
more grade reverts
theduffster Jun 9, 2017
4743027
Changed CustomFrameLayout name to more descriptive name
theduffster Jun 9, 2017
585f9e7
Added logging
theduffster Jun 9, 2017
c697fa7
Added coordinate logs
theduffster Jun 9, 2017
677d033
fixed coordinate logging
theduffster Jun 9, 2017
0b7c234
Possible fix so it works on all phones
theduffster Jun 9, 2017
0f003ad
Manually forced click
theduffster Jun 9, 2017
8c18349
callonclick manually
theduffster Jun 9, 2017
d7cfe75
something different
theduffster Jun 9, 2017
f6dd635
trying to gauge on move
theduffster Jun 9, 2017
f5e4aba
fixed long press when scrolling
theduffster Jun 10, 2017
76ab6ee
smaller click distance
theduffster Jun 10, 2017
896c4f7
Potentially fix scroll/tap detection
echeung-amzn Jun 10, 2017
d1bc242
Merge pull request #1 from arkon/song_name_scroll_patch
theduffster Jun 10, 2017
ebf0d0e
Added case for devices that call ACTION_MOVE on clicks
theduffster Jun 10, 2017
8689c45
Merge remote-tracking branch 'kabouzeid/master'
theduffster Jun 10, 2017
7df7e55
Merge pull request #3 from theduffmaster/song_name_scroll
theduffster Jun 10, 2017
f35bd92
Minor cleanups
echeung-amzn Jun 10, 2017
91ecba3
Merge pull request #4 from arkon/song_name_scroll
theduffster Jun 10, 2017
0cc5fc7
Merge pull request #5 from theduffmaster/song_name_scroll
theduffster Jun 10, 2017
df46c8e
Fixed weird behavior in PlayingQueue and on Vertical Scrolling. Added…
theduffster Jun 11, 2017
0baa2e0
Move truncating error log
theduffster Jun 11, 2017
0738982
See above commit
theduffster Jun 11, 2017
ba6a88e
Fixed more error reporting
theduffster Jun 11, 2017
0c22e8e
Added Arkon's suggestions and added setTruncateText to SearchAdapter
theduffster Jun 11, 2017
b0797a5
Removed retrieving string resources and added documentation for Cance…
theduffster Jun 11, 2017
822421f
Removed Error Tag resource strings
theduffster Jun 11, 2017
1703199
Merge branch 'master' into song_name_scroll
arkon Jun 13, 2017
f1a9ad2
Revert back to tried and trusted method of ignoring long clicks
theduffster Jun 13, 2017
25f80e8
Added get ACTION_MASK to get bit info on movement. Much improved touc…
theduffster Jun 13, 2017
9eb947e
Touch passed to nested scroll supporting views on over scroll
theduffster Jun 13, 2017
e933d59
removed unnecessary setting of variable
theduffster Jun 15, 2017
d3a1e36
toggle scrolling on and off with data binding
theduffster Jul 1, 2017
3c3fec9
Revert "removed unnecessary setting of variable"
theduffster Jul 1, 2017
3667521
Revert "Revert "removed unnecessary setting of variable""
theduffster Jul 1, 2017
63cd45d
Revert "toggle scrolling on and off with data binding"
theduffster Jul 1, 2017
f0bf36b
Canceled child touches on list parent scrolling
theduffster Jul 7, 2017
0e0d893
Don't need this anymore since we're interacting with the recycler vie…
theduffster Jul 7, 2017
84f8023
Retruncates text after scrolling with a 1000ms delay
theduffster Jul 7, 2017
25099c9
Can now easily set everything from xml. Added options to set things p…
theduffster Jul 9, 2017
6057efa
SearchAdapter Fix
theduffster Jul 9, 2017
885a606
Added correct scroll state int for recycler view
theduffster Jul 9, 2017
6a3cbec
Added documentation
theduffster Jul 10, 2017
194837f
Code cleanup
theduffster Jul 10, 2017
1d42670
Added CanScroll() boolean to fix truncating on text that does not nee…
theduffster Jul 11, 2017
f85f927
Implemented safer way to test CanScroll
theduffster Jul 11, 2017
096786c
Code cleanup
theduffster Jul 11, 2017
404a87b
Merge branch 'dynamic_playing_queue_w_song_scroll' into song_name_scroll
theduffster Jul 12, 2017
19a02bc
Fix inconsistent dragging on playing queue sliding panel
theduffster Jul 13, 2017
0f99fd7
Possibly fixed long press getting canceled
theduffster Jul 14, 2017
c96bc95
Removed mini player scrolling ability
theduffster Jul 14, 2017
fbbb5e9
Fixed long click not clicking
theduffster Jul 14, 2017
fc61205
TextView intercepts settext and makes sure it doesn't blink but the i…
theduffster Jul 21, 2017
dc8f4d9
Commit before programmatically create scrollviews
theduffster Jul 23, 2017
841aca0
Setting text through onMeasure is successful
theduffster Jul 24, 2017
5d18033
Optimized and fixed flashing, scroll not sticking. Just need to preve…
theduffster Jul 24, 2017
af7b37b
Fixed not retruncating and not untruncating
theduffster Jul 24, 2017
c2964fb
Fixed over scroll and background setting
theduffster Jul 24, 2017
3398136
Cleaned up code
theduffster Jul 24, 2017
9fce7f6
fixed not retrunucating
theduffster Jul 24, 2017
547ed42
Merge remote-tracking branch 'kabouzeid/master' into song_name_scroll
theduffster Jul 24, 2017
5cf52b5
Resolved conflict
theduffster Jul 24, 2017
b7ef464
Resolved further conflicts
theduffster Jul 24, 2017
cafa622
Add to single row list item
theduffster Jul 24, 2017
bb8833c
Removed setListParent, so no longer no need to set anything dynamical…
theduffster Jul 24, 2017
ad51a4c
Cleaned up comments
theduffster Jul 24, 2017
06ec3ef
Made ArtistDetailActivity artist name scrollable
theduffster Jul 24, 2017
e565a42
Made Grid Item titles scrollable
theduffster Jul 24, 2017
f95a90e
Clean up
theduffster Jul 24, 2017
726ceb1
Added check so untruncate only get called onscroll for all devices
theduffster Jul 24, 2017
c2fc441
Revert "Made Grid Item titles scrollable"
theduffster Jul 24, 2017
f587840
Implemented Arkon's changes plus more cleanup
theduffster Jul 24, 2017
6b72b35
Added documentation
theduffster Jul 25, 2017
d286e8f
Fixed illegal unicode in comments
theduffster Jul 25, 2017
e7d1da6
Merge remote-tracking branch 'kabouzeid/master' into song_name_scroll
theduffster Jul 26, 2017
9c27672
Added further documentation
theduffster Jul 28, 2017
1633340
Formatting fixes
echeung-amzn Jul 28, 2017
cbf25cb
Refactoring
echeung-amzn Jul 29, 2017
95426e6
Removed uses of cancelPendingInputEvents and slidingPanelSetTouchEnabled
theduffster Jul 29, 2017
78c2a09
More cleanup
echeung-amzn Jul 29, 2017
a0bfa37
Removed invisible test view and changed TouchInterceptTextView to Aut…
theduffster Aug 1, 2017
e3b3fa0
Refactored to AutoTruncateTextView
theduffster Aug 1, 2017
780f0d7
fixed wrong string not truncating (I think)
theduffster Aug 1, 2017
e9596ed
Reverted invisible view removal because it turns out those are used t…
theduffster Aug 1, 2017
caa3d2c
Minor edits
echeung-amzn Aug 2, 2017
a617668
Possibly fixed wrong re truncating text
theduffster Aug 2, 2017
ac46c30
Possibly better fix for wrong text
echeung-amzn Aug 3, 2017
4237452
Fixed the occasional long click on scroll
theduffster Aug 7, 2017
a24bd98
Don't need this anymore
theduffster Aug 7, 2017
b2971b3
Code cleanup
theduffster Aug 8, 2017
0c68210
Reverted back to old method of checking for retruncate for performanc…
theduffster Aug 9, 2017
6f600b6
Better way of canceling unwarranted long clicks
theduffster Aug 9, 2017
1800182
Code cleanup
theduffster Aug 9, 2017
f09c145
Addressed invalid pointer id error
theduffster Aug 10, 2017
8bef5cc
Reverted scrollview because that fixes the occasional unwarranted tex…
theduffster Aug 10, 2017
3b3104e
Use animator listener to retruncate text instead of timeout handler
echeung-amzn Aug 12, 2017
9eb14b6
Added further documentation
theduffster Aug 12, 2017
78890be
Corrected code inconsistency
theduffster Aug 14, 2017
26548dc
Merge remote-tracking branch 'kabouzeid/master' into song_name_scroll
theduffster Aug 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.kabouzeid.gramophone.R;
Expand All @@ -17,6 +19,10 @@
* @author Karim Abou Zeid (kabouzeid)
*/
public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
@Nullable
@BindView(R.id.song_view)
public LinearLayout songView;

@Nullable
@BindView(R.id.image)
public ImageView image;
Expand All @@ -29,6 +35,10 @@ public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements Vie
@BindView(R.id.title)
public TextView title;

@Nullable
@BindView(R.id.title_scrollview)
public HorizontalScrollView title_scrollview;

@Nullable
@BindView(R.id.text)
public TextView text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected SongAdapter.ViewHolder createViewHolder(View view) {
}

@Override
public void onBindViewHolder(@NonNull SongAdapter.ViewHolder holder, int position) {
public void onBindViewHolder(@NonNull final SongAdapter.ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
if (holder.imageText != null) {
holder.imageText.setText(String.valueOf(position - current));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

Expand Down Expand Up @@ -109,6 +110,8 @@ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {

if (holder.title != null) {
holder.title.setText(getSongTitle(song));


}
if (holder.text != null) {
holder.text.setText(getSongText(song));
Expand All @@ -118,6 +121,8 @@ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {

}



private void setColors(int color, ViewHolder holder) {
if (holder.paletteColorContainer != null) {
holder.paletteColorContainer.setBackgroundColor(color);
Expand Down Expand Up @@ -197,6 +202,13 @@ public ViewHolder(@NonNull View itemView) {
if (menu == null) {
return;
}
menu.setOnTouchListener(new View.OnTouchListener()
{public boolean onTouch(View v, MotionEvent ev)
{
menu.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
menu.setOnClickListener(new SongMenuHelper.OnClickSongMenu(activity) {
@Override
public Song getSong() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.method.ScrollingMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -327,6 +328,8 @@ public void setStatusbarColor(int color) {
private void setAlbum(Album album) {
this.album = album;
loadAlbumCover();
//allows album title's that are longer then their container to be scrolled horizontally
albumTitleView.setMovementMethod(new ScrollingMovementMethod());
albumTitleView.setText(album.getTitle());
adapter.swapDataSet(album.songs);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.kabouzeid.gramophone.views;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;

/**
* Created by lincoln on 6/8/17.
*/

/**
* A custom FrameLayout view that intercepts touch events and decides whether to consume them or
* pass on the touch events to it's children
*/
public class CustomFrameLayout extends FrameLayout {

public CustomFrameLayout(@NonNull Context context) {
super(context);
}

public CustomFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}

public CustomFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

/**
* This intercepts the touch event and, by returning false, passes the touchevent to both itself and it's
* child views (by calling TouchEvent it passes it to itself). However, if the action is ACTION_MOVE it cancels the touch event in itself and
* only gives it to it's children, which, in this case is a HorizontalScrollView
* @param e the intercepted touch event
* @return If this function returns true, the MotionEvent will be intercepted,
* meaning it will be not be passed on to the child, but rather to the onTouchEvent of this View.
*/
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {

switch (e.getAction()) {
case MotionEvent.ACTION_MOVE: {
MotionEvent eUp = e;
eUp.setAction(MotionEvent.ACTION_CANCEL);
onTouchEvent(eUp);
}
}
onTouchEvent(e);
return false;
}
}
1 change: 1 addition & 0 deletions app/src/main/res/drawable-v21/rect_selector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:state_activated="true"
android:drawable="@color/ripple_material_light" />
</selector>

</item>

</ripple>
6 changes: 3 additions & 3 deletions app/src/main/res/drawable/rect_selector.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@color/ripple_material_light" android:state_activated="true" android:state_pressed="true" />
<item android:drawable="@color/ripple_material_light" android:state_activated="true" />
<item android:drawable="@color/ripple_material_light" android:state_pressed="true" />
<item android:color="@color/ripple_material_light" android:state_activated="true" android:state_pressed="true" />
<item android:color="@color/ripple_material_light" android:state_activated="true" />
<item android:color="@color/ripple_material_light" android:state_pressed="true" />
<item android:drawable="@android:color/transparent" />

</selector>
2 changes: 2 additions & 0 deletions app/src/main/res/layout/activity_album_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">


<TextView
android:id="@+id/title"
android:layout_width="match_parent"
Expand All @@ -45,6 +46,7 @@
android:paddingLeft="72dp"
android:paddingRight="72dp"
android:singleLine="true"
android:ellipsize="none"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
tools:ignore="UnusedAttribute" />

Expand Down
40 changes: 31 additions & 9 deletions app/src/main/res/layout/item_list.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.kabouzeid.gramophone.views.CustomFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="72dp"
Expand All @@ -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.

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 put a comment here for future reference so people know what this is for.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I plan on going through this and documenting everything tonight, but I'll definitely do this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@arkon Let me know if there's anything you still see that might not be so clear. I'm pretty sure I explained everything, but I'd be surprised if I didn't miss a thing or two.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll look through the view classes tomorrow evening. 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

So what is this invisible view for again?

android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_dark"
android:alpha="0"
/>

<LinearLayout
android:id="@+id/song_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
Expand Down Expand Up @@ -65,15 +74,28 @@
android:paddingEnd="0dp"
android:paddingLeft="16dp"
android:paddingRight="0dp"
android:paddingStart="16dp">
android:paddingStart="16dp"
android:descendantFocusability="blocksDescendants"
>

<TextView
android:id="@+id/title"
<HorizontalScrollView
android:id="@+id/title_scrollview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:layout_height="fill_parent"
android:scrollbars="none">

<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="none"
android:clickable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>

</HorizontalScrollView>

<TextView
android:id="@+id/text"
Expand Down Expand Up @@ -110,4 +132,4 @@
android:layout_marginStart="72dp"
android:background="?attr/dividerColor" />

</FrameLayout>
</com.kabouzeid.gramophone.views.CustomFrameLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="twenty_percent_black_overlay">#34000000</color>

<color name="ripple_control_lighter">#60000000</color>
<color name="app_shortcut_default_foreground">#607d8b</color>
<color name="app_shortcut_default_background">#f5f5f5</color>
</resources>
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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.

url 'https://maven.google.com'
}

}
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

}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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.

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