From 53565ee2931117eb077f9ce2ba5beef1598a9d7e Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Sat, 4 Apr 2015 22:46:54 +0800 Subject: [PATCH] fixed wrong icon color in wizard page fixed sign in button color --- .../fragment/support/UserFragment.java | 5 +-- .../ForegroundColorIconPreference.java | 38 +++++++++++++++++++ .../preference/ResourceIconPreference.java | 22 ----------- .../src/main/res/layout/activity_sign_in.xml | 4 +- .../res/xml/settings_wizard_page_hints.xml | 8 ++-- .../settings_wizard_page_usage_statistics.xml | 4 +- 6 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 twidere/src/main/java/org/mariotaku/twidere/preference/ForegroundColorIconPreference.java delete mode 100644 twidere/src/main/java/org/mariotaku/twidere/preference/ResourceIconPreference.java diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java index 0f8380c7c..2524af8f8 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java @@ -57,7 +57,6 @@ import android.support.v4.content.res.ResourcesCompat; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; -import android.support.v7.internal.widget.TintButton; import android.text.Html; import android.text.SpannableStringBuilder; import android.text.Spanned; @@ -194,7 +193,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener private TabPagerIndicator mPagerIndicator; private View mUuckyFooter; private View mProfileBannerContainer; - private TintButton mFollowButton; + private Button mFollowButton; private ProgressBar mFollowProgress; private View mPagesContent, mPagesErrorContainer; private ImageView mPagesErrorIcon; @@ -1145,7 +1144,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener mProfileBannerSpace = headerView.findViewById(R.id.profile_banner_space); mViewPager = (ViewPager) contentView.findViewById(R.id.view_pager); mPagerIndicator = (TabPagerIndicator) contentView.findViewById(R.id.view_pager_tabs); - mFollowButton = (TintButton) headerView.findViewById(R.id.follow); + mFollowButton = (Button) headerView.findViewById(R.id.follow); mFollowProgress = (ProgressBar) headerView.findViewById(R.id.follow_progress); mUuckyFooter = headerView.findViewById(R.id.uucky_footer); mPagesContent = view.findViewById(R.id.pages_content); diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/ForegroundColorIconPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/ForegroundColorIconPreference.java new file mode 100644 index 000000000..7c8ce2aca --- /dev/null +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/ForegroundColorIconPreference.java @@ -0,0 +1,38 @@ +package org.mariotaku.twidere.preference; + +import android.content.Context; +import android.graphics.PorterDuff.Mode; +import android.graphics.drawable.Drawable; +import android.preference.Preference; +import android.support.annotation.NonNull; +import android.util.AttributeSet; +import android.view.View; + +import org.mariotaku.twidere.util.ThemeUtils; + +/** + * Created by mariotaku on 14-7-28. + */ +public class ForegroundColorIconPreference extends Preference { + public ForegroundColorIconPreference(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + protected void onBindView(@NonNull View view) { + super.onBindView(view); + final Drawable icon = getIcon(); + if (icon != null) { + icon.setColorFilter(ThemeUtils.getThemeForegroundColor(getContext()), Mode.SRC_ATOP); + } + setIcon(icon); + } + + public ForegroundColorIconPreference(Context context, AttributeSet attrs) { + this(context, attrs, android.R.attr.preferenceStyle); + } + + public ForegroundColorIconPreference(Context context) { + this(context, null); + } +} diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/ResourceIconPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/ResourceIconPreference.java deleted file mode 100644 index 477045a35..000000000 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/ResourceIconPreference.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.mariotaku.twidere.preference; - -import android.content.Context; -import android.preference.Preference; -import android.util.AttributeSet; - -/** - * Created by mariotaku on 14-7-28. - */ -public class ResourceIconPreference extends Preference { - public ResourceIconPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - public ResourceIconPreference(Context context, AttributeSet attrs) { - this(context, attrs, android.R.attr.preferenceStyle); - } - - public ResourceIconPreference(Context context) { - this(context, null); - } -} diff --git a/twidere/src/main/res/layout/activity_sign_in.xml b/twidere/src/main/res/layout/activity_sign_in.xml index 201e86504..d2664e0e3 100644 --- a/twidere/src/main/res/layout/activity_sign_in.xml +++ b/twidere/src/main/res/layout/activity_sign_in.xml @@ -68,7 +68,7 @@ android:orientation="horizontal" android:padding="8dp"> -