Feature/removve kotlin extensions

This commit is contained in:
Ivan Agosto 2024-05-26 21:47:25 +00:00
parent ff995e383d
commit c4c5737344
25 changed files with 469 additions and 744 deletions

View File

@ -2,13 +2,12 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-android-extensions"
}
android {
compileSdkVersion 34
defaultConfig {
applicationId "org.libre.agosto.p2play"
compileSdk 34
minSdkVersion 26
targetSdkVersion 32
versionCode 10
@ -22,9 +21,12 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
namespace 'org.libre.agosto.p2play'
lint {
@ -41,14 +43,14 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.media3:media3-exoplayer:1.1.1'
implementation 'androidx.media3:media3-exoplayer-dash:1.1.1'
implementation 'androidx.media3:media3-ui:1.1.1'
implementation 'androidx.media3:media3-exoplayer-hls:1.1.1'
implementation "androidx.media3:media3-session:1.1.1"
implementation 'androidx.media3:media3-exoplayer:1.3.1'
implementation 'androidx.media3:media3-exoplayer-dash:1.3.1'
implementation 'androidx.media3:media3-ui:1.3.1'
implementation 'androidx.media3:media3-exoplayer-hls:1.3.1'
implementation "androidx.media3:media3-session:1.3.1"
}

View File

@ -59,11 +59,6 @@
<activity
android:name=".AboutActivity"
android:exported="false" />
<activity
android:name=".SettingsActivity"
android:exported="false"
android:label="@string/title_activity_settings"
android:theme="@style/Theme.P2play" />
<service
android:name=".services.PlaybackService"

View File

@ -2,16 +2,18 @@ package org.libre.agosto.p2play
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_about.*
import org.libre.agosto.p2play.databinding.ActivityAboutBinding
class AboutActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_about)
val binding = ActivityAboutBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
aboutUrl.text = "https://" + ManagerSingleton.url + "/about/instance"
binding.aboutUrl.text = "https://" + ManagerSingleton.url + "/about/instance"
aboutLabel.text = aboutLabel.text.toString() + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
binding.aboutLabel.text = binding.aboutLabel.text.toString() + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
}
}

View File

@ -1,90 +0,0 @@
package org.libre.agosto.p2play
import android.content.res.Configuration
import android.os.Bundle
import android.preference.PreferenceActivity
import android.view.MenuInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.appcompat.app.ActionBar
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.widget.Toolbar
/**
* A [android.preference.PreferenceActivity] which implements and proxies the necessary calls
* to be used with AppCompat.
*/
abstract class AppCompatPreferenceActivity : PreferenceActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
delegate.installViewFactory()
delegate.onCreate(savedInstanceState)
super.onCreate(savedInstanceState)
}
override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
delegate.onPostCreate(savedInstanceState)
}
val supportActionBar: ActionBar?
get() = delegate.supportActionBar
fun setSupportActionBar(toolbar: Toolbar?) {
delegate.setSupportActionBar(toolbar)
}
override fun getMenuInflater(): MenuInflater {
return delegate.menuInflater
}
override fun setContentView(@LayoutRes layoutResID: Int) {
delegate.setContentView(layoutResID)
}
override fun setContentView(view: View) {
delegate.setContentView(view)
}
override fun setContentView(view: View, params: ViewGroup.LayoutParams) {
delegate.setContentView(view, params)
}
override fun addContentView(view: View, params: ViewGroup.LayoutParams) {
delegate.addContentView(view, params)
}
override fun onPostResume() {
super.onPostResume()
delegate.onPostResume()
}
override fun onTitleChanged(title: CharSequence, color: Int) {
super.onTitleChanged(title, color)
delegate.setTitle(title)
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
delegate.onConfigurationChanged(newConfig)
}
override fun onStop() {
super.onStop()
delegate.onStop()
}
override fun onDestroy() {
super.onDestroy()
delegate.onDestroy()
}
override fun invalidateOptionsMenu() {
delegate.invalidateOptionsMenu()
}
private val delegate: AppCompatDelegate by lazy {
AppCompatDelegate.create(this, null)
}
}

View File

@ -4,14 +4,13 @@ import android.os.AsyncTask
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.activity_channel.*
import org.libre.agosto.p2play.adapters.VideosAdapter
import org.libre.agosto.p2play.ajax.Actions
import org.libre.agosto.p2play.ajax.Channels
import org.libre.agosto.p2play.ajax.Videos
import org.libre.agosto.p2play.databinding.ActivityChannelBinding
import org.libre.agosto.p2play.helpers.getViewManager
import org.libre.agosto.p2play.models.ChannelModel
import org.libre.agosto.p2play.models.VideoModel
@ -27,15 +26,19 @@ class ChannelActivity : AppCompatActivity() {
private lateinit var viewAdapter: RecyclerView.Adapter<VideosAdapter.ViewHolder>
private lateinit var viewManager: RecyclerView.LayoutManager
private lateinit var binding: ActivityChannelBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_channel)
binding = ActivityChannelBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
channelId = this.intent.extras?.getString("channel")!!
viewManager = getViewManager(this, resources)
subcriptionBtn.setOnClickListener {
binding.subcriptionBtn.setOnClickListener {
subscribeAction()
}
}
@ -48,7 +51,7 @@ class ChannelActivity : AppCompatActivity() {
getVideos()
if (ManagerSingleton.user.status == 1) {
subcriptionBtn.visibility = View.VISIBLE
binding.subcriptionBtn.visibility = View.VISIBLE
getSubscription()
}
}
@ -57,11 +60,11 @@ class ChannelActivity : AppCompatActivity() {
AsyncTask.execute {
channel = channelService.getChannelInfo(channelId)
runOnUiThread {
usernameProfile.text = channel.name
hostTxt.text = channel.host
subcriptionsTxt.text = channel.followers.toString()
binding.usernameProfile.text = channel.name
binding.hostTxt.text = channel.host
binding.subcriptionsTxt.text = channel.followers.toString()
if (channel.channelImg != "") {
Picasso.get().load("https://${ManagerSingleton.url}${channel.channelImg}").into(channelImg)
Picasso.get().load("https://${ManagerSingleton.url}${channel.channelImg}").into(binding.channelImg)
}
}
}
@ -72,7 +75,7 @@ class ChannelActivity : AppCompatActivity() {
val res = actionsService.subscribe(ManagerSingleton.token.token, channel.getAccount())
runOnUiThread {
if (res == 1) {
subcriptionBtn.text = getString(R.string.unSubscribeBtn)
binding.subcriptionBtn.text = getString(R.string.unSubscribeBtn)
ManagerSingleton.toast(getString(R.string.subscribeMsg), this)
getSubscription()
} else {
@ -87,7 +90,7 @@ class ChannelActivity : AppCompatActivity() {
val res = actionsService.unSubscribe(ManagerSingleton.token.token, channel.getAccount())
runOnUiThread {
if (res == 1) {
subcriptionBtn.text = getString(R.string.subscribeBtn)
binding.subcriptionBtn.text = getString(R.string.subscribeBtn)
ManagerSingleton.toast(getString(R.string.unSubscribeMsg), this)
getSubscription()
} else {
@ -110,9 +113,9 @@ class ChannelActivity : AppCompatActivity() {
isSubcribed = actionsService.getSubscription(ManagerSingleton.token.token, channel.getAccount())
runOnUiThread {
if (isSubcribed) {
subcriptionBtn.text = getText(R.string.unSubscribeBtn)
binding.subcriptionBtn.text = getText(R.string.unSubscribeBtn)
} else {
subcriptionBtn.text = getText(R.string.subscribeBtn)
binding.subcriptionBtn.text = getText(R.string.subscribeBtn)
}
}
}

View File

@ -7,8 +7,8 @@ import android.os.Bundle
import android.os.Looper
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.PreferenceManager
import kotlinx.android.synthetic.main.activity_host.*
import org.libre.agosto.p2play.ajax.Auth
import org.libre.agosto.p2play.databinding.ActivityHostBinding
class HostActivity : AppCompatActivity() {
lateinit var settings: SharedPreferences
@ -16,15 +16,19 @@ class HostActivity : AppCompatActivity() {
val client: Auth = Auth()
private val db = Database(this)
private lateinit var binding: ActivityHostBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_host)
binding = ActivityHostBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
settings = PreferenceManager.getDefaultSharedPreferences(this)
editor = settings.edit()
button.setOnClickListener {
getKeys(hostText.text.toString())
binding.button.setOnClickListener {
getKeys(binding.hostText.text.toString())
}
val host = settings.getString("hostP2play", "")
@ -51,7 +55,7 @@ class HostActivity : AppCompatActivity() {
}
private fun getKeys(hostText: String) {
button.isEnabled = false
binding.button.isEnabled = false
var host = hostText.toString()
host = host.replace("http://", "")
host = host.replace("https://", "")
@ -71,7 +75,7 @@ class HostActivity : AppCompatActivity() {
} else {
runOnUiThread {
ManagerSingleton.toast(getString(R.string.errorMsg), this)
button.isEnabled = true
binding.button.isEnabled = true
}
}
}

View File

@ -9,8 +9,8 @@ import android.widget.EditText
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.PreferenceManager
import kotlinx.android.synthetic.main.activity_login.*
import org.libre.agosto.p2play.ajax.Auth
import org.libre.agosto.p2play.databinding.ActivityLoginBinding
class LoginActivity : AppCompatActivity() {
private val auth = Auth()
@ -20,9 +20,13 @@ class LoginActivity : AppCompatActivity() {
private lateinit var db: Database
private var optCode: String? = null
private lateinit var binding: ActivityLoginBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
binding = ActivityLoginBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
setTitle(R.string.action_login)
db = Database(this)
@ -30,14 +34,14 @@ class LoginActivity : AppCompatActivity() {
clientId = settings.getString("client_id", "")!!
clientSecret = settings.getString("client_secret", "")!!
registerActionBtn.setOnClickListener { startActivity(Intent(this, RegisterActivity::class.java)) }
loginBtn.setOnClickListener { tryLogin() }
binding.registerActionBtn.setOnClickListener { startActivity(Intent(this, RegisterActivity::class.java)) }
binding.loginBtn.setOnClickListener { tryLogin() }
}
fun tryLogin() {
loginBtn.isEnabled = false
val username = userText.text.toString()
val password = passwordText.text.toString()
binding.loginBtn.isEnabled = false
val username = binding.userText.text.toString()
val password = binding.passwordText.text.toString()
AsyncTask.execute {
if (Looper.myLooper() == null) {
@ -62,7 +66,7 @@ class LoginActivity : AppCompatActivity() {
}
"-1" -> {
runOnUiThread {
loginBtn.isEnabled = true
binding.loginBtn.isEnabled = true
ManagerSingleton.toast(getString(R.string.loginFailed_msg), this)
}
}
@ -84,7 +88,7 @@ class LoginActivity : AppCompatActivity() {
}
.setNegativeButton("Cancel") { d, _ ->
dialog.run { d.cancel() }
loginBtn.isEnabled = true
binding.loginBtn.isEnabled = true
}
val alertDialog = builder.create()
alertDialog.show()

View File

@ -1,34 +1,24 @@
package org.libre.agosto.p2play
import android.content.Intent
import android.content.res.Configuration
import android.os.AsyncTask
import android.os.Bundle
import android.os.Handler
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
import androidx.core.view.GravityCompat
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.navigation.NavigationView
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.activity_main.drawer_layout
import kotlinx.android.synthetic.main.activity_main.nav_view
import kotlinx.android.synthetic.main.app_bar_main.toolbar
import kotlinx.android.synthetic.main.content_main.mini
import kotlinx.android.synthetic.main.content_main.swipeContainer
import kotlinx.android.synthetic.main.mini_player.mini_play_pause
import kotlinx.android.synthetic.main.mini_player.mini_player_author
import kotlinx.android.synthetic.main.mini_player.mini_player_image
import kotlinx.android.synthetic.main.mini_player.mini_player_title
import kotlinx.android.synthetic.main.nav_header_main.*
import org.libre.agosto.p2play.adapters.VideosAdapter
import org.libre.agosto.p2play.ajax.Videos
import org.libre.agosto.p2play.databinding.ActivityMainBinding
import org.libre.agosto.p2play.helpers.getViewManager
import org.libre.agosto.p2play.models.VideoModel
import org.libre.agosto.p2play.singletons.PlaybackSingleton
@ -44,16 +34,20 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
var section: String = ""
var searchVal: String = ""
var pagination = 0
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
setSupportActionBar(binding.toolbar)
val toggle = ActionBarDrawerToggle(this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close)
drawer_layout.addDrawerListener(toggle)
val toggle = ActionBarDrawerToggle(this, binding.drawerLayout, binding.toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close)
binding.drawerLayout.addDrawerListener(toggle)
toggle.syncState()
nav_view.setNavigationItemSelectedListener(this)
binding.navView.setNavigationItemSelectedListener(this)
viewManager = getViewManager(this, resources)
@ -62,19 +56,20 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
this.getTrengindVideos()
swipeContainer.setOnRefreshListener {
binding.content.swipeContainer.setOnRefreshListener {
this.refresh()
}
mini_player_image.setOnClickListener { this.resumeVideo() }
mini_player_title.setOnClickListener { this.resumeVideo() }
mini_player_author.setOnClickListener { this.resumeVideo() }
mini.setOnClickListener { this.resumeVideo() }
mini_play_pause.setOnClickListener { this.playPausePlayer() }
binding.content.mini.miniPlayerImage.setOnClickListener { this.resumeVideo() }
binding.content.mini.miniPlayerTitle.setOnClickListener { this.resumeVideo() }
binding.content.mini.miniPlayerAuthor.setOnClickListener { this.resumeVideo() }
// binding.content.mini.setOnClickListener { this.resumeVideo() }
binding.content.mini.miniPlayPause.setOnClickListener { this.playPausePlayer() }
Handler().postDelayed({
// Title for nav_bar
side_emailTxt?.text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
binding.navView.getHeaderView(0).findViewById<TextView>(R.id.side_emailTxt).text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
}, 2000)
}
@ -99,7 +94,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
super.onScrolled(recyclerView, dx, dy)
// super.onScrolled(recyclerView!!, dx, dy)
if (!swipeContainer.isRefreshing) {
if (!binding.content.swipeContainer.isRefreshing) {
if (!canScrollVertically(1)) {
loadMore()
}
@ -107,11 +102,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
})
}
swipeContainer.isRefreshing = false
binding.content.swipeContainer.isRefreshing = false
}
private fun addVideos(videos: ArrayList<VideoModel>) {
this.swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
try {
if (this.pagination == 0) {
@ -125,11 +120,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
ManagerSingleton.toast(getString(R.string.errorMsg), this)
}
this.swipeContainer.isRefreshing = false
binding.content.swipeContainer.isRefreshing = false
}
private fun refresh() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
this.pagination = 0
when (section) {
"local" -> this.getLocalVideos()
@ -154,7 +149,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
startActivity(Intent(this, LoginActivity::class.java))
return
}
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "sub"
setTitle(R.string.title_subscriptions)
AsyncTask.execute {
@ -167,7 +162,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Last videos
private fun getLastVideos() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "last"
setTitle(R.string.title_recent)
AsyncTask.execute {
@ -180,7 +175,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Popular videos
private fun getPopularVideos() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "popular"
setTitle(R.string.title_popular)
AsyncTask.execute {
@ -193,7 +188,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Trending videos
private fun getTrengindVideos() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "trending"
setTitle(R.string.title_trending)
AsyncTask.execute {
@ -206,7 +201,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Local videos
private fun getLocalVideos() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "local"
setTitle(R.string.title_local)
AsyncTask.execute {
@ -219,7 +214,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Videos of user
private fun getMyVideos() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "my_videos"
setTitle(R.string.title_myVideos)
AsyncTask.execute {
@ -232,7 +227,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Videos history of user
private fun getHistory() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "my_videos"
setTitle(R.string.nav_history)
AsyncTask.execute {
@ -245,7 +240,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Most liked
private fun getMostLiked() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "liked"
setTitle(R.string.nav_likes)
AsyncTask.execute {
@ -257,8 +252,8 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
override fun onBackPressed() {
if (drawer_layout.isDrawerOpen(GravityCompat.START)) {
drawer_layout.closeDrawer(GravityCompat.START)
if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
binding.drawerLayout.closeDrawer(GravityCompat.START)
} else if (!section.equals("trending")) {
// Hot fix
pagination = 0
@ -350,7 +345,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
R.id.nav_likes -> getMostLiked()
}
drawer_layout.closeDrawer(GravityCompat.START)
binding.drawerLayout.closeDrawer(GravityCompat.START)
return true
}
@ -360,13 +355,14 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
if (PlaybackSingleton.player != null && PlaybackSingleton.player!!.isPlaying) {
PlaybackSingleton.runMediaSession(this)
mini_player_title.text = PlaybackSingleton.video!!.name
mini_player_author.text = PlaybackSingleton.video!!.username
Picasso.get().load("https://${ManagerSingleton.url}${PlaybackSingleton.video!!.thumbUrl}").into(mini_player_image)
mini_play_pause.setImageResource(R.drawable.ic_pause_24)
mini.visibility = View.VISIBLE
binding.content.mini.miniPlayerTitle.text = PlaybackSingleton.video!!.name
binding.content.mini.miniPlayerAuthor.text = PlaybackSingleton.video!!.username
Picasso.get().load("https://${ManagerSingleton.url}${PlaybackSingleton.video!!.thumbUrl}").into(binding.content.mini.miniPlayerImage)
binding.content.mini.miniPlayPause.setImageResource(R.drawable.ic_pause_24)
binding.content.mini.miniPlayer.visibility = View.VISIBLE
} else {
mini.visibility = View.GONE
binding.content.mini.miniPlayer.visibility = View.GONE
}
}
@ -379,24 +375,25 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
private fun setSideData() {
if (ManagerSingleton.user.status == 1) {
nav_view.menu.findItem(R.id.ml).isVisible = true
binding.navView.menu.findItem(R.id.ml).isVisible = true
side_usernameTxt?.text = ManagerSingleton.user.username
side_emailTxt?.text = ManagerSingleton.user.email
if (ManagerSingleton.user.avatar != "" && side_imageView != null) {
Picasso.get().load("https://" + ManagerSingleton.url + ManagerSingleton.user.avatar).into(side_imageView)
val headerView = binding.navView.getHeaderView(0)
headerView.findViewById<TextView>(R.id.side_usernameTxt).text = ManagerSingleton.user.username
headerView.findViewById<TextView>(R.id.side_emailTxt).text = ManagerSingleton.user.email
if (ManagerSingleton.user.avatar != "" && headerView.findViewById<ImageView>(R.id.side_imageView) != null) {
Picasso.get().load("https://" + ManagerSingleton.url + ManagerSingleton.user.avatar).into(headerView.findViewById<ImageView>(R.id.side_imageView))
}
side_imageView?.setOnClickListener {
headerView.findViewById<ImageView>(R.id.side_imageView).setOnClickListener {
pagination = 0
getMyVideos()
drawer_layout.closeDrawer(GravityCompat.START)
binding.drawerLayout.closeDrawer(GravityCompat.START)
}
if (::myMenu.isInitialized) {
myMenu.findItem(R.id.action_login).isVisible = false
myMenu.findItem(R.id.action_logout).isVisible = true
}
} else {
nav_view.menu.findItem(R.id.ml).isVisible = false
binding.navView.menu.findItem(R.id.ml).isVisible = false
}
}
@ -405,11 +402,12 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
myMenu.findItem(R.id.action_login).isVisible = true
myMenu.findItem(R.id.action_logout).isVisible = false
}
// nav_view.menu.findItem(R.id.ml).isVisible = false
side_usernameTxt?.text = getString(R.string.nav_header_title)
side_emailTxt?.text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
side_imageView?.setImageResource(R.drawable.default_avatar)
side_imageView?.setOnClickListener { }
val headerView = binding.navView.getHeaderView(0)
binding.navView.menu.findItem(R.id.ml).isVisible = false
headerView.findViewById<TextView>(R.id.side_usernameTxt).text = getString(R.string.nav_header_title)
headerView.findViewById<TextView>(R.id.side_emailTxt).text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
headerView.findViewById<ImageView>(R.id.side_imageView).setImageResource(R.drawable.default_avatar)
headerView.findViewById<ImageView>(R.id.side_imageView).setOnClickListener { }
db.logout()
ManagerSingleton.logout()
@ -419,7 +417,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
private fun loadMore() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
this.pagination += ManagerSingleton.videosCount
when (section) {
@ -441,7 +439,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
private fun searchVideos() {
swipeContainer.isRefreshing = true
binding.content.swipeContainer.isRefreshing = true
section = "search"
this.title = this.searchVal
AsyncTask.execute {
@ -462,10 +460,10 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
PlaybackSingleton.player?.let {
if (it.isPlaying) {
it.pause()
mini_play_pause.setImageResource(R.drawable.ic_play_arrow_24)
binding.content.mini.miniPlayPause.setImageResource(R.drawable.ic_play_arrow_24)
} else {
it.play()
mini_play_pause.setImageResource(R.drawable.ic_pause_24)
binding.content.mini.miniPlayPause.setImageResource(R.drawable.ic_pause_24)
}
}
}

View File

@ -7,8 +7,8 @@ import android.os.Looper
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.PreferenceManager
import kotlinx.android.synthetic.main.activity_register.*
import org.libre.agosto.p2play.ajax.Auth
import org.libre.agosto.p2play.databinding.ActivityRegisterBinding
class RegisterActivity : AppCompatActivity() {
private val auth = Auth()
@ -16,23 +16,27 @@ class RegisterActivity : AppCompatActivity() {
lateinit var clientId: String
lateinit var clientSecret: String
private lateinit var binding: ActivityRegisterBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_register)
binding = ActivityRegisterBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
setTitle(R.string.registerActionBtn)
settings = PreferenceManager.getDefaultSharedPreferences(this)
clientId = settings.getString("client_id", "")!!
clientSecret = settings.getString("client_secret", "")!!
registerBtn.setOnClickListener { registerUser() }
binding.registerBtn.setOnClickListener { registerUser() }
}
private fun registerUser() {
registerBtn.isEnabled = false
val username = userText2.text.toString()
val password = passwordText2.text.toString()
val email = emailText.text.toString()
binding.registerBtn.isEnabled = false
val username = binding.userText2.text.toString()
val password = binding.passwordText2.text.toString()
val email = binding.emailText.text.toString()
AsyncTask.execute {
if (Looper.myLooper() == null) {
Looper.prepare()
@ -49,7 +53,7 @@ class RegisterActivity : AppCompatActivity() {
0 -> ManagerSingleton.toast(getString(R.string.registerFailed_msg), this)
-1 -> ManagerSingleton.toast(getString(R.string.registerError_msg), this)
}
registerBtn.isEnabled = true
binding.registerBtn.isEnabled = true
}
}
}

View File

@ -15,35 +15,28 @@ import android.webkit.WebChromeClient
import android.widget.EditText
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata
import androidx.media3.common.Player
import androidx.media3.exoplayer.DefaultLoadControl
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.upstream.DefaultAllocator
import androidx.media3.session.MediaController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.activity_reproductor.*
import kotlinx.android.synthetic.main.comment_component.commentaryBtn
import kotlinx.android.synthetic.main.comment_component.commentaryLayout
import kotlinx.android.synthetic.main.comment_component.commentaryText
import kotlinx.android.synthetic.main.comment_component.userImgCom
import kotlinx.android.synthetic.main.custom_player_controls.view.exo_controls
import org.libre.agosto.p2play.adapters.CommentariesAdapter
import org.libre.agosto.p2play.ajax.Actions
import org.libre.agosto.p2play.ajax.Comments
import org.libre.agosto.p2play.ajax.Videos
import org.libre.agosto.p2play.databinding.ActivityReproductorBinding
import org.libre.agosto.p2play.helpers.setFullscreen
import org.libre.agosto.p2play.models.CommentaryModel
import org.libre.agosto.p2play.models.VideoModel
import org.libre.agosto.p2play.singletons.PlaybackSingleton
@Suppress("NAME_SHADOWING")
class ReproductorActivity : AppCompatActivity() {
private val clientVideo: Videos = Videos()
lateinit var video: VideoModel
@ -68,14 +61,19 @@ class ReproductorActivity : AppCompatActivity() {
// Resume info
private var isResume = false
private lateinit var binding: ActivityReproductorBinding
@SuppressLint("SetJavaScriptEnabled", "SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_reproductor)
binding = ActivityReproductorBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
val fullscreenButton: ImageView = exoPlayer.findViewById(R.id.exo_fullscreen_custom)
val fullscreenButton2 = fullscreenPlayer.findViewById<ImageView>(R.id.exo_fullscreen_custom)
val fullscreenButton = binding.exoPlayer.findViewById<ImageView>(R.id.exo_fullscreen_custom)
val fullscreenButton2 = binding.fullscreenPlayer.findViewById<ImageView>(R.id.exo_fullscreen_custom)
val videoView = binding.videoView
videoView.webChromeClient = WebClient()
videoView.settings.javaScriptEnabled = true
videoView.settings.allowContentAccess = true
@ -95,19 +93,19 @@ class ReproductorActivity : AppCompatActivity() {
isResume = true
}
tittleVideoTxt.text = this.video.name
viewsTxt.text = "${this.video.views} ${getString(R.string.view_text)}"
userTxt.text = this.video.username
descriptionVideoTxt.text = this.video.description
binding.tittleVideoTxt.text = this.video.name
binding.viewsTxt.text = "${this.video.views} ${getString(R.string.view_text)}"
binding.userTxt.text = this.video.username
binding.descriptionVideoTxt.text = this.video.description
val haveDescription = this.video.description.endsWith("...")
if (haveDescription) {
showMoreBtn.visibility = View.VISIBLE
binding.showMoreBtn.visibility = View.VISIBLE
}
hostTxt.text = this.video.userHost
binding.hostTxt.text = this.video.userHost
// Check if user had profile image
if (this.video.userImageUrl != "") {
Picasso.get().load("https://" + ManagerSingleton.url + this.video.userImageUrl).into(userImg)
Picasso.get().load("https://" + ManagerSingleton.url + this.video.userImageUrl).into(binding.userImg)
}
// Load the video
videoView.loadUrl("https://" + ManagerSingleton.url + this.video.embedUrl)
@ -120,17 +118,17 @@ class ReproductorActivity : AppCompatActivity() {
this.getComments()
subscribeBtn.setOnClickListener { subscribe() }
likeLayout.setOnClickListener { rate("like") }
dislikeLayout.setOnClickListener { rate("dislike") }
commentaryBtn.setOnClickListener { makeComment() }
showMoreBtn.setOnClickListener { getDescription() }
shareLayout.setOnClickListener { shareIntent() }
reportLayout.setOnClickListener { reportIntent() }
binding.subscribeBtn.setOnClickListener { subscribe() }
binding.likeLayout.setOnClickListener { rate("like") }
binding.dislikeLayout.setOnClickListener { rate("dislike") }
binding.commentBox.commentaryBtn.setOnClickListener { makeComment() }
binding.showMoreBtn.setOnClickListener { getDescription() }
binding.shareLayout.setOnClickListener { shareIntent() }
binding.reportLayout.setOnClickListener { reportIntent() }
fullscreenButton.setOnClickListener { toggleFullscreen() }
fullscreenButton2.setOnClickListener { toggleFullscreen() }
userImg.setOnClickListener {
binding.userImg.setOnClickListener {
val intent = Intent(this, ChannelActivity::class.java)
intent.putExtra("channel", video.getChannel())
startActivity(intent)
@ -139,32 +137,35 @@ class ReproductorActivity : AppCompatActivity() {
AsyncTask.execute {
videoPlayback = this.clientVideo.getVideo(this.video.uuid)
// TODO: Make this configurable
val bufferSize = 1024 * 1024 // 1mb
val allocator = DefaultAllocator(true, bufferSize)
val loadControl = DefaultLoadControl.Builder()
.setAllocator(allocator)
.build()
// val bufferSize = 1024 * 1024 // 1mb
// val allocator = DefaultAllocator(true, bufferSize)
// val loadControl = DefaultLoadControl.Builder()
// .setAllocator(allocator)
// .build()
runOnUiThread {
try {
if (PlaybackSingleton.player == null || !PlaybackSingleton.player!!.playWhenReady) {
PlaybackSingleton.player = ExoPlayer.Builder(this.baseContext)
.setSeekBackIncrementMs(10000)
.setSeekForwardIncrementMs(10000)
.setLoadControl(loadControl).build()
PlaybackSingleton.player = ExoPlayer.Builder(this)
//.setSeekBackIncrementMs(10000)
//.setSeekForwardIncrementMs(10000)
//.setLoadControl(loadControl)
.build()
}
player = PlaybackSingleton.player!!
exoPlayer.player = player
binding.exoPlayer.player = player
binding.exoPlayer
player.addListener(
object : Player.Listener {
override fun onPlaybackStateChanged(playbackState: Int) {
super.onPlaybackStateChanged(playbackState)
val controls = binding.exoPlayer.findViewById<LinearLayout>(R.id.exo_center_controls)
if (playbackState == Player.STATE_BUFFERING || playbackState == Player.STATE_IDLE) {
exoPlayer.exo_controls.visibility = View.INVISIBLE
controls.visibility = View.INVISIBLE
} else if (playbackState == Player.STATE_READY) {
exoPlayer.exo_controls.visibility = View.VISIBLE
controls.visibility = View.VISIBLE
}
}
}
@ -186,6 +187,7 @@ class ReproductorActivity : AppCompatActivity() {
PlaybackSingleton.setData(mediaItem, video)
}
// Start the playback.
// TODO: Setting for autoplay
// player.play()
} catch (err: Exception) {
err.printStackTrace()
@ -234,11 +236,11 @@ class ReproductorActivity : AppCompatActivity() {
runOnUiThread {
ManagerSingleton.toast(getString(R.string.rateMsg), this)
if (rate == "like") {
textViewLike.setTextColor(ContextCompat.getColor(this, R.color.colorLike))
textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
binding.textViewLike.setTextColor(ContextCompat.getColor(this, R.color.colorLike))
binding.textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
} else if (rate == "dislike") {
textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.colorDislike))
textViewLike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
binding.textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.colorDislike))
binding.textViewLike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
}
}
}
@ -254,16 +256,16 @@ class ReproductorActivity : AppCompatActivity() {
runOnUiThread {
when (rate) {
"like" -> {
textViewLike.setTextColor(ContextCompat.getColor(this, R.color.colorLike))
textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
binding.textViewLike.setTextColor(ContextCompat.getColor(this, R.color.colorLike))
binding.textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
}
"dislike" -> {
textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.colorDislike))
textViewLike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
binding.textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.colorDislike))
binding.textViewLike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
}
else -> {
textViewLike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
binding.textViewLike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
binding.textViewDislike.setTextColor(ContextCompat.getColor(this, R.color.primary_dark_material_light))
}
}
}
@ -285,11 +287,11 @@ class ReproductorActivity : AppCompatActivity() {
private fun changeSubscribeBtn(subscribed: Boolean) {
if (subscribed) {
subscribeBtn.text = getText(R.string.unSubscribeBtn)
subscribeBtn.setOnClickListener { this.unSubscribe() }
binding.subscribeBtn.text = getText(R.string.unSubscribeBtn)
binding.subscribeBtn.setOnClickListener { this.unSubscribe() }
} else {
subscribeBtn.text = getText(R.string.subscribeBtn)
subscribeBtn.setOnClickListener { this.subscribe() }
binding.subscribeBtn.text = getText(R.string.subscribeBtn)
binding.subscribeBtn.setOnClickListener { this.subscribe() }
}
}
@ -320,17 +322,17 @@ class ReproductorActivity : AppCompatActivity() {
}
private fun makeComment() {
if (commentaryText.text.toString() == "") {
if (binding.commentBox.commentaryText.text.toString() == "") {
ManagerSingleton.toast(getString(R.string.emptyCommentaryMsg), this)
return
}
val text = commentaryText.text.toString()
val text = binding.commentBox.commentaryText.text.toString()
AsyncTask.execute {
val res = this.client.makeCommentary(ManagerSingleton.token.token, this.video.id, text)
runOnUiThread {
if (res) {
ManagerSingleton.toast(getString(R.string.makedCommentaryMsg), this)
commentaryText.text?.clear()
binding.commentBox.commentaryText.text?.clear()
this.getComments()
} else {
ManagerSingleton.toast(getString(R.string.errorCommentaryMsg), this)
@ -344,14 +346,14 @@ class ReproductorActivity : AppCompatActivity() {
if (ManagerSingleton.user.status == 1) {
this.getRate()
this.getSubscription()
actionsLayout.visibility = View.VISIBLE
subscribeBtn.visibility = View.VISIBLE
commentaryLayout.visibility = View.VISIBLE
binding.actionsLayout.visibility = View.VISIBLE
binding.subscribeBtn.visibility = View.VISIBLE
binding.commentBox.commentaryLayout.visibility = View.VISIBLE
if (ManagerSingleton.user.avatar != "") {
Picasso.get().load("https://" + ManagerSingleton.url + ManagerSingleton.user.avatar).into(userImgCom)
Picasso.get().load("https://" + ManagerSingleton.url + ManagerSingleton.user.avatar).into(binding.commentBox.userImgCom)
}
} else {
commentaryLayout.visibility = View.GONE
binding.commentBox.commentaryLayout.visibility = View.GONE
}
}
@ -359,8 +361,8 @@ class ReproductorActivity : AppCompatActivity() {
AsyncTask.execute {
val fullDescription = this.videos.fullDescription(this.video.id)
runOnUiThread {
descriptionVideoTxt.text = fullDescription
showMoreBtn.visibility = View.GONE
binding.descriptionVideoTxt.text = fullDescription
binding.showMoreBtn.visibility = View.GONE
}
}
}
@ -413,10 +415,10 @@ class ReproductorActivity : AppCompatActivity() {
private fun toggleFullscreen() {
if (isFullscreen) {
nonFullScreen.visibility = View.VISIBLE
fullScreenExo.visibility = View.GONE
exoPlayer.player = player
fullscreenPlayer.player = null
binding.nonFullScreen.visibility = View.VISIBLE
binding.fullScreenExo.visibility = View.GONE
binding.exoPlayer.player = player
binding.fullscreenPlayer.player = null
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
val attrs = window.attributes
@ -429,11 +431,11 @@ class ReproductorActivity : AppCompatActivity() {
} else {
val matchParent = WindowManager.LayoutParams.MATCH_PARENT
nonFullScreen.visibility = View.GONE
fullScreenExo.visibility = View.VISIBLE
binding.nonFullScreen.visibility = View.GONE
binding.fullScreenExo.visibility = View.VISIBLE
exoPlayer.player = null
fullscreenPlayer.player = player
binding.exoPlayer.player = null
binding.fullscreenPlayer.player = player
setFullscreen(window)
@ -469,9 +471,9 @@ class ReproductorActivity : AppCompatActivity() {
override fun onHideCustomView() {
try {
this@ReproductorActivity.nonFullScreen.visibility = View.VISIBLE
this@ReproductorActivity.fullScreen.visibility = View.GONE
this@ReproductorActivity.fullScreen.removeView(this.mCustomView)
this@ReproductorActivity.binding.nonFullScreen.visibility = View.VISIBLE
this@ReproductorActivity.binding.fullScreen.visibility = View.GONE
this@ReproductorActivity.binding.fullScreen.removeView(this.mCustomView)
this.mCustomView = null
this.mCustomViewCallback!!.onCustomViewHidden()
@ -502,10 +504,10 @@ class ReproductorActivity : AppCompatActivity() {
this.mCustomViewCallback = paramCustomViewCallback
val matchParent = WindowManager.LayoutParams.MATCH_PARENT
this@ReproductorActivity.nonFullScreen.visibility = View.GONE
this@ReproductorActivity.fullScreen.visibility = View.VISIBLE
this@ReproductorActivity.binding.nonFullScreen.visibility = View.GONE
this@ReproductorActivity.binding.fullScreen.visibility = View.VISIBLE
this@ReproductorActivity.fullScreen.addView(paramView, FrameLayout.LayoutParams(matchParent, matchParent))
this@ReproductorActivity.binding.fullScreen.addView(paramView, FrameLayout.LayoutParams(matchParent, matchParent))
setFullscreen(this@ReproductorActivity.window)

View File

@ -1,159 +0,0 @@
package org.libre.agosto.p2play
import android.annotation.TargetApi
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.preference.ListPreference
import android.preference.Preference
import android.preference.PreferenceActivity
import android.preference.PreferenceFragment
import android.preference.PreferenceManager
import android.view.MenuItem
/**
* A [PreferenceActivity] that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
*
* See [Android Design: Settings](http://developer.android.com/design/patterns/settings.html)
* for design guidelines and the [Settings API Guide](http://developer.android.com/guide/topics/ui/settings.html)
* for more information on developing a Settings UI.
*/
class SettingsActivity : AppCompatPreferenceActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setupActionBar()
}
override fun onBackPressed() {
super.onBackPressed()
ManagerSingleton.toast(getString(R.string.pref_message_exit), this)
}
/**
* Set up the [android.app.ActionBar], if the API is available.
*/
private fun setupActionBar() {
supportActionBar?.setDisplayHomeAsUpEnabled(false)
}
/**
* {@inheritDoc}
*/
override fun onIsMultiPane(): Boolean {
return isXLargeTablet(this)
}
/**
* {@inheritDoc}
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
override fun onBuildHeaders(target: List<PreferenceActivity.Header>) {
loadHeadersFromResource(R.xml.pref_headers, target)
}
/**
* This method stops fragment injection in malicious applications.
* Make sure to deny any unknown fragments here.
*/
override fun isValidFragment(fragmentName: String): Boolean {
return PreferenceFragment::class.java.name == fragmentName ||
GeneralPreferenceFragment::class.java.name == fragmentName
}
/**
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
class GeneralPreferenceFragment : PreferenceFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addPreferencesFromResource(R.xml.pref_general)
setHasOptionsMenu(true)
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("hostP2play"))
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
if (id == android.R.id.home) {
startActivity(Intent(activity, SettingsActivity::class.java))
return true
}
return super.onOptionsItemSelected(item)
}
}
companion object {
/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private val sBindPreferenceSummaryToValueListener = Preference.OnPreferenceChangeListener { preference, value ->
val stringValue = value.toString()
if (preference is ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
val listPreference = preference
val index = listPreference.findIndexOfValue(stringValue)
// Set the summary to reflect the new value.
preference.setSummary(
if (index >= 0) {
listPreference.entries[index]
} else {
null
},
)
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.summary = stringValue
}
true
}
/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private fun isXLargeTablet(context: Context): Boolean {
return context.resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK >= Configuration.SCREENLAYOUT_SIZE_XLARGE
}
/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format is
* dependent on the type of preference.
* @see .sBindPreferenceSummaryToValueListener
*/
private fun bindPreferenceSummaryToValue(preference: Preference) {
// Set the listener to watch for value changes.
preference.onPreferenceChangeListener = sBindPreferenceSummaryToValueListener
// Trigger the listener immediately with the preference's
// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(
preference,
PreferenceManager
.getDefaultSharedPreferences(preference.context)
.getString(preference.key, ""),
)
}
}
}

View File

@ -12,22 +12,11 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.comment_component.commentaryLayout
import kotlinx.android.synthetic.main.comment_component.commentaryText
import kotlinx.android.synthetic.main.comment_component.userImgCom
import kotlinx.android.synthetic.main.comment_component.view.commentaryBtn
import kotlinx.android.synthetic.main.comment_component.view.commentaryLayout
import kotlinx.android.synthetic.main.comment_component.view.commentaryText
import kotlinx.android.synthetic.main.comment_component.view.userImgCom
import kotlinx.android.synthetic.main.dialog_thread.view.materialToolbar
import kotlinx.android.synthetic.main.view_commentary.view.replyBtn
import kotlinx.android.synthetic.main.view_commentary.view.userCommentImg
import kotlinx.android.synthetic.main.view_commentary.view.userCommentary
import kotlinx.android.synthetic.main.view_commentary.view.userTxt
import org.libre.agosto.p2play.ManagerSingleton
import org.libre.agosto.p2play.R
import org.libre.agosto.p2play.adapters.CommentariesAdapter
import org.libre.agosto.p2play.ajax.Comments
import org.libre.agosto.p2play.databinding.DialogThreadBinding
import org.libre.agosto.p2play.models.CommentaryModel
class ThreadDialog : DialogFragment() {
@ -35,6 +24,12 @@ class ThreadDialog : DialogFragment() {
lateinit var fragmentManager2: FragmentManager
private val client: Comments = Comments()
private var _binding: DialogThreadBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
// The system calls this to get the DialogFragment's layout, regardless of
// whether it's being displayed as a dialog or an embedded fragment.
override fun onCreateView(
@ -43,29 +38,30 @@ class ThreadDialog : DialogFragment() {
savedInstanceState: Bundle?,
): View {
// Inflate the layout to use as a dialog or embedded fragment.
val view = inflater.inflate(R.layout.dialog_thread, container, false)
_binding = DialogThreadBinding.inflate(inflater, container, false)
val view = binding.root
comment = arguments?.getSerializable("comment") as CommentaryModel
view.userTxt.text = comment.username
view.userCommentary.text = comment.commentary
Picasso.get().load("https://${ManagerSingleton.url}${comment.userImageUrl}").into(view.userCommentImg)
view.replyBtn.visibility = View.GONE
binding.commentThread?.userTxt?.text = comment.username
binding.commentThread?.userCommentary?.text = comment.commentary
Picasso.get().load("https://${ManagerSingleton.url}${comment.userImageUrl}").into(binding.commentThread?.userCommentImg)
binding.commentThread?.replyBtn?.visibility = View.GONE
if (ManagerSingleton.user.status == 1) {
view.commentaryText.setText("${comment.username}@${comment.userHost} ")
binding.commentBox?.commentaryText?.setText("${comment.nameChannel}@${comment.userHost} ")
if (ManagerSingleton.user.avatar != "") {
Picasso.get().load("https://${ManagerSingleton.url}${ManagerSingleton.user.avatar}").into(view.userImgCom)
Picasso.get().load("https://${ManagerSingleton.url}${ManagerSingleton.user.avatar}").into(binding.commentBox?.userImgCom)
}
view.commentaryText.requestFocus()
view.commentaryBtn.setOnClickListener { this.replyThread() }
binding.commentBox?.commentaryText?.requestFocus()
binding.commentBox?.commentaryBtn?.setOnClickListener { this.replyThread() }
} else {
view.commentaryLayout.visibility = View.GONE
binding.commentBox?.commentaryLayout?.visibility = View.GONE
}
view.materialToolbar.setTitle("Thread")
view.materialToolbar.setNavigationIcon(R.drawable.baseline_arrow_back_24)
view.materialToolbar.setNavigationOnClickListener {
binding.materialToolbar.setTitle("Thread")
binding.materialToolbar.setNavigationIcon(R.drawable.baseline_arrow_back_24)
binding.materialToolbar.setNavigationOnClickListener {
dismiss()
this.fragmentManager2.popBackStack()
}
@ -109,7 +105,7 @@ class ThreadDialog : DialogFragment() {
}
private fun replyThread() {
val commentary = view?.commentaryText?.text.toString()
val commentary = binding.commentBox?.commentaryText?.text.toString()
if (commentary == "") {
ManagerSingleton.toast(getString(R.string.emptyCommentaryMsg), requireActivity())
@ -121,7 +117,7 @@ class ThreadDialog : DialogFragment() {
activity?.runOnUiThread {
if (res) {
ManagerSingleton.toast(getString(R.string.makedCommentaryMsg), requireActivity())
commentaryText.text?.clear()
binding.commentBox?.commentaryText?.text?.clear()
this.getComments()
} else {
ManagerSingleton.toast(getString(R.string.errorCommentaryMsg), requireActivity())

View File

@ -1,4 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#fff" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="48dp" android:tint="#fff" android:viewportHeight="24" android:viewportWidth="24" android:width="48dp">
<path android:fillColor="@android:color/white" android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z"/>

View File

@ -84,12 +84,9 @@
android:id="@+id/exoPlayer"
android:layout_width="match_parent"
android:layout_height="500dp"
app:auto_show="true"
app:controller_layout_id="@layout/custom_player_controls"
app:repeat_toggle_modes="none"
app:show_buffering="always"
app:surface_type="surface_view"
app:use_controller="true" />
app:use_controller="true"
app:controller_layout_id="@layout/custom_player_controls"/>
<TextView
android:id="@+id/tittleVideoTxt"
@ -337,7 +334,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="@layout/comment_component" />
<include
android:id="@+id/commentBox"
layout="@layout/comment_component" />
<TextView
android:id="@+id/commentariesTxt"

View File

@ -1,110 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/exo_controls"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#44000000">
<!-- Copyright 2020 The Android Open Source Project
<ImageView
android:id="@+id/exo_settings"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_weight="0"
android:alpha="0.5"
android:src="@drawable/ic_baseline_settings_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
http://www.apache.org/licenses/LICENSE-2.0
<ImageView
android:id="@+id/exo_rew"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/ic_replay_10_24" />
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/exo_play_pause"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginHorizontal="30dp" />
<ImageView
android:id="@+id/exo_ffwd"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/ic_forward_10_24" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<androidx.media3.ui.DefaultTimeBar
android:id="@+id/exo_progress"
android:layout_width="wrap_content"
<!-- 0dp dimensions are used to prevent this view from influencing the size of
the parent view if it uses "wrap_content". It is expanded to occupy the
entirety of the parent in code, after the parent's size has been
determined. See: https://github.com/google/ExoPlayer/issues/8726.
-->
<View android:id="@id/exo_controls_background"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
android:background="@color/exo_black_opacity_60"/>
<FrameLayout
android:id="@id/exo_bottom_bar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/exo_styled_bottom_bar_margin_top"
android:background="@color/exo_bottom_bar_background"
android:layoutDirection="ltr">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/exo_position"
android:id="@id/exo_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="20sp" />
android:layout_gravity="center_vertical|start"
android:layoutDirection="ltr"
android:paddingStart="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingLeft="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingEnd="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingRight="@dimen/exo_styled_bottom_bar_time_padding">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:text="/"
android:textColor="#CBCDC8"
android:textSize="20sp" />
android:id="@id/exo_position"
style="@style/ExoStyledControls.TimeText.Position" />
<TextView
android:id="@+id/exo_duration"
style="@style/ExoStyledControls.TimeText.Separator"
android:text="/" />
<TextView
android:id="@id/exo_duration"
style="@style/ExoStyledControls.TimeText.Duration" />
</LinearLayout>
<LinearLayout
android:id="@id/exo_basic_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#CBCDC8"
android:textSize="20sp" />
android:layout_gravity="center_vertical|end"
android:layoutDirection="ltr">
<ImageView
<ImageButton
android:id="@id/exo_subtitle"
style="@style/ExoStyledControls.Button.Bottom.CC" />
<ImageButton
android:id="@id/exo_settings"
style="@style/ExoStyledControls.Button.Bottom.Settings" />
<ImageButton
android:id="@+id/exo_fullscreen_custom"
android:layout_width="50dp"
android:layout_height="50dp"
style="@style/ExoStyledControls.Button.Bottom.Settings"
android:src="@drawable/ic_fullscreen_24"
android:visibility="visible" />
</LinearLayout>
</FrameLayout>
<View android:id="@id/exo_progress_placeholder"
android:layout_width="match_parent"
android:layout_height="@dimen/exo_styled_progress_layout_height"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/exo_styled_progress_margin_bottom"/>
<LinearLayout
android:id="@id/exo_center_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:src="@drawable/ic_fullscreen_24" />
</LinearLayout>
android:background="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/exo_styled_controls_padding"
android:clipToPadding="false"
android:layoutDirection="ltr">
<include layout="@layout/exo_player_control_rewind_button" />
<ImageButton android:id="@id/exo_play_pause"
style="@style/ExoStyledControls.Button.Center.PlayPause"/>
<include layout="@layout/exo_player_control_ffwd_button" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>

View File

@ -23,6 +23,7 @@
android:minHeight="?attr/actionBarSize" />
<include
android:id="@+id/commentThread"
layout="@layout/view_commentary"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@ -41,6 +42,7 @@
</LinearLayout>
<include
android:id="@+id/commentBox"
layout="@layout/comment_component"
android:layout_width="700dp"
android:layout_height="wrap_content"

View File

@ -8,10 +8,27 @@
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"/>
</com.google.android.material.appbar.AppBarLayout>
<include
android:id="@+id/content"
layout="@layout/content_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -29,7 +29,7 @@
android:contentDescription="Logo"
app:srcCompat="@drawable/icon" />
<Space
<androidx.legacy.widget.Space
android:layout_width="match_parent"
android:layout_height="30dp" />
@ -42,7 +42,7 @@
android:textAppearance="@android:style/TextAppearance.Material.Medium.Inverse"
android:textColor="@android:color/black" />
<Space
<androidx.legacy.widget.Space
android:layout_width="match_parent"
android:layout_height="30dp" />
@ -99,4 +99,4 @@
</LinearLayout>
</ScrollView>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -74,12 +74,9 @@
android:id="@+id/exoPlayer"
android:layout_width="match_parent"
android:layout_height="205dp"
app:auto_show="true"
app:show_buffering="always"
app:controller_layout_id="@layout/custom_player_controls"
app:surface_type="surface_view"
app:use_controller="true"
app:repeat_toggle_modes="none"/>
app:controller_layout_id="@layout/custom_player_controls" />
<TextView
android:id="@+id/tittleVideoTxt"
@ -329,7 +326,9 @@
android:layout_width="match_parent"
android:layout_height="20dp" />
<include layout="@layout/comment_component" />
<include
android:id="@+id/commentBox"
layout="@layout/comment_component" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listCommentaries"

View File

@ -6,17 +6,6 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"/>
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,107 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/exo_controls"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#44000000">
<!-- Copyright 2020 The Android Open Source Project
<ImageView
android:id="@+id/exo_settings"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_weight="0"
android:alpha="0.5"
android:src="@drawable/ic_baseline_settings_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 0dp dimensions are used to prevent this view from influencing the size of
the parent view if it uses "wrap_content". It is expanded to occupy the
entirety of the parent in code, after the parent's size has been
determined. See: https://github.com/google/ExoPlayer/issues/8726.
-->
<View android:id="@id/exo_controls_background"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/exo_black_opacity_60"/>
<FrameLayout
android:id="@id/exo_bottom_bar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/exo_styled_bottom_bar_margin_top"
android:background="@color/exo_bottom_bar_background"
android:layoutDirection="ltr">
<LinearLayout
android:layout_width="match_parent"
android:id="@id/exo_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_gravity="center_vertical|start"
android:layoutDirection="ltr"
android:paddingStart="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingLeft="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingEnd="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingRight="@dimen/exo_styled_bottom_bar_time_padding">
<ImageView
android:id="@+id/exo_rew"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_replay_10_24" />
<TextView
android:id="@id/exo_position"
style="@style/ExoStyledControls.TimeText.Position" />
<ImageView
android:id="@+id/exo_play_pause"
android:layout_width="43dp"
android:layout_height="43dp"
android:layout_marginHorizontal="30dp" />
<TextView
style="@style/ExoStyledControls.TimeText.Separator"
android:text="/" />
<ImageView
android:id="@+id/exo_ffwd"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_forward_10_24" />
<TextView
android:id="@id/exo_duration"
style="@style/ExoStyledControls.TimeText.Duration" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<androidx.media3.ui.DefaultTimeBar
android:id="@+id/exo_progress"
android:layout_width="wrap_content"
android:layout_height="10dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/exo_position"
android:id="@id/exo_basic_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff" />
android:layout_gravity="center_vertical|end"
android:layoutDirection="ltr">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:text="/"
android:textColor="#CBCDC8" />
<ImageButton
android:id="@id/exo_subtitle"
style="@style/ExoStyledControls.Button.Bottom.CC" />
<TextView
android:id="@+id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#CBCDC8" />
<ImageButton
android:id="@id/exo_settings"
style="@style/ExoStyledControls.Button.Bottom.Settings" />
<ImageView
<ImageButton
android:id="@+id/exo_fullscreen_custom"
android:layout_width="35dp"
android:layout_height="42dp"
style="@style/ExoStyledControls.Button.Bottom.Settings"
android:src="@drawable/ic_fullscreen_24"
android:visibility="visible" />
</LinearLayout>
</FrameLayout>
<View android:id="@id/exo_progress_placeholder"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="bottom"
android:layout_marginBottom="45dp"/>
<LinearLayout
android:id="@id/exo_center_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:src="@drawable/ic_fullscreen_24" />
</LinearLayout>
android:background="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/exo_styled_controls_padding"
android:clipToPadding="false"
android:layoutDirection="ltr">
<include layout="@layout/exo_player_control_rewind_button" />
<ImageButton android:id="@id/exo_play_pause"
style="@style/ExoStyledControls.Button.Center.PlayPause"/>
<include layout="@layout/exo_player_control_ffwd_button" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -24,6 +23,7 @@
android:minHeight="?attr/actionBarSize" />
<include
android:id="@+id/commentThread"
layout="@layout/view_commentary"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@ -42,6 +42,7 @@
</LinearLayout>
<include
android:id="@+id/commentBox"
layout="@layout/comment_component"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -1,29 +0,0 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- NOTE: EditTextPreference accepts EditText attributes. -->
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
<EditTextPreference
android:capitalize="words"
android:defaultValue="@string/pref_hostname_error"
android:inputType="text"
android:key="hostP2play"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/pref_hostname_title" />
<SwitchPreference
android:defaultValue="false"
android:key="show_nfsw"
android:summary="@string/pref_nfsw_description"
android:title="@string/pref_nfsw_title" />
<EditTextPreference
android:defaultValue="15"
android:inputType="number"
android:key="videos_count"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/pref_videos_count_title" />
</PreferenceScreen>

View File

@ -1,23 +0,0 @@
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- These settings headers are only used on tablets. -->
<header
android:fragment="org.libre.agosto.p2play.SettingsActivity$GeneralPreferenceFragment"
android:icon="@drawable/ic_info_black_24dp"
android:title="@string/pref_header_general"
android:textColor="@color/md_theme_light_secondary"/>
<!-- <header
android:fragment="org.libre.agosto.p2play.SettingsActivity$NotificationPreferenceFragment"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/pref_header_notifications" />
<header
android:fragment="org.libre.agosto.p2play.SettingsActivity$DataSyncPreferenceFragment"
android:icon="@drawable/ic_sync_black_24dp"
android:title="@string/pref_header_data_sync" /> -->
</preference-headers>

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.6.21'
ext.kotlin_version = '1.9.20'
repositories {
google()
mavenCentral()