Tweak movie list items
This commit is contained in:
parent
5f6d4051f0
commit
fb03153365
|
@ -20,6 +20,7 @@ import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.BaseColumns;
|
import android.provider.BaseColumns;
|
||||||
|
@ -327,16 +328,18 @@ public class MovieListFragment extends AbstractCursorListFragment {
|
||||||
|
|
||||||
private HostManager hostManager;
|
private HostManager hostManager;
|
||||||
private int artWidth, artHeight;
|
private int artWidth, artHeight;
|
||||||
private int themeAccentColor;
|
private int themeAccentColor, dimmedNeutralColor;
|
||||||
|
|
||||||
MoviesAdapter(Context context) {
|
MoviesAdapter(Context context) {
|
||||||
// Get the default accent color
|
// Get the default accent color
|
||||||
Resources.Theme theme = context.getTheme();
|
Resources.Theme theme = context.getTheme();
|
||||||
TypedArray styledAttributes = theme.obtainStyledAttributes(new int[] {
|
TypedArray styledAttributes = theme.obtainStyledAttributes(new int[] {
|
||||||
R.attr.colorAccent
|
R.attr.colorAccent, R.attr.dimmedNeutralColor
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
themeAccentColor = styledAttributes.getColor(styledAttributes.getIndex(0), getResources().getColor(R.color.accent_default));
|
themeAccentColor = styledAttributes.getColor(styledAttributes.getIndex(0), getResources().getColor(R.color.accent_default));
|
||||||
|
dimmedNeutralColor = styledAttributes.getColor(styledAttributes.getIndex(1), getResources().getColor(R.color.white_dim_26pct));
|
||||||
styledAttributes.recycle();
|
styledAttributes.recycle();
|
||||||
|
|
||||||
this.hostManager = HostManager.getInstance(context);
|
this.hostManager = HostManager.getInstance(context);
|
||||||
|
@ -356,7 +359,7 @@ public class MovieListFragment extends AbstractCursorListFragment {
|
||||||
final View view = LayoutInflater.from(getContext())
|
final View view = LayoutInflater.from(getContext())
|
||||||
.inflate(R.layout.grid_item_movie, parent, false);
|
.inflate(R.layout.grid_item_movie, parent, false);
|
||||||
|
|
||||||
return new ViewHolder(view, getContext(), themeAccentColor, hostManager, artWidth, artHeight);
|
return new ViewHolder(view, getContext(), themeAccentColor, dimmedNeutralColor, hostManager, artWidth, artHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getSectionColumnIdx() { return MovieListQuery.TITLE; }
|
protected int getSectionColumnIdx() { return MovieListQuery.TITLE; }
|
||||||
|
@ -376,16 +379,17 @@ public class MovieListFragment extends AbstractCursorListFragment {
|
||||||
int artWidth;
|
int artWidth;
|
||||||
int artHeight;
|
int artHeight;
|
||||||
Context context;
|
Context context;
|
||||||
int themeAccentColor;
|
int themeAccentColor, dimmedNeutralColor;
|
||||||
|
|
||||||
AbstractFragment.DataHolder dataHolder = new AbstractFragment.DataHolder(0);
|
AbstractFragment.DataHolder dataHolder = new AbstractFragment.DataHolder(0);
|
||||||
|
|
||||||
ViewHolder(View itemView, Context context, int themeAccentColor,
|
ViewHolder(View itemView, Context context, int themeAccentColor, int dimmedNeutralColor,
|
||||||
HostManager hostManager,
|
HostManager hostManager,
|
||||||
int artWidth, int artHeight) {
|
int artWidth, int artHeight) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.themeAccentColor = themeAccentColor;
|
this.themeAccentColor = themeAccentColor;
|
||||||
|
this.dimmedNeutralColor = dimmedNeutralColor;
|
||||||
this.hostManager = hostManager;
|
this.hostManager = hostManager;
|
||||||
this.artWidth = artWidth;
|
this.artWidth = artWidth;
|
||||||
this.artHeight = artHeight;
|
this.artHeight = artHeight;
|
||||||
|
@ -432,11 +436,16 @@ public class MovieListFragment extends AbstractCursorListFragment {
|
||||||
dataHolder.getTitle(),
|
dataHolder.getTitle(),
|
||||||
artView, artWidth, artHeight);
|
artView, artWidth, artHeight);
|
||||||
|
|
||||||
if (showWatchedStatus && (cursor.getInt(MovieListQuery.PLAYCOUNT) > 0)) {
|
if (showWatchedStatus) {
|
||||||
checkmarkView.setVisibility(View.VISIBLE);
|
checkmarkView.setVisibility(View.VISIBLE);
|
||||||
checkmarkView.setColorFilter(themeAccentColor);
|
if (cursor.getInt(MovieListQuery.PLAYCOUNT) > 0) {
|
||||||
} else {
|
checkmarkView.setColorFilter(themeAccentColor);
|
||||||
checkmarkView.setVisibility(View.INVISIBLE);
|
} else {
|
||||||
|
checkmarkView.setColorFilter(dimmedNeutralColor, PorterDuff.Mode.SRC_IN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkmarkView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isLollipopOrLater()) {
|
if (Utils.isLollipopOrLater()) {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
tools:layout_width="match_parent"
|
tools:layout_width="match_parent"
|
||||||
tools:layout_height="100dp">
|
tools:layout_height="100dp">
|
||||||
|
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.constraint.ConstraintLayout
|
||||||
android:id="@+id/relativeLayout"
|
android:id="@+id/relativeLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
@ -44,10 +44,10 @@
|
||||||
style="@style/TextAppearance.Medialist.Title"
|
style="@style/TextAppearance.Medialist.Title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/art"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/art"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/art"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/art"
|
||||||
app:layout_constraintTop_toTopOf="@id/art" />
|
app:layout_constraintTop_toTopOf="@id/art" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -55,10 +55,10 @@
|
||||||
style="@style/TextAppearance.Medialist.Details"
|
style="@style/TextAppearance.Medialist.Details"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintRight_toRightOf="@id/title"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/title"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/title"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/title"
|
||||||
|
app:layout_constraintRight_toRightOf="@id/title"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/title"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -67,32 +67,34 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/title"
|
app:layout_constraintEnd_toStartOf="@id/rating_bar"
|
||||||
app:layout_constraintEnd_toStartOf="@id/rating_bar"/>
|
app:layout_constraintStart_toStartOf="@id/title" />
|
||||||
|
|
||||||
<org.xbmc.kore.ui.views.RatingBar
|
<org.xbmc.kore.ui.views.RatingBar
|
||||||
android:id="@+id/rating_bar"
|
android:id="@+id/rating_bar"
|
||||||
style="@style/RatingBar"
|
style="@style/RatingBar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/meta_info"
|
|
||||||
app:layout_constraintRight_toLeftOf="@id/checkmark"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/checkmark"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/meta_info"
|
|
||||||
app:backgroundColor="?attr/ratingBarStarBackgroundColor"
|
app:backgroundColor="?attr/ratingBarStarBackgroundColor"
|
||||||
app:foregroundColor="?attr/ratingBarStarForegroundColor"
|
app:foregroundColor="?attr/ratingBarStarForegroundColor"
|
||||||
app:icon="?attr/iconRating"/>
|
app:icon="?attr/iconRating"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/meta_info"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/checkmark"
|
||||||
|
app:layout_constraintRight_toLeftOf="@id/checkmark"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/meta_info" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/checkmark"
|
android:id="@+id/checkmark"
|
||||||
style="@style/Widget.Button.Borderless"
|
style="@style/Widget.Button.Borderless"
|
||||||
android:layout_width="@dimen/default_icon_size"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/default_icon_size"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/small_padding"
|
||||||
|
android:layout_marginRight="@dimen/small_padding"
|
||||||
|
android:layout_marginBottom="@dimen/small_padding"
|
||||||
android:contentDescription="@string/seen"
|
android:contentDescription="@string/seen"
|
||||||
android:padding="@dimen/default_icon_padding"
|
|
||||||
android:src="?attr/iconSeen"
|
android:src="?attr/iconSeen"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/meta_info"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
|
@ -144,5 +144,8 @@
|
||||||
<attr name="iconCount" format="integer"/>
|
<attr name="iconCount" format="integer"/>
|
||||||
<attr name="icon" format="reference"/>
|
<attr name="icon" format="reference"/>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
<attr name="dimmedNeutralColor" format="reference|color" />
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
@ -370,6 +370,7 @@
|
||||||
|
|
||||||
<style name="RatingBar">
|
<style name="RatingBar">
|
||||||
<item name="android:layout_marginBottom">@dimen/small_padding</item>
|
<item name="android:layout_marginBottom">@dimen/small_padding</item>
|
||||||
|
<item name="android:layout_marginRight">@dimen/small_padding</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@
|
||||||
<item name="ratingBarStarBackgroundColor">@color/white_dim_26pct</item>
|
<item name="ratingBarStarBackgroundColor">@color/white_dim_26pct</item>
|
||||||
<item name="ratingBarStarForegroundColor">?attr/colorAccent</item>
|
<item name="ratingBarStarForegroundColor">?attr/colorAccent</item>
|
||||||
|
|
||||||
|
<item name="dimmedNeutralColor">@color/white_dim_26pct</item>
|
||||||
|
|
||||||
<!-- Icons -->
|
<!-- Icons -->
|
||||||
<item name="iconFABDialsOpenClose">@drawable/ic_plus_white_24dp</item>
|
<item name="iconFABDialsOpenClose">@drawable/ic_plus_white_24dp</item>
|
||||||
<item name="iconFABDefault">@drawable/ic_play_arrow_white_24dp</item>
|
<item name="iconFABDefault">@drawable/ic_play_arrow_white_24dp</item>
|
||||||
|
@ -240,6 +242,8 @@
|
||||||
<item name="ratingBarStarBackgroundColor">@color/black_dim_26pct</item>
|
<item name="ratingBarStarBackgroundColor">@color/black_dim_26pct</item>
|
||||||
<item name="ratingBarStarForegroundColor">?attr/colorAccent</item>
|
<item name="ratingBarStarForegroundColor">?attr/colorAccent</item>
|
||||||
|
|
||||||
|
<item name="dimmedNeutralColor">@color/black_dim_26pct</item>
|
||||||
|
|
||||||
<!-- Icons, same for all themes, will be colored dynamically -->
|
<!-- Icons, same for all themes, will be colored dynamically -->
|
||||||
<item name="iconFABDialsOpenClose">@drawable/ic_plus_white_24dp</item>
|
<item name="iconFABDialsOpenClose">@drawable/ic_plus_white_24dp</item>
|
||||||
<item name="iconFABDefault">@drawable/ic_play_arrow_white_24dp</item>
|
<item name="iconFABDefault">@drawable/ic_play_arrow_white_24dp</item>
|
||||||
|
|
Loading…
Reference in New Issue