73 Commits
0.1.0 ... 0.3.0

Author SHA1 Message Date
e4ac01605f fix crash after clicking on the highlight play button 2021-01-01 13:08:25 +01:00
75ecac6144 always visible next ep button fix
the always visible next ep button cloud be hidden, when playing the last ep of a tv show and changing to a previous ep via the episodes list
2021-01-01 12:15:17 +01:00
1efc108bd7 version 0.3.0 2020-12-31 13:43:57 +01:00
31197a5d44 minor fixes
* fix current language is set to preferred and not to actual language
* fix player episodes lists sometimes missing the play icon
2020-12-31 13:12:37 +01:00
489ef02a35 fix controls autohide not working when epsiodes list was shown
fixes #19
2020-12-30 20:08:19 +01:00
9705a752fb don't crash if initial loading was not successful 2020-12-30 14:18:04 +01:00
7a5f90cb82 don't initialize exoplayer, if view model exists and player is ready
this prevents the media being reloaded, when the app is moved to the background and to the foreground again
2020-12-28 20:45:52 +01:00
800c2a144c polish player episodes list ui
closes #16
2020-12-28 20:17:11 +01:00
6bec0512ba minor player fixes
* fix exoplayer access on wrong thread
* fix remaining time calculation sometimes failed
2020-12-27 20:41:18 +01:00
b3ce43c614 release player in PlayerVIewModel onCleared()
this fixes playback after the activity has been destroyed, while being in background
2020-12-27 20:31:18 +01:00
7845770067 Clean up PlayerActivity and PlayerViewModel
* use Local instead of streamURL to save selected language, this allows nextEp/ selected Eps to use previously selected language
* hide episodes button, if media is a movie
2020-12-27 20:11:01 +01:00
94da8c6cee player language settings [Part 2]
* move player object to PlayerViewModel
* minor code clean up
2020-12-26 20:09:35 +01:00
8a43567737 rework how different streams/languages per episode are handled
* potentially support more than 2 streams
* part of language settings in player
2020-12-26 14:39:35 +01:00
8f60a30d61 improve media parsing / loadStreams()
* fix #20, return 0 as episode number on NumberFormatException
* don't crash if a episode can not be parsed
* update material components: 1.3.0-alpha04 -> 1.3.0-beta01
2020-12-26 11:32:09 +01:00
8fc2d69eb8 „README.md“ ändern 2020-12-23 22:39:33 +01:00
2a0bccaf5a „README.md“ ändern 2020-12-23 22:35:09 +01:00
9a45d4453c update screenshots 2020-12-23 22:11:47 +01:00
c648acdff0 Fastlane de-DE -> de, do not distinguish between different german metadata 2020-12-23 20:04:16 +01:00
00699aaec7 add language settings to player [Part 1] 2020-12-20 20:21:27 +01:00
bba642e9e3 use a random new title, if highlights is empty 2020-12-18 17:23:04 +01:00
f4518056db „README.md“ ändern 2020-12-17 17:49:49 +01:00
1edcf29c07 Merge pull request 'Add Episodes List to Player' (#18) from feature/episodes_list_player into master
Reviewed-on: #18
2020-12-15 23:16:33 +01:00
04893060e4 add episodes list to player [Part 2] 2020-12-15 23:15:14 +01:00
6fc7bb2c1e add episodes list to player [Part 1] 2020-12-14 23:46:55 +01:00
ab180ddd89 add new simulcasts and new titles to home screen
* simulcasts and new titles
* update some libraries
* don't crash if AoDPraser fails to parse mediaId
2020-12-11 10:54:40 +01:00
98636d326e make sure highlighted media has a valid mediaId
this also prevents non media from showing as highlights
2020-12-07 17:50:10 +01:00
b73822c945 „README.md“ ändern 2020-12-06 20:38:50 +01:00
6775a4da2e show AoD highlights on home fragment 2020-12-06 15:18:15 +01:00
a390bc9686 update exoplayer to version 2.12.2 2020-12-05 22:17:54 +01:00
82bf34e4cb update theme colors to better reflect material design guidelines
* dark primary: #000000 -> #121212
2020-12-05 21:51:12 +01:00
e34e5b2bbd replace licenses dialog and about dialog with about fragment 2020-12-05 21:03:14 +01:00
77e657d37c version 0.2.1 2020-12-02 11:25:36 +01:00
20407d9cac add permanently visible next episode button & fix autoplay
* autoplay / play next episode could sometimes skip episodes
2020-12-02 11:14:09 +01:00
dbd4b26a65 minor text change 2020-11-29 20:25:22 +01:00
ac5aee20de update material components to alpha 4 2020-11-29 18:23:02 +01:00
32844223fc minor episodes ui improvements
* show 3 lines of episode description
* episodes title: Episode xy -> Ep. xy
2020-11-28 15:09:39 +01:00
d01e87bf14 use suspending functions for coroutines when possible
* fix crash, when media is selected, but MediaFragment is removed before AoDParser could load data
2020-11-27 11:06:16 +01:00
bb8c8ca85a update changelog 2020-11-26 17:36:21 +01:00
3ed55ca3c9 fix episodes without a streaming link make AoDParser crash 2020-11-26 17:32:15 +01:00
dfaf359952 fix poster not being scaled correctly
regression from 2de1419d36
2020-11-26 17:07:33 +01:00
78d9f3cfa5 version 0.2.0 2020-11-26 15:01:19 +01:00
db5758edf9 minor code clean up 2020-11-25 23:33:06 +01:00
2de1419d36 fix theme not applying to nav bar
regression from 7df99ea0cc
2020-11-25 23:26:46 +01:00
7df99ea0cc use view binding wherever possible 2020-11-25 22:35:55 +01:00
8d1c3d9a3f move some player data to PlayerViewModel 2020-11-25 16:04:04 +01:00
c0c5cb9110 change themeSecondaryDark to #202020 2020-11-24 18:07:48 +01:00
21b6e358e7 theme selection & gradle update
* it's now possible to change the app theme (light/dark)
* update gradle to version 6.7.1
* update gradle pugin to version 4.1.1
* update kotlin to  1.4.10
2020-11-23 20:11:10 +01:00
0e5c697bce set theme for dialogs 2020-11-23 09:53:44 +01:00
830f7e753b theme account fragment, new primary & accent color 2020-11-22 23:23:28 +01:00
71079ddc92 add light and dark theme
* currently the theme can not be changed
2020-11-22 14:24:02 +01:00
57897077ab fix next episode button 2020-11-22 14:20:17 +01:00
dcd6ebccea theme rework preparation 2020-11-21 19:40:55 +01:00
91c9b6d716 fix some minor player gui issues
* hide rwd_10 button when indicator is shown
* update remaining time more often
2020-11-21 18:05:34 +01:00
256c32aa3c add rwd/ffwd double tap indicator & pause/play on long press 2020-11-20 11:20:11 +01:00
3880b3ab75 add watched callback for next episode 2020-11-18 18:58:39 +01:00
0f0573e5bd adjust size of rewind/fast forward button 2020-11-16 20:42:25 +01:00
6ce263832b use custom rewind/fast forward button with animations 2020-11-16 19:23:06 +01:00
fd099e97e6 add visual indicator for rewind/forward gesture 2020-11-15 17:17:56 +01:00
d4fa726f9c improve autoplay next episode
* add animations to show/hide next episode button
* add option to disable/enable autoplay
2020-11-15 13:39:33 +01:00
c8d80ddc9f Fix my-list issues
* fix entries can be added multiple times to my list
* fix entries can’t be removed from my list after the app was restarted
* closes #15
2020-11-14 13:10:05 +01:00
14377c3f18 don't show next episode, if there is no 2020-11-13 15:45:52 +01:00
23713fc1e6 Player: add auto play next episode 2020-11-13 15:36:12 +01:00
353ae6937a Player: get media info by id
This allows us to get additional data (needed for "play next episode")
2020-11-13 11:23:09 +01:00
2e0a114a80 player interface part 3
add double tap to rewind/forward
2020-11-08 18:05:46 +01:00
0e9500e39d Player: increase clickable area of back button 2020-11-07 18:30:12 +01:00
27e8e1c3c2 player interface part 2
* replace current time position with remaining time
* show title and back button at the top
2020-11-07 18:23:09 +01:00
e51fb0b290 add remaining time to player 2020-11-07 13:33:59 +01:00
d3f078c661 disable time-bar animation 2020-11-06 10:21:57 +01:00
6526b8868e „README.md“ ändern 2020-11-06 09:24:46 +01:00
1118c8339c custom player interface: add progress-bar, rewind/forward 2020-11-05 20:07:41 +01:00
1595ef52bc start working on custom play controls 2020-11-05 18:47:49 +01:00
406434809f „README.md“ ändern 2020-11-03 18:25:13 +01:00
1523e0235a tv shows: play next episode, on play btn click 2020-11-03 18:21:23 +01:00
90 changed files with 4028 additions and 723 deletions

View File

@ -1,41 +1,29 @@
# teapod
A unoffical App for Anime-on-Demand.
A unofficial App for Anime-on-Demand.
Teapod is a unofficial App for Anime-on-Demand (AoD). It allows you to watch all your favourite animes from AoD on your Android Device.
[<img src="https://gitlab.com/IzzyOnDroid/repo/-/raw/master/assets/IzzyOnDroid.png" height="75">](https://apt.izzysoft.de/fdroid/index/apk/org.mosad.teapod)
## Features
* acces all media in the library
* search the library
* play movies/tv shows via integrated exoplayer
* add movies/tv shows to you list, for easier access
### Missing Features
* a alternative/secondary stream is currently not supported (for dub titles the subtitle version is missing)
* Watch all animes from AoD on your Android device
* Native Player based on ExoPayer
* Prefer the OmU version via the app settings
* Save your favorite animes to "My List"
## Screenshots
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Home_200px.png" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Home.png)
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Library_200px.png" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Library.png)
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Media_200px.png" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Media.png)
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Search_200px.png" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Search.png)
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Home.webp" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Home.webp)
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Library.webp" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Library.webp)
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Media.webp" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Media.webp)
[<img src="https://www.mosad.xyz/images/Teapod/Teapod_Search.webp" width=180>](https://www.mosad.xyz/images/Teapod/Teapod_Search.webp)
### License
This App is licensed under the terms and conditions of GPL 3. This Project is not associated with Anime-on-Demand in any way.
This App is licensed under the terms and conditions of GPL 3. This Project is not associated with Anime-on-Demand in any way. Using this app may violates the ToS of AoD.
### Known Issues
If a tv show is selected, the first episode will be marked as already watched. This is due to the difficulties of parsing. The Parser is designed to be as easy to maintain and fail safe as possible.
### Used Libraries
* AndroidX: https://developer.android.com/jetpack/androidx
* Material Components for Android: https://github.com/material-components/material-components-android
* ExoPlayer: https://github.com/google/ExoPlayer
* Gson: https://github.com/google/gson
* Material design icons: https://github.com/google/material-design-icons
* Material Dialogs: https://github.com/afollestad/material-dialogs
* Jsoup: https://jsoup.org
* kotlinx.coroutines: https://github.com/Kotlin/kotlinx.coroutines
* Glide: https://github.com/bumptech/glide
* Glide Transformations: https://github.com/wasabeef/glide-transformations
If a tv show is selected, the first episode will be marked as already watched. This is due to parsing the website. The Parser is designed to be easy to maintain and as fail safe as possible.
#### Why is it called Teapod?
Teapod is a Acronym for "The ultimate anime app on demand", hence this project is called Teapod and not Teapot.
Teapod © 2020 [@Seil0](https://git.mosad.xyz/Seil0)
Teapod © 2020-2021 [@Seil0](https://git.mosad.xyz/Seil0)

View File

@ -4,20 +4,24 @@ apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "org.mosad.teapod"
minSdkVersion 23
targetSdkVersion 30
versionCode 1000 //00.01.0000
versionName "0.1.0"
versionCode 3000 //00.03.000
versionName "0.3.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "string", "build_time", buildTime()
setProperty("archivesBaseName", "teapod-$versionName")
}
buildFeatures {
viewBinding true
}
buildTypes {
release {
minifyEnabled true
@ -37,31 +41,30 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
implementation 'androidx.security:security-crypto:1.1.0-alpha02'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
implementation 'androidx.security:security-crypto:1.1.0-alpha03'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha03'
implementation 'com.google.android.material:material:1.3.0-beta01'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.exoplayer:exoplayer-core:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-core:2.12.2'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.12.2'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.12.2'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.12.2'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'com.afollestad.material-dialogs:core:3.3.0'
implementation 'com.afollestad.material-dialogs:bottomsheets:3.3.0'
implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

View File

@ -10,7 +10,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme.Light">
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
@ -22,7 +22,7 @@
</intent-filter>
</activity>
<activity
android:name=".PlayerActivity"
android:name=".player.PlayerActivity"
android:label="@string/app_name"
android:theme="@style/PlayerTheme"
android:configChanges="orientation|screenSize|layoutDirection" />

View File

@ -1,7 +1,7 @@
/**
* Teapod
*
* Copyright 2020 <seil0@mosad.xyz>
* Copyright 2020-2021 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,28 +30,35 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.commit
import com.google.android.material.bottomnavigation.BottomNavigationView
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.mosad.teapod.databinding.ActivityMainBinding
import org.mosad.teapod.parser.AoDParser
import org.mosad.teapod.player.PlayerActivity
import org.mosad.teapod.preferences.EncryptedPreferences
import org.mosad.teapod.preferences.Preferences
import org.mosad.teapod.ui.components.LoginDialog
import org.mosad.teapod.ui.fragments.*
import org.mosad.teapod.util.DataTypes
import org.mosad.teapod.util.StorageController
import org.mosad.teapod.util.TMDBApiController
import kotlin.system.measureTimeMillis
class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener {
private lateinit var binding: ActivityMainBinding
private var activeBaseFragment: Fragment = HomeFragment() // the currently active fragment, home at the start
companion object {
var wasInitialized = false
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
nav_view.setOnNavigationItemSelectedListener(this)
load()
if (!wasInitialized) { load() }
theme.applyStyle(getThemeResource(), true)
binding = ActivityMainBinding.inflate(layoutInflater)
binding.navView.setOnNavigationItemSelectedListener(this)
setContentView(binding.root)
supportFragmentManager.commit {
replace(R.id.nav_host_fragment, activeBaseFragment, activeBaseFragment.javaClass.simpleName)
@ -63,7 +70,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
supportFragmentManager.popBackStack()
} else {
if (activeBaseFragment !is HomeFragment) {
nav_view.selectedItemId = R.id.navigation_home
binding.navView.selectedItemId = R.id.navigation_home
} else {
super.onBackPressed()
}
@ -102,12 +109,19 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
return ret
}
private fun getThemeResource(): Int {
return when (Preferences.theme) {
DataTypes.Theme.DARK -> R.style.AppTheme_Dark
else -> R.style.AppTheme_Light
}
}
private fun load() {
// running login and list in parallel does not bring any speed improvements
val time = measureTimeMillis {
Preferences.load(this)
// make sure credentials are set
// make sure credentials are set, run's async
EncryptedPreferences.readCredentials(this)
if (EncryptedPreferences.password.isEmpty()) {
showLoginDialog(true)
@ -118,46 +132,12 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
StorageController.load(this)
AoDParser.initialLoading()
wasInitialized = true
}
Log.i(javaClass.name, "login and list in $time ms")
}
/**
* Show the media fragment for the selected media.
* While loading show the loading fragment.
* The loading and media fragment are not stored in activeBaseFragment,
* as the don't replace a fragment but are added on top of one.
*/
fun showMediaFragment(mediaId: Int) = GlobalScope.launch {
val loadingFragment = LoadingFragment()
supportFragmentManager.commit {
add(R.id.nav_host_fragment, loadingFragment, "MediaFragment")
show(loadingFragment)
}
// load the streams for the selected media
val media = AoDParser.getMediaById(mediaId)
val tmdb = TMDBApiController().search(media.info.title, media.type)
val mediaFragment = MediaFragment(media, tmdb)
supportFragmentManager.commit {
add(R.id.nav_host_fragment, mediaFragment, "MediaFragment")
addToBackStack(null)
show(mediaFragment)
}
supportFragmentManager.commit {
remove(loadingFragment)
}
}
fun startPlayer(streamUrl: String) {
val intent = Intent(this, PlayerActivity::class.java).apply {
putExtra(getString(R.string.intent_stream_url), streamUrl)
}
startActivity(intent)
}
private fun showLoginDialog(firstTry: Boolean) {
LoginDialog(this, firstTry).positiveButton {
EncryptedPreferences.saveCredentials(login, password, context)
@ -171,4 +151,37 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
finish()
}.show()
}
/**
* Show a fragment on top of the current fragment.
* The current fragment is replaced and the new one is added
* to the back stack.
*/
fun showFragment(fragment: Fragment) {
supportFragmentManager.commit {
replace(R.id.nav_host_fragment, fragment, fragment.javaClass.simpleName)
addToBackStack(fragment.javaClass.name)
show(fragment)
}
}
fun startPlayer(mediaId: Int, episodeId: Int) {
val intent = Intent(this, PlayerActivity::class.java).apply {
putExtra(getString(R.string.intent_media_id), mediaId)
putExtra(getString(R.string.intent_episode_id), episodeId)
}
startActivity(intent)
}
/**
* use custom restart instead of recreate(), since it has animations
*/
fun restart() {
val restartIntent = intent
restartIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)
finish()
startActivity(restartIntent)
}
}

View File

@ -1,153 +0,0 @@
package org.mosad.teapod
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsController
import androidx.appcompat.app.AppCompatActivity
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.SimpleExoPlayer
import com.google.android.exoplayer2.source.hls.HlsMediaSource
import com.google.android.exoplayer2.upstream.DataSource
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
import com.google.android.exoplayer2.util.Util
import kotlinx.android.synthetic.main.activity_player.*
class PlayerActivity : AppCompatActivity() {
private lateinit var player: SimpleExoPlayer
private lateinit var dataSourceFactory: DataSource.Factory
private var streamUrl = ""
private var playWhenReady = true
private var currentWindow = 0
private var playbackPosition: Long = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_player)
hideBars() // Initial hide the bars
savedInstanceState?.let {
currentWindow = it.getInt(getString(R.string.state_resume_window))
playbackPosition = it.getLong(getString(R.string.state_resume_position))
playWhenReady = it.getBoolean(getString(R.string.state_is_playing))
}
streamUrl = intent.getStringExtra(getString(R.string.intent_stream_url)).toString()
}
override fun onStart() {
super.onStart()
if (Util.SDK_INT > 23) {
initPlayer()
if (video_view != null) video_view.onResume()
}
}
override fun onResume() {
super.onResume()
if (Util.SDK_INT <= 23) {
initPlayer()
if (video_view != null) video_view.onResume()
}
}
override fun onPause() {
super.onPause()
if (Util.SDK_INT <= 23) {
if (video_view != null) video_view.onPause()
releasePlayer()
}
}
override fun onStop() {
super.onStop()
if (Util.SDK_INT > 23) {
if (video_view != null) video_view.onPause()
releasePlayer()
}
}
override fun onSaveInstanceState(outState: Bundle) {
outState.putInt(getString(R.string.state_resume_window), currentWindow)
outState.putLong(getString(R.string.state_resume_position), playbackPosition)
outState.putBoolean(getString(R.string.state_is_playing), playWhenReady)
super.onSaveInstanceState(outState)
}
private fun initPlayer() {
if (streamUrl.isEmpty()) {
Log.e(javaClass.name, "No stream url was set.")
return
}
player = SimpleExoPlayer.Builder(this).build()
dataSourceFactory = DefaultDataSourceFactory(this, Util.getUserAgent(this, "Teapod"))
val mediaSource = HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(Uri.parse(streamUrl)))
player.playWhenReady = playWhenReady
player.setMediaSource(mediaSource)
player.seekTo(playbackPosition)
player.prepare()
player.addListener(object : Player.EventListener {
override fun onPlaybackStateChanged(state: Int) {
super.onPlaybackStateChanged(state)
loading.visibility = when (state) {
ExoPlayer.STATE_READY -> View.GONE
ExoPlayer.STATE_BUFFERING -> View.VISIBLE
else -> View.GONE
}
}
})
// when the player controls get hidden, hide the bars too
video_view.setControllerVisibilityListener {
if (it == View.GONE) hideBars()
}
video_view.player = player
}
private fun releasePlayer(){
playbackPosition = player.currentPosition
currentWindow = player.currentWindowIndex
playWhenReady = player.playWhenReady
player.release()
}
/**
* hide the status and navigation bar
*/
private fun hideBars() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.setDecorFitsSystemWindows(false)
window.insetsController?.apply {
hide(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars())
systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE
}
} else {
@Suppress("deprecation")
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_FULLSCREEN)
}
}
}

View File

@ -1,7 +1,7 @@
/**
* Teapod
*
* Copyright 2020 <seil0@mosad.xyz>
* Copyright 2020-2021 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,7 +31,9 @@ import org.mosad.teapod.preferences.EncryptedPreferences
import org.mosad.teapod.util.*
import org.mosad.teapod.util.DataTypes.MediaType
import java.io.IOException
import java.lang.NumberFormatException
import java.util.*
import kotlin.random.Random
object AoDParser {
@ -45,9 +47,12 @@ object AoDParser {
private var csrfToken: String = ""
private var loginSuccess = false
private val mediaList = arrayListOf<Media>()
val itemMediaList = arrayListOf<ItemMedia>()
private val mediaList = arrayListOf<Media>() // actual media (data)
val itemMediaList = arrayListOf<ItemMedia>() // gui media
val highlightsList = arrayListOf<ItemMedia>()
val newEpisodesList = arrayListOf<ItemMedia>()
val newSimulcastsList = arrayListOf<ItemMedia>()
val newTitlesList = arrayListOf<ItemMedia>()
fun login(): Boolean = runBlocking {
@ -73,6 +78,7 @@ object AoDParser {
val resLogin = Jsoup.connect(baseUrl + loginPath)
.method(Connection.Method.POST)
.timeout(60000) // login can take some time
.data(data)
.postDataCharset("UTF-8")
.cookies(authCookies)
@ -93,15 +99,15 @@ object AoDParser {
* -> blocking
*/
fun initialLoading() = runBlocking {
val newEPJob = GlobalScope.async {
listNewEpisodes()
val loadHomeJob = GlobalScope.async {
loadHome()
}
val listJob = GlobalScope.async {
listAnimes()
}
newEPJob.await()
loadHomeJob.await()
listJob.await()
}
@ -109,18 +115,26 @@ object AoDParser {
* get a media by it's ID (int)
* @return Media
*/
fun getMediaById(mediaId: Int): Media {
suspend fun getMediaById(mediaId: Int): Media {
val media = mediaList.first { it.id == mediaId }
if (media.episodes.isEmpty()) {
loadStreams(media)
loadStreams(media).join()
}
return media
}
fun markAsWatched(mediaId: Int, episodeId: Int) = GlobalScope.launch {
val episode = getMediaById(mediaId).getEpisodeById(episodeId)
episode.watched = true
sendCallback(episode.watchedCallback)
Log.d(javaClass.name, "Marked episode ${episode.id} as watched")
}
// TODO don't use jsoup here
fun sendCallback(callbackPath: String) = GlobalScope.launch {
fun sendCallback(callbackPath: String) = GlobalScope.launch(Dispatchers.IO) {
val headers = mutableMapOf(
Pair("Accept", "application/json, text/javascript, */*; q=0.01"),
Pair("Accept-Language", "de,en-US;q=0.7,en;q=0.3"),
@ -130,13 +144,11 @@ object AoDParser {
)
try {
withContext(Dispatchers.IO) {
Jsoup.connect(baseUrl + callbackPath)
.ignoreContentType(true)
.cookies(sessionCookies)
.headers(headers)
.execute()
}
Jsoup.connect(baseUrl + callbackPath)
.ignoreContentType(true)
.cookies(sessionCookies)
.headers(headers)
.execute()
} catch (ex: IOException) {
Log.e(javaClass.name, "Callback for $callbackPath failed.", ex)
}
@ -183,9 +195,9 @@ object AoDParser {
}
/**
* load all new episodes from AoD into newEpisodesList
* load new episodes, titles and highlights
*/
private fun listNewEpisodes() = runBlocking {
private fun loadHome() = runBlocking {
if (sessionCookies.isEmpty()) login()
withContext(Dispatchers.Default) {
@ -193,18 +205,66 @@ object AoDParser {
.cookies(sessionCookies)
.get()
newEpisodesList.clear()
resHome.select("div.jcarousel-container-new").select("li").forEach {
if (it.select("span").hasClass("neweps")) {
val mediaId = it.select("a.thumbs").attr("href")
.substringAfterLast("/").toInt()
val mediaImage = it.select("a.thumbs > img").attr("src")
val mediaTitle = "${it.select("a").text()} - ${it.select("span.neweps").text()}"
// get highlights from AoD
highlightsList.clear()
resHome.select("#aod-highlights").select("div.news-item").forEach {
val mediaId = it.select("div.news-item-text").select("a.serienlink")
.attr("href").substringAfterLast("/").toIntOrNull()
val mediaTitle = it.select("div.news-title").select("h2").text()
val mediaImage = it.select("img").attr("src")
if (mediaId != null) {
highlightsList.add(ItemMedia(mediaId, mediaTitle, mediaImage))
}
}
// get all new episodes from AoD
newEpisodesList.clear()
resHome.select("h2:contains(Neue Episoden)").next().select("li").forEach {
val mediaId = it.select("a.thumbs").attr("href")
.substringAfterLast("/").toIntOrNull()
val mediaImage = it.select("a.thumbs > img").attr("src")
val mediaTitle = "${it.select("a").text()} - ${it.select("span.neweps").text()}"
if (mediaId != null) {
newEpisodesList.add(ItemMedia(mediaId, mediaTitle, mediaImage))
}
}
// get new simulcasts from AoD
newSimulcastsList.clear()
resHome.select("h2:contains(Neue Simulcasts)").next().select("li").forEach {
val mediaId = it.select("a.thumbs").attr("href")
.substringAfterLast("/").toIntOrNull()
val mediaImage = it.select("a.thumbs > img").attr("src")
val mediaTitle = it.select("a").text()
if (mediaId != null) {
newSimulcastsList.add(ItemMedia(mediaId, mediaTitle, mediaImage))
}
}
// get new titles from AoD
newTitlesList.clear()
resHome.select("h2:contains(Neue Anime-Titel)").next().select("li").forEach {
val mediaId = it.select("a.thumbs").attr("href")
.substringAfterLast("/").toIntOrNull()
val mediaImage = it.select("a.thumbs > img").attr("src")
val mediaTitle = it.select("a").text()
if (mediaId != null) {
newTitlesList.add(ItemMedia(mediaId, mediaTitle, mediaImage))
}
}
// if highlights is empty, add a random new title
if (highlightsList.isEmpty()) {
if (newTitlesList.isNotEmpty()) {
highlightsList.add(newTitlesList[Random.nextInt(0, newTitlesList.size)])
} else {
highlightsList.add(ItemMedia(0,"", ""))
}
}
}
}
@ -212,103 +272,84 @@ object AoDParser {
* load streams for the media path, movies have one episode
* @param media is used as call ba reference
*/
private fun loadStreams(media: Media) = runBlocking {
private suspend fun loadStreams(media: Media) = GlobalScope.launch(Dispatchers.IO) {
if (sessionCookies.isEmpty()) login()
if (!loginSuccess) {
Log.w(javaClass.name, "Login, was not successful.")
return@runBlocking
return@launch
}
withContext(Dispatchers.Default) {
// get the media page
val res = Jsoup.connect(baseUrl + media.link)
.cookies(sessionCookies)
.get()
// get the media page
val res = Jsoup.connect(baseUrl + media.link)
.cookies(sessionCookies)
.get()
//println(res)
//println(res)
if (csrfToken.isEmpty()) {
csrfToken = res.select("meta[name=csrf-token]").attr("content")
//Log.i(javaClass.name, "New csrf token is $csrfToken")
}
if (csrfToken.isEmpty()) {
csrfToken = res.select("meta[name=csrf-token]").attr("content")
//Log.i(javaClass.name, "New csrf token is $csrfToken")
val besides = res.select("div.besides").first()
val playlists = besides.select("input.streamstarter_html5").map { streamstarter ->
parsePlaylistAsync(
streamstarter.attr("data-playlist"),
streamstarter.attr("data-lang")
)
}.awaitAll()
playlists.forEach { aod ->
// TODO improve language handling
val locale = when (aod.extLanguage) {
"ger" -> Locale.GERMAN
"jap" -> Locale.JAPANESE
else -> Locale.ROOT
}
val pl = res.select("input.streamstarter_html5").first()
val primary = pl.attr("data-playlist")
val secondary = pl.attr("data-otherplaylist")
val secondaryIsOmU = secondary.contains("OmU", true)
// load primary and secondary playlist
val primaryPlaylist = parsePlaylistAsync(primary)
val secondaryPlaylist = parsePlaylistAsync(secondary)
primaryPlaylist.await().playlist.forEach { ep ->
val epNumber = if (media.type == MediaType.TVSHOW) {
ep.title.substringAfter(", Ep. ").toInt()
} else {
0
}
media.episodes.add(
Episode(
id = ep.mediaid,
priStreamUrl = ep.sources.first().file,
posterUrl = ep.image,
title = ep.title,
description = ep.description,
number = epNumber
)
)
}
Log.i(javaClass.name, "Loading primary playlist finished")
secondaryPlaylist.await().playlist.forEach { ep ->
val episode = media.episodes.firstOrNull { it.id == ep.mediaid }
if (episode != null) {
episode.secStreamUrl = ep.sources.first().file
episode.secStreamOmU = secondaryIsOmU
} else {
val epNumber = if (media.type == MediaType.TVSHOW) {
ep.title.substringAfter(", Ep. ").toInt()
aod.playlist.forEach { ep ->
try {
if (media.hasEpisode(ep.mediaid)) {
media.getEpisodeById(ep.mediaid).streams.add(
Stream(ep.sources.first().file, locale)
)
} else {
0
}
media.episodes.add(
Episode(
media.episodes.add(Episode(
id = ep.mediaid,
secStreamUrl = ep.sources.first().file,
secStreamOmU = secondaryIsOmU,
streams = mutableListOf(Stream(ep.sources.first().file, locale)),
posterUrl = ep.image,
title = ep.title,
description = ep.description,
number = epNumber
)
)
}
}
Log.i(javaClass.name, "Loading secondary plalyist finished")
// parse additional info from the media page
res.select("table.vertical-table").select("tr").forEach { row ->
when (row.select("th").text().toLowerCase(Locale.ROOT)) {
"produktionsjahr" -> media.info.year = row.select("td").text().toInt()
"fsk" -> media.info.age = row.select("td").text().toInt()
"episodenanzahl" -> {
media.info.episodesCount = row.select("td").text()
.substringBefore("/")
.filter{ it.isDigit() }
.toInt()
number = getNumberFromTitle(ep.title, media.type)
))
}
} catch (ex: Exception) {
Log.w(javaClass.name, "Could not parse episode information.", ex)
}
}
}
Log.i(javaClass.name, "Loaded playlists successfully")
// parse additional information for tv shows
if (media.type == MediaType.TVSHOW) {
res.select("div.three-box-container > div.episodebox").forEach { episodebox ->
// parse additional info from the media page
res.select("table.vertical-table").select("tr").forEach { row ->
when (row.select("th").text().toLowerCase(Locale.ROOT)) {
"produktionsjahr" -> media.info.year = row.select("td").text().toInt()
"fsk" -> media.info.age = row.select("td").text().toInt()
"episodenanzahl" -> {
media.info.episodesCount = row.select("td").text()
.substringBefore("/")
.filter { it.isDigit() }
.toInt()
}
}
}
// parse additional information for tv shows the episode title (description) is loaded from the "api"
if (media.type == MediaType.TVSHOW) {
res.select("div.three-box-container > div.episodebox").forEach { episodebox ->
// make sure the episode has a streaming link
if (episodebox.select("input.streamstarter_html5").isNotEmpty()) {
val episodeId = episodebox.select("div.flip-front").attr("id").substringAfter("-").toInt()
val episodeShortDesc = episodebox.select("p.episodebox-shorttext").text()
val episodeWatched = episodebox.select("div.episodebox-icons > div").hasClass("status-icon-orange")
@ -321,19 +362,18 @@ object AoDParser {
}
}
}
}
}
/**
* don't use Gson().fromJson() as we don't have any control over the api and it may change
*/
private fun parsePlaylistAsync(playlistPath: String): Deferred<AoDObject> {
private fun parsePlaylistAsync(playlistPath: String, language: String): Deferred<AoDObject> {
if (playlistPath == "[]") {
return CompletableDeferred(AoDObject(listOf()))
return CompletableDeferred(AoDObject(listOf(), language))
}
return GlobalScope.async {
return GlobalScope.async(Dispatchers.IO) {
val headers = mutableMapOf(
Pair("Accept", "application/json, text/javascript, */*; q=0.01"),
Pair("Accept-Language", "de,en-US;q=0.7,en;q=0.3"),
@ -363,7 +403,27 @@ object AoDParser {
description = it.asJsonObject.get("description").asString,
mediaid = it.asJsonObject.get("mediaid").asInt
)
})
},
language
)
}
}
/**
* get the episode number from the title
* @param title the episode title, containing a number after "Ep."
* @param type the media type, if not TVSHOW, return 0
* @return the episode number, on NumberFormatException return 0
*/
private fun getNumberFromTitle(title: String, type: MediaType): Int {
return if (type == MediaType.TVSHOW) {
try {
title.substringAfter(", Ep. ").toInt()
} catch (nex: NumberFormatException) {
0
}
} else {
0
}
}

View File

@ -0,0 +1,429 @@
package org.mosad.teapod.player
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.annotation.SuppressLint
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.*
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.GestureDetectorCompat
import androidx.core.view.isVisible
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.ui.StyledPlayerControlView
import com.google.android.exoplayer2.util.Util
import kotlinx.android.synthetic.main.activity_player.*
import kotlinx.android.synthetic.main.player_controls.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.mosad.teapod.R
import org.mosad.teapod.preferences.Preferences
import org.mosad.teapod.ui.components.EpisodesListPlayer
import org.mosad.teapod.ui.components.LanguageSettingsPlayer
import org.mosad.teapod.util.DataTypes
import java.util.*
import java.util.concurrent.TimeUnit
import kotlin.concurrent.scheduleAtFixedRate
class PlayerActivity : AppCompatActivity() {
private val model: PlayerViewModel by viewModels()
private lateinit var controller: StyledPlayerControlView
private lateinit var gestureDetector: GestureDetectorCompat
private lateinit var timerUpdates: TimerTask
private var playWhenReady = true
private var currentWindow = 0
private var playbackPosition: Long = 0
private var remainingTime: Long = 0
private val rwdTime: Long = 10000.unaryMinus()
private val fwdTime: Long = 10000
private val defaultShowTimeoutMs = 5000
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_player)
hideBars() // Initial hide the bars
savedInstanceState?.let {
currentWindow = it.getInt(getString(R.string.state_resume_window))
playbackPosition = it.getLong(getString(R.string.state_resume_position))
playWhenReady = it.getBoolean(getString(R.string.state_is_playing))
}
model.loadMedia(
intent.getIntExtra(getString(R.string.intent_media_id), 0),
intent.getIntExtra(getString(R.string.intent_episode_id), 0)
)
model.currentEpisodeChangedListener.add { onMediaChanged() }
gestureDetector = GestureDetectorCompat(this, PlayerGestureListener())
controller = video_view.findViewById(R.id.exo_controller)
controller.isAnimationEnabled = false // disable controls (time-bar) animation
initExoPlayer() // call in onCreate, exoplayer lives in view model
initGUI()
initActions()
}
override fun onStart() {
super.onStart()
if (Util.SDK_INT > 23) {
initPlayer()
video_view?.onResume()
}
}
override fun onResume() {
super.onResume()
if (Util.SDK_INT <= 23) {
initPlayer()
video_view?.onResume()
}
}
override fun onPause() {
super.onPause()
if (Util.SDK_INT <= 23) {
video_view?.onPause()
releasePlayer()
}
}
override fun onStop() {
super.onStop()
if (Util.SDK_INT > 23) {
video_view?.onPause()
releasePlayer()
}
}
override fun onSaveInstanceState(outState: Bundle) {
outState.putInt(getString(R.string.state_resume_window), currentWindow)
outState.putLong(getString(R.string.state_resume_position), playbackPosition)
outState.putBoolean(getString(R.string.state_is_playing), playWhenReady)
super.onSaveInstanceState(outState)
}
private fun initPlayer() {
if (model.media.id < 0) {
Log.e(javaClass.name, "No media was set.")
this.finish()
}
initVideoView()
initTimeUpdates()
// if the player is ready or buffering we can simply play the file again, else do nothing
if ((model.player.playbackState == ExoPlayer.STATE_READY || model.player.playbackState == ExoPlayer.STATE_BUFFERING)
) {
model.player.play()
}
}
/**
* set play when ready and listeners
*/
private fun initExoPlayer() {
model.player.playWhenReady = playWhenReady
model.player.addListener(object : Player.EventListener {
override fun onPlaybackStateChanged(state: Int) {
super.onPlaybackStateChanged(state)
loading.visibility = when (state) {
ExoPlayer.STATE_READY -> View.GONE
ExoPlayer.STATE_BUFFERING -> View.VISIBLE
else -> View.GONE
}
exo_play_pause.visibility = when (loading.visibility) {
View.GONE -> View.VISIBLE
View.VISIBLE -> View.INVISIBLE
else -> View.VISIBLE
}
if (state == ExoPlayer.STATE_ENDED && model.nextEpisode != null && Preferences.autoplay) {
playNextEpisode()
}
}
})
// start playing the current episode, after all needed player components have been initialized
model.playEpisode(model.currentEpisode, true, playbackPosition)
}
@SuppressLint("ClickableViewAccessibility")
private fun initVideoView() {
video_view.player = model.player
// when the player controls get hidden, hide the bars too
video_view.setControllerVisibilityListener {
when (it) {
View.GONE -> hideBars()
View.VISIBLE -> updateControls()
}
}
video_view.setOnTouchListener { _, event ->
gestureDetector.onTouchEvent(event)
true
}
}
private fun initActions() {
exo_close_player.setOnClickListener { this.finish() }
rwd_10.setOnButtonClickListener { rewind() }
ffwd_10.setOnButtonClickListener { fastForward() }
button_next_ep.setOnClickListener { playNextEpisode() }
button_language.setOnClickListener { showLanguageSettings() }
button_episodes.setOnClickListener { showEpisodesList() }
button_next_ep_c.setOnClickListener { playNextEpisode() }
}
private fun initGUI() {
if (model.media.type == DataTypes.MediaType.MOVIE) {
button_episodes.visibility = View.GONE
}
}
private fun initTimeUpdates() {
if (this::timerUpdates.isInitialized) {
timerUpdates.cancel()
}
timerUpdates = Timer().scheduleAtFixedRate(0, 500) {
GlobalScope.launch {
var btnNextEpIsVisible: Boolean
var controlsVisible: Boolean
withContext(Dispatchers.Main) {
if (model.player.duration > 0) {
remainingTime = model.player.duration - model.player.currentPosition
remainingTime = if (remainingTime < 0) 0 else remainingTime
}
btnNextEpIsVisible = button_next_ep.isVisible
controlsVisible = controller.isVisible
}
if (remainingTime in 1..20000) {
// if the next ep button is not visible, make it visible
if (!btnNextEpIsVisible && model.nextEpisode != null && Preferences.autoplay) {
withContext(Dispatchers.Main) { showButtonNextEp() }
}
} else if (btnNextEpIsVisible) {
withContext(Dispatchers.Main) { hideButtonNextEp() }
}
// if controls are visible, update them
if (controlsVisible) {
withContext(Dispatchers.Main) { updateControls() }
}
}
}
}
private fun releasePlayer(){
playbackPosition = model.player.currentPosition
currentWindow = model.player.currentWindowIndex
playWhenReady = model.player.playWhenReady
model.player.pause()
timerUpdates.cancel()
}
/**
* update the custom controls
*/
private fun updateControls() {
// update remaining time label
val hours = TimeUnit.MILLISECONDS.toHours(remainingTime) % 24
val minutes = TimeUnit.MILLISECONDS.toMinutes(remainingTime) % 60
val seconds = TimeUnit.MILLISECONDS.toSeconds(remainingTime) % 60
// if remaining time is below 60 minutes, don't show hours
exo_remaining.text = if (TimeUnit.MILLISECONDS.toMinutes(remainingTime) < 60) {
getString(R.string.time_min_sec, minutes, seconds)
} else {
getString(R.string.time_hour_min_sec, hours, minutes, seconds)
}
}
/**
* update title text and next ep button visibility, set ignoreNextStateEnded
*/
private fun onMediaChanged() {
exo_text_title.text = model.getMediaTitle()
button_next_ep_c.visibility = if (model.nextEpisode == null) {
View.GONE
} else {
View.VISIBLE
}
}
/**
* TODO set position of rewind/fast forward indicators programmatically
*/
private fun rewind() {
model.seekToOffset(rwdTime)
// hide/show needed components
exo_double_tap_indicator.visibility = View.VISIBLE
ffwd_10_indicator.visibility = View.INVISIBLE
rwd_10.visibility = View.INVISIBLE
rwd_10_indicator.onAnimationEndCallback = {
exo_double_tap_indicator.visibility = View.GONE
ffwd_10_indicator.visibility = View.VISIBLE
rwd_10.visibility = View.VISIBLE
}
// run animation
rwd_10_indicator.runOnClickAnimation()
}
private fun fastForward() {
model.seekToOffset(fwdTime)
// hide/show needed components
exo_double_tap_indicator.visibility = View.VISIBLE
rwd_10_indicator.visibility = View.INVISIBLE
ffwd_10.visibility = View.INVISIBLE
ffwd_10_indicator.onAnimationEndCallback = {
exo_double_tap_indicator.visibility = View.GONE
rwd_10_indicator.visibility = View.VISIBLE
ffwd_10.visibility = View.VISIBLE
}
// run animation
ffwd_10_indicator.runOnClickAnimation()
}
private fun playNextEpisode() {
model.playNextEpisode()
hideButtonNextEp()
}
/**
* hide the status and navigation bar
*/
private fun hideBars() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.setDecorFitsSystemWindows(false)
window.insetsController?.apply {
hide(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars())
systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE
}
} else {
@Suppress("deprecation")
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_FULLSCREEN)
}
}
/**
* show the next episode button
* TODO improve the show animation
*/
private fun showButtonNextEp() {
button_next_ep.visibility = View.VISIBLE
button_next_ep.alpha = 0.0f
button_next_ep.animate()
.alpha(1.0f)
.setListener(null)
}
/**
* hide the next episode button
* TODO improve the hide animation
*/
private fun hideButtonNextEp() {
button_next_ep.animate()
.alpha(0.0f)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
super.onAnimationEnd(animation)
button_next_ep.visibility = View.GONE
}
})
}
private fun showEpisodesList() {
val episodesList = EpisodesListPlayer(this, model = model).apply {
onViewRemovedAction = { model.player.play() }
}
player_layout.addView(episodesList)
pauseAndHideControls()
}
private fun showLanguageSettings() {
val languageSettings = LanguageSettingsPlayer(this, model = model).apply {
onViewRemovedAction = { model.player.play() }
}
player_layout.addView(languageSettings)
pauseAndHideControls()
}
/**
* pause playback and hide controls
*/
private fun pauseAndHideControls() {
model.player.pause() // showTimeoutMs is set to 0 when calling pause, but why
controller.showTimeoutMs = defaultShowTimeoutMs // fix showTimeoutMs set to 0
controller.hide()
}
inner class PlayerGestureListener : GestureDetector.SimpleOnGestureListener() {
/**
* on single tap hide or show the controls
*/
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
if (controller.isVisible) controller.hide() else controller.show()
return true
}
/**
* on double tap rewind or forward
*/
override fun onDoubleTap(e: MotionEvent?): Boolean {
val eventPosX = e?.x?.toInt() ?: 0
val viewCenterX = video_view.measuredWidth / 2
// if the event position is on the left side rewind, if it's on the right forward
if (eventPosX < viewCenterX) rewind() else fastForward()
return true
}
/**
* not used
*/
override fun onDoubleTapEvent(e: MotionEvent?): Boolean {
return true
}
/**
* on long press toggle pause/play
*/
override fun onLongPress(e: MotionEvent?) {
model.togglePausePlay()
}
}
}

View File

@ -0,0 +1,149 @@
package org.mosad.teapod.player
import android.app.Application
import android.net.Uri
import android.util.Log
import androidx.lifecycle.AndroidViewModel
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.SimpleExoPlayer
import com.google.android.exoplayer2.source.MediaSource
import com.google.android.exoplayer2.source.hls.HlsMediaSource
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
import com.google.android.exoplayer2.util.Util
import kotlinx.coroutines.runBlocking
import org.mosad.teapod.R
import org.mosad.teapod.parser.AoDParser
import org.mosad.teapod.preferences.Preferences
import org.mosad.teapod.ui.fragments.MediaFragment
import org.mosad.teapod.util.DataTypes
import org.mosad.teapod.util.Episode
import org.mosad.teapod.util.Media
import java.util.*
import kotlin.collections.ArrayList
/**
* PlayerViewModel handles all stuff related to media/episodes.
* When currentEpisode is changed the player will start playing it (not initial media),
* the next episode will be update and the callback is handled.
*/
class PlayerViewModel(application: Application) : AndroidViewModel(application) {
val player = SimpleExoPlayer.Builder(application).build()
val dataSourceFactory = DefaultDataSourceFactory(application, Util.getUserAgent(application, "Teapod"))
val currentEpisodeChangedListener = ArrayList<() -> Unit>()
val preferredLanguage = if (Preferences.preferSecondary) Locale.JAPANESE else Locale.GERMAN
var media: Media = Media(-1, "", DataTypes.MediaType.OTHER)
internal set
var currentEpisode = Episode()
internal set
var nextEpisode: Episode? = null
internal set
var currentLanguage: Locale = Locale.ROOT
internal set
override fun onCleared() {
super.onCleared()
player.release()
Log.d(javaClass.name, "Released player")
}
fun loadMedia(mediaId: Int, episodeId: Int) {
runBlocking {
media = AoDParser.getMediaById(mediaId)
}
currentEpisode = media.getEpisodeById(episodeId)
nextEpisode = selectNextEpisode()
currentLanguage = currentEpisode.getPreferredStream(preferredLanguage).language
}
fun setLanguage(language: Locale) {
currentLanguage = language
val seekTime = player.currentPosition
val mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(
MediaItem.fromUri(Uri.parse(currentEpisode.getPreferredStream(language).url))
)
playMedia(mediaSource, true, seekTime)
}
// player actions
fun seekToOffset(offset: Long) {
player.seekTo(player.currentPosition + offset)
}
fun togglePausePlay() {
if (player.isPlaying) player.pause() else player.play()
}
/**
* play the next episode, if nextEpisode is not null
*/
fun playNextEpisode() = nextEpisode?.let { it ->
playEpisode(it, replace = true)
}
/**
* set currentEpisode to the param episode and start playing it
* update nextEpisode to reflect the change
*
* updateWatchedState for the next (now current) episode
*/
fun playEpisode(episode: Episode, replace: Boolean = false, seekPosition: Long = 0) {
val preferredStream = episode.getPreferredStream(currentLanguage)
currentLanguage = preferredStream.language // update current language, since it may have changed
currentEpisode = episode
nextEpisode = selectNextEpisode()
currentEpisodeChangedListener.forEach { it() } // update player gui (title)
val mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(
MediaItem.fromUri(Uri.parse(preferredStream.url))
)
playMedia(mediaSource, replace, seekPosition)
// if episodes has not been watched, mark as watched
if (!episode.watched) {
AoDParser.markAsWatched(media.id, episode.id)
}
}
fun playMedia(source: MediaSource, replace: Boolean = false, seekPosition: Long = 0) {
if (replace || player.contentDuration == C.TIME_UNSET) {
player.setMediaSource(source)
player.prepare()
if (seekPosition > 0) player.seekTo(seekPosition)
player.playWhenReady = true
}
}
fun getMediaTitle(): String {
return if (media.type == DataTypes.MediaType.TVSHOW) {
getApplication<Application>().getString(
R.string.component_episode_title,
currentEpisode.number,
currentEpisode.description
)
} else {
currentEpisode.title
}
}
/**
* Based on the current episodeId, get the next episode. If there is no next
* episode, return null
*/
private fun selectNextEpisode(): Episode? {
val nextEpIndex = media.episodes.indexOfFirst { it.id == currentEpisode.id } + 1
return if (nextEpIndex < media.episodes.size) {
media.episodes[nextEpIndex]
} else {
null
}
}
}

View File

@ -1,20 +1,28 @@
package org.mosad.teapod.preferences
import android.content.Context
import android.content.SharedPreferences
import org.mosad.teapod.R
import org.mosad.teapod.util.DataTypes
object Preferences {
var preferSecondary = false
internal set
var autoplay = true
internal set
var theme = DataTypes.Theme.LIGHT
internal set
fun savePreferSecondary(context: Context, preferSecondary: Boolean) {
val sharedPref = context.getSharedPreferences(
private fun getSharedPref(context: Context): SharedPreferences {
return context.getSharedPreferences(
context.getString(R.string.preference_file_key),
Context.MODE_PRIVATE
)
}
with(sharedPref.edit()) {
fun savePreferSecondary(context: Context, preferSecondary: Boolean) {
with(getSharedPref(context).edit()) {
putBoolean(context.getString(R.string.save_key_prefer_secondary), preferSecondary)
apply()
}
@ -22,18 +30,41 @@ object Preferences {
this.preferSecondary = preferSecondary
}
fun saveAutoplay(context: Context, autoplay: Boolean) {
with(getSharedPref(context).edit()) {
putBoolean(context.getString(R.string.save_key_autoplay), autoplay)
apply()
}
this.autoplay = autoplay
}
fun saveTheme(context: Context, theme: DataTypes.Theme) {
with(getSharedPref(context).edit()) {
putString(context.getString(R.string.save_key_theme), theme.toString())
apply()
}
this.theme = theme
}
/**
* initially load the stored values
*/
fun load(context: Context) {
val sharedPref = context.getSharedPreferences(
context.getString(R.string.preference_file_key),
Context.MODE_PRIVATE
)
val sharedPref = getSharedPref(context)
preferSecondary = sharedPref.getBoolean(
context.getString(R.string.save_key_prefer_secondary), false
)
autoplay = sharedPref.getBoolean(
context.getString(R.string.save_key_autoplay), true
)
theme = DataTypes.Theme.valueOf(
sharedPref.getString(
context.getString(R.string.save_key_theme), DataTypes.Theme.LIGHT.toString()
) ?: DataTypes.Theme.LIGHT.toString()
)
}

View File

@ -0,0 +1,44 @@
package org.mosad.teapod.ui.components
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.LinearLayout
import org.mosad.teapod.databinding.PlayerEpisodesListBinding
import org.mosad.teapod.player.PlayerViewModel
import org.mosad.teapod.util.adapter.PlayerEpisodeItemAdapter
class EpisodesListPlayer @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
model: PlayerViewModel? = null
) : LinearLayout(context, attrs, defStyleAttr) {
private val binding = PlayerEpisodesListBinding.inflate(LayoutInflater.from(context), this, true)
private lateinit var adapterRecEpisodes: PlayerEpisodeItemAdapter
var onViewRemovedAction: (() -> Unit)? = null // TODO find a better solution for this
init {
binding.buttonCloseEpisodesList.setOnClickListener {
(this.parent as ViewGroup).removeView(this)
onViewRemovedAction?.invoke()
}
model?.let {
adapterRecEpisodes = PlayerEpisodeItemAdapter(model.media.episodes)
adapterRecEpisodes.onImageClick = { _, position ->
(this.parent as ViewGroup).removeView(this)
model.playEpisode(model.media.episodes[position], replace = true)
}
adapterRecEpisodes.currentSelected = model.currentEpisode.number - 1
binding.recyclerEpisodesPlayer.adapter = adapterRecEpisodes
binding.recyclerEpisodesPlayer.scrollToPosition(model.currentEpisode.number - 1) // number != index
}
}
}

View File

@ -0,0 +1,68 @@
package org.mosad.teapod.ui.components
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
import kotlinx.android.synthetic.main.button_fast_forward.view.*
import org.mosad.teapod.R
class FastForwardButton(context: Context, attrs: AttributeSet?): FrameLayout(context, attrs) {
private val animationDuration: Long = 800
private val buttonAnimation: ObjectAnimator
private val labelAnimation: ObjectAnimator
var onAnimationEndCallback: (() -> Unit)? = null
init {
inflate(context, R.layout.button_fast_forward, this)
buttonAnimation = ObjectAnimator.ofFloat(imageButton, View.ROTATION, 0f, 50f).apply {
duration = animationDuration / 4
repeatCount = 1
repeatMode = ObjectAnimator.REVERSE
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator?) {
imageButton.isEnabled = false // disable button
imageButton.setBackgroundResource(R.drawable.ic_baseline_forward_24)
}
})
}
labelAnimation = ObjectAnimator.ofFloat(textView, View.TRANSLATION_X, 35f).apply {
duration = animationDuration
addListener(object : AnimatorListenerAdapter() {
// the label animation takes longer then the button animation, reset stuff in here
override fun onAnimationEnd(animation: Animator?) {
imageButton.isEnabled = true // enable button
imageButton.setBackgroundResource(R.drawable.ic_baseline_forward_10_24)
textView.visibility = View.GONE
textView.animate().translationX(0f)
onAnimationEndCallback?.invoke()
}
})
}
}
fun setOnButtonClickListener(func: FastForwardButton.() -> Unit) {
imageButton.setOnClickListener {
func()
}
}
fun runOnClickAnimation() {
// run button animation
buttonAnimation.start()
// run lbl animation
textView.visibility = View.VISIBLE
labelAnimation.start()
}
}

View File

@ -0,0 +1,103 @@
package org.mosad.teapod.ui.components
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.util.AttributeSet
import android.util.TypedValue
import android.view.Gravity
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.view.children
import org.mosad.teapod.R
import org.mosad.teapod.databinding.PlayerLanguageSettingsBinding
import org.mosad.teapod.player.PlayerViewModel
import java.util.*
class LanguageSettingsPlayer @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
model: PlayerViewModel? = null
) : LinearLayout(context, attrs, defStyleAttr) {
private val binding = PlayerLanguageSettingsBinding.inflate(LayoutInflater.from(context), this, true)
var onViewRemovedAction: (() -> Unit)? = null // TODO find a better solution for this
private var currentLanguage = model?.currentLanguage ?: Locale.ROOT
init {
model?.let {
model.currentEpisode.streams.forEach { stream ->
addLanguage(stream.language.displayName, stream.language == currentLanguage) {
currentLanguage = stream.language
updateSelectedLanguage(it as TextView)
}
}
}
binding.buttonCloseLanguageSettings.setOnClickListener { close() }
binding.buttonCancel.setOnClickListener { close() }
binding.buttonSelect.setOnClickListener {
model?.setLanguage(currentLanguage)
close()
}
}
private fun addLanguage(str: String, isSelected: Boolean, onClick: OnClickListener) {
val text = TextView(context).apply {
height = 96
gravity = Gravity.CENTER_VERTICAL
text = str
setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
if (isSelected) {
setTextColor(context.resources.getColor(R.color.exo_white, context.theme))
setTypeface(null, Typeface.BOLD)
setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_baseline_check_24, 0, 0, 0)
compoundDrawablesRelative.getOrNull(0)?.setTint(Color.WHITE)
compoundDrawablePadding = 12
} else {
setTextColor(context.resources.getColor(R.color.textPrimaryDark, context.theme))
setPadding(75, 0, 0, 0)
}
setOnClickListener(onClick)
}
binding.linearLanguages.addView(text)
}
private fun updateSelectedLanguage(selected: TextView) {
// rest all tf to not selected style
binding.linearLanguages.children.forEach { child ->
if (child is TextView) {
child.apply {
setTextColor(context.resources.getColor(R.color.textPrimaryDark, context.theme))
setTypeface(null, Typeface.NORMAL)
setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0)
setPadding(75, 0, 0, 0)
}
}
}
// set selected to selected style
selected.apply {
setTextColor(context.resources.getColor(R.color.exo_white, context.theme))
setTypeface(null, Typeface.BOLD)
setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_baseline_check_24, 0, 0, 0)
setPadding(0, 0, 0, 0)
compoundDrawablesRelative.getOrNull(0)?.setTint(Color.WHITE)
compoundDrawablePadding = 12
}
}
private fun close() {
(this.parent as ViewGroup).removeView(this)
onViewRemovedAction?.invoke()
}
}

View File

@ -0,0 +1,67 @@
package org.mosad.teapod.ui.components
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
import kotlinx.android.synthetic.main.button_rewind.view.*
import org.mosad.teapod.R
class RewindButton(context: Context, attrs: AttributeSet): FrameLayout(context, attrs) {
private val animationDuration: Long = 800
private val buttonAnimation: ObjectAnimator
private val labelAnimation: ObjectAnimator
var onAnimationEndCallback: (() -> Unit)? = null
init {
inflate(context, R.layout.button_rewind, this)
buttonAnimation = ObjectAnimator.ofFloat(imageButton, View.ROTATION, 0f, -50f).apply {
duration = animationDuration / 4
repeatCount = 1
repeatMode = ObjectAnimator.REVERSE
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator?) {
imageButton.isEnabled = false // disable button
imageButton.setBackgroundResource(R.drawable.ic_baseline_rewind_24)
}
})
}
labelAnimation = ObjectAnimator.ofFloat(textView, View.TRANSLATION_X, -35f).apply {
duration = animationDuration
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
imageButton.isEnabled = true // enable button
imageButton.setBackgroundResource(R.drawable.ic_baseline_rewind_10_24)
textView.visibility = View.GONE
textView.animate().translationX(0f)
onAnimationEndCallback?.invoke()
}
})
}
}
fun setOnButtonClickListener(func: RewindButton.() -> Unit) {
imageButton.setOnClickListener {
func()
}
}
fun runOnClickAnimation() {
// run button animation
buttonAnimation.start()
// run lbl animation
textView.visibility = View.VISIBLE
labelAnimation.start()
}
}

View File

@ -0,0 +1,105 @@
package org.mosad.teapod.ui.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RawRes
import androidx.fragment.app.Fragment
import com.afollestad.materialdialogs.MaterialDialog
import org.mosad.teapod.BuildConfig
import org.mosad.teapod.R
import org.mosad.teapod.databinding.FragmentAboutBinding
import org.mosad.teapod.databinding.ItemComponentBinding
import org.mosad.teapod.util.DataTypes.License
import org.mosad.teapod.util.ThirdPartyComponent
import java.lang.StringBuilder
class AboutFragment : Fragment() {
private lateinit var binding: FragmentAboutBinding
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentAboutBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.textVersion.text = getString(R.string.info_about_desc, BuildConfig.VERSION_NAME, getString(R.string.build_time))
getThirdPartyComponents().forEach { thirdParty ->
val componentBinding = ItemComponentBinding.inflate(layoutInflater) //(R.layout.item_component, container, false)
componentBinding.textComponentTitle.text = thirdParty.name
componentBinding.textComponentDesc.text = getString(
R.string.third_party_component_desc,
thirdParty.year,
thirdParty.copyrightOwner,
thirdParty.license.short
)
componentBinding.linearComponent.setOnClickListener {
showLicense(thirdParty.license)
}
binding.linearThirdParty.addView(componentBinding.root)
}
}
private fun getThirdPartyComponents(): List<ThirdPartyComponent> {
return listOf<ThirdPartyComponent>(
ThirdPartyComponent("AndroidX", "", "The Android Open Source Project",
"https://developer.android.com/jetpack/androidx", License.APACHE2),
ThirdPartyComponent("Material Components for Android", "2020", "The Android Open Source Project",
"https://github.com/material-components/material-components-android", License.APACHE2),
ThirdPartyComponent("ExoPlayer", "2014 - 2020", "The Android Open Source Project",
"https://github.com/google/ExoPlayer", License.APACHE2),
ThirdPartyComponent("Gson", "2008", "Google Inc.",
"https://github.com/google/gson", License.APACHE2),
ThirdPartyComponent("Material design icons", "2020", "Google Inc.",
"https://github.com/google/material-design-icons", License.APACHE2),
ThirdPartyComponent("Material Dialogs", "", "Aidan Follestad",
"https://github.com/afollestad/material-dialogs", License.APACHE2),
ThirdPartyComponent("Jsoup", "2009 - 2020", "Jonathan Hedley",
"https://jsoup.org/", License.MIT),
ThirdPartyComponent("kotlinx.coroutines", "2016 - 2019", "JetBrains",
"https://github.com/Kotlin/kotlinx.coroutines", License.APACHE2),
ThirdPartyComponent("Glide", "2014", "Google Inc.",
"https://github.com/bumptech/glide", License.BSD2),
ThirdPartyComponent("Glide Transformations", "2020", "Wasabeef",
"https://github.com/wasabeef/glide-transformations", License.APACHE2)
)
}
private fun showLicense(license: License) {
val licenseText = when(license) {
License.APACHE2 -> parseLicense(R.raw.al_20_full)
License.BSD2 -> parseLicense(R.raw.bsd_2_full)
License.GPL3 -> parseLicense(R.raw.gpl_3_full)
License.MIT -> parseLicense(R.raw.mit_full)
}
println("showing: ${license.long}")
MaterialDialog(requireContext())
.title(text = license.long)
.message(text = licenseText)
.show()
}
private fun parseLicense(@RawRes id: Int): String {
val sb = StringBuilder()
resources.openRawResource(id).bufferedReader().forEachLine {
if (it.isEmpty()) {
sb.appendLine(" ")
} else {
sb.append(it.trim() + " ")
}
}
return sb.toString()
}
}

View File

@ -7,55 +7,61 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.afollestad.materialdialogs.MaterialDialog
import de.psdev.licensesdialog.LicensesDialog
import kotlinx.android.synthetic.main.fragment_account.*
import com.afollestad.materialdialogs.list.listItemsSingleChoice
import org.mosad.teapod.BuildConfig
import org.mosad.teapod.MainActivity
import org.mosad.teapod.R
import org.mosad.teapod.databinding.FragmentAccountBinding
import org.mosad.teapod.parser.AoDParser
import org.mosad.teapod.preferences.EncryptedPreferences
import org.mosad.teapod.preferences.Preferences
import org.mosad.teapod.ui.components.LoginDialog
import org.mosad.teapod.util.DataTypes.Theme
class AccountFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_account, container, false)
private lateinit var binding: FragmentAccountBinding
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentAccountBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
text_account_login.text = EncryptedPreferences.login
text_info_about_desc.text = getString(R.string.info_about_desc, BuildConfig.VERSION_NAME, getString(R.string.build_time))
switch_secondary.isChecked = Preferences.preferSecondary
binding.textAccountLogin.text = EncryptedPreferences.login
binding.textInfoAboutDesc.text = getString(R.string.info_about_desc, BuildConfig.VERSION_NAME, getString(R.string.build_time))
binding.textThemeSelected.text = when (Preferences.theme) {
Theme.DARK -> getString(R.string.theme_dark)
else -> getString(R.string.theme_light)
}
binding.switchSecondary.isChecked = Preferences.preferSecondary
binding.switchAutoplay.isChecked = Preferences.autoplay
initActions()
}
private fun initActions() {
linear_account_login.setOnClickListener {
binding.linearAccountLogin.setOnClickListener {
showLoginDialog(true)
}
linear_about.setOnClickListener {
MaterialDialog(requireContext())
.title(R.string.info_about)
.message(R.string.info_about_dialog)
.show()
binding.linearTheme.setOnClickListener {
showThemeDialog()
}
text_licenses.setOnClickListener {
LicensesDialog.Builder(requireContext())
.setNotices(R.raw.notices)
.setTitle(R.string.licenses)
.setIncludeOwnLicense(true)
.setThemeResourceId(R.style.AppTheme)
.build()
.show()
binding.linearInfo.setOnClickListener {
(activity as MainActivity).showFragment(AboutFragment())
}
switch_secondary.setOnClickListener {
Preferences.savePreferSecondary(requireContext(), switch_secondary.isChecked)
binding.switchSecondary.setOnClickListener {
Preferences.savePreferSecondary(requireContext(), binding.switchSecondary.isChecked)
}
binding.switchAutoplay.setOnClickListener {
Preferences.saveAutoplay(requireContext(), binding.switchAutoplay.isChecked)
}
}
@ -72,4 +78,24 @@ class AccountFragment : Fragment() {
password = ""
}
}
private fun showThemeDialog() {
val themes = listOf(
resources.getString(R.string.theme_light),
resources.getString(R.string.theme_dark)
)
MaterialDialog(requireContext()).show {
title(R.string.theme)
listItemsSingleChoice(items = themes, initialSelection = Preferences.theme.ordinal) { _, index, _ ->
when(index) {
0 -> Preferences.saveTheme(context, Theme.LIGHT)
1 -> Preferences.saveTheme(context, Theme.DARK)
else -> Preferences.saveTheme(context, Theme.LIGHT)
}
(activity as MainActivity).restart()
}
}
}
}

View File

@ -1,52 +1,149 @@
package org.mosad.teapod.ui.fragments
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import kotlinx.android.synthetic.main.fragment_home.*
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.transition.Transition
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.mosad.teapod.MainActivity
import org.mosad.teapod.R
import org.mosad.teapod.databinding.FragmentHomeBinding
import org.mosad.teapod.parser.AoDParser
import org.mosad.teapod.util.ItemMedia
import org.mosad.teapod.util.StorageController
import org.mosad.teapod.util.adapter.MediaItemAdapter
import org.mosad.teapod.util.decoration.MediaItemDecoration
class HomeFragment : Fragment() {
private lateinit var binding: FragmentHomeBinding
private lateinit var adapterMyList: MediaItemAdapter
private lateinit var adapterNewEpisodes: MediaItemAdapter
private lateinit var adapterNewSimulcasts: MediaItemAdapter
private lateinit var adapterNewTitles: MediaItemAdapter
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_home, container, false)
private lateinit var highlightMedia: ItemMedia
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentHomeBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
GlobalScope.launch {
withContext(Dispatchers.Main) {
context?.let {
recycler_my_list.addItemDecoration(MediaItemDecoration(9))
updateMyListMedia()
adapterNewEpisodes = MediaItemAdapter(AoDParser.newEpisodesList)
recycler_new_episodes.adapter = adapterNewEpisodes
recycler_new_episodes.addItemDecoration(MediaItemDecoration(9))
initActions()
}
GlobalScope.launch(Dispatchers.Main) {
context?.let {
initHighlight()
initRecyclerViews()
initActions()
}
}
}
// TODO recreating the adapter on list change is not a good solution
private fun initHighlight() {
if (AoDParser.highlightsList.isNotEmpty()) {
highlightMedia = AoDParser.highlightsList[0]
binding.textHighlightTitle.text = highlightMedia.title
Glide.with(requireContext()).load(highlightMedia.posterUrl)
.into(binding.imageHighlight)
if (StorageController.myList.contains(highlightMedia.id)) {
loadIntoCompoundDrawable(R.drawable.ic_baseline_check_24, binding.textHighlightMyList)
} else {
loadIntoCompoundDrawable(R.drawable.ic_baseline_add_24, binding.textHighlightMyList)
}
}
}
private fun initRecyclerViews() {
binding.recyclerMyList.addItemDecoration(MediaItemDecoration(9))
binding.recyclerNewEpisodes.addItemDecoration(MediaItemDecoration(9))
binding.recyclerNewSimulcasts.addItemDecoration(MediaItemDecoration(9))
binding.recyclerNewTitles.addItemDecoration(MediaItemDecoration(9))
// my list
val myListMedia = StorageController.myList.map { elementId ->
AoDParser.itemMediaList.first {
elementId == it.id
}
}
adapterMyList = MediaItemAdapter(myListMedia)
adapterMyList.onItemClick = { mediaId, _ ->
(activity as MainActivity).showFragment(MediaFragment(mediaId))
}
binding.recyclerMyList.adapter = adapterMyList
// new episodes
adapterNewEpisodes = MediaItemAdapter(AoDParser.newEpisodesList)
binding.recyclerNewEpisodes.adapter = adapterNewEpisodes
// new simulcasts
adapterNewSimulcasts = MediaItemAdapter(AoDParser.newSimulcastsList)
binding.recyclerNewSimulcasts.adapter = adapterNewSimulcasts
// new titles
adapterNewTitles = MediaItemAdapter(AoDParser.newTitlesList)
binding.recyclerNewTitles.adapter = adapterNewTitles
}
private fun initActions() {
binding.buttonPlayHighlight.setOnClickListener {
// TODO get next episode
GlobalScope.launch {
val media = AoDParser.getMediaById(highlightMedia.id)
Log.d(javaClass.name, "Starting Player with mediaId: ${media.id}")
(activity as MainActivity).startPlayer(media.id, media.episodes.first().id)
}
}
binding.textHighlightMyList.setOnClickListener {
if (StorageController.myList.contains(highlightMedia.id)) {
StorageController.myList.remove(highlightMedia.id)
loadIntoCompoundDrawable(R.drawable.ic_baseline_add_24, binding.textHighlightMyList)
} else {
StorageController.myList.add(highlightMedia.id)
loadIntoCompoundDrawable(R.drawable.ic_baseline_check_24, binding.textHighlightMyList)
}
StorageController.saveMyList(requireContext())
updateMyListMedia() // update my list, since it has changed
}
binding.textHighlightInfo.setOnClickListener {
(activity as MainActivity).showFragment(MediaFragment(highlightMedia.id))
}
adapterNewEpisodes.onItemClick = { mediaId, _ ->
(activity as MainActivity).showFragment(MediaFragment(mediaId))
}
adapterNewSimulcasts.onItemClick = { mediaId, _ ->
(activity as MainActivity).showFragment(MediaFragment(mediaId))
}
adapterNewTitles.onItemClick = { mediaId, _ ->
(activity as MainActivity).showFragment(MediaFragment(mediaId))
}
}
/**
* update my media list
* TODO
* * auto call when StorageController.myList is changed
* * only update actual change and not all data (performance)
*/
fun updateMyListMedia() {
val myListMedia = StorageController.myList.map { elementId ->
AoDParser.itemMediaList.first {
@ -54,17 +151,22 @@ class HomeFragment : Fragment() {
}
}
adapterMyList = MediaItemAdapter(myListMedia)
adapterMyList.onItemClick = { mediaId, _ ->
(activity as MainActivity).showMediaFragment(mediaId)
}
recycler_my_list.adapter = adapterMyList
adapterMyList.updateMediaList(myListMedia)
adapterMyList.notifyDataSetChanged()
}
private fun initActions() {
adapterNewEpisodes.onItemClick = { mediaId, _ ->
(activity as MainActivity).showMediaFragment(mediaId)
}
private fun loadIntoCompoundDrawable(drawable: Int, textView: TextView) {
Glide.with(requireContext())
.load(drawable)
.into(object : CustomTarget<Drawable>(48, 48) {
override fun onLoadCleared(drawable: Drawable?) {
textView.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null)
}
override fun onResourceReady(res: Drawable, transition: Transition<in Drawable>?) {
textView.setCompoundDrawablesWithIntrinsicBounds(null, res, null, null)
}
})
}
}

View File

@ -5,20 +5,24 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import kotlinx.android.synthetic.main.fragment_library.*
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.mosad.teapod.MainActivity
import org.mosad.teapod.R
import org.mosad.teapod.databinding.FragmentLibraryBinding
import org.mosad.teapod.parser.AoDParser
import org.mosad.teapod.util.decoration.MediaItemDecoration
import org.mosad.teapod.util.adapter.MediaItemAdapter
import org.mosad.teapod.util.decoration.MediaItemDecoration
class LibraryFragment : Fragment() {
private lateinit var binding: FragmentLibraryBinding
private lateinit var adapter: MediaItemAdapter
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_library, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentLibraryBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -31,11 +35,11 @@ class LibraryFragment : Fragment() {
context?.let {
adapter = MediaItemAdapter(AoDParser.itemMediaList)
adapter.onItemClick = { mediaId, _ ->
(activity as MainActivity).showMediaFragment(mediaId)
(activity as MainActivity).showFragment(MediaFragment(mediaId))
}
recycler_media_library.adapter = adapter
recycler_media_library.addItemDecoration(MediaItemDecoration(9))
binding.recyclerMediaLibrary.adapter = adapter
binding.recyclerMediaLibrary.addItemDecoration(MediaItemDecoration(9))
}
}

View File

@ -1,16 +0,0 @@
package org.mosad.teapod.ui.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import org.mosad.teapod.R
class LoadingFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_loading, container, false)
}
}

View File

@ -13,39 +13,63 @@ import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import jp.wasabeef.glide.transformations.BlurTransformation
import kotlinx.android.synthetic.main.fragment_media.*
import kotlinx.coroutines.*
import org.mosad.teapod.MainActivity
import org.mosad.teapod.R
import org.mosad.teapod.databinding.FragmentMediaBinding
import org.mosad.teapod.parser.AoDParser
import org.mosad.teapod.preferences.Preferences
import org.mosad.teapod.util.*
import org.mosad.teapod.util.DataTypes.MediaType
import org.mosad.teapod.util.Episode
import org.mosad.teapod.util.Media
import org.mosad.teapod.util.StorageController
import org.mosad.teapod.util.TMDBResponse
import org.mosad.teapod.util.adapter.EpisodeItemAdapter
class MediaFragment(private val media: Media, private val tmdb: TMDBResponse) : Fragment() {
class MediaFragment(private val mediaId: Int) : Fragment() {
private lateinit var binding: FragmentMediaBinding
private lateinit var adapterRecEpisodes: EpisodeItemAdapter
private lateinit var viewManager: RecyclerView.LayoutManager
private lateinit var media: Media
private lateinit var tmdb: TMDBResponse
private lateinit var nextEpisode: Episode
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_media, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentMediaBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.frameLoading.visibility = View.VISIBLE
initGUI()
initActions()
GlobalScope.launch(Dispatchers.Main) {
// load the streams for the selected media
media = AoDParser.getMediaById(mediaId)
tmdb = TMDBApiController().search(media.info.title, media.type)
if (this@MediaFragment.isAdded) {
updateGUI()
initActions()
}
}
}
override fun onResume() {
super.onResume()
// only notify adapter, if initialized
if (this::adapterRecEpisodes.isInitialized) {
// TODO find a better solution for this
media.episodes.forEachIndexed() { index, episode ->
adapterRecEpisodes.updateWatchedState(episode.watched, index)
}
adapterRecEpisodes.notifyDataSetChanged()
}
}
/**
* if tmdb data is present, use it, else use the aod data
*/
private fun initGUI() {
private fun updateGUI() = with(binding) {
// generic gui
val backdropUrl = if (tmdb.backdropUrl.isNotEmpty()) tmdb.backdropUrl else media.info.posterUrl
val posterUrl = if (tmdb.posterUrl.isNotEmpty()) tmdb.posterUrl else media.info.posterUrl
@ -53,57 +77,69 @@ class MediaFragment(private val media: Media, private val tmdb: TMDBResponse) :
Glide.with(requireContext()).load(backdropUrl)
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
.apply(RequestOptions.bitmapTransform(BlurTransformation(20, 3)))
.into(image_backdrop)
.into(imageBackdrop)
Glide.with(requireContext()).load(posterUrl)
.into(image_poster)
.into(imagePoster)
text_title.text = media.info.title
text_year.text = media.info.year.toString()
text_age.text = media.info.age.toString()
text_overview.text = media.info.shortDesc
textTitle.text = media.info.title
textYear.text = media.info.year.toString()
textAge.text = media.info.age.toString()
textOverview.text = media.info.shortDesc
if (StorageController.myList.contains(media.id)) {
Glide.with(requireContext()).load(R.drawable.ic_baseline_check_24).into(image_my_list_action)
Glide.with(requireContext()).load(R.drawable.ic_baseline_check_24).into(imageMyListAction)
} else {
Glide.with(requireContext()).load(R.drawable.ic_baseline_add_24).into(image_my_list_action)
Glide.with(requireContext()).load(R.drawable.ic_baseline_add_24).into(imageMyListAction)
}
// specific gui
if (media.type == MediaType.TVSHOW) {
adapterRecEpisodes = EpisodeItemAdapter(media.episodes)
viewManager = LinearLayoutManager(context)
recycler_episodes.layoutManager = viewManager
recycler_episodes.adapter = adapterRecEpisodes
recyclerEpisodes.layoutManager = viewManager
recyclerEpisodes.adapter = adapterRecEpisodes
text_episodes_or_runtime.text = getString(R.string.text_episodes_count, media.info.episodesCount)
binding.textEpisodesOrRuntime.text = getString(R.string.text_episodes_count, media.info.episodesCount)
// get next episode
nextEpisode = if (media.episodes.firstOrNull{ !it.watched } != null) {
media.episodes.first{ !it.watched }
} else {
media.episodes.first()
}
// title is the next episodes title
textTitle.text = nextEpisode.title
} else if (media.type == MediaType.MOVIE) {
recycler_episodes.visibility = View.GONE
recyclerEpisodes.visibility = View.GONE
if (tmdb.runtime > 0) {
text_episodes_or_runtime.text = getString(R.string.text_runtime, tmdb.runtime)
textEpisodesOrRuntime.text = getString(R.string.text_runtime, tmdb.runtime)
} else {
text_episodes_or_runtime.visibility = View.GONE
textEpisodesOrRuntime.visibility = View.GONE
}
}
frameLoading.visibility = View.GONE // hide loading indicator
}
private fun initActions() {
button_play.setOnClickListener {
binding.buttonPlay.setOnClickListener {
when (media.type) {
MediaType.MOVIE -> playStream(media.episodes.first())
MediaType.TVSHOW -> playStream(media.episodes.first())
MediaType.TVSHOW -> playEpisode(nextEpisode)
else -> Log.e(javaClass.name, "Wrong Type: $media.type")
}
}
// add or remove media from myList
linear_my_list_action.setOnClickListener {
binding.linearMyListAction.setOnClickListener {
if (StorageController.myList.contains(media.id)) {
StorageController.myList.remove(media.id)
Glide.with(requireContext()).load(R.drawable.ic_baseline_add_24).into(image_my_list_action)
Glide.with(requireContext()).load(R.drawable.ic_baseline_add_24).into(binding.imageMyListAction)
} else {
StorageController.myList.add(media.id)
Glide.with(requireContext()).load(R.drawable.ic_baseline_check_24).into(image_my_list_action)
Glide.with(requireContext()).load(R.drawable.ic_baseline_check_24).into(binding.imageMyListAction)
}
StorageController.saveMyList(requireContext())
@ -116,33 +152,26 @@ class MediaFragment(private val media: Media, private val tmdb: TMDBResponse) :
// set onItemClick only in adapter is initialized
if (this::adapterRecEpisodes.isInitialized) {
adapterRecEpisodes.onImageClick = { _, position ->
playStream(media.episodes[position])
// update watched state
AoDParser.sendCallback(media.episodes[position].watchedCallback)
adapterRecEpisodes.updateWatchedState(true, position)
adapterRecEpisodes.notifyDataSetChanged()
playEpisode(media.episodes[position])
}
}
}
/**
* Play the media's stream
* If prefer secondary or primary is empty and secondary is present (secStreamOmU),
* use the secondary stream. Else, if the primary stream is set use the primary stream.
*/
private fun playStream(ep: Episode) {
val streamUrl = if ((Preferences.preferSecondary || ep.priStreamUrl.isEmpty()) && ep.secStreamOmU) {
ep.secStreamUrl
} else if (ep.priStreamUrl.isNotEmpty()) {
ep.priStreamUrl
} else {
Log.e(javaClass.name, "No stream url set.")
""
}
private fun playEpisode(ep: Episode) {
playStream(ep)
Log.d(javaClass.name, "Playing stream: $streamUrl")
(activity as MainActivity).startPlayer(streamUrl)
// update nextEpisode
nextEpisode = if (media.episodes.firstOrNull{ !it.watched } != null) {
media.episodes.first{ !it.watched }
} else {
media.episodes.first()
}
binding.textTitle.text = nextEpisode.title
}
private fun playStream(ep: Episode) {
Log.d(javaClass.name, "Starting Player with mediaId: ${media.id}")
(activity as MainActivity).startPlayer(media.id, ep.id)
}
}

View File

@ -6,20 +6,21 @@ import android.view.View
import android.view.ViewGroup
import android.widget.SearchView
import androidx.fragment.app.Fragment
import kotlinx.android.synthetic.main.fragment_search.*
import kotlinx.coroutines.*
import org.mosad.teapod.MainActivity
import org.mosad.teapod.R
import org.mosad.teapod.databinding.FragmentSearchBinding
import org.mosad.teapod.parser.AoDParser
import org.mosad.teapod.util.decoration.MediaItemDecoration
import org.mosad.teapod.util.adapter.MediaItemAdapter
class SearchFragment : Fragment() {
private lateinit var binding: FragmentSearchBinding
private var adapter : MediaItemAdapter? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_search, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentSearchBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -31,12 +32,12 @@ class SearchFragment : Fragment() {
context?.let {
adapter = MediaItemAdapter(AoDParser.itemMediaList)
adapter!!.onItemClick = { mediaId, _ ->
search_text.clearFocus()
(activity as MainActivity).showMediaFragment(mediaId)
binding.searchText.clearFocus()
(activity as MainActivity).showFragment(MediaFragment(mediaId))
}
recycler_media_search.adapter = adapter
recycler_media_search.addItemDecoration(MediaItemDecoration(9))
binding.recyclerMediaSearch.adapter = adapter
binding.recyclerMediaSearch.addItemDecoration(MediaItemDecoration(9))
}
}
}
@ -45,7 +46,7 @@ class SearchFragment : Fragment() {
}
private fun initActions() {
search_text.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
binding.searchText.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean {
adapter?.filter?.filter(query)
adapter?.notifyDataSetChanged()

View File

@ -1,13 +1,36 @@
package org.mosad.teapod.util
import java.util.*
import kotlin.collections.ArrayList
class DataTypes {
enum class MediaType {
OTHER,
MOVIE,
TVSHOW
}
enum class Theme(val str: String) {
LIGHT("Light"),
DARK("Dark")
}
enum class License(val short: String, val long: String) {
APACHE2("AL 2.0", "Apache License Version 2.0"),
MIT("MIT", "MIT License"),
GPL3("GPL 3", "GNU General Public License Version 3"),
BSD2("BSD 2", "BSD 2-Clause License")
}
}
data class ThirdPartyComponent(
val name: String,
val year: String,
val copyrightOwner: String,
val link: String,
val license: DataTypes.License
)
/**
* this class is used to represent the item media
* it is uses in the ItemMediaAdapter (RecyclerView)
@ -18,7 +41,6 @@ data class ItemMedia(
val posterUrl: String
)
/**
* TODO the episodes workflow could use a clean up/rework
*/
@ -27,8 +49,11 @@ data class Media(
val link: String,
val type: DataTypes.MediaType,
val info: Info = Info(),
var episodes: ArrayList<Episode> = arrayListOf()
)
val episodes: ArrayList<Episode> = arrayListOf()
) {
fun hasEpisode(id: Int) = episodes.any { it.id == id }
fun getEpisodeById(id: Int) = episodes.first { it.id == id }
}
data class Info(
var title: String = "",
@ -41,22 +66,37 @@ data class Info(
)
/**
* if secStreamOmU == true, then a secondary stream is present
* number = episode number (0..n)
*/
data class Episode(
val id: Int = 0,
var title: String = "",
var priStreamUrl: String = "",
var secStreamUrl: String = "",
var secStreamOmU: Boolean = false,
var posterUrl: String = "",
var description: String = "",
val id: Int = -1,
val streams: MutableList<Stream> = mutableListOf(),
val title: String = "",
val posterUrl: String = "",
val description: String = "",
var shortDesc: String = "",
var number: Int = 0,
val number: Int = 0,
var watched: Boolean = false,
var watchedCallback: String = ""
) {
/**
* get the preferred stream
* @return the preferred stream, if not present use the first stream
*/
fun getPreferredStream(language: Locale) =
streams.firstOrNull { it.language == language } ?: streams.first()
fun hasDub() = streams.any { it.language == Locale.GERMAN }
}
data class Stream(
val url: String,
val language : Locale
)
/**
* this class is used for tmdb responses
*/
data class TMDBResponse(
val id: Int = 0,
val title: String = "",
@ -66,7 +106,13 @@ data class TMDBResponse(
var runtime: Int = 0
)
data class AoDObject(val playlist: List<Playlist>)
/**
* this class is used to represent the aod json API?
*/
data class AoDObject(
val playlist: List<Playlist>,
val extLanguage: String
)
data class Playlist(
val sources: List<Source>,

View File

@ -1,10 +1,12 @@
package org.mosad.teapod.util
import android.content.Context
import android.util.Log
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.JsonParser
import kotlinx.coroutines.*
import java.io.File
import java.lang.Exception
/**
* This controller contains the logic for permanently saved data.
@ -21,17 +23,21 @@ object StorageController {
if (!file.exists()) runBlocking { saveMyList(context).join() }
myList.clear()
myList.addAll(
GsonBuilder().create().fromJson(file.readText(), ArrayList<Int>().javaClass)
)
try {
myList.clear()
myList.addAll(JsonParser.parseString(file.readText()).asJsonArray.map { it.asInt }.distinct())
} catch (ex: Exception) {
myList.clear()
Log.e(javaClass.name, "Parsing of My-List failed.")
}
}
fun saveMyList(context: Context): Job {
val file = File(context.filesDir, fileNameMyList)
return GlobalScope.launch(Dispatchers.IO) {
file.writeText(Gson().toJson(myList))
file.writeText(Gson().toJson(myList.distinct()))
}
}

View File

@ -3,9 +3,7 @@ package org.mosad.teapod.util
import android.util.Log
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.*
import java.net.URL
import java.net.URLEncoder
import org.mosad.teapod.util.DataTypes.MediaType
@ -22,12 +20,12 @@ class TMDBApiController {
private val imageUrl = "https://image.tmdb.org/t/p/w500"
fun search(title: String, type: MediaType): TMDBResponse {
suspend fun search(title: String, type: MediaType): TMDBResponse {
val searchTerm = title.replace("(Sub)", "").trim()
return when (type) {
MediaType.MOVIE -> searchMovie(searchTerm)
MediaType.TVSHOW -> searchTVShow(searchTerm)
MediaType.MOVIE -> searchMovie(searchTerm).await()
MediaType.TVSHOW -> searchTVShow(searchTerm).await()
else -> {
Log.e(javaClass.name, "Wrong Type: $type")
TMDBResponse()
@ -36,17 +34,17 @@ class TMDBApiController {
}
fun searchTVShow(title: String) = runBlocking {
fun searchTVShow(title: String): Deferred<TMDBResponse> {
val url = URL("$searchTVUrl$preparedParameters&query=${URLEncoder.encode(title, "UTF-8")}")
GlobalScope.async {
return GlobalScope.async {
val response = JsonParser.parseString(url.readText()).asJsonObject
//println(response)
return@async if (response.get("total_results").asInt > 0) {
if (response.get("total_results").asInt > 0) {
response.get("results").asJsonArray.first().asJsonObject.let {
val id = getStringNotNull(it,"id").toInt()
val overview = getStringNotNull(it,"overview")
val id = getStringNotNull(it, "id").toInt()
val overview = getStringNotNull(it, "overview")
val posterPath = getStringNotNullPrefix(it, "poster_path", imageUrl)
val backdropPath = getStringNotNullPrefix(it, "backdrop_path", imageUrl)
@ -55,18 +53,17 @@ class TMDBApiController {
} else {
TMDBResponse()
}
}.await()
}
}
fun searchMovie(title: String) = runBlocking {
fun searchMovie(title: String): Deferred<TMDBResponse> {
val url = URL("$searchMovieUrl$preparedParameters&query=${URLEncoder.encode(title, "UTF-8")}")
GlobalScope.async {
return GlobalScope.async {
val response = JsonParser.parseString(url.readText()).asJsonObject
//println(response)
return@async if (response.get("total_results").asInt > 0) {
if (response.get("total_results").asInt > 0) {
response.get("results").asJsonArray.first().asJsonObject.let {
val id = getStringNotNull(it,"id").toInt()
val overview = getStringNotNull(it,"overview")
@ -79,9 +76,7 @@ class TMDBApiController {
} else {
TMDBResponse()
}
}.await()
}
}
/**

View File

@ -1,53 +1,49 @@
package org.mosad.teapod.util.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import jp.wasabeef.glide.transformations.RoundedCornersTransformation
import kotlinx.android.synthetic.main.item_episode.view.*
import org.mosad.teapod.R
import org.mosad.teapod.databinding.ItemEpisodeBinding
import org.mosad.teapod.util.Episode
class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Adapter<EpisodeItemAdapter.MyViewHolder>() {
class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Adapter<EpisodeItemAdapter.EpisodeViewHolder>() {
var onItemClick: ((String, Int) -> Unit)? = null
var onImageClick: ((String, Int) -> Unit)? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_episode, parent, false)
return MyViewHolder(view)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EpisodeViewHolder {
return EpisodeViewHolder(ItemEpisodeBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
val context = holder.view.context
override fun onBindViewHolder(holder: EpisodeViewHolder, position: Int) {
val context = holder.binding.root.context
val ep = episodes[position]
val titleText = if (ep.priStreamUrl.isEmpty() && ep.secStreamOmU) {
context.getString(R.string.component_episode_title_sub, ep.number, ep.description)
} else {
val titleText = if (ep.hasDub()) {
context.getString(R.string.component_episode_title, ep.number, ep.description)
} else {
context.getString(R.string.component_episode_title_sub, ep.number, ep.description)
}
holder.view.text_episode_title.text = titleText
holder.view.text_episode_desc.text = ep.shortDesc
holder.binding.textEpisodeTitle.text = titleText
holder.binding.textEpisodeDesc.text = ep.shortDesc
if (episodes[position].posterUrl.isNotEmpty()) {
Glide.with(context).load(ep.posterUrl)
.apply(RequestOptions.bitmapTransform(RoundedCornersTransformation(10, 0)))
.into(holder.view.image_episode)
.into(holder.binding.imageEpisode)
}
if (ep.watched) {
holder.view.image_watched.setImageDrawable(
holder.binding.imageWatched.setImageDrawable(
ContextCompat.getDrawable(context, R.drawable.ic_baseline_check_circle_24)
)
} else {
holder.view.image_watched.setImageDrawable(null)
holder.binding.imageWatched.setImageDrawable(null)
}
}
@ -59,13 +55,9 @@ class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Ada
episodes[position].watched = watched
}
inner class MyViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
inner class EpisodeViewHolder(val binding: ItemEpisodeBinding) : RecyclerView.ViewHolder(binding.root) {
init {
view.setOnClickListener {
onItemClick?.invoke(episodes[adapterPosition].title, adapterPosition)
}
view.image_episode.setOnClickListener {
binding.imageEpisode.setOnClickListener {
onImageClick?.invoke(episodes[adapterPosition].title, adapterPosition)
}
}

View File

@ -1,33 +1,29 @@
package org.mosad.teapod.util.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Filter
import android.widget.Filterable
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.item_media.view.*
import org.mosad.teapod.R
import org.mosad.teapod.databinding.ItemMediaBinding
import org.mosad.teapod.util.ItemMedia
import java.util.*
class MediaItemAdapter(private val media: List<ItemMedia>) : RecyclerView.Adapter<MediaItemAdapter.ViewHolder>(), Filterable {
class MediaItemAdapter(private val initMedia: List<ItemMedia>) : RecyclerView.Adapter<MediaItemAdapter.MediaViewHolder>(), Filterable {
var onItemClick: ((Int, Int) -> Unit)? = null
private val filter = MediaFilter()
private var filteredMedia = media.map { it.copy() }
private var filteredMedia = initMedia.map { it.copy() }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MediaItemAdapter.ViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_media, parent, false)
return ViewHolder(view)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MediaItemAdapter.MediaViewHolder {
return MediaViewHolder(ItemMediaBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}
override fun onBindViewHolder(holder: MediaItemAdapter.ViewHolder, position: Int) {
holder.view.apply {
text_title.text = filteredMedia[position].title
Glide.with(context).load(filteredMedia[position].posterUrl).into(image_poster)
override fun onBindViewHolder(holder: MediaItemAdapter.MediaViewHolder, position: Int) {
holder.binding.root.apply {
holder.binding.textTitle.text = filteredMedia[position].title
Glide.with(context).load(filteredMedia[position].posterUrl).into(holder.binding.imagePoster)
}
}
@ -39,9 +35,13 @@ class MediaItemAdapter(private val media: List<ItemMedia>) : RecyclerView.Adapte
return filter
}
inner class ViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
fun updateMediaList(mediaList: List<ItemMedia>) {
filteredMedia = mediaList
}
inner class MediaViewHolder(val binding: ItemMediaBinding) : RecyclerView.ViewHolder(binding.root) {
init {
view.setOnClickListener {
binding.root.setOnClickListener {
onItemClick?.invoke(filteredMedia[adapterPosition].id, adapterPosition)
}
}
@ -53,9 +53,9 @@ class MediaItemAdapter(private val media: List<ItemMedia>) : RecyclerView.Adapte
val results = FilterResults()
val filteredList = if (filterTerm.isEmpty()) {
media
initMedia
} else {
media.filter {
initMedia.filter {
it.title.toLowerCase(Locale.ROOT).contains(filterTerm)
}
}

View File

@ -0,0 +1,64 @@
package org.mosad.teapod.util.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import jp.wasabeef.glide.transformations.RoundedCornersTransformation
import org.mosad.teapod.R
import org.mosad.teapod.databinding.ItemEpisodePlayerBinding
import org.mosad.teapod.util.Episode
class PlayerEpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Adapter<PlayerEpisodeItemAdapter.EpisodeViewHolder>() {
var onImageClick: ((String, Int) -> Unit)? = null
var currentSelected: Int = -1 // -1, since position should never be < 0
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EpisodeViewHolder {
return EpisodeViewHolder(ItemEpisodePlayerBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}
override fun onBindViewHolder(holder: EpisodeViewHolder, position: Int) {
val context = holder.binding.root.context
val ep = episodes[position]
val titleText = if (ep.hasDub()) {
context.getString(R.string.component_episode_title, ep.number, ep.description)
} else {
context.getString(R.string.component_episode_title_sub, ep.number, ep.description)
}
holder.binding.textEpisodeTitle2.text = titleText
holder.binding.textEpisodeDesc2.text = ep.shortDesc
if (episodes[position].posterUrl.isNotEmpty()) {
Glide.with(context).load(ep.posterUrl)
.apply(RequestOptions.bitmapTransform(RoundedCornersTransformation(10, 0)))
.into(holder.binding.imageEpisode)
}
// hide the play icon, if it's the current episode
holder.binding.imageEpisodePlay.visibility = if (currentSelected == position) {
View.GONE
} else {
View.VISIBLE
}
}
override fun getItemCount(): Int {
return episodes.size
}
inner class EpisodeViewHolder(val binding: ItemEpisodePlayerBinding) : RecyclerView.ViewHolder(binding.root) {
init {
binding.imageEpisode.setOnClickListener {
// don't execute, if it's the current episode
if (currentSelected != adapterPosition) {
onImageClick?.invoke(episodes[adapterPosition].title, adapterPosition)
}
}
}
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/colorPrimary" android:state_checked="true"/>
<item android:color="?attr/iconColor"/>
</selector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z" />
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,6v3l4,-4 -4,-4v3c-4.42,0 -8,3.58 -8,8 0,1.57 0.46,3.03 1.24,4.26L6.7,14.8c-0.45,-0.83 -0.7,-1.79 -0.7,-2.8 0,-3.31 2.69,-6 6,-6zM18.76,7.74L17.3,9.2c0.44,0.84 0.7,1.79 0.7,2.8 0,3.31 -2.69,6 -6,6v-3l-4,4 4,4v-3c4.42,0 8,-3.58 8,-8 0,-1.57 -0.46,-3.03 -1.24,-4.26z" />
</vector>

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M18,13c0,3.31 -2.69,6 -6,6s-6,-2.69 -6,-6s2.69,-6 6,-6v4l5,-5l-5,-5v4c-4.42,0 -8,3.58 -8,8c0,4.42 3.58,8 8,8s8,-3.58 8,-8H18z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M10.86,15.94l0,-4.27l-0.09,0l-1.77,0.63l0,0.69l1.01,-0.31l0,3.26z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M12.25,13.44v0.74c0,1.9 1.31,1.82 1.44,1.82c0.14,0 1.44,0.09 1.44,-1.82v-0.74c0,-1.9 -1.31,-1.82 -1.44,-1.82C13.55,11.62 12.25,11.53 12.25,13.44zM14.29,13.32v0.97c0,0.77 -0.21,1.03 -0.59,1.03c-0.38,0 -0.6,-0.26 -0.6,-1.03v-0.97c0,-0.75 0.22,-1.01 0.59,-1.01C14.07,12.3 14.29,12.57 14.29,13.32z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M18,13c0,3.31 -2.69,6 -6,6s-6,-2.69 -6,-6s2.69,-6 6,-6v4l5,-5l-5,-5v4c-4.42,0 -8,3.58 -8,8c0,4.42 3.58,8 8,8c4.42,0 8,-3.58 8,-8H18z" />
</vector>

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M11.99,5V1l-5,5l5,5V7c3.31,0 6,2.69 6,6s-2.69,6 -6,6s-6,-2.69 -6,-6h-2c0,4.42 3.58,8 8,8s8,-3.58 8,-8S16.41,5 11.99,5z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M10.89,16h-0.85v-3.26l-1.01,0.31v-0.69l1.77,-0.63h0.09V16z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M15.17,14.24c0,0.32 -0.03,0.6 -0.1,0.82s-0.17,0.42 -0.29,0.57s-0.28,0.26 -0.45,0.33s-0.37,0.1 -0.59,0.1s-0.41,-0.03 -0.59,-0.1s-0.33,-0.18 -0.46,-0.33s-0.23,-0.34 -0.3,-0.57s-0.11,-0.5 -0.11,-0.82V13.5c0,-0.32 0.03,-0.6 0.1,-0.82s0.17,-0.42 0.29,-0.57s0.28,-0.26 0.45,-0.33s0.37,-0.1 0.59,-0.1s0.41,0.03 0.59,0.1c0.18,0.07 0.33,0.18 0.46,0.33s0.23,0.34 0.3,0.57s0.11,0.5 0.11,0.82V14.24zM14.32,13.38c0,-0.19 -0.01,-0.35 -0.04,-0.48s-0.07,-0.23 -0.12,-0.31s-0.11,-0.14 -0.19,-0.17s-0.16,-0.05 -0.25,-0.05s-0.18,0.02 -0.25,0.05s-0.14,0.09 -0.19,0.17s-0.09,0.18 -0.12,0.31s-0.04,0.29 -0.04,0.48v0.97c0,0.19 0.01,0.35 0.04,0.48s0.07,0.24 0.12,0.32s0.11,0.14 0.19,0.17s0.16,0.05 0.25,0.05s0.18,-0.02 0.25,-0.05s0.14,-0.09 0.19,-0.17s0.09,-0.19 0.11,-0.32s0.04,-0.29 0.04,-0.48V13.38z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,5V1L7,6l5,5V7c3.31,0 6,2.69 6,6s-2.69,6 -6,6 -6,-2.69 -6,-6H4c0,4.42 3.58,8 8,8s8,-3.58 8,-8 -3.58,-8 -8,-8z"/>
</vector>

View File

@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
android:tint="?attr/iconColor">
<path
android:fillColor="@android:color/white"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M2.53,19.65l1.34,0.56v-9.03l-2.43,5.86c-0.41,1.02 0.08,2.19 1.09,2.61zM22.03,15.95L17.07,3.98c-0.31,-0.75 -1.04,-1.21 -1.81,-1.23 -0.26,0 -0.53,0.04 -0.79,0.15L7.1,5.95c-0.75,0.31 -1.21,1.03 -1.23,1.8 -0.01,0.27 0.04,0.54 0.15,0.8l4.96,11.97c0.31,0.76 1.05,1.22 1.83,1.23 0.26,0 0.52,-0.05 0.77,-0.15l7.36,-3.05c1.02,-0.42 1.51,-1.59 1.09,-2.6zM7.88,8.75c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM5.88,19.75c0,1.1 0.9,2 2,2h1.45l-3.45,-8.34v6.34z"/>
</vector>

View File

@ -1,10 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM12,14.5v-9l6,4.5 -6,4.5z"/>
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM12,14.5v-9l6,4.5 -6,4.5z"/>
</vector>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight" />

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#B0B0B0"/>
<solid android:color="?textBackground"/>
<corners android:radius="3dp"/>
</shape>

View File

@ -9,9 +9,8 @@
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="?android:attr/windowBackground"
android:background="?themeSecondary"
app:itemIconTint="@color/bottom_nav_item_tint"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

View File

@ -2,27 +2,91 @@
<FrameLayout 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:id="@+id/player_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:background="#000000"
tools:context=".PlayerActivity">
android:keepScreenOn="true"
tools:context=".player.PlayerActivity">
<com.google.android.exoplayer2.ui.PlayerView
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:animateLayoutChanges="true"
android:foreground="@drawable/ripple_background"
app:controller_layout_id="@layout/player_controls"
app:fastforward_increment="10000"
app:rewind_increment="10000" />
<!-- app:controller_layout_id="@layout/player_custom_control"/>-->
<com.google.android.material.progressindicator.ProgressIndicator
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/loading"
style="@style/Widget.MaterialComponents.ProgressIndicator.Circular.Indeterminate"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:indeterminate="true"
app:indicatorColor="@color/exo_white"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/exo_double_tap_indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<org.mosad.teapod.ui.components.RewindButton
android:id="@+id/rwd_10_indicator"
android:layout_width="100dp"
android:layout_height="wrap_content" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<Space
android:layout_width="60dp"
android:layout_height="1dp" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<org.mosad.teapod.ui.components.FastForwardButton
android:id="@+id/ffwd_10_indicator"
android:layout_width="100dp"
android:layout_height="wrap_content" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/button_next_ep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="12dp"
android:layout_marginBottom="70dp"
android:gravity="center"
android:text="@string/next_episode"
android:textAllCaps="false"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp"
android:visibility="gone"
app:backgroundTint="@color/exo_white"
app:iconGravity="textStart" />
</FrameLayout>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/imageButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentStart="true"
android:background="@drawable/ic_baseline_forward_10_24"
android:contentDescription="@string/forward_10" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:layout_marginStart="42dp"
android:text="@string/fwd_10_s"
android:textColor="@color/exo_white"
android:visibility="gone" />
</RelativeLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true">
<ImageButton
android:id="@+id/imageButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:background="@drawable/ic_baseline_rewind_10_24"
android:contentDescription="@string/forward_10" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:layout_marginEnd="42dp"
android:text="@string/rwd_10_s"
android:textColor="@color/exo_white"
android:visibility="gone" />
</RelativeLayout>

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?themePrimary"
tools:context=".ui.fragments.AboutFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:contentDescription="@string/app_name"
android:src="@mipmap/ic_launcher_round" />
<TextView
android:id="@+id/text_app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="5dp"
android:text="@string/app_name"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/text_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:text="@string/info_about_desc"
android:textAlignment="center" />
<TextView
android:id="@+id/text_about_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="5dp"
android:text="@string/about_info"
android:textAlignment="center" />
<TextView
android:id="@+id/text_tmdb_notice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="7dp"
android:text="@string/tmdb_notice"
android:textAlignment="center"
android:textColor="?textSecondary" />
<TextView
android:id="@+id/text_teapod_repo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="7dp"
android:autoLink="web"
android:text="@string/teapod_repo"
android:textAlignment="center" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="5dp">
<TextView
android:id="@+id/text_third_party"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="17dp"
android:layout_marginEnd="5dp"
android:text="@string/third_party_heading"
android:textSize="17sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/linear_third_party"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="7dp"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:background="?themePrimary"
tools:context=".ui.fragments.AccountFragment">
<ScrollView
@ -14,14 +14,17 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:clipToPadding="false"
android:orientation="vertical"
android:paddingBottom="12dp">
<LinearLayout
android:id="@+id/linear_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="#ffffff"
android:background="?themeSecondary"
android:elevation="5dp"
android:orientation="vertical">
<TextView
@ -31,7 +34,6 @@
android:paddingStart="7dp"
android:paddingEnd="7dp"
android:text="@string/account"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp"
android:textStyle="bold" />
@ -39,9 +41,10 @@
android:id="@+id/linear_account_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="7dp"
android:foreground="?android:selectableItemBackground"
android:gravity="center"
android:orientation="horizontal">
android:orientation="horizontal"
android:padding="7dp">
<ImageView
android:id="@+id/imageView"
@ -50,10 +53,10 @@
android:contentDescription="@string/account"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="5dp"
android:padding="9dp"
android:scaleType="fitXY"
android:src="@drawable/ic_baseline_account_box_24"
app:srcCompat="@drawable/ic_baseline_account_box_24" />
app:tint="?iconColor" />
<LinearLayout
android:layout_width="match_parent"
@ -66,7 +69,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/account_login_ex"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp" />
<TextView
@ -75,7 +77,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/account_login_desc"
android:textColor="@android:color/secondary_text_light" />
android:textColor="?textSecondary" />
</LinearLayout>
</LinearLayout>
@ -84,9 +86,10 @@
<LinearLayout
android:id="@+id/linear_settings"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="#ffffff"
android:background="?themeSecondary"
android:elevation="5dp"
android:orientation="vertical">
<TextView
@ -96,7 +99,6 @@
android:paddingStart="7dp"
android:paddingEnd="7dp"
android:text="@string/settings"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp"
android:textStyle="bold" />
@ -104,20 +106,21 @@
android:id="@+id/linear_settings_secondary"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="7dp"
android:gravity="center"
android:orientation="horizontal">
android:orientation="horizontal"
android:padding="7dp">
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account"
android:contentDescription="@string/settings_secondary"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="5dp"
android:padding="9dp"
android:scaleType="fitXY"
android:src="@drawable/ic_baseline_subtitles_24" />
android:src="@drawable/ic_baseline_subtitles_24"
app:tint="?iconColor" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -139,7 +142,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/settings_secondary"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp" />
<TextView
@ -149,7 +151,7 @@
android:layout_weight="1"
android:maxLines="2"
android:text="@string/settings_secondary_desc"
android:textColor="@android:color/secondary_text_light" />
android:textColor="?textSecondary" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
@ -164,14 +166,122 @@
</LinearLayout>
<LinearLayout
android:id="@+id/linear_settings_autoplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal"
android:padding="7dp">
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/settings_autoplay"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="9dp"
android:src="@drawable/ic_baseline_autorenew_24"
app:tint="?iconColor" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/switch_autoplay"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/text_settings_auoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_autoplay"
android:textSize="16sp" />
<TextView
android:id="@+id/text_settings_auoplay_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_autoplay_desc"
android:textColor="?textSecondary" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switch_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linear_theme"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?android:selectableItemBackground"
android:gravity="center"
android:orientation="horizontal"
android:padding="7dp">
<ImageView
android:id="@+id/imageViewTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="9dp"
android:scaleType="fitXY"
android:src="@drawable/ic_baseline_style_24"
app:tint="?iconColor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/text_theme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/theme"
android:textSize="16sp" />
<TextView
android:id="@+id/text_theme_selected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/theme_light"
android:textColor="?textSecondary" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linear_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="#ffffff"
android:background="?themeSecondary"
android:clipToPadding="false"
android:elevation="5dp"
android:orientation="vertical">
<TextView
@ -181,7 +291,6 @@
android:paddingStart="7dp"
android:paddingEnd="7dp"
android:text="@string/info"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp"
android:textStyle="bold" />
@ -189,9 +298,10 @@
android:id="@+id/linear_about"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="7dp"
android:foreground="?android:selectableItemBackground"
android:gravity="center"
android:orientation="horizontal">
android:orientation="horizontal"
android:padding="7dp">
<ImageView
android:id="@+id/imageView2"
@ -200,9 +310,10 @@
android:contentDescription="@string/info"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="5dp"
android:padding="9dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_baseline_info_24" />
app:srcCompat="@drawable/ic_baseline_info_24"
app:tint="?iconColor" />
<LinearLayout
android:layout_width="match_parent"
@ -215,7 +326,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/info_about"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp" />
<TextView
@ -224,27 +334,11 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/info_about_desc"
android:textColor="@android:color/secondary_text_light" />
android:textColor="?textSecondary" />
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/text_licenses"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="7dp"
android:paddingStart="48dp"
android:paddingEnd="48dp"
android:text="@string/licenses"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

View File

@ -2,9 +2,10 @@
<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:id="@+id/ff_test"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:background="?themePrimary"
tools:context=".ui.fragments.HomeFragment">
<ScrollView
@ -14,9 +15,100 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:orientation="vertical">
<LinearLayout
android:id="@+id/linear_highlight"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="7dp">
<ImageView
android:id="@+id/image_highlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/highlight_media"
app:layout_constraintDimensionRatio="H,16:9"
tools:src="@drawable/ic_launcher_background" />
<TextView
android:id="@+id/text_highlight_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="@string/text_title_ex"
android:textAlignment="center"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="7dp"
android:gravity="center"
android:orientation="horizontal">
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
android:id="@+id/text_highlight_my_list"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/my_list"
android:textColor="?textSecondary"
android:textSize="12sp"
app:drawableTint="?buttonBackground"
app:drawableTopCompat="@drawable/ic_baseline_add_24" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_play_highlight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/button_play"
android:textAllCaps="false"
android:textColor="?themePrimary"
android:textSize="16sp"
app:backgroundTint="?buttonBackground"
app:icon="@drawable/ic_baseline_play_arrow_24"
app:iconGravity="textStart"
app:iconTint="?themePrimary" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
android:id="@+id/text_highlight_info"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/info"
android:textColor="?textSecondary"
android:textSize="12sp"
app:drawableTint="?buttonBackground"
app:drawableTopCompat="@drawable/ic_baseline_info_24" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linear_my_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@ -44,6 +136,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/linear_new_episodes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@ -70,6 +163,62 @@
tools:listitem="@layout/item_media" />
</LinearLayout>
<LinearLayout
android:id="@+id/linear_new_simulcasts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="7dp">
<TextView
android:id="@+id/text_new_simulcasts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingTop="15dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:text="@string/new_simulcasts"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_new_simulcasts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_media" />
</LinearLayout>
<LinearLayout
android:id="@+id/linear_new_titles"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="7dp">
<TextView
android:id="@+id/text_new_titles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingTop="15dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:text="@string/new_titles"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_new_titles"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_media" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:background="?themePrimary"
tools:context=".ui.fragments.LibraryFragment">
<androidx.recyclerview.widget.RecyclerView

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:clickable="true"
android:focusable="true">
<com.google.android.material.progressindicator.ProgressIndicator
android:id="@+id/progressBar2"
style="@style/Widget.MaterialComponents.ProgressIndicator.Circular.Indeterminate"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
tools:visibility="visible" />
</FrameLayout>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:background="?themePrimary"
tools:context=".ui.fragments.MediaFragment">
<androidx.core.widget.NestedScrollView
@ -36,7 +36,7 @@
android:layout_height="200dp"
android:layout_gravity="center"
app:shapeAppearance="@style/ShapeAppearance.Teapod.RoundedPoster"
app:srcCompat="@drawable/ic_launcher_background" />
tools:src="@drawable/ic_launcher_background" />
</FrameLayout>
@ -60,7 +60,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:background="@drawable/shape_rounden_corner"
android:background="@drawable/shape_rounded_corner"
android:paddingStart="3dp"
android:paddingTop="2dp"
android:paddingEnd="3dp"
@ -86,11 +86,12 @@
android:gravity="center"
android:text="@string/button_play"
android:textAllCaps="false"
android:textColor="@android:color/primary_text_dark"
android:textColor="?themePrimary"
android:textSize="16sp"
app:backgroundTint="#4A4141"
app:backgroundTint="?buttonBackground"
app:icon="@drawable/ic_baseline_play_arrow_24"
app:iconGravity="textStart" />
app:iconGravity="textStart"
app:iconTint="?themePrimary" />
<TextView
android:id="@+id/text_title"
@ -134,13 +135,16 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_baseline_add_24"
app:tint="#4A4141" />
app:tint="?buttonBackground"
android:contentDescription="@string/my_list" />
<TextView
android:id="@+id/text_my_list_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_list" />
android:text="@string/my_list"
android:textColor="?textSecondary"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
@ -156,4 +160,21 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<FrameLayout
android:id="@+id/frame_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?themePrimary"
android:visibility="gone">
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/loadingIndicator"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:indeterminate="true"
app:indicatorColor="?colorPrimary"
tools:visibility="visible" />
</FrameLayout>
</FrameLayout>

View File

@ -4,18 +4,19 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:background="?themePrimary"
tools:context=".ui.fragments.SearchFragment">
<SearchView
android:id="@+id/search_text"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#FFFFFF"
android:background="?themeSecondary"
android:elevation="8dp"
android:iconifiedByDefault="false"
android:paddingBottom="5dp"
android:queryHint="@string/search_hint"
android:searchIcon="@drawable/ic_baseline_search_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -27,13 +28,13 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:clipToPadding="false"
android:padding="3dp"
android:orientation="vertical"
android:padding="3dp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search_text"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:listitem="@layout/item_media">

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear_component"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingTop="7dp"
android:paddingEnd="12dp"
android:paddingBottom="7dp">
<TextView
android:id="@+id/text_component_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textStyle="bold" />
<TextView
android:id="@+id/text_component_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/third_party_component_desc" />
</LinearLayout>

View File

@ -44,6 +44,7 @@
android:layout_marginStart="7dp"
android:layout_weight="1"
android:text="@string/component_episode_title"
android:textColor="?textPrimary"
android:textSize="16sp" />
<ImageView
@ -52,13 +53,15 @@
android:layout_height="30dp"
android:layout_margin="2dp"
android:contentDescription="@string/component_watched_desc"
app:srcCompat="@drawable/ic_baseline_check_circle_24" />
app:srcCompat="@drawable/ic_baseline_check_circle_24"
app:tint="?iconColor" />
</LinearLayout>
<TextView
android:id="@+id/text_episode_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:ellipsize="end"/>
android:ellipsize="end"
android:maxLines="3"
android:textColor="?textSecondary" />
</LinearLayout>

View File

@ -0,0 +1,57 @@
<?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:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="7dp">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/image_episode"
android:layout_width="192dp"
android:layout_height="108dp"
android:contentDescription="@string/component_poster_desc"
app:shapeAppearance="@style/ShapeAppearance.Teapod.RoundedPoster"
app:srcCompat="@color/md_disabled_text_dark_theme" />
<ImageView
android:id="@+id/image_episode_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bg_circle__black_transparent_24dp"
android:contentDescription="@string/button_play"
app:srcCompat="@drawable/ic_baseline_play_arrow_24"
app:tint="#FFFFFF" />
</FrameLayout>
<TextView
android:id="@+id/text_episode_title2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="@string/component_episode_title"
android:textColor="@color/textPrimaryDark"
android:textSize="16sp" />
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/textSecondaryDark" />
<TextView
android:id="@+id/text_episode_desc2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:text="@string/text_overview_ex"
android:textColor="@color/textPrimaryDark"/>
</LinearLayout>

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView 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="195dp"
android:layout_height="wrap_content"
android:backgroundTint="#FFFFFF"
android:backgroundTint="?themeSecondary"
android:visibility="visible"
app:cardCornerRadius="7dp"
app:cardElevation="4dp">
@ -23,7 +24,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@color/md_disabled_text_dark_theme" />
tools:srcCompat="@color/md_disabled_text_dark_theme" />
<TextView
android:id="@+id/text_title"

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#73000000">
<LinearLayout
android:id="@+id/exo_top_controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="12dp"
android:gravity="center"
android:orientation="horizontal">
<ImageButton
android:id="@+id/exo_close_player"
android:background="@android:color/transparent"
android:scaleType="fitXY"
android:layout_width="44dp"
android:layout_height="44dp"
android:contentDescription="@string/close_player"
android:padding="10dp"
app:srcCompat="@drawable/ic_baseline_arrow_back_24" />
<TextView
android:id="@+id/exo_text_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="44dp"
android:text="@string/text_title_ex"
android:textAlignment="center"
android:textColor="@color/exo_white"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/exo_main_controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<org.mosad.teapod.ui.components.RewindButton
android:id="@+id/rwd_10"
android:layout_width="100dp"
android:layout_height="wrap_content" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<ImageButton
android:id="@+id/exo_play_pause"
style="@style/ExoStyledControls.Button.Center.PlayPause"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_gravity="center"
android:contentDescription="@string/play_pause" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<org.mosad.teapod.ui.components.FastForwardButton
android:id="@+id/ffwd_10"
android:layout_width="100dp"
android:layout_height="wrap_content" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/exo_time_controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="@dimen/exo_styled_progress_margin_bottom">
<View
android:id="@+id/exo_progress_placeholder"
android:layout_width="0dp"
android:layout_height="@dimen/exo_styled_progress_layout_height"
android:layout_marginBottom="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/exo_remaining"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/exo_remaining"
style="@style/ExoStyledControls.TimeText.Position"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/exo_bottom_controls"
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_gravity="bottom"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="7dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/button_language"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="7dp"
android:text="@string/language"
android:textAllCaps="false"
app:icon="@drawable/ic_baseline_subtitles_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button_episodes"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_episodes"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="7dp"
android:text="@string/episodes"
android:textAllCaps="false"
app:icon="@drawable/ic_baseline_video_library_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/button_next_ep_c"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_next_ep_c"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/episode"
android:textAllCaps="false"
app:icon="@drawable/ic_baseline_skip_next_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

View File

@ -0,0 +1,46 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#73000000"
android:clickable="true"
android:focusable="true">
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="12dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageButton
android:id="@+id/button_close_episodes_list"
android:background="@android:color/transparent"
android:scaleType="fitXY"
android:layout_width="44dp"
android:layout_height="44dp"
android:contentDescription="@string/close_player"
android:padding="10dp"
app:srcCompat="@drawable/ic_baseline_arrow_back_24" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_episodes_player"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3"
tools:listitem="@layout/item_episode_player" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,99 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#73000000"
android:clickable="true"
android:focusable="true">
<LinearLayout
android:id="@+id/linear_top"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="12dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageButton
android:id="@+id/button_close_language_settings"
android:background="@android:color/transparent"
android:scaleType="fitXY"
android:layout_width="44dp"
android:layout_height="44dp"
android:contentDescription="@string/close_player"
android:padding="10dp"
app:srcCompat="@drawable/ic_baseline_arrow_back_24" />
<TextView
android:id="@+id/exo_text_language"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="44dp"
android:text="@string/language"
android:textAlignment="center"
android:textColor="@color/exo_white"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/linear_languages"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="56dp"
android:layout_marginEnd="56dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linear_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linear_top" />
<LinearLayout
android:id="@+id/linear_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="7dp"
android:gravity="end"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.material.button.MaterialButton
android:id="@+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="7dp"
android:text="@string/cancel"
android:textAllCaps="false"
android:textColor="@color/exo_white"
android:textSize="16sp"
app:backgroundTint="@color/buttonBackgroundLight"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save"
android:textAllCaps="false"
android:textColor="@color/themePrimaryDark"
android:textSize="16sp"
app:backgroundTint="@color/buttonBackgroundDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,235 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View File

@ -0,0 +1,13 @@
Copyright <YEAR> <COPYRIGHT HOLDER>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,750 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and
other kinds of works.
The licenses for most software and other practical works are designed to take
away your freedom to share and change the works. By contrast, the GNU General
Public License is intended to guarantee your freedom to share and change all
versions of a program--to make sure it remains free software for all its users.
We, the Free Software Foundation, use the GNU General Public License for most
of our software; it applies also to any other work released this way by its
authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for them if you wish), that
you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs, and that you know you
can do these things.
To protect your rights, we need to prevent others from denying you these rights
or asking you to surrender the rights. Therefore, you have certain responsibilities
if you distribute copies of the software, or if you modify it: responsibilities
to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must pass on to the recipients the same freedoms that you received.
You must make sure that they, too, receive or can get the source code. And
you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert
copyright on the software, and (2) offer you this License giving you legal
permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that
there is no warranty for this free software. For both users' and authors'
sake, the GPL requires that modified versions be marked as changed, so that
their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified
versions of the software inside them, although the manufacturer can do so.
This is fundamentally incompatible with the aim of protecting users' freedom
to change the software. The systematic pattern of such abuse occurs in the
area of products for individuals to use, which is precisely where it is most
unacceptable. Therefore, we have designed this version of the GPL to prohibit
the practice for those products. If such problems arise substantially in other
domains, we stand ready to extend this provision to those domains in future
versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States
should not allow patents to restrict development and use of software on general-purpose
computers, but in those that do, we wish to avoid the special danger that
patents applied to a free program could make it effectively proprietary. To
prevent this, the GPL assures that patents cannot be used to render the program
non-free.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of works,
such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this License.
Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals
or organizations.
To "modify" a work means to copy from or adapt all or part of the work in
a fashion requiring copyright permission, other than the making of an exact
copy. The resulting work is called a "modified version" of the earlier work
or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based on the
Program.
To "propagate" a work means to do anything with it that, without permission,
would make you directly or secondarily liable for infringement under applicable
copyright law, except executing it on a computer or modifying a private copy.
Propagation includes copying, distribution (with or without modification),
making available to the public, and in some countries other activities as
well.
To "convey" a work means any kind of propagation that enables other parties
to make or receive copies. Mere interaction with a user through a computer
network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices" to the
extent that it includes a convenient and prominently visible feature that
(1) displays an appropriate copyright notice, and (2) tells the user that
there is no warranty for the work (except to the extent that warranties are
provided), that licensees may convey the work under this License, and how
to view a copy of this License. If the interface presents a list of user commands
or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work for making
modifications to it. "Object code" means any non-source form of a work.
A "Standard Interface" means an interface that either is an official standard
defined by a recognized standards body, or, in the case of interfaces specified
for a particular programming language, one that is widely used among developers
working in that language.
The "System Libraries" of an executable work include anything, other than
the work as a whole, that (a) is included in the normal form of packaging
a Major Component, but which is not part of that Major Component, and (b)
serves only to enable use of the work with that Major Component, or to implement
a Standard Interface for which an implementation is available to the public
in source code form. A "Major Component", in this context, means a major essential
component (kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to produce
the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all the source
code needed to generate, install, and (for an executable work) run the object
code and to modify the work, including scripts to control those activities.
However, it does not include the work's System Libraries, or general-purpose
tools or generally available free programs which are used unmodified in performing
those activities but which are not part of the work. For example, Corresponding
Source includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically linked
subprograms that the work is specifically designed to require, such as by
intimate data communication or control flow between those subprograms and
other parts of the work.
The Corresponding Source need not include anything that users can regenerate
automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright
on the Program, and are irrevocable provided the stated conditions are met.
This License explicitly affirms your unlimited permission to run the unmodified
Program. The output from running a covered work is covered by this License
only if the output, given its content, constitutes a covered work. This License
acknowledges your rights of fair use or other equivalent, as provided by copyright
law.
You may make, run and propagate covered works that you do not convey, without
conditions so long as your license otherwise remains in force. You may convey
covered works to others for the sole purpose of having them make modifications
exclusively for you, or provide you with facilities for running those works,
provided that you comply with the terms of this License in conveying all material
for which you do not control copyright. Those thus making or running the covered
works for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of your copyrighted
material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure
under any applicable law fulfilling obligations under article 11 of the WIPO
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention
of technological measures to the extent such circumvention is effected by
exercising rights under this License with respect to the covered work, and
you disclaim any intention to limit operation or modification of the work
as a means of enforcing, against the work's users, your or third parties'
legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive
it, in any medium, provided that you conspicuously and appropriately publish
on each copy an appropriate copyright notice; keep intact all notices stating
that this License and any non-permissive terms added in accord with section
7 apply to the code; keep intact all notices of the absence of any warranty;
and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you
may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce
it from the Program, in the form of source code under the terms of section
4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and
giving a relevant date.
b) The work must carry prominent notices stating that it is released under
this License and any conditions added under section 7. This requirement modifies
the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone
who comes into possession of a copy. This License will therefore apply, along
with any applicable section 7 additional terms, to the whole of the work,
and all its parts, regardless of how they are packaged. This License gives
no permission to license the work in any other way, but it does not invalidate
such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate
Legal Notices; however, if the Program has interactive interfaces that do
not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works,
which are not by their nature extensions of the covered work, and which are
not combined with it such as to form a larger program, in or on a volume of
a storage or distribution medium, is called an "aggregate" if the compilation
and its resulting copyright are not used to limit the access or legal rights
of the compilation's users beyond what the individual works permit. Inclusion
of a covered work in an aggregate does not cause this License to apply to
the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections
4 and 5, provided that you also convey the machine-readable Corresponding
Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by the Corresponding Source fixed
on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by a written offer, valid for
at least three years and valid for as long as you offer spare parts or customer
support for that product model, to give anyone who possesses the object code
either (1) a copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical medium customarily
used for software interchange, for a price no more than your reasonable cost
of physically performing this conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written
offer to provide the Corresponding Source. This alternative is allowed only
occasionally and noncommercially, and only if you received the object code
with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis
or for a charge), and offer equivalent access to the Corresponding Source
in the same way through the same place at no further charge. You need not
require recipients to copy the Corresponding Source along with the object
code. If the place to copy the object code is a network server, the Corresponding
Source may be on a different server (operated by you or a third party) that
supports equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source. Regardless
of what server hosts the Corresponding Source, you remain obligated to ensure
that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform
other peers where the object code and Corresponding Source of the work are
being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from
the Corresponding Source as a System Library, need not be included in conveying
the object code work.
A "User Product" is either (1) a "consumer product", which means any tangible
personal property which is normally used for personal, family, or household
purposes, or (2) anything designed or sold for incorporation into a dwelling.
In determining whether a product is a consumer product, doubtful cases shall
be resolved in favor of coverage. For a particular product received by a particular
user, "normally used" refers to a typical or common use of that class of product,
regardless of the status of the particular user or of the way in which the
particular user actually uses, or expects or is expected to use, the product.
A product is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent the
only significant mode of use of the product.
"Installation Information" for a User Product means any methods, procedures,
authorization keys, or other information required to install and execute modified
versions of a covered work in that User Product from a modified version of
its Corresponding Source. The information must suffice to ensure that the
continued functioning of the modified object code is in no case prevented
or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically
for use in, a User Product, and the conveying occurs as part of a transaction
in which the right of possession and use of the User Product is transferred
to the recipient in perpetuity or for a fixed term (regardless of how the
transaction is characterized), the Corresponding Source conveyed under this
section must be accompanied by the Installation Information. But this requirement
does not apply if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has been installed
in ROM).
The requirement to provide Installation Information does not include a requirement
to continue to provide support service, warranty, or updates for a work that
has been modified or installed by the recipient, or for the User Product in
which it has been modified or installed. Access to a network may be denied
when the modification itself materially and adversely affects the operation
of the network or violates the rules and protocols for communication across
the network.
Corresponding Source conveyed, and Installation Information provided, in accord
with this section must be in a format that is publicly documented (and with
an implementation available to the public in source code form), and must require
no special password or key for unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this License
by making exceptions from one or more of its conditions. Additional permissions
that are applicable to the entire Program shall be treated as though they
were included in this License, to the extent that they are valid under applicable
law. If additional permissions apply only to part of the Program, that part
may be used separately under those permissions, but the entire Program remains
governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any
additional permissions from that copy, or from any part of it. (Additional
permissions may be written to require their own removal in certain cases when
you modify the work.) You may place additional permissions on material, added
by you to a covered work, for which you have or can give appropriate copyright
permission.
Notwithstanding any other provision of this License, for material you add
to a covered work, you may (if authorized by the copyright holders of that
material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of
sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices displayed
by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring
that modified versions of such material be marked in reasonable ways as different
from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors
of the material; or
e) Declining to grant rights under trademark law for use of some trade names,
trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by
anyone who conveys the material (or modified versions of it) with contractual
assumptions of liability to the recipient, for any liability that these contractual
assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "further restrictions"
within the meaning of section 10. If the Program as you received it, or any
part of it, contains a notice stating that it is governed by this License
along with a term that is a further restriction, you may remove that term.
If a license document contains a further restriction but permits relicensing
or conveying under this License, you may add to a covered work material governed
by the terms of that license document, provided that the further restriction
does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place,
in the relevant source files, a statement of the additional terms that apply
to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form
of a separately written license, or stated as exceptions; the above requirements
apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided
under this License. Any attempt otherwise to propagate or modify it is void,
and will automatically terminate your rights under this License (including
any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from
a particular copyright holder is reinstated (a) provisionally, unless and
until the copyright holder explicitly and finally terminates your license,
and (b) permanently, if the copyright holder fails to notify you of the violation
by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently
if the copyright holder notifies you of the violation by some reasonable means,
this is the first time you have received notice of violation of this License
(for any work) from that copyright holder, and you cure the violation prior
to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses
of parties who have received copies or rights from you under this License.
If your rights have been terminated and not permanently reinstated, you do
not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy
of the Program. Ancillary propagation of a covered work occurring solely as
a consequence of using peer-to-peer transmission to receive a copy likewise
does not require acceptance. However, nothing other than this License grants
you permission to propagate or modify any covered work. These actions infringe
copyright if you do not accept this License. Therefore, by modifying or propagating
a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives
a license from the original licensors, to run, modify and propagate that work,
subject to this License. You are not responsible for enforcing compliance
by third parties with this License.
An "entity transaction" is a transaction transferring control of an organization,
or substantially all assets of one, or subdividing an organization, or merging
organizations. If propagation of a covered work results from an entity transaction,
each party to that transaction who receives a copy of the work also receives
whatever licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the Corresponding
Source of the work from the predecessor in interest, if the predecessor has
it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights
granted or affirmed under this License. For example, you may not impose a
license fee, royalty, or other charge for exercise of rights granted under
this License, and you may not initiate litigation (including a cross-claim
or counterclaim in a lawsuit) alleging that any patent claim is infringed
by making, using, selling, offering for sale, or importing the Program or
any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this License
of the Program or a work on which the Program is based. The work thus licensed
is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned or controlled
by the contributor, whether already acquired or hereafter acquired, that would
be infringed by some manner, permitted by this License, of making, using,
or selling its contributor version, but do not include claims that would be
infringed only as a consequence of further modification of the contributor
version. For purposes of this definition, "control" includes the right to
grant patent sublicenses in a manner consistent with the requirements of this
License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
license under the contributor's essential patent claims, to make, use, sell,
offer for sale, import and otherwise run, modify and propagate the contents
of its contributor version.
In the following three paragraphs, a "patent license" is any express agreement
or commitment, however denominated, not to enforce a patent (such as an express
permission to practice a patent or covenant not to sue for patent infringement).
To "grant" such a patent license to a party means to make such an agreement
or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the
Corresponding Source of the work is not available for anyone to copy, free
of charge and under the terms of this License, through a publicly available
network server or other readily accessible means, then you must either (1)
cause the Corresponding Source to be so available, or (2) arrange to deprive
yourself of the benefit of the patent license for this particular work, or
(3) arrange, in a manner consistent with the requirements of this License,
to extend the patent license to downstream recipients. "Knowingly relying"
means you have actual knowledge that, but for the patent license, your conveying
the covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that country
that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement,
you convey, or propagate by procuring conveyance of, a covered work, and grant
a patent license to some of the parties receiving the covered work authorizing
them to use, propagate, modify or convey a specific copy of the covered work,
then the patent license you grant is automatically extended to all recipients
of the covered work and works based on it.
A patent license is "discriminatory" if it does not include within the scope
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
of one or more of the rights that are specifically granted under this License.
You may not convey a covered work if you are a party to an arrangement with
a third party that is in the business of distributing software, under which
you make payment to the third party based on the extent of your activity of
conveying the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by you
(or copies made from those copies), or (b) primarily for and in connection
with specific products or compilations that contain the covered work, unless
you entered into that arrangement, or that patent license was granted, prior
to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied
license or other defenses to infringement that may otherwise be available
to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise)
that contradict the conditions of this License, they do not excuse you from
the conditions of this License. If you cannot convey a covered work so as
to satisfy simultaneously your obligations under this License and any other
pertinent obligations, then as a consequence you may not convey it at all.
For example, if you agree to terms that obligate you to collect a royalty
for further conveying from those to whom you convey the Program, the only
way you could satisfy both those terms and this License would be to refrain
entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to
link or combine any covered work with a work licensed under version 3 of the
GNU Affero General Public License into a single combined work, and to convey
the resulting work. The terms of this License will continue to apply to the
part which is the covered work, but the special requirements of the GNU Affero
General Public License, section 13, concerning interaction through a network
will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the
GNU General Public License from time to time. Such new versions will be similar
in spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program specifies
that a certain numbered version of the GNU General Public License "or any
later version" applies to it, you have the option of following the terms and
conditions either of that numbered version or of any later version published
by the Free Software Foundation. If the Program does not specify a version
number of the GNU General Public License, you may choose any version ever
published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of
the GNU General Public License can be used, that proxy's public statement
of acceptance of a version permanently authorizes you to choose that version
for the Program.
Later license versions may give you additional or different permissions. However,
no additional obligations are imposed on any author or copyright holder as
a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot
be given local legal effect according to their terms, reviewing courts shall
apply local law that most closely approximates an absolute waiver of all civil
liability in connection with the Program, unless a warranty or assumption
of liability accompanies a copy of the Program in return for a fee. END OF
TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively state the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like
this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain
conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands might
be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. For
more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General Public
License instead of this License. But first, please read <https://www.gnu.org/
licenses /why-not-lgpl.html>.

View File

@ -0,0 +1,10 @@
Copyright <YEAR> <COPYRIGHT HOLDER>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -52,7 +52,7 @@
<name>Glide</name>
<url>https://github.com/bumptech/glide</url>
<copyright>Copyright Google, Inc</copyright>
<license>BSD 3-Clause License</license>
<license>BSD 2-Clause License</license>
</notice>
<notice>
<name>Glide Transformations</name>
@ -60,4 +60,9 @@
<copyright>Copyright 2020 Wasabeef</copyright>
<license>Apache Software License 2.0</license>
</notice>
<notice>
<name>The Movie Database API</name>
<url>https://www.themoviedb.org</url>
<copyright>This product uses the TMDb API but is not endorsed or certified by TMDb</copyright>
</notice>
</notices>

View File

@ -6,8 +6,11 @@
<string name="title_account">Account</string>
<!-- home fragment -->
<string name="highlight_media">Highlight</string>
<string name="my_list">Meine Liste</string>
<string name="new_episodes">Neue Episoden</string>
<string name="new_simulcasts">Neue Simulcasts</string>
<string name="new_titles">Neue Titel</string>
<!-- search fragment -->
<string name="search_hint">Suche nach Filmen und Serien</string>
@ -16,19 +19,42 @@
<string name="button_play">Abspielen</string>
<string name="text_episodes_count">%1$d Episoden</string>
<string name="text_runtime">%1$d Minuten</string>
<string name="component_episode_title">Episode %1$d %2$s</string>
<string name="component_episode_title_sub">Episode %1$d %2$s (OmU)</string>
<string name="component_episode_title">Flg. %1$d %2$s</string>
<string name="component_episode_title_sub">Flg. %1$d %2$s (OmU)</string>
<!-- settings fragment -->
<string name="account">Account</string>
<string name="account_login_desc">Zum bearbeiten tippen</string>
<string name="info">Info</string>
<string name="info_about_desc">Version %1$s (%2$s)</string>
<string name="info_about_dialog">Diese App wird unter den Bedingungen der GNU GPL 3 oder höher zur Verfügung gestellt. Weiter Informationen findest du unter: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz</string>
<string name="licenses">Lizenzen</string>
<string name="settings">Einstellungen</string>
<string name="settings_secondary">Bevorzuge alternativen Stream</string>
<string name="settings_secondary_desc">Untertitle-Stream verwenden, sofern vorhanden</string>
<string name="settings_secondary">Bevorzuge Japanisch (OmU)</string>
<string name="settings_secondary_desc">Japanisch verwenden, sofern vorhanden</string>
<string name="settings_autoplay">Autoplay</string>
<string name="settings_autoplay_desc">Nächste Episode automatisch abspielen</string>
<string name="theme">Design</string>
<string name="theme_light">Hell</string>
<string name="theme_dark">Dunkel</string>
<!-- about fragment -->
<string name="about_info">
Teapod ist eine inoffizielle App für Anime on Demand.
Sie wird unter den Bedingungen der GNU GPL 3 oder höher zur Verfügung gestellt.
\n\n
© 2020-2021 seil0@mosad.xyz
</string>
<string name="third_party_heading">Lizenzen von Drittanbietern</string>
<string name="third_party_component_desc">© %1$s %2$s unter %3$s</string>
<!-- player -->
<string name="close_player">Player schließen</string>
<string name="rewind_10">10 Sekunden zurück</string>
<string name="play_pause">Abspielen/Pause</string>
<string name="forward_10">10 Sekunden vorwärts</string>
<string name="next_episode">Nächste Folge</string>
<string name="language">Sprache</string>
<string name="episodes">Folgen</string>
<string name="episode">Folge</string>
<!-- dialogs -->
<string name="save">speichern</string>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr format="color" name="themePrimary"/>
<attr format="color" name="themeSecondary"/>
<attr format="color" name="textPrimary"/>
<attr format="color" name="textSecondary"/>
<attr format="color" name="textBackground"/>
<attr format="color" name="iconColor"/>
<attr format="color" name="buttonBackground"/>
</resources>

View File

@ -1,8 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<!-- base theme colors -->
<color name="colorPrimary">#66aa00</color>
<color name="colorPrimaryLight">#99dc45</color>
<color name="colorPrimaryDark">#317a00</color>
<color name="colorAccent">#607d8b</color>
<color name="ic_launcher_background">#FFFFFF</color>
<!-- light theme colors -->
<color name="themePrimaryLight">#ffffff</color>
<color name="themeSecondaryLight">#ffffff</color>
<color name="textPrimaryLight">#de000000</color>
<color name="textSecondaryLight">#99000000</color>
<color name="textBackgroundLight">#55000000</color>
<color name="iconColorLight">#99000000</color>
<color name="buttonBackgroundLight">#000000</color>
<!-- dark theme colors -->
<color name="themePrimaryDark">#121212</color>
<color name="themeSecondaryDark">#202020</color>
<color name="textPrimaryDark">#deffffff</color>
<color name="textSecondaryDark">#99ffffff</color>
<color name="textBackgroundDark">#55ffffff</color>
<color name="iconColorDark">#99ffffff</color>
<color name="buttonBackgroundDark">#ffffff</color>
<color name="controlHighlightDark">#11ffffff</color>
<color name="ic_launcher_background">#ffffff</color>
</resources>

View File

@ -6,8 +6,11 @@
<string name="title_account">Account</string>
<!-- home fragment -->
<string name="highlight_media">Highlight</string>
<string name="my_list">My list</string>
<string name="new_episodes">New episodes</string>
<string name="new_simulcasts">New simulcasts</string>
<string name="new_titles">New titles</string>
<!-- search fragment -->
<string name="search_hint">Search for movies and series</string>
@ -21,8 +24,8 @@
<string name="text_age_ex" translatable="false">6</string>
<string name="text_episodes_count">%1$d episodes</string>
<string name="text_runtime">%1$d Minutes</string>
<string name="component_episode_title">Episode %1$d %2$s</string>
<string name="component_episode_title_sub">Episode %1$d %2$s (Sub)</string>
<string name="component_episode_title">Ep. %1$d %2$s</string>
<string name="component_episode_title_sub">Ep. %1$d %2$s (Sub)</string>
<string name="component_poster_desc" translatable="false">episode poster</string>
<string name="component_watched_desc" translatable="false">already watched</string>
@ -33,11 +36,40 @@
<string name="info">Info</string>
<string name="info_about" translatable="false">Teapod by @Seil0</string>
<string name="info_about_desc">Version %1$s (%2$s)</string>
<string name="info_about_dialog">This app is published under the terms and conditions of the GNU GPL 3 or later. For further information visit: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz</string>
<string name="licenses">Licenses</string>
<string name="settings">Settings</string>
<string name="settings_secondary">Prefer secondary (sub) stream</string>
<string name="settings_secondary_desc">Use the subtitles stream if present</string>
<string name="settings_secondary">Prefer japanese (sub)</string>
<string name="settings_secondary_desc">Use the japanese, if present</string>
<string name="settings_autoplay">Autoplay</string>
<string name="settings_autoplay_desc">Play next episode automatically</string>
<string name="theme">Theme</string>
<string name="theme_light">Light</string>
<string name="theme_dark">Dark</string>
<!-- about fragment -->
<string name="about_info">
Teapod is an unofficial app for anime on demand.
It is published under the terms and conditions of the GNU GPL 3 or later.
\n\n
© 2020-2021 seil0@mosad.xyz
</string>
<string name="tmdb_notice" translatable="false">This product uses the TMDb API but is not endorsed or certified by TMDb.</string>
<string name="teapod_repo" translatable="false">git.mosad.xyz/Seil0/teapod</string>
<string name="third_party_heading">Third Party Licenses</string>
<string name="third_party_component_desc">© %1$s %2$s under %3$s</string>
<!-- player -->
<string name="close_player">close player</string>
<string name="rewind_10">rewind 10 seconds</string>
<string name="play_pause">play/pause</string>
<string name="forward_10">forward 10 seconds</string>
<string name="rwd_10_s" translatable="false">- 10 s</string>
<string name="fwd_10_s" translatable="false">+ 10 s</string>
<string name="next_episode">Next Episode</string>
<string name="time_min_sec" translatable="false">%1$02d:%2$02d</string>
<string name="time_hour_min_sec" translatable="false">%1$d:%2$02d:%3$02d</string>
<string name="language">Language</string>
<string name="episodes">Episodes</string>
<string name="episode">Episode</string>
<!-- dialogs -->
<string name="save">save</string>
@ -55,9 +87,12 @@
<string name="save_key_user_login" translatable="false">org.mosad.teapod.user_login</string>
<string name="save_key_user_password" translatable="false">org.mosad.teapod.user_password</string>
<string name="save_key_prefer_secondary" translatable="false">org.mosad.teapod.prefer_secondary</string>
<string name="save_key_autoplay" translatable="false">org.mosad.teapod.autoplay</string>
<string name="save_key_theme" translatable="false">org.mosad.teapod.theme</string>
<!-- intents & states -->
<string name="intent_stream_url" translatable="false">intent_stream_url</string>
<string name="intent_media_id" translatable="false">intent_media_id</string>
<string name="intent_episode_id" translatable="false">intent_episode_id</string>
<string name="state_resume_window" translatable="false">state_resume_window</string>
<string name="state_resume_position" translatable="false">state_resume_position</string>
<string name="state_is_playing" translatable="false">state_is_playing</string>

View File

@ -1,19 +1,61 @@
<resources>
<!-- Base application theme. -->
<!-- application themes -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Light" parent="AppTheme">
<item name="themePrimary">@color/themePrimaryLight</item>
<item name="themeSecondary">@color/themeSecondaryLight</item>
<item name="textPrimary">@color/textPrimaryLight</item>
<item name="textSecondary">@color/textSecondaryLight</item>
<item name="android:textColor">@color/textPrimaryLight</item>
<item name="android:textColorPrimary">@color/textPrimaryLight</item>
<item name="android:textColorHint">@color/textSecondaryLight</item>
<item name="textBackground">@color/textBackgroundLight</item>
<item name="iconColor">@color/iconColorLight</item>
<item name="buttonBackground">@color/buttonBackgroundLight</item>
<item name="md_background_color">@color/themeSecondaryLight</item>
<item name="md_color_content">@color/textSecondaryLight</item>
</style>
<style name="AppTheme.Dark" parent="AppTheme">
<item name="themePrimary">@color/themePrimaryDark</item>
<item name="themeSecondary">@color/themeSecondaryDark</item>
<item name="textPrimary">@color/textPrimaryDark</item>
<item name="textSecondary">@color/textSecondaryDark</item>
<item name="android:textColor">@color/textPrimaryDark</item>
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="android:textColorHint">@color/textSecondaryDark</item>
<item name="textBackground">@color/textBackgroundDark</item>
<item name="iconColor">@color/iconColorDark</item>
<item name="buttonBackground">@color/buttonBackgroundDark</item>
<item name="md_background_color">@color/themeSecondaryDark</item>
<item name="md_color_content">@color/textSecondaryDark</item>
<!-- without this, the unchecked single choice buttons while be black -->
<item name="md_color_widget_unchecked">@color/textSecondaryDark</item>
<!-- change on click indicator color for manually set components -->
<item name="colorControlHighlight">@color/controlHighlightDark</item>
</style>
<style name="LicensesDialogTheme.Dark" parent="Theme.AppCompat.Dialog">
<item name="android:windowBackground">@color/themeSecondaryDark</item>
</style>
<!-- player theme -->
<style name="PlayerTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
<!-- splash theme -->
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/bg_splash</item>
</style>

View File

@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.10"
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -0,0 +1,9 @@
* überarbeitetes Player Interface (#10)
* Autoplay für Serien
* Gesten für Vor-/Zurückspulen(doppelt tippen), Pause/Abspielen (lang tippen)
* verbleibende Zeit und Titel
* Unterstützung für Themes (#13)
* helles/dunkles Themes
* Primärfarbe angepasst
* Fehler beim Hinzufügen/löschen in "Meine Liste" behoben (#15)
* Fehler beim Parsen von Serien behoben

View File

@ -0,0 +1,3 @@
* Ein Fehler wurde behoben, bei dem Autoplay Folgen überspringen konnte
* Der Player zeigt nun einen Button an, um zur nächsten Folge zu springen
* Die UI wurde an einigen Stellen angepasst

View File

@ -0,0 +1,7 @@
* Die Startseite zeigt nun Highlights, neue Simulcast und neue Titel an
* Player Interface 2 (#16)
* Episodenübersicht
* Sprachauswahl
* Der Infodialog wurde überarbeitet (#17)
* Einige Fehler beim Parsen der AoD Webseite wurden behoben (#20)
* Die Themes wurden besser an die Material Design Richtlinien angepasst

View File

@ -5,7 +5,7 @@ Teapod ist eine inoffizielle App für Anime-on-Demand (AoD).
* Bevorzuge die OmU Version über die App-Einstellungen
* Speicher deine lieblings Anime in "Meine Liste"
Zur Verfügung gestellt unter den Bedingungen der GNU GPL 3 oder höher.
Um Teapod zu verwenden musst du dich mit deinem AoD Account anmelden.
Dieses Projekt ist in keiner Weise mit Anime-on-Demand verbunden.
Bitte melde Fehler und Probleme an support@mosad.xyz

View File

@ -0,0 +1,7 @@
* the Home screen now contains Highlights, new Simulcasts and new Titles
* Player Interface 2 (#16)
* episodes list
* language selection
* the about dialog has been reworked (#17)
* a few issues with the AoDParses have been resolved (#20)
* theme colors now better reflect the material design guidelines

View File

@ -5,7 +5,7 @@ Teapod is a unoffical App for Anime-on-Demand (AoD).
* Prefer the OmU version via the app settings
* Save your favorite animes to "My List"
Licensed under the terms and conditions of GPL 3.
To use Teapod you have to login with your AoD account.
This Project is not associated with Anime-on-Demand in any way.
Please report bugs and issues to support@mosad.xyz

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

View File

@ -0,0 +1 @@
Teapod

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Tue Oct 13 12:04:29 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

53
gradlew vendored
View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# 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
#
# https://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.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

22
gradlew.bat vendored
View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%