aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/AndroidManifest.xml2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/view/CardView.java54
-rw-r--r--app/src/main/java/github/daneren2005/dsub/view/FastScroller.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java45
-rw-r--r--app/src/main/res/drawable/card_rounded_corners.xml6
-rw-r--r--app/src/main/res/layout/abstract_recycler_fragment.xml3
-rw-r--r--app/src/main/res/layout/album_cell_item.xml143
-rw-r--r--app/src/main/res/layout/basic_cell_item.xml65
-rw-r--r--app/src/main/res/layout/fast_scroller.xml4
-rw-r--r--app/src/main/res/values/dimens.xml3
-rw-r--r--app/src/main/res/values/styles.xml2
11 files changed, 219 insertions, 110 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index be941740..2f3b1a5f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="github.daneren2005.dsub"
android:installLocation="internalOnly"
- android:versionCode="167"
+ android:versionCode="168"
android:versionName="5.1.2">
<instrumentation android:name="android.test.InstrumentationTestRunner"
diff --git a/app/src/main/java/github/daneren2005/dsub/view/CardView.java b/app/src/main/java/github/daneren2005/dsub/view/CardView.java
new file mode 100644
index 00000000..973e63fa
--- /dev/null
+++ b/app/src/main/java/github/daneren2005/dsub/view/CardView.java
@@ -0,0 +1,54 @@
+package github.daneren2005.dsub.view;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Path;
+import android.graphics.RectF;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.FrameLayout;
+
+import github.daneren2005.dsub.R;
+
+public class CardView extends FrameLayout{
+ public CardView(Context context) {
+ super(context);
+ init(context);
+ }
+
+ public CardView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init(context);
+ }
+
+ public CardView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init(context);
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public CardView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ init(context);
+ }
+
+ @Override
+ public void onDraw(Canvas canvas) {
+ Path clipPath = new Path();
+
+ float roundedDp = getResources().getDimension(R.dimen.Card_Radius);
+ clipPath.addRoundRect(new RectF(canvas.getClipBounds()), roundedDp, roundedDp, Path.Direction.CW);
+ canvas.clipPath(clipPath);
+ super.onDraw(canvas);
+ }
+
+ private void init(Context context) {
+ setClipChildren(true);
+ setBackgroundResource(R.drawable.card_rounded_corners);
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ setElevation(10.0f);
+ }
+ }
+}
diff --git a/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java b/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java
index 7cb29835..d3eacefc 100644
--- a/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java
+++ b/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java
@@ -95,7 +95,7 @@ public class FastScroller extends LinearLayout {
switch(action)
{
case MotionEvent.ACTION_DOWN:
- if(event.getX() < (handle.getX() - 20)) {
+ if(event.getX() < (handle.getX() - 30)) {
return false;
}
diff --git a/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java b/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java
index b59e7157..a33746c4 100644
--- a/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java
+++ b/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java
@@ -18,10 +18,17 @@ package github.daneren2005.dsub.view;
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
+import android.util.Log;
import android.util.TypedValue;
import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+import static android.widget.LinearLayout.*;
public class GridSpacingDecoration extends RecyclerView.ItemDecoration {
+ private static final String TAG = GridSpacingDecoration.class.getSimpleName();
public static final int SPACING = 10;
@Override
@@ -39,30 +46,52 @@ public class GridSpacingDecoration extends RecyclerView.ItemDecoration {
}
int spanCount = getTotalSpan(view, parent);
int spanIndex = childIndex % spanCount;
+
+ // If we can, use the SpanSizeLookup since headers screw up the index calculation
+ RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
+ if(layoutManager instanceof GridLayoutManager) {
+ GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
+ GridLayoutManager.SpanSizeLookup spanSizeLookup = gridLayoutManager.getSpanSizeLookup();
+ if(spanSizeLookup != null) {
+ spanIndex = spanSizeLookup.getSpanIndex(childIndex, spanCount);
+ }
+ }
int spanSize = getSpanSize(parent, childIndex);
/* INVALID SPAN */
if (spanCount < 1 || spanSize > 1) return;
- outRect.top = halfSpacing;
- outRect.bottom = halfSpacing;
- outRect.left = halfSpacing;
- outRect.right = halfSpacing;
+ int margins = 0;
+ if(view instanceof UpdateView) {
+ View firstChild = ((ViewGroup) view).getChildAt(0);
+ ViewGroup.LayoutParams layoutParams = firstChild.getLayoutParams();
+ if (layoutParams instanceof LinearLayout.LayoutParams) {
+ margins = ((LinearLayout.LayoutParams) layoutParams).bottomMargin;
+ } else if (layoutParams instanceof FrameLayout.LayoutParams) {
+ margins = ((FrameLayout.LayoutParams) layoutParams).bottomMargin;
+ }
+ }
+ int doubleMargins = margins * 2;
+
+ outRect.top = halfSpacing - margins;
+ outRect.bottom = halfSpacing - margins;
+ outRect.left = halfSpacing - margins;
+ outRect.right = halfSpacing - margins;
if (isTopEdge(childIndex, spanCount)) {
- outRect.top = spacing;
+ outRect.top = spacing - doubleMargins;
}
if (isLeftEdge(spanIndex, spanCount)) {
- outRect.left = spacing;
+ outRect.left = spacing - doubleMargins;
}
if (isRightEdge(spanIndex, spanCount)) {
- outRect.right = spacing;
+ outRect.right = spacing - doubleMargins;
}
if (isBottomEdge(childIndex, childCount, spanCount)) {
- outRect.bottom = spacing;
+ outRect.bottom = spacing - doubleMargins;
}
}
diff --git a/app/src/main/res/drawable/card_rounded_corners.xml b/app/src/main/res/drawable/card_rounded_corners.xml
new file mode 100644
index 00000000..5475c3d6
--- /dev/null
+++ b/app/src/main/res/drawable/card_rounded_corners.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@android:color/white"/>
+ <corners android:radius="@dimen/Card.Radius"/>
+ <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
+</shape> \ No newline at end of file
diff --git a/app/src/main/res/layout/abstract_recycler_fragment.xml b/app/src/main/res/layout/abstract_recycler_fragment.xml
index 0e0c87f4..2537d222 100644
--- a/app/src/main/res/layout/abstract_recycler_fragment.xml
+++ b/app/src/main/res/layout/abstract_recycler_fragment.xml
@@ -19,7 +19,8 @@
android:id="@+id/fragment_recycler"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:scrollbars="vertical"/>
+ android:scrollbars="vertical"
+ android:paddingRight="6dp"/>
<github.daneren2005.dsub.view.FastScroller
android:id="@+id/fragment_fast_scroller"
diff --git a/app/src/main/res/layout/album_cell_item.xml b/app/src/main/res/layout/album_cell_item.xml
index f6693a7f..524727a0 100644
--- a/app/src/main/res/layout/album_cell_item.xml
+++ b/app/src/main/res/layout/album_cell_item.xml
@@ -1,90 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<github.daneren2005.dsub.view.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?attr/selectableItemBackground">
+ android:layout_margin="2dp">
- <RelativeLayout
+ <LinearLayout
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
+ android:layout_height="match_parent"
+ android:background="?attr/selectableItemBackground">
- <github.daneren2005.dsub.view.SquareImageView
- android:id="@+id/album_coverart"
+ <RelativeLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_height="0dp"
+ android:layout_weight="1">
- <RatingBar
- android:id="@+id/album_rating"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:isIndicator="true"
- android:layout_centerHorizontal="true"
- android:numStars="5"
- style="@android:style/Widget.Holo.RatingBar.Small"
- android:layout_alignParentBottom="true"
- android:visibility="gone"/>
- </RelativeLayout>
+ <github.daneren2005.dsub.view.SquareImageView
+ android:id="@+id/album_coverart"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="4dp"
- android:paddingLeft="2dp">
+ <RatingBar
+ android:id="@+id/album_rating"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:isIndicator="true"
+ android:layout_centerHorizontal="true"
+ android:numStars="5"
+ style="@android:style/Widget.Holo.RatingBar.Small"
+ android:layout_alignParentBottom="true"
+ android:visibility="gone"/>
+ </RelativeLayout>
<LinearLayout
- android:layout_width="0dp"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:gravity="center_vertical"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/album_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:text="@string/search.albums"
- android:textColor="?android:textColorPrimary"/>
+ android:orientation="horizontal"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
+ android:paddingLeft="2dp">
<LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:orientation="vertical">
<TextView
- android:id="@+id/album_artist"
- android:layout_width="0dp"
- android:layout_weight="1"
+ android:id="@+id/album_title"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="12sp"
- android:textColor="?android:textColorSecondary"
+ android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true"
- android:text="@string/search.artists"/>
+ android:ellipsize="marquee"
+ android:text="@string/search.albums"
+ android:textColor="?android:textColorPrimary"
+ android:paddingLeft="@dimen/Card.TextLeftPadding"/>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
- <ImageButton
- android:id="@+id/album_star"
- android:layout_width="@dimen/Star.Small"
- android:layout_height="@dimen/Star.Small"
- android:scaleType="fitCenter"
- android:layout_gravity="right|center_vertical"
- android:background="@android:color/transparent"
- android:focusable="false"
- android:visibility="gone"/>
+ <TextView
+ android:id="@+id/album_artist"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:textSize="12sp"
+ android:textColor="?android:textColorSecondary"
+ android:singleLine="true"
+ android:text="@string/search.artists"
+ android:paddingLeft="@dimen/Card.TextLeftPadding"/>
+
+ <ImageButton
+ android:id="@+id/album_star"
+ android:layout_width="@dimen/Star.Small"
+ android:layout_height="@dimen/Star.Small"
+ android:scaleType="fitCenter"
+ android:layout_gravity="right|center_vertical"
+ android:background="@android:color/transparent"
+ android:focusable="false"
+ android:visibility="gone"/>
+ </LinearLayout>
</LinearLayout>
+
+ <ImageView
+ android:id="@+id/item_more"
+ android:src="?attr/download_none"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right|center_vertical"
+ android:paddingRight="2dp"
+ style="@style/BasicButton"/>
</LinearLayout>
- <ImageView
- android:id="@+id/item_more"
- android:src="?attr/download_none"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right|center_vertical"
- android:paddingRight="2dp"
- style="@style/BasicButton"/>
</LinearLayout>
-
-</LinearLayout> \ No newline at end of file
+</github.daneren2005.dsub.view.CardView> \ No newline at end of file
diff --git a/app/src/main/res/layout/basic_cell_item.xml b/app/src/main/res/layout/basic_cell_item.xml
index f522b196..fcfb6da5 100644
--- a/app/src/main/res/layout/basic_cell_item.xml
+++ b/app/src/main/res/layout/basic_cell_item.xml
@@ -1,39 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<github.daneren2005.dsub.view.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?attr/selectableItemBackground">
-
- <github.daneren2005.dsub.view.SquareImageView
- android:id="@+id/item_art"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_margin="2dp">
<LinearLayout
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="4dp"
- android:paddingLeft="2dp">
+ android:layout_height="match_parent"
+ android:background="?attr/selectableItemBackground">
- <TextView
- android:id="@+id/item_name"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textColor="?android:textColorPrimary"/>
+ <github.daneren2005.dsub.view.SquareImageView
+ android:id="@+id/item_art"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
- <ImageView
- android:id="@+id/item_more"
- android:src="?attr/download_none"
- android:layout_width="wrap_content"
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="right|center_vertical"
- android:paddingRight="2dp"
- style="@style/BasicButton"/>
+ android:orientation="horizontal"
+ android:paddingTop="4dp"
+ android:paddingLeft="2dp">
+
+ <TextView
+ android:id="@+id/item_name"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:textColor="?android:textColorPrimary"
+ android:paddingLeft="@dimen/Card.TextLeftPadding"/>
+
+ <ImageView
+ android:id="@+id/item_more"
+ android:src="?attr/download_none"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right|center_vertical"
+ android:paddingRight="2dp"
+ style="@style/BasicButton"/>
+ </LinearLayout>
</LinearLayout>
-</LinearLayout> \ No newline at end of file
+</github.daneren2005.dsub.view.CardView> \ No newline at end of file
diff --git a/app/src/main/res/layout/fast_scroller.xml b/app/src/main/res/layout/fast_scroller.xml
index b2e244e3..bfe990dd 100644
--- a/app/src/main/res/layout/fast_scroller.xml
+++ b/app/src/main/res/layout/fast_scroller.xml
@@ -18,8 +18,8 @@
<ImageView
android:id="@+id/fastscroller_handle"
android:layout_width="wrap_content"
- android:layout_marginRight="8dp"
- android:layout_marginLeft="8dp"
+ android:layout_marginRight="4dp"
+ android:layout_marginLeft="12dp"
android:layout_height="wrap_content"
android:src="@drawable/fast_scroller_handle"/>
</merge> \ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 23a3f4a3..3431de0c 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -6,4 +6,7 @@
<dimen name="AlbumArt.Small">78dip</dimen>
<dimen name="AlbumArt.Header">120dip</dimen>
<dimen name="Star.Small">20dp</dimen>
+ <dimen name="Card.Radius">4dp</dimen>
+ <dimen name="Card.TextLeftPadding">8dp</dimen>
+ <dimen name="Card.MarginsForShadow">2dp</dimen>
</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 0b45b69e..ea6eb0d1 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -38,7 +38,7 @@
</style>
<style name="MoreButton" parent="BasicButton">
- <item name="android:paddingRight">14dip</item>
+ <item name="android:paddingRight">8dip</item>
</style>
<style name="PlaybackControl" parent="@style/BasicButton">