mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
Merge pull request #30 from archroid/master
Redesigned searchbar and login/register fragment;Fixed subscribe butt…
This commit is contained in:
commit
32f97075b6
@ -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)
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_libretube_foreground"
|
||||
android:layout_width="match_parent"
|
||||
@ -10,27 +14,48 @@
|
||||
android:scaleType="center"
|
||||
android:background="#CD5757"
|
||||
android:contentDescription="@string/app_name" />
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:inputType="textShortMessage"
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hintEnabled="false"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginLeft="7dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:hint="@string/username" />
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:inputType="textPassword"
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:hint="@string/password"/>
|
||||
android:hint="@string/username"
|
||||
android:inputType="text"
|
||||
android:padding="12dp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hintEnabled="false"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginLeft="7dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/password"
|
||||
android:inputType="textPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/password"
|
||||
android:padding="12dp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -51,4 +76,5 @@
|
||||
android:padding="8dp"
|
||||
android:layout_margin="8dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -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"
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/outlinedTextField"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
app:hintEnabled="false"
|
||||
app:boxCornerRadiusBottomEnd="20dp"
|
||||
app:boxCornerRadiusBottomStart="20dp"
|
||||
app:boxCornerRadiusTopEnd="20dp"
|
||||
app:boxCornerRadiusTopStart="20dp"
|
||||
android:id="@+id/outlinedTextField"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/autoCompleteTextView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_margin="5dp"
|
||||
>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Search"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:padding="12dp" />
|
||||
app:hintEnabled="false"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@android:color/transparent"
|
||||
>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/autoCompleteTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Search"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:padding="12dp" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<!-- <com.google.android.material.textfield.MaterialAutoCompleteTextView-->
|
||||
<!-- android:id="@+id/autoCompleteTextView"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="7dp"-->
|
||||
<!-- android:hint="@string/search_hint"-->
|
||||
<!-- android:imeOptions="actionSearch"-->
|
||||
<!-- android:inputType="text"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:minHeight="48dp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
Loading…
x
Reference in New Issue
Block a user