Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change retry & subscribe buttons background color based on service color #3565

Merged
merged 2 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ShareUtils;
import org.schabi.newpipe.util.ThemeHelper;

import java.util.ArrayList;
import java.util.Iterator;
Expand Down Expand Up @@ -374,8 +375,8 @@ private void updateSubscribeButton(final boolean isSubscribed) {
int backgroundDuration = isButtonVisible ? 300 : 0;
int textDuration = isButtonVisible ? 200 : 0;

int subscribeBackground = ContextCompat
.getColor(activity, R.color.subscribe_background_color);
int subscribeBackground = ThemeHelper
.resolveColorFromAttr(activity, R.attr.colorPrimary);
int subscribeText = ContextCompat.getColor(activity, R.color.subscribe_text_color);
int subscribedBackground = ContextCompat
.getColor(activity, R.color.subscribed_background_color);
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/res/layout-large-land/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,6 @@
tools:text="Uploader" />
</LinearLayout>

<!--<Button
android:id="@+id/detail_uploader_subscribe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="12dp"
android:text="@string/rss_button_title"
android:textSize="12sp"
android:theme="@style/RedButton"
android:drawableLeft="@drawable/ic_rss_feed_white_24dp"
tools:ignore="RtlHardcoded"
android:visibility="gone"/>-->
</LinearLayout>

<!-- VIEW & THUMBS -->
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/channel_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
android:layout_marginRight="2dp"
android:text="@string/subscribe_button_title"
android:textSize="@dimen/channel_rss_title_size"
android:theme="@style/RedButton"
android:theme="@style/ServiceColoredButton"
android:visibility="gone"
tools:ignore="RtlHardcoded"
tools:visibility="visible" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/error_retry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
android:theme="@style/RedButton"/>
android:theme="@style/ServiceColoredButton"/>

</LinearLayout>
12 changes: 0 additions & 12 deletions app/src/main/res/layout/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,6 @@

</LinearLayout>

<!--<Button
android:id="@+id/detail_uploader_subscribe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="12dp"
android:text="@string/rss_button_title"
android:textSize="12sp"
android:theme="@style/RedButton"
android:drawableLeft="@drawable/ic_rss_feed_white_24dp"
tools:ignore="RtlHardcoded"
android:visibility="gone"/>-->
</LinearLayout>

<!-- VIEW & THUMBS -->
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
<color name="background_title_color">#ffffff</color>
<color name="background_subtext_color">#999999</color>

<color name="subscribe_background_color">#e53935</color>
<color name="subscribe_text_color">#fff</color>
<color name="subscribed_background_color">#d6d6d6</color>
<color name="subscribed_text_color">#717171</color>
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/values/styles_misc.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="RedButton" parent="Widget.AppCompat.Button.Colored">
<item name="colorButtonNormal">@color/subscribe_background_color</item>
<!-- Follows service's primary color -->
<style name="ServiceColoredButton" parent="Widget.AppCompat.Button.Colored">
<item name="colorButtonNormal">?attr/colorPrimary</item>
<item name="android:textColor">@color/subscribe_text_color</item>
<item name="colorControlHighlight">@color/dark_ripple_color</item>
</style>
Expand Down