mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Starting to use style colors instead of runtime color change.
This commit is contained in:
@@ -295,11 +295,6 @@ namespace Opus.Api
|
||||
playlists.Add(Loading);
|
||||
|
||||
View Layout = MainActivity.instance.LayoutInflater.Inflate(Resource.Layout.AddToPlaylistLayout, null);
|
||||
if (MainActivity.Theme == 1)
|
||||
{
|
||||
Layout.FindViewById<ImageView>(Resource.Id.leftIcon).SetColorFilter(Color.White);
|
||||
Layout.FindViewById<View>(Resource.Id.divider).SetBackgroundColor(Color.White);
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.instance, MainActivity.dialogTheme);
|
||||
builder.SetTitle(Resource.String.save_playlist);
|
||||
builder.SetView(Layout);
|
||||
|
||||
@@ -36,7 +36,7 @@ using YoutubeExplode;
|
||||
using Environment = Android.OS.Environment;
|
||||
using Fragment = Android.Support.V4.App.Fragment;
|
||||
using Playlist = Opus.Fragments.Playlist;
|
||||
using Request = Square.OkHttp.Request;
|
||||
//using Request = Square.OkHttp.Request;
|
||||
using SearchView = Android.Support.V7.Widget.SearchView;
|
||||
using Toolbar = Android.Support.V7.Widget.Toolbar;
|
||||
using TransportType = Android.Net.TransportType;
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace Opus.Adapter
|
||||
{
|
||||
holder.Status.Visibility = ViewStates.Gone;
|
||||
holder.SyncLoading.Visibility = ViewStates.Visible;
|
||||
if (MainActivity.Theme == 1)
|
||||
holder.SyncLoading.IndeterminateTintList = ColorStateList.ValueOf(Color.White);
|
||||
}
|
||||
else if(Playlists[position].YoutubeID != null)
|
||||
{
|
||||
@@ -59,12 +57,6 @@ namespace Opus.Adapter
|
||||
holder.Status.Visibility = ViewStates.Gone;
|
||||
holder.SyncLoading.Visibility = ViewStates.Gone;
|
||||
}
|
||||
|
||||
if (MainActivity.Theme == 1)
|
||||
{
|
||||
holder.Status.SetColorFilter(Color.White);
|
||||
holder.Title.SetTextColor(Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
using Android.Content.Res;
|
||||
using Android.Graphics;
|
||||
using Android.Graphics.Drawables;
|
||||
using Android.Util;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Java.Lang;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -41,11 +43,15 @@ namespace Opus.Adapter
|
||||
|
||||
((TextView)convertView).Text = items[position].name;
|
||||
|
||||
Drawable icon = MainActivity.instance.GetDrawable(items[position].Ressource);
|
||||
if(MainActivity.Theme != 1)
|
||||
icon.SetTintList(ColorStateList.ValueOf(Color.Black));
|
||||
Color color;
|
||||
TypedValue value = new TypedValue();
|
||||
if (Context.Theme.ResolveAttribute(Resource.Attribute.iconColor, value, true))
|
||||
color = Color.ParseColor("#" + Integer.ToHexString(value.Data));
|
||||
else
|
||||
icon.SetTintList(ColorStateList.ValueOf(Color.White));
|
||||
color = Color.Black;
|
||||
|
||||
Drawable icon = MainActivity.instance.GetDrawable(items[position].Ressource);
|
||||
icon.SetTintList(ColorStateList.ValueOf(color));
|
||||
|
||||
((TextView)convertView).SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
||||
|
||||
|
||||
@@ -32,12 +32,7 @@ namespace Opus.Adapter
|
||||
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
|
||||
{
|
||||
if (position == 0 && displayShuffle)
|
||||
{
|
||||
if (MainActivity.Theme == 1)
|
||||
((CardView)viewHolder.ItemView).SetCardBackgroundColor(Color.ParseColor("#212121"));
|
||||
else
|
||||
((CardView)viewHolder.ItemView).SetCardBackgroundColor(Color.White);
|
||||
}
|
||||
return;
|
||||
else
|
||||
base.OnBindViewHolder(viewHolder, position);
|
||||
}
|
||||
|
||||
3
Opus/Resources/Resource.Designer.cs
generated
3
Opus/Resources/Resource.Designer.cs
generated
@@ -1119,6 +1119,9 @@ namespace Opus
|
||||
// aapt resource value: 0x7f01008d
|
||||
public const int icon = 2130772109;
|
||||
|
||||
// aapt resource value: 0x7f01027e
|
||||
public const int iconColor = 2130772606;
|
||||
|
||||
// aapt resource value: 0x7f0101c9
|
||||
public const int iconEndPadding = 2130772425;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:tint="?iconColor"
|
||||
android:id="@+id/status"
|
||||
android:paddingRight="15dp"
|
||||
android:layout_centerVertical="true"
|
||||
@@ -34,7 +35,7 @@
|
||||
android:layout_height="20dp"
|
||||
android:paddingRight="15dp"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateTint="@android:color/black"
|
||||
android:indeterminateTint="?iconColor"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
android:id="@+id/divider"
|
||||
android:layout_margin="5dp"
|
||||
android:alpha="0.6"
|
||||
android:background="#000000" />
|
||||
android:background="?iconColor" />
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="28dp"
|
||||
@@ -31,6 +31,7 @@
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@null"
|
||||
android:tint="?iconColor"
|
||||
android:src="@drawable/Add"
|
||||
android:id="@+id/leftIcon" />
|
||||
<TextView
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="14dp"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardBackgroundColor="?defaultColor"
|
||||
android:clickable="true" >
|
||||
<LinearLayout
|
||||
android:gravity="center"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
<attr name="defaultColor" format="reference|color" />
|
||||
<attr name="iconColor" format="reference|color" />
|
||||
</resources>
|
||||
@@ -11,6 +11,7 @@
|
||||
<item name="android:dropDownListViewStyle">@style/LightDropDown</item>
|
||||
<item name="preferenceTheme">@style/LightPreferences</item>
|
||||
<item name="colorAccent">#A3BBDC</item>
|
||||
<item name="iconColor">#000</item>
|
||||
<item name="android:textColor">#000</item>
|
||||
<item name="android:textColorPrimary">#000</item>
|
||||
<item name="defaultColor">#ffffff</item>
|
||||
@@ -25,6 +26,7 @@
|
||||
<item name="android:navigationBarColor">#212121</item>
|
||||
<item name="preferenceTheme">@style/DarkPreferences</item>
|
||||
<item name="colorAccent">#A3BBDC</item>
|
||||
<item name="iconColor">#ffffff</item>
|
||||
<item name="android:textColor">#ffffff</item>
|
||||
<item name="android:textColorPrimary">#ffffff</item>
|
||||
<item name="defaultColor">#212121</item>
|
||||
|
||||
Reference in New Issue
Block a user