mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Updated some dialogs to md3
This commit is contained in:
parent
0dc3f87db3
commit
536098bf0b
@ -4,14 +4,17 @@ import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.github.libretube.adapters.PlaylistsAdapter
|
||||
import com.github.libretube.obj.PlaylistId
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import retrofit2.HttpException
|
||||
import java.io.IOException
|
||||
|
||||
@ -24,7 +27,7 @@ class AddtoPlaylistDialog : DialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return activity?.let {
|
||||
videoId = arguments?.getString("videoId")!!
|
||||
val builder = AlertDialog.Builder(it)
|
||||
val builder = MaterialAlertDialogBuilder(it)
|
||||
// Get the layout inflater
|
||||
val inflater = requireActivity().layoutInflater;
|
||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||
@ -35,6 +38,15 @@ class AddtoPlaylistDialog : DialogFragment() {
|
||||
if(token!=""){
|
||||
fetchPlaylists()
|
||||
}
|
||||
val typedValue = TypedValue()
|
||||
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
|
||||
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
|
||||
val appName = HtmlCompat.fromHtml(
|
||||
"Libre<span style='color:$hexColor';>Tube</span>",
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
)
|
||||
view.findViewById<TextView>(R.id.title).text = appName
|
||||
|
||||
builder.setView(view)
|
||||
builder.create()
|
||||
} ?: throw IllegalStateException("Activity cannot be null")
|
||||
|
@ -1,12 +1,15 @@
|
||||
package com.github.libretube
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.setFragmentResult
|
||||
|
||||
@ -18,6 +21,15 @@ class CreatePlaylistDialog : DialogFragment() {
|
||||
): View? {
|
||||
var rootView: View = inflater.inflate(R.layout.dialog_create_playlist, container, false)
|
||||
|
||||
val typedValue = TypedValue()
|
||||
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
|
||||
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
|
||||
val appName = HtmlCompat.fromHtml(
|
||||
"Libre<span style='color:$hexColor';>Tube</span>",
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
)
|
||||
rootView.findViewById<TextView>(R.id.title).text = appName
|
||||
|
||||
val cancelBtn = rootView.findViewById<Button>(R.id.cancel_button)
|
||||
cancelBtn.setOnClickListener {
|
||||
dismiss()
|
||||
|
@ -4,10 +4,13 @@ import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
||||
|
||||
class DownloadDialog : DialogFragment() {
|
||||
@ -29,7 +32,7 @@ class DownloadDialog : DialogFragment() {
|
||||
audioUrl = arguments?.getStringArrayList("audioUrl") as ArrayList<String>
|
||||
duration = arguments?.getInt("duration")!!
|
||||
videoId = arguments?.getString("videoId")!!
|
||||
val builder = AlertDialog.Builder(it)
|
||||
val builder = MaterialAlertDialogBuilder(it)
|
||||
// Get the layout inflater
|
||||
val inflater = requireActivity().layoutInflater
|
||||
var view: View = inflater.inflate(R.layout.dialog_download, null)
|
||||
@ -82,6 +85,16 @@ class DownloadDialog : DialogFragment() {
|
||||
context?.startService(intent)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
val typedValue = TypedValue()
|
||||
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
|
||||
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
|
||||
val appName = HtmlCompat.fromHtml(
|
||||
"Libre<span style='color:$hexColor';>Tube</span>",
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
)
|
||||
view.findViewById<TextView>(R.id.title).text = appName
|
||||
|
||||
builder.setView(view)
|
||||
builder.create()
|
||||
} ?: throw IllegalStateException("Activity cannot be null")
|
||||
|
@ -5,17 +5,20 @@ import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.github.libretube.adapters.TrendingAdapter
|
||||
import com.github.libretube.obj.Login
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.w3c.dom.Text
|
||||
import retrofit2.HttpException
|
||||
import java.io.IOException
|
||||
@ -28,7 +31,7 @@ class LoginDialog : DialogFragment() {
|
||||
lateinit var password: EditText
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return activity?.let {
|
||||
val builder = AlertDialog.Builder(it)
|
||||
val builder = MaterialAlertDialogBuilder(it)
|
||||
// Get the layout inflater
|
||||
val inflater = requireActivity().layoutInflater;
|
||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||
@ -70,6 +73,17 @@ class LoginDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val typedValue = TypedValue()
|
||||
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
|
||||
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
|
||||
val appName = HtmlCompat.fromHtml(
|
||||
"Libre<span style='color:$hexColor';>Tube</span>",
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
)
|
||||
view.findViewById<TextView>(R.id.title).text = appName
|
||||
|
||||
|
||||
builder.setView(view)
|
||||
builder.create()
|
||||
} ?: throw IllegalStateException("Activity cannot be null")
|
||||
|
@ -155,6 +155,8 @@ class SettingsActivity : AppCompatActivity(),
|
||||
|
||||
val login = findPreference<Preference>("login_register")
|
||||
login?.setOnPreferenceClickListener {
|
||||
|
||||
|
||||
val newFragment = LoginDialog()
|
||||
newFragment.show(childFragmentManager, "Login")
|
||||
true
|
||||
|
@ -7,13 +7,17 @@
|
||||
>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_libretube_foreground"
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:scaleType="center"
|
||||
android:background="#CD5757"
|
||||
android:contentDescription="@string/app_name" />
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/playlists_spinner"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -7,13 +7,16 @@
|
||||
>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="64dp"
|
||||
android:background="#CD5757"
|
||||
android:contentDescription="@string/app_name"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_libretube_foreground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
|
@ -6,13 +6,15 @@
|
||||
>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_libretube_foreground"
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:scaleType="center"
|
||||
android:background="#CD5757"
|
||||
android:contentDescription="@string/app_name" />
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/video_spinner"
|
||||
|
@ -7,13 +7,17 @@
|
||||
>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_libretube_foreground"
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:scaleType="center"
|
||||
android:background="#CD5757"
|
||||
android:contentDescription="@string/app_name" />
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
|
@ -3,13 +3,16 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:src="@drawable/ic_libretube_foreground"
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:scaleType="center"
|
||||
android:background="#CD5757"
|
||||
android:contentDescription="@string/app_name" />
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user"
|
||||
|
Loading…
Reference in New Issue
Block a user