diff --git a/app/src/main/java/com/github/libretube/ChannelFragment.kt b/app/src/main/java/com/github/libretube/ChannelFragment.kt index e8b1070af..9346aa0f0 100644 --- a/app/src/main/java/com/github/libretube/ChannelFragment.kt +++ b/app/src/main/java/com/github/libretube/ChannelFragment.kt @@ -2,17 +2,18 @@ package com.github.libretube import android.annotation.SuppressLint +import android.app.Activity import android.content.Context import android.os.Bundle import android.util.Log -import androidx.fragment.app.Fragment +import android.util.TypedValue import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.ScrollView import android.widget.TextView -import android.widget.Toast +import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -95,23 +96,37 @@ class ChannelFragment : Fragment() { Log.e(TAG, "HttpException, unexpected response") return@launchWhenCreated } + val colorPrimary = TypedValue() + (context as Activity).theme.resolveAttribute( + android.R.attr.colorPrimary, + colorPrimary, + true) + + val ColorText = TypedValue() + (context as Activity).theme.resolveAttribute( + R.attr.colorOnSurface, + ColorText, + true) + runOnUiThread { if (response.subscribed==true){ isSubscribed=true button.text=getString(R.string.unsubscribe) - button.setTextColor(R.attr.colorPrimaryDark) + button.setTextColor(ColorText.data) + } if(response.subscribed!=null){ button.setOnClickListener { if(isSubscribed){ unsubscribe() button.text=getString(R.string.subscribe) - button.setTextColor(resources.getColor(R.color.md_theme_light_primary)) + button.setTextColor(colorPrimary.data) + }else{ subscribe() button.text=getString(R.string.unsubscribe) - button.setTextColor(R.attr.colorPrimaryDark) + button.setTextColor(ColorText.data) } }} } diff --git a/app/src/main/java/com/github/libretube/PlayerFragment.kt b/app/src/main/java/com/github/libretube/PlayerFragment.kt index d7c8f53f4..d5f71ac97 100644 --- a/app/src/main/java/com/github/libretube/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/PlayerFragment.kt @@ -26,6 +26,7 @@ import kotlin.math.abs import com.google.android.exoplayer2.util.MimeTypes import com.google.common.collect.ImmutableList import android.app.ActionBar +import android.app.Activity import android.content.Context import android.content.DialogInterface import android.content.Intent @@ -51,6 +52,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Build import android.text.Html import android.util.Log +import android.util.TypedValue import androidx.appcompat.app.AlertDialog import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.os.bundleOf @@ -412,23 +414,35 @@ class PlayerFragment : Fragment() { Log.e(TAG, "HttpException, unexpected response") return@launchWhenCreated } + val colorPrimary = TypedValue() + (context as Activity).theme.resolveAttribute( + android.R.attr.colorPrimary, + colorPrimary, + true) + + val ColorText = TypedValue() + (context as Activity).theme.resolveAttribute( + R.attr.colorOnSurface, + ColorText, + true) + runOnUiThread { if (response.subscribed==true){ isSubscribed=true button.text=getString(R.string.unsubscribe) - button.setTextColor(R.attr.colorPrimaryDark) + button.setTextColor(ColorText.data) } if(response.subscribed!=null){ button.setOnClickListener { if(isSubscribed){ unsubscribe(channel_id) button.text=getString(R.string.subscribe) - button.setTextColor(resources.getColor(R.color.md_theme_light_primary)) + button.setTextColor(colorPrimary.data) }else{ subscribe(channel_id) button.text=getString(R.string.unsubscribe) - button.setTextColor(R.attr.colorPrimaryDark) + button.setTextColor(colorPrimary.data) } }} } diff --git a/app/src/main/res/layout/dialog_login.xml b/app/src/main/res/layout/dialog_login.xml index eddd68a64..6f6ae6b07 100644 --- a/app/src/main/res/layout/dialog_login.xml +++ b/app/src/main/res/layout/dialog_login.xml @@ -1,8 +1,12 @@ + android:layout_height="wrap_content" + > + + - - + + + android:hint="@string/username" + android:inputType="text" + android:padding="12dp" /> + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index ced6fffc6..ff5368722 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -4,48 +4,44 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".SearchFragment"> + tools:context=".SearchFragment" + > - - - + + app:hintEnabled="false" + android:layout_marginRight="20dp" + android:layout_marginLeft="20dp" + android:background="@android:color/transparent" +> - + + + + + - - - - - - - - - - - - -