Merge branch 'master' into background-mode

This commit is contained in:
Iker 2022-05-26 21:43:30 +02:00 committed by GitHub
commit 4904858649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
331 changed files with 8223 additions and 2311 deletions

View File

@ -1,29 +0,0 @@
---
name: Bug report
about: Create a bug report to help fix an issue with LibreTube
title: "[BUG] <brief bug description>"
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
<!--
Please use the latest version of LibreTube
-->
**Smartphone (please complete the following information):**
- Device: [e.g. Xiamoi Note 10]
- Android version: [e.g. 10]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,35 @@
name: ⭐ Feature request
description: Suggest a feature to improve the app
labels: [enhancement]
body:
- type: textarea
id: feature-description
attributes:
label: Describe your suggested feature
description: How can an existing source be improved?
placeholder: |
Example:
"It should work like this..."
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
required: true
- label: I have written a short but informative title.
required: true
- label: I will fill out all of the requested information in this form.
required: true

View File

@ -1,14 +0,0 @@
---
name: Feature request
about: Suggest a feature that would improve LibreTube
title: "[FEATURE] <description of feature>"
labels: enhancement
assignees: ''
---
**Describe the feature you'd like to see added**
A short description of the feature, and what it would accomplish.
**Additional context**
Add any other context or screenshots about the feature request here.

79
.github/ISSUE_TEMPLATE/report_bug.yml vendored Normal file
View File

@ -0,0 +1,79 @@
name: 🐞 Issue Report
description: Report a issue in LibreTube
labels: [bug]
body:
- type: textarea
id: reproduce-steps
attributes:
label: Steps to reproduce
description: Provide an example of the issue.
placeholder: |
Example:
1. First step
2. Second step
3. Issue here
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
placeholder: |
Example:
"This should happen..."
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
placeholder: |
Example:
"This happened instead..."
validations:
required: true
- type: input
id: libretube-version
attributes:
label: LibreTube version
description: |
You can find your LibreTube version in **Settings**.
placeholder: |
Example: "0.2.6"
validations:
required: true
- type: input
id: android-version
attributes:
label: Android version
description: |
You can find this somewhere in your Android settings.
placeholder: |
Example: "Android 12"
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
required: true
- label: I have written a short but informative title.
required: true
- label: I will fill out all of the requested information in this form.
required: true

12
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,12 @@
version: 2
updates:
# Maintain dependencies for Gradle
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@ -4,36 +4,36 @@ on:
workflow_dispatch:
pull_request:
paths-ignore:
- 'README*.md'
- 'fastlane/**'
- 'assets/**'
- '.github/**/*.md'
- "README*.md"
- "fastlane/**"
- "assets/**"
- ".github/**/*.md"
push:
paths-ignore:
- 'README*.md'
- 'fastlane/**'
- 'assets/**'
- '.github/**/*.md'
- "README*.md"
- "fastlane/**"
- "assets/**"
- ".github/**/*.md"
jobs:
debug-builds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 11
distribution: "temurin"
cache: 'gradle'
cache: "gradle"
- name: Build debug APK and run jvm tests
run: ./gradlew assembleDebug
- name: Upload APK
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: app
path: app/build/outputs/apk/debug/*.apk

View File

@ -13,12 +13,12 @@ name: "CodeQL"
on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '16 14 * * 4'
- cron: "16 14 * * 4"
jobs:
analyze:
@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
language: ["java"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
@ -42,7 +42,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@ -67,4 +67,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2

18
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: reviewdog
on: [pull_request]
jobs:
ktlint:
name: Check Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: ktlint
uses: ScaCap/action-ktlint@1.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
android: true
fail_on_error: true

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ google-services.json
# Android Profiling
*.hprof
.DS_Store

View File

@ -1,15 +1,16 @@
<div align="center">
<img src="https://avatars.githubusercontent.com/u/96022078?s=200&v=4" width="150" height="150" alt="LibreTube">
<h1>LibreTube</h1>
<p>Alternative YouTube frontend for Android<br />built with <a href="https://github.com/TeamPiped/Piped">Piped</a></p>
<img src="https://libre-tube.github.io/assets/gh-banner.png" width="auto" height="auto" alt="LibreTube">
[![GPL-v3](https://shields.io/badge/License-GPL%20v3-red.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)
[![Matrix](https://badges.alefvanoon.xyz/matrix/LibreTube:matrix.org)](https://matrix.to/#/#LibreTube:matrix.org)
[![GPL-v3](https://libre-tube.github.io/assets/license-widget.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)
[![Matrix](https://libre-tube.github.io/assets/mat-widget.svg)](https://matrix.to/#/#LibreTube:matrix.org)
[![Telegram](https://libre-tube.github.io/assets/tg-widget.svg)](https://t.me/libretube)
[![Twitter](https://libre-tube.github.io/assets/tw-widget.svg)](https://twitter.com/libretube)
[![Reddit](https://libre-tube.github.io/assets/rd-widget.svg)](https://www.reddit.com/r/Libretube/)
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid" height="80">](https://f-droid.org/en/packages/com.github.libretube/)
[<img src="https://github.com/machiav3lli/oandbackupx/blob/034b226cea5c1b30eb4f6a6f313e4dadcbb0ece4/badge_github.png" alt="Get it on GitHub" height="80">](https://github.com/libre-tube/LibreTube/releases/latest)
[<img src="https://libre-tube.github.io/assets/fdrload.png" alt="Get it on F-Droid" height="80">](https://f-droid.org/en/packages/com.github.libretube/)
[<img src="https://libre-tube.github.io/assets/ghload.png" alt="Get it on GitHub" height="80">](https://github.com/libre-tube/LibreTube/releases/latest)
[<img src="https://libre-tube.github.io/assets/tgload.png" alt="Get it on GitHub" height="80">](https://t.me/LibreTube)
</div>
WARNING: THIS IS A BETA VERSION, THEREFORE YOU MAY ENCOUNTER BUGS. IF YOU DO, OPEN AN ISSUE VIA OUR GITHUB REPOSITORY.
## Screenshots
@ -25,22 +26,32 @@ WARNING: THIS IS A BETA VERSION, THEREFORE YOU MAY ENCOUNTER BUGS. IF YOU DO, OP
## Features
| Feature | Availability |
| Feature ||
| - | - |
| User Accounts | ✅ |
| Subscriptions | ✅ ||
| User Playlists | 🔴 |
| Trending | ✅ |
| Channels | ✅ |
| Subscriptions | ✅ |
| User Playlists | ✅ |
| Channel Playlists | ✅ |
| Search | ✅ |
| Search Suggestions | ✅ |
| Search Filters | 🔴 |
| Search Filters | ✅ |
| SponsorBlock | ✅ |
| Subtitles | ✅ |
| Comments | 🔴 |
| Comments | |
## Contributing
If you're interested in contributing, you can browse the [issues](https://github.com/libre-tube/libretube/issues) list or create a new one to discuss your feature idea. Every contribution is very welcome.
Whether you have ideas, translations, design changes, code cleaning, or real heavy code changes, help is always welcome. The more is done the better it gets!
WARNING: THIS IS A BETA VERSION, THEREFORE YOU MAY ENCOUNTER BUGS. IF YOU DO, OPEN AN ISSUE VIA OUR GITHUB REPOSITORY.
### Translation
<a href="https://hosted.weblate.org/projects/libretube/#languages">
<img src="https://hosted.weblate.org/widgets/libretube/-/287x66-grey.png" alt="Translation status" />
</a>
### Donate
**BTC:** `bc1qfcgqwddr894mywn9rk2crzlgvlac3prkwhdrdq`
**BTC:** `bc1q0hk2smc74ej8fxupfrp05wk867e54e2zztnxfc`
**XMR:** `44txdmy4E5bDzMYQJh1ZSoHbrp1sWfpGa2FYg26L2ya8EaRejPsh42yVrYhepW9P4YWvrqmTZvms35z5FDgqy1xcVewk18d`
## Mirrors (read-only)
<a href="https://gitlab.com/libretube/LibreTube">GitLab</a></p>

View File

@ -10,8 +10,8 @@ android {
applicationId 'com.github.libretube'
minSdk 21
targetSdk 31
versionCode 7
versionName '0.2.5'
versionCode 10
versionName '0.3.0'
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
resValue "string", "app_name", "LibreTube"
@ -51,6 +51,7 @@ android {
excludes += ['lib/armeabi-v7a/*_neon.so']
}
}
namespace 'com.github.libretube'
}
dependencies {

View File

@ -20,19 +20,6 @@
"versionName": "0.2.5",
"outputFile": "app-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 7,
"versionName": "0.2.5",
"outputFile": "app-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
@ -46,6 +33,19 @@
"versionName": "0.2.5",
"outputFile": "app-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 7,
"versionName": "0.2.5",
"outputFile": "app-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [

View File

@ -1,13 +1,11 @@
package com.github.libretube
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.libretube">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@ -11,11 +10,11 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_libretube"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_libretube_round"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LibreTube"
android:theme="@style/Theme.MY"
android:name=".myApp"
android:networkSecurityConfig="@xml/network_security_config"
android:largeHeap="true"
@ -27,10 +26,14 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:configChanges="orientation|screenSize"
/>
<activity
android:name=".SettingsActivity"
android:label="@string/settings" />
<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="orientation|screenSize"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
>
@ -133,6 +136,126 @@
<data android:pathPrefix="/" />
</intent-filter>
</activity>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_gradient"
android:roundIcon="@mipmap/ic_gradient_round"
android:name=".IconGradient"
android:enabled="false"
android:targetActivity=".MainActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_fire"
android:roundIcon="@mipmap/ic_fire_round"
android:name=".IconFire"
android:enabled="false"
android:targetActivity=".MainActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_flame"
android:roundIcon="@mipmap/ic_flame_round"
android:name=".IconFlame"
android:enabled="false"
android:targetActivity=".MainActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_shaped"
android:roundIcon="@mipmap/ic_shaped_round"
android:name=".IconShaped"
android:enabled="false"
android:targetActivity=".MainActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_torch"
android:roundIcon="@mipmap/ic_torch_round"
android:name=".IconTorch"
android:enabled="false"
android:targetActivity=".MainActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_legacy"
android:roundIcon="@mipmap/ic_legacy_round"
android:name=".IconLegacy"
android:enabled="false"
android:targetActivity=".MainActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_bird"
android:roundIcon="@mipmap/ic_bird_round"
android:name=".IconBird"
android:enabled="false"
android:targetActivity=".MainActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:hardwareAccelerated="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<service
android:name=".DownloadService"
android:enabled="true"

View File

@ -0,0 +1,632 @@
<!DOCTYPE html>
<html lang="en">
<body>
<h3 style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
<p style="text-align: center;">Version 3, 29 June 2007</p>
<p>Copyright &copy; 2007 Free Software Foundation, Inc.
&lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;</p><p>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.</p>
<h3><a name="preamble"></a>Preamble</h3>
<p>The GNU General Public License is a free, copyleft license for
software and other kinds of works.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>The precise terms and conditions for copying, distribution and
modification follow.</p>
<h3><a name="terms"></a>TERMS AND CONDITIONS</h3>
<h4><a name="section0"></a>0. Definitions.</h4>
<p>&ldquo;This License&rdquo; refers to version 3 of the GNU General Public License.</p>
<p>&ldquo;Copyright&rdquo; also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.</p>
<p>&ldquo;The Program&rdquo; refers to any copyrightable work licensed under this
License. Each licensee is addressed as &ldquo;you&rdquo;. &ldquo;Licensees&rdquo; and
&ldquo;recipients&rdquo; may be individuals or organizations.</p>
<p>To &ldquo;modify&rdquo; 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 &ldquo;modified version&rdquo; of the
earlier work or a work &ldquo;based on&rdquo; the earlier work.</p>
<p>A &ldquo;covered work&rdquo; means either the unmodified Program or a work based
on the Program.</p>
<p>To &ldquo;propagate&rdquo; 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.</p>
<p>To &ldquo;convey&rdquo; 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.</p>
<p>An interactive user interface displays &ldquo;Appropriate Legal Notices&rdquo;
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.</p>
<h4><a name="section1"></a>1. Source Code.</h4>
<p>The &ldquo;source code&rdquo; for a work means the preferred form of the work
for making modifications to it. &ldquo;Object code&rdquo; means any non-source
form of a work.</p>
<p>A &ldquo;Standard Interface&rdquo; 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.</p>
<p>The &ldquo;System Libraries&rdquo; 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
&ldquo;Major Component&rdquo;, 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.</p>
<p>The &ldquo;Corresponding Source&rdquo; 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.</p>
<p>The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.</p>
<p>The Corresponding Source for a work in source code form is that
same work.</p>
<h4><a name="section2"></a>2. Basic Permissions.</h4>
<p>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.</p>
<p>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.</p>
<p>Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.</p>
<h4><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
<p>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.</p>
<p>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.</p>
<h4><a name="section4"></a>4. Conveying Verbatim Copies.</h4>
<p>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.</p>
<p>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.</p>
<h4><a name="section5"></a>5. Conveying Modified Source Versions.</h4>
<p>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:</p>
<ul>
<li>a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.</li>
<li>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
&ldquo;keep intact all notices&rdquo;.</li>
<li>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.</li>
<li>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.</li>
</ul>
<p>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
&ldquo;aggregate&rdquo; 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.</p>
<h4><a name="section6"></a>6. Conveying Non-Source Forms.</h4>
<p>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:</p>
<ul>
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
</ul>
<p>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.</p>
<p>A &ldquo;User Product&rdquo; is either (1) a &ldquo;consumer product&rdquo;, 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, &ldquo;normally used&rdquo; 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.</p>
<p>&ldquo;Installation Information&rdquo; 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.</p>
<p>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).</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section7"></a>7. Additional Terms.</h4>
<p>&ldquo;Additional permissions&rdquo; 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.</p>
<p>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.</p>
<p>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:</p>
<ul>
<li>a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or</li>
<li>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</li>
<li>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</li>
<li>d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or</li>
<li>e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or</li>
<li>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.</li>
</ul>
<p>All other non-permissive additional terms are considered &ldquo;further
restrictions&rdquo; 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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section8"></a>8. Termination.</h4>
<p>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).</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h4>
<p>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.</p>
<h4><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h4>
<p>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.</p>
<p>An &ldquo;entity transaction&rdquo; 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.</p>
<p>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.</p>
<h4><a name="section11"></a>11. Patents.</h4>
<p>A &ldquo;contributor&rdquo; 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 &ldquo;contributor version&rdquo;.</p>
<p>A contributor's &ldquo;essential patent claims&rdquo; 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, &ldquo;control&rdquo; includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.</p>
<p>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.</p>
<p>In the following three paragraphs, a &ldquo;patent license&rdquo; 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 &ldquo;grant&rdquo; such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.</p>
<p>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. &ldquo;Knowingly relying&rdquo; 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.</p>
<p>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.</p>
<p>A patent license is &ldquo;discriminatory&rdquo; 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.</p>
<p>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.</p>
<h4><a name="section12"></a>12. No Surrender of Others' Freedom.</h4>
<p>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.</p>
<h4><a name="section13"></a>13. Use with the GNU Affero General Public License.</h4>
<p>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.</p>
<h4><a name="section14"></a>14. Revised Versions of this License.</h4>
<p>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.</p>
<p>Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License &ldquo;or any later version&rdquo; 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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section15"></a>15. Disclaimer of Warranty.</h4>
<p>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 &ldquo;AS IS&rdquo; 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.</p>
<h4><a name="section16"></a>16. Limitation of Liability.</h4>
<p>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.</p>
<h4><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h4>
<p>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.</p>
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -4,16 +4,21 @@ import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.View
import android.widget.*
import androidx.appcompat.app.AlertDialog
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.Spinner
import android.widget.TextView
import android.widget.Toast
import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.adapters.PlaylistsAdapter
import com.github.libretube.obj.PlaylistId
import retrofit2.HttpException
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import retrofit2.HttpException
class AddtoPlaylistDialog : DialogFragment() {
private val TAG = "AddToPlaylistDialog"
@ -24,83 +29,95 @@ class AddtoPlaylistDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return activity?.let {
videoId = arguments?.getString("videoId")!!
val builder = AlertDialog.Builder(it)
val builder = MaterialAlertDialogBuilder(it)
// Get the layout inflater
val inflater = requireActivity().layoutInflater;
val inflater = requireActivity().layoutInflater
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
token = sharedPref?.getString("token","")!!
token = sharedPref?.getString("token", "")!!
var view: View = inflater.inflate(R.layout.dialog_addtoplaylist, null)
spinner = view.findViewById(R.id.playlists_spinner)
button = view.findViewById(R.id.addToPlaylist)
if(token!=""){
if (token != "") {
fetchPlaylists()
}
val typedValue = TypedValue()
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
val appName = HtmlCompat.fromHtml(
"Libre<span style='color:$hexColor';>Tube</span>",
HtmlCompat.FROM_HTML_MODE_COMPACT
)
view.findViewById<TextView>(R.id.title).text = appName
builder.setView(view)
builder.create()
} ?: throw IllegalStateException("Activity cannot be null")
}
private fun fetchPlaylists(){
private fun fetchPlaylists() {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.playlists(token)
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context,R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context,R.string.server_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
if (response.isNotEmpty()){
if (response.isNotEmpty()) {
var names = emptyList<String>().toMutableList()
for(playlist in response){
for (playlist in response) {
names.add(playlist.name!!)
}
val arrayAdapter = ArrayAdapter(requireContext(),android.R.layout.simple_spinner_item,names)
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
val arrayAdapter =
ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, names)
arrayAdapter.setDropDownViewResource(
android.R.layout.simple_spinner_dropdown_item
)
spinner.adapter = arrayAdapter
runOnUiThread {
button.setOnClickListener {
addToPlaylist(response[spinner.selectedItemPosition].id!!)
}
}
}else{
} else {
}
}
}
run()
}
private fun addToPlaylist(playlistId: String){
private fun addToPlaylist(playlistId: String) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.addToPlaylist(token, PlaylistId(playlistId, videoId))
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context,R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context,R.string.server_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
if (response.message == "ok"){
Toast.makeText(context,R.string.success, Toast.LENGTH_SHORT).show()
if (response.message == "ok") {
Toast.makeText(context, R.string.success, Toast.LENGTH_SHORT).show()
dialog?.dismiss()
}else{
Toast.makeText(context,R.string.fail, Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(context, R.string.fail, Toast.LENGTH_SHORT).show()
}
}
}
run()
}
private fun Fragment?.runOnUiThread(action: () -> Unit) {
this ?: return
if (!isAdded) return // Fragment not attached to an Activity

View File

@ -1,13 +1,9 @@
package com.github.libretube
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.opengl.Visibility
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -23,18 +19,17 @@ import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.obj.Subscribe
import com.google.android.material.button.MaterialButton
import com.squareup.picasso.Picasso
import retrofit2.HttpException
import java.io.IOException
import retrofit2.HttpException
class ChannelFragment : Fragment() {
private var channel_id: String? = null
private val TAG = "ChannelFragment"
var nextPage: String? =null
var nextPage: String? = null
var channelAdapter: ChannelAdapter? = null
var isLoading = true
var isSubscribed: Boolean =false
var isSubscribed: Boolean = false
private var refreshLayout: SwipeRefreshLayout? = null
override fun onCreate(savedInstanceState: Bundle?) {
@ -45,20 +40,19 @@ class ChannelFragment : Fragment() {
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_channel, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
channel_id = channel_id!!.replace("/channel/","")
view.findViewById<TextView>(R.id.channel_name).text=channel_id
channel_id = channel_id!!.replace("/channel/", "")
view.findViewById<TextView>(R.id.channel_name).text = channel_id
val recyclerView = view.findViewById<RecyclerView>(R.id.channel_recView)
recyclerView.layoutManager = LinearLayoutManager(context)
refreshLayout = view.findViewById(R.id.channel_refresh)
@ -68,7 +62,7 @@ class ChannelFragment : Fragment() {
fetchChannel(view)
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
val subButton = view.findViewById<MaterialButton>(R.id.channel_subscribe)
if (sharedPref?.getString("token","") != "") {
if (sharedPref?.getString("token", "") != "") {
isSubscribed(subButton)
}
}
@ -81,28 +75,29 @@ class ChannelFragment : Fragment() {
scrollView.viewTreeObserver
.addOnScrollChangedListener {
if (scrollView.getChildAt(0).bottom
== (scrollView.height + scrollView.scrollY)) {
//scroll view is at bottom
if(nextPage!=null && !isLoading){
isLoading=true
refreshLayout?.isRefreshing = true;
== (scrollView.height + scrollView.scrollY)
) {
// scroll view is at bottom
if (nextPage != null && !isLoading) {
isLoading = true
refreshLayout?.isRefreshing = true
fetchNextPage()
}
}
}
}
}
private fun isSubscribed(button: MaterialButton){
private fun isSubscribed(button: MaterialButton) {
@SuppressLint("ResourceAsColor")
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
RetrofitInstance.api.isSubscribed(channel_id!!,sharedPref?.getString("token","")!!)
}catch(e: IOException) {
RetrofitInstance.api.isSubscribed(
channel_id!!,
sharedPref?.getString("token", "")!!
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
@ -110,52 +105,39 @@ class ChannelFragment : Fragment() {
Log.e(TAG, "HttpException, unexpected response")
return@launchWhenCreated
}
val colorPrimary = TypedValue()
(context as Activity).theme.resolveAttribute(
android.R.attr.colorPrimary,
colorPrimary,
true)
val ColorText = TypedValue()
(context as Activity).theme.resolveAttribute(
R.attr.colorOnSurface,
ColorText,
true)
runOnUiThread {
if (response.subscribed==true){
isSubscribed=true
button.text=getString(R.string.unsubscribe)
button.setTextColor(ColorText.data)
if (response.subscribed == true) {
isSubscribed = true
button.text = getString(R.string.unsubscribe)
}
if(response.subscribed!=null){
if (response.subscribed != null) {
button.setOnClickListener {
if(isSubscribed){
if (isSubscribed) {
unsubscribe()
button.text=getString(R.string.subscribe)
button.setTextColor(colorPrimary.data)
}else{
button.text = getString(R.string.subscribe)
} else {
subscribe()
button.text=getString(R.string.unsubscribe)
button.setTextColor(ColorText.data)
button.text = getString(R.string.unsubscribe)
}
}
}
}}
}
}
}
run()
}
private fun subscribe(){
private fun subscribe() {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
RetrofitInstance.api.subscribe(sharedPref?.getString("token","")!!, Subscribe(channel_id))
}catch(e: IOException) {
RetrofitInstance.api.subscribe(
sharedPref?.getString("token", "")!!,
Subscribe(channel_id)
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
@ -163,18 +145,22 @@ class ChannelFragment : Fragment() {
Log.e(TAG, "HttpException, unexpected response$e")
return@launchWhenCreated
}
isSubscribed=true
isSubscribed = true
}
}
run()
}
private fun unsubscribe(){
private fun unsubscribe() {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
RetrofitInstance.api.unsubscribe(sharedPref?.getString("token","")!!, Subscribe(channel_id))
}catch(e: IOException) {
RetrofitInstance.api.unsubscribe(
sharedPref?.getString("token", "")!!,
Subscribe(channel_id)
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
@ -182,53 +168,17 @@ class ChannelFragment : Fragment() {
Log.e(TAG, "HttpException, unexpected response")
return@launchWhenCreated
}
isSubscribed=false
isSubscribed = false
}
}
run()
}
private fun fetchChannel(view: View){
private fun fetchChannel(view: View) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getChannel(channel_id!!)
}catch(e: IOException) {
refreshLayout?.isRefreshing = false;
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
refreshLayout?.isRefreshing = false;
Log.e(TAG, "HttpException, unexpected response")
return@launchWhenCreated
}
nextPage = response.nextpage
isLoading=false
refreshLayout?.isRefreshing = false;
runOnUiThread {
view.findViewById<ScrollView>(R.id.channel_scrollView).visibility = View.VISIBLE
view.findViewById<TextView>(R.id.channel_name).text=response.name
view.findViewById<TextView>(R.id.channel_subs).text=response.subscriberCount.formatShort() + " subscribers"
view.findViewById<TextView>(R.id.channel_description).text=response.description
val bannerImage = view.findViewById<ImageView>(R.id.channel_banner)
val channelImage = view.findViewById<ImageView>(R.id.channel_image)
Picasso.get().load(response.bannerUrl).into(bannerImage)
Picasso.get().load(response.avatarUrl).into(channelImage)
channelAdapter = ChannelAdapter(response.relatedStreams!!.toMutableList())
view.findViewById<RecyclerView>(R.id.channel_recView).adapter = channelAdapter
}
}
}
run()
}
private fun fetchNextPage(){
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getChannelNextPage(channel_id!!,nextPage!!)
} catch (e: IOException) {
refreshLayout?.isRefreshing = false
println(e)
@ -236,17 +186,67 @@ class ChannelFragment : Fragment() {
return@launchWhenCreated
} catch (e: HttpException) {
refreshLayout?.isRefreshing = false
Log.e(TAG, "HttpException, unexpected response,"+e.response())
Log.e(TAG, "HttpException, unexpected response")
return@launchWhenCreated
}
nextPage = response.nextpage
isLoading = false
refreshLayout?.isRefreshing = false
runOnUiThread {
view.findViewById<ScrollView>(R.id.channel_scrollView).visibility = View.VISIBLE
val channelName = view.findViewById<TextView>(R.id.channel_name)
channelName.text = response.name
if (response.verified) {
channelName.setCompoundDrawablesWithIntrinsicBounds(
0, 0, R.drawable.ic_verified, 0
)
}
view.findViewById<TextView>(R.id.channel_subs).text = resources.getString(
R.string.subscribers,
response.subscriberCount.formatShort()
)
val channelDescription = view.findViewById<TextView>(R.id.channel_description)
if (response.description?.trim() == "")
channelDescription.visibility = View.GONE
else
channelDescription.text = response.description?.trim()
val bannerImage = view.findViewById<ImageView>(R.id.channel_banner)
val channelImage = view.findViewById<ImageView>(R.id.channel_image)
Picasso.get().load(response.bannerUrl).into(bannerImage)
Picasso.get().load(response.avatarUrl).into(channelImage)
channelAdapter = ChannelAdapter(response.relatedStreams!!.toMutableList())
view.findViewById<RecyclerView>(R.id.channel_recView).adapter = channelAdapter
}
}
}
run()
}
private fun fetchNextPage() {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getChannelNextPage(channel_id!!, nextPage!!)
} catch (e: IOException) {
refreshLayout?.isRefreshing = false
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
refreshLayout?.isRefreshing = false
Log.e(TAG, "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage
channelAdapter?.updateItems(response.relatedStreams!!)
isLoading=false
isLoading = false
refreshLayout?.isRefreshing = false
}
}
run()
}
private fun Fragment?.runOnUiThread(action: () -> Unit) {
this ?: return
if (!isAdded) return // Fragment not attached to an Activity
@ -257,8 +257,8 @@ class ChannelFragment : Fragment() {
val scrollView = view?.findViewById<ScrollView>(R.id.channel_scrollView)
scrollView?.viewTreeObserver?.removeOnScrollChangedListener {
}
channelAdapter=null
view?.findViewById<RecyclerView>(R.id.channel_recView)?.adapter=null
channelAdapter = null
view?.findViewById<RecyclerView>(R.id.channel_recView)?.adapter = null
super.onDestroyView()
}
}

View File

@ -0,0 +1,53 @@
package com.github.libretube
import android.os.Bundle
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.setFragmentResult
import com.google.android.material.textfield.TextInputEditText
class CreatePlaylistDialog : DialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
var rootView: View = inflater.inflate(R.layout.dialog_create_playlist, container, false)
val typedValue = TypedValue()
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
val appName = HtmlCompat.fromHtml(
"Libre<span style='color:$hexColor';>Tube</span>",
HtmlCompat.FROM_HTML_MODE_COMPACT
)
rootView.findViewById<TextView>(R.id.title).text = appName
val cancelBtn = rootView.findViewById<Button>(R.id.cancel_button)
cancelBtn.setOnClickListener {
dismiss()
}
val playlistName = rootView.findViewById<TextInputEditText>(R.id.playlist_name)
val createPlaylistBtn = rootView.findViewById<Button>(R.id.create_new_playlist)
createPlaylistBtn.setOnClickListener {
var listName = playlistName.text.toString()
if (listName != "") {
setFragmentResult("key_parent", bundleOf("playlistName" to "$listName"))
dismiss()
} else {
Toast.makeText(context, R.string.emptyPlaylistName, Toast.LENGTH_LONG).show()
}
}
return rootView
}
}

View File

@ -4,12 +4,11 @@ import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import com.google.android.exoplayer2.ui.PlayerView
import com.google.android.exoplayer2.ui.StyledPlayerControlView
import com.google.android.exoplayer2.ui.StyledPlayerView
internal class CustomExoPlayerView(
context: Context, attributeSet: AttributeSet? = null
context: Context,
attributeSet: AttributeSet? = null
) : StyledPlayerView(context, attributeSet) {
@SuppressLint("ClickableViewAccessibility")
@ -18,7 +17,7 @@ internal class CustomExoPlayerView(
MotionEvent.ACTION_DOWN -> {
if (isControllerFullyVisible) {
hideController()
}else {
} else {
showController()
}
}

View File

@ -4,11 +4,18 @@ import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.View
import android.widget.*
import androidx.appcompat.app.AlertDialog
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.RadioButton
import android.widget.RadioGroup
import android.widget.Spinner
import android.widget.TextView
import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class DownloadDialog : DialogFragment() {
private val TAG = "DownloadDialog"
@ -29,14 +36,18 @@ class DownloadDialog : DialogFragment() {
audioUrl = arguments?.getStringArrayList("audioUrl") as ArrayList<String>
duration = arguments?.getInt("duration")!!
videoId = arguments?.getString("videoId")!!
val builder = AlertDialog.Builder(it)
val builder = MaterialAlertDialogBuilder(it)
// Get the layout inflater
val inflater = requireActivity().layoutInflater
var view: View = inflater.inflate(R.layout.dialog_download, null)
val videoSpinner = view.findViewById<Spinner>(R.id.video_spinner)
val videoArrayAdapter =ArrayAdapter<String>(requireContext(),android.R.layout.simple_spinner_item,vidName)
val videoArrayAdapter = ArrayAdapter<String>(
requireContext(),
android.R.layout.simple_spinner_item,
vidName
)
videoArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
videoSpinner.adapter=videoArrayAdapter
videoSpinner.adapter = videoArrayAdapter
videoSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(
parent: AdapterView<*>,
@ -45,12 +56,17 @@ class DownloadDialog : DialogFragment() {
id: Long
) {
selectedVideo = position
Log.d(TAG,selectedVideo.toString())
Log.d(TAG, selectedVideo.toString())
}
override fun onNothingSelected(parent: AdapterView<*>?) {}
}
val audioSpinner = view.findViewById<Spinner>(R.id.audio_spinner)
val audioArrayAdapter = ArrayAdapter<String>(requireContext(),android.R.layout.simple_spinner_item,audioName)
val audioArrayAdapter = ArrayAdapter(
requireContext(),
android.R.layout.simple_spinner_item,
audioName
)
audioArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
audioSpinner.adapter = audioArrayAdapter
audioSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
@ -61,31 +77,43 @@ class DownloadDialog : DialogFragment() {
id: Long
) {
selectedAudio = position
Log.d(TAG,selectedAudio.toString())
Log.d(TAG, selectedAudio.toString())
}
override fun onNothingSelected(parent: AdapterView<*>?) {}
}
val radioGroup = view.findViewById<RadioGroup>(R.id.radioGp)
radioGroup.setOnCheckedChangeListener { group, checkedId ->
val radio: RadioButton = view.findViewById(checkedId)
extension = radio.text.toString()
Log.d(TAG,extension)
Log.d(TAG, extension)
}
view.findViewById<Button>(R.id.download).setOnClickListener {
val intent = Intent(context,DownloadService::class.java)
intent.putExtra("videoId",videoId)
intent.putExtra("videoUrl",vidUrl[selectedVideo])
intent.putExtra("audioUrl",audioUrl[selectedAudio])
intent.putExtra("duration",duration)
intent.putExtra("extension",extension)
//intent.putExtra("command","-y -i ${response.videoStreams[which].url} -i ${response.audioStreams!![0].url} -c copy ${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)}/${videoId}.mkv")
val intent = Intent(context, DownloadService::class.java)
intent.putExtra("videoId", videoId)
intent.putExtra("videoUrl", vidUrl[selectedVideo])
intent.putExtra("audioUrl", audioUrl[selectedAudio])
intent.putExtra("duration", duration)
intent.putExtra("extension", extension)
// intent.putExtra("command","-y -i ${response.videoStreams[which].url} -i ${response.audioStreams!![0].url} -c copy ${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)}/${videoId}.mkv")
context?.startService(intent)
dismiss()
}
val typedValue = TypedValue()
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
val appName = HtmlCompat.fromHtml(
"Libre<span style='color:$hexColor';>Tube</span>",
HtmlCompat.FROM_HTML_MODE_COMPACT
)
view.findViewById<TextView>(R.id.title).text = appName
builder.setView(view)
builder.create()
} ?: throw IllegalStateException("Activity cannot be null")
}
override fun onDestroy() {
vidName.clear()
vidUrl.clear()

View File

@ -1,6 +1,11 @@
package com.github.libretube
import android.app.*
import android.app.DownloadManager
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
@ -9,6 +14,7 @@ import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.os.Environment.DIRECTORY_DOWNLOADS
import android.os.IBinder
import android.util.Log
import androidx.core.app.NotificationCompat
@ -16,17 +22,18 @@ import androidx.core.app.NotificationManagerCompat
import com.arthenica.ffmpegkit.FFmpegKit
import java.io.File
var IS_DOWNLOAD_RUNNING = false
class DownloadService : Service(){
class DownloadService : Service() {
val TAG = "DownloadService"
private var downloadId: Long =-1
private var downloadId: Long = -1
private lateinit var videoId: String
private lateinit var videoUrl: String
private lateinit var audioUrl: String
private lateinit var extension: String
private var duration: Int = 0
//private lateinit var command: String
// private lateinit var command: String
private lateinit var audioDir: File
private lateinit var videoDir: File
lateinit var service: NotificationManager
@ -41,13 +48,15 @@ class DownloadService : Service(){
videoUrl = intent.getStringExtra("videoUrl")!!
audioUrl = intent.getStringExtra("audioUrl")!!
extension = intent.getStringExtra("extension")!!
//command = intent.getStringExtra("command")!!
duration = intent.getIntExtra("duration",1)
// command = intent.getStringExtra("command")!!
duration = intent.getIntExtra("duration", 1)
service = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channelId =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val chan = NotificationChannel("service",
"DownloadService", NotificationManager.IMPORTANCE_NONE)
val chan = NotificationChannel(
"service",
"DownloadService", NotificationManager.IMPORTANCE_NONE
)
chan.lightColor = Color.BLUE
chan.lockscreenVisibility = Notification.VISIBILITY_PRIVATE
service.createNotificationChannel(chan)
@ -63,7 +72,7 @@ class DownloadService : Service(){
} else {
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT)
}
//Creating a notification and setting its various attributes
// Creating a notification and setting its various attributes
notification =
NotificationCompat.Builder(this@DownloadService, channelId)
.setSmallIcon(R.drawable.ic_download)
@ -75,11 +84,12 @@ class DownloadService : Service(){
.setProgress(100, 0, true)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
startForeground(1,notification.build())
startForeground(1, notification.build())
downloadManager()
return super.onStartCommand(intent, flags, startId)
}
override fun onBind(intent: Intent?): IBinder? {
TODO("Not yet implemented")
}
@ -100,7 +110,10 @@ class DownloadService : Service(){
videoDir = File(f, "$videoId-video")
try {
Log.e(TAG, "Directory make")
registerReceiver(onDownloadComplete, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE))
registerReceiver(
onDownloadComplete,
IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
)
val request: DownloadManager.Request =
DownloadManager.Request(Uri.parse(videoUrl))
.setTitle("Video") // Title of the Download Notification
@ -112,10 +125,12 @@ class DownloadService : Service(){
val downloadManager: DownloadManager =
applicationContext.getSystemService(DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)
if(audioUrl==""){downloadId = 0L}
if (audioUrl == "") {
downloadId = 0L
}
} catch (e: IllegalArgumentException) {
Log.e(TAG, "download error $e")
try{
try {
downloadId = 0L
val request: DownloadManager.Request =
DownloadManager.Request(Uri.parse(audioUrl))
@ -128,22 +143,21 @@ class DownloadService : Service(){
val downloadManager: DownloadManager =
applicationContext.getSystemService(DOWNLOAD_SERVICE) as DownloadManager
downloadManager.enqueue(request)
}catch (e: Exception){
} catch (e: Exception) {
Log.e(TAG, "audio download error $e")
stopService(Intent(this,DownloadService::class.java))}
stopService(Intent(this, DownloadService::class.java))
}
}
}
private val onDownloadComplete: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
//Fetching the download id received with the broadcast
// Fetching the download id received with the broadcast
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
//Checking if the received broadcast is for our enqueued download by matching download id
// Checking if the received broadcast is for our enqueued download by matching download id
if (downloadId == id) {
downloadId=0L
try{
downloadId = 0L
try {
val request: DownloadManager.Request =
DownloadManager.Request(Uri.parse(audioUrl))
.setTitle("Audio") // Title of the Download Notification
@ -155,9 +169,12 @@ class DownloadService : Service(){
val downloadManager: DownloadManager =
applicationContext.getSystemService(DOWNLOAD_SERVICE) as DownloadManager
downloadManager.enqueue(request)
}catch (e: Exception){}
}else if (downloadId == 0L){
val libreTube = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),"LibreTube")
} catch (e: Exception) {
}
} else if (downloadId == 0L) {
val libreTube = File(
Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS), "LibreTube"
)
if (!libreTube.exists()) {
libreTube.mkdirs()
Log.e(TAG, "libreTube Directory make")
@ -165,18 +182,19 @@ class DownloadService : Service(){
Log.e(TAG, "libreTube Directory already have")
}
var command: String = when {
videoUrl=="" -> {
"-y -i $audioDir -c copy ${libreTube}/${videoId}-audio$extension"
videoUrl == "" -> {
"-y -i $audioDir -c copy $libreTube/$videoId-audio$extension"
}
audioUrl=="" -> {
"-y -i $videoDir -c copy ${libreTube}/${videoId}-video$extension"
audioUrl == "" -> {
"-y -i $videoDir -c copy $libreTube/$videoId-video$extension"
}
else -> {
"-y -i $videoDir -i $audioDir -c copy ${libreTube}/${videoId}$extension"
"-y -i $videoDir -i $audioDir -c copy $libreTube/${videoId}$extension"
}
}
notification.setContentTitle("Muxing")
FFmpegKit.executeAsync(command,
FFmpegKit.executeAsync(
command,
{ session ->
val state = session.state
val returnCode = session.returnCode
@ -190,11 +208,12 @@ class DownloadService : Service(){
session.failStackTrace
)
)
val path = applicationContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
val path =
applicationContext.getExternalFilesDir(DIRECTORY_DOWNLOADS)
val folder_main = ".tmp"
val f = File(path, folder_main)
f.deleteRecursively()
if (returnCode.toString()!="0"){
if (returnCode.toString() != "0") {
var builder = NotificationCompat.Builder(this@DownloadService, "failed")
.setSmallIcon(R.drawable.ic_download)
.setContentTitle(resources.getString(R.string.downloadfailed))
@ -207,13 +226,14 @@ class DownloadService : Service(){
}
}
stopForeground(true)
stopService(Intent(this@DownloadService,DownloadService::class.java))
stopService(Intent(this@DownloadService, DownloadService::class.java))
}, {
// CALLED WHEN SESSION PRINTS LOGS
Log.e(TAG,it.message.toString())
}) {
Log.e(TAG, it.message.toString())
}
) {
// CALLED WHEN SESSION GENERATES STATISTICS
Log.e(TAG+"stat",it.time.toString())
Log.e(TAG + "stat", it.time.toString())
/*val progress = it.time/(10*duration!!)
if (progress<1){
notification
@ -221,7 +241,6 @@ class DownloadService : Service(){
service.notify(1,notification.build())
}*/
}
}
}
}
@ -242,13 +261,14 @@ class DownloadService : Service(){
notificationManager.createNotificationChannel(channel)
}
}
override fun onDestroy() {
try {
unregisterReceiver(onDownloadComplete)
}catch (e: Exception){}
} catch (e: Exception) {
}
IS_DOWNLOAD_RUNNING = false
Log.d(TAG,"dl finished!")
Log.d(TAG, "dl finished!")
super.onDestroy()
}
}

View File

@ -2,23 +2,20 @@ package com.github.libretube
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ProgressBar
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import okhttp3.*
import retrofit2.HttpException
import com.github.libretube.adapters.TrendingAdapter
import java.io.IOException
import retrofit2.HttpException
class Home : Fragment() {
@ -31,51 +28,51 @@ class Home : Fragment() {
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_home, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val recyclerView = view.findViewById<RecyclerView>(R.id.recview)
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
val grid = sharedPreferences.getString("grid", resources.getInteger(R.integer.grid_items).toString())!!
val grid = sharedPreferences.getString(
"grid",
resources.getInteger(R.integer.grid_items).toString()
)!!
recyclerView.layoutManager = GridLayoutManager(view.context, grid.toInt())
val progressbar = view.findViewById<ProgressBar>(R.id.progressBar)
fetchJson(progressbar,recyclerView)
fetchJson(progressbar, recyclerView)
refreshLayout = view.findViewById(R.id.home_refresh)
refreshLayout?.isEnabled = true
refreshLayout?.setOnRefreshListener {
Log.d(TAG,"hmm")
fetchJson(progressbar,recyclerView)
Log.d(TAG, "hmm")
fetchJson(progressbar, recyclerView)
}
}
private fun fetchJson(progressBar: ProgressBar, recyclerView: RecyclerView) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
val sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(requireContext())
RetrofitInstance.api.getTrending(sharedPreferences.getString("region", "US")!!)
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context,R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context,R.string.server_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}finally {
} finally {
refreshLayout?.isRefreshing = false
}
runOnUiThread {
@ -85,8 +82,8 @@ class Home : Fragment() {
}
}
run()
}
private fun Fragment?.runOnUiThread(action: () -> Unit) {
this ?: return
if (!isAdded) return // Fragment not attached to an Activity
@ -94,9 +91,9 @@ class Home : Fragment() {
}
override fun onDestroyView() {
view?.findViewById<RecyclerView>(R.id.recview)?.adapter=null
view?.findViewById<RecyclerView>(R.id.recview)?.adapter = null
refreshLayout = null
Log.e(TAG,"destroyview")
Log.e(TAG, "destroyview")
super.onDestroyView()
}
}

View File

@ -3,24 +3,22 @@ package com.github.libretube
import android.content.Context
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.adapters.PlaylistsAdapter
import com.github.libretube.adapters.SubscriptionAdapter
import com.github.libretube.obj.Playlists
import com.squareup.picasso.Picasso
import retrofit2.HttpException
import java.io.IOException
import retrofit2.HttpException
class Library : Fragment() {
@ -31,12 +29,12 @@ class Library : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
@ -48,102 +46,108 @@ class Library : Fragment() {
playlistRecyclerView = view.findViewById(R.id.playlist_recView)
playlistRecyclerView.layoutManager = LinearLayoutManager(view.context)
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
token = sharedPref?.getString("token","")!!
if(token!="") {
token = sharedPref?.getString("token", "")!!
refreshLayout = view.findViewById(R.id.playlist_refresh)
view.findViewById<ImageView>(R.id.boogh2).visibility=View.GONE
view.findViewById<TextView>(R.id.textLike2).visibility=View.GONE
if (token != "") {
view.findViewById<ImageView>(R.id.boogh2).visibility = View.GONE
view.findViewById<TextView>(R.id.textLike2).visibility = View.GONE
fetchPlaylists(view)
refreshLayout?.isEnabled = true
refreshLayout?.setOnRefreshListener {
Log.d(TAG,"hmm")
refreshLayout.isEnabled = true
refreshLayout.setOnRefreshListener {
Log.d(TAG, "hmm")
fetchPlaylists(view)
}
val playlistName = view.findViewById<EditText>(R.id.playlists_name)
view.findViewById<Button>(R.id.create_playlist).setOnClickListener {
if(playlistName.text.toString()!="") createPlaylist(playlistName.text.toString(),view)
hideKeyboard()
val newFragment = CreatePlaylistDialog()
newFragment.show(childFragmentManager, "Create Playlist")
}
} else{
with(view.findViewById<ImageView>(R.id.boogh2)){
visibility=View.VISIBLE
childFragmentManager.setFragmentResultListener("key_parent", this) { _, result ->
val playlistName = result.getString("playlistName")
createPlaylist("$playlistName", view)
}
} else {
refreshLayout.isEnabled = false
view.findViewById<Button>(R.id.create_playlist).visibility = View.GONE
with(view.findViewById<ImageView>(R.id.boogh2)) {
visibility = View.VISIBLE
setImageResource(R.drawable.ic_login)
}
with(view.findViewById<TextView>(R.id.textLike2)){
visibility=View.VISIBLE
with(view.findViewById<TextView>(R.id.textLike2)) {
visibility = View.VISIBLE
text = getString(R.string.please_login)
}
}
}
private fun fetchPlaylists(view: View){
private fun fetchPlaylists(view: View) {
fun run() {
refreshLayout?.isRefreshing = true
refreshLayout.isRefreshing = true
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.playlists(token)
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context,R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context,R.string.server_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}finally {
refreshLayout?.isRefreshing = false
} finally {
refreshLayout.isRefreshing = false
}
if (response.isNotEmpty()){
if (response.isNotEmpty()) {
runOnUiThread {
with(view.findViewById<ImageView>(R.id.boogh2)){
visibility=View.GONE
with(view.findViewById<ImageView>(R.id.boogh2)) {
visibility = View.GONE
}
with(view.findViewById<TextView>(R.id.textLike2)){
visibility=View.GONE
with(view.findViewById<TextView>(R.id.textLike2)) {
visibility = View.GONE
}
}
val playlistsAdapter = PlaylistsAdapter(response.toMutableList(),requireActivity())
playlistRecyclerView.adapter= playlistsAdapter
}else{
val playlistsAdapter = PlaylistsAdapter(
response.toMutableList(),
requireActivity()
)
playlistRecyclerView.adapter = playlistsAdapter
} else {
runOnUiThread {
with(view.findViewById<ImageView>(R.id.boogh2)){
visibility=View.VISIBLE
with(view.findViewById<ImageView>(R.id.boogh2)) {
visibility = View.VISIBLE
setImageResource(R.drawable.ic_list)
}
with(view.findViewById<TextView>(R.id.textLike2)){
visibility=View.VISIBLE
with(view.findViewById<TextView>(R.id.textLike2)) {
visibility = View.VISIBLE
text = getString(R.string.emptyList)
}
}
}
}
}
run()
}
private fun createPlaylist(name: String, view: View){
private fun createPlaylist(name: String, view: View) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.createPlaylist(token, Playlists(name = name))
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context,R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response $e")
Toast.makeText(context,R.string.server_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
if (response != null){
Toast.makeText(context,R.string.playlistCreated, Toast.LENGTH_SHORT).show()
if (response != null) {
Toast.makeText(context, R.string.playlistCreated, Toast.LENGTH_SHORT).show()
fetchPlaylists(view)
}else{
} else {
}
}
}
run()

View File

@ -2,25 +2,21 @@ package com.github.libretube
import android.app.Dialog
import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.obj.Login
import org.w3c.dom.Text
import retrofit2.HttpException
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import java.lang.Exception
import kotlin.math.log
import retrofit2.HttpException
class LoginDialog : DialogFragment() {
private val TAG = "LoginDialog"
@ -28,129 +24,141 @@ class LoginDialog : DialogFragment() {
lateinit var password: EditText
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return activity?.let {
val builder = AlertDialog.Builder(it)
val builder = MaterialAlertDialogBuilder(it)
// Get the layout inflater
val inflater = requireActivity().layoutInflater;
val inflater = requireActivity().layoutInflater
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
val token = sharedPref?.getString("token","")
val token = sharedPref?.getString("token", "")
var view: View
Log.e("dafaq",token!!)
if(token!=""){
Log.e("dafaq", token!!)
if (token != "") {
val sharedPref2 = context?.getSharedPreferences("username", Context.MODE_PRIVATE)
val user = sharedPref2?.getString("username","")
val user = sharedPref2?.getString("username", "")
view = inflater.inflate(R.layout.dialog_logout, null)
view.findViewById<TextView>(R.id.user).text = view.findViewById<TextView>(R.id.user).text.toString()+" ("+user+")"
view.findViewById<TextView>(R.id.user).text =
view.findViewById<TextView>(R.id.user).text.toString() + " (" + user + ")"
view.findViewById<Button>(R.id.logout).setOnClickListener {
Toast.makeText(context,R.string.loggedout, Toast.LENGTH_SHORT).show()
val sharedPref = context?.getSharedPreferences("token",Context.MODE_PRIVATE)
with (sharedPref!!.edit()) {
putString("token","")
Toast.makeText(context, R.string.loggedout, Toast.LENGTH_SHORT).show()
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
with(sharedPref!!.edit()) {
putString("token", "")
apply()
}
dialog?.dismiss()
}
}else{
} else {
view = inflater.inflate(R.layout.dialog_login, null)
username=view.findViewById(R.id.username)
password=view.findViewById(R.id.password)
username = view.findViewById(R.id.username)
password = view.findViewById(R.id.password)
view.findViewById<Button>(R.id.login).setOnClickListener {
if(username.text.toString()!="" && password.text.toString()!=""){
val login = Login(username.text.toString(),password.text.toString())
if (username.text.toString() != "" && password.text.toString() != "") {
val login = Login(username.text.toString(), password.text.toString())
login(login)
}else{
Toast.makeText(context,R.string.empty, Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(context, R.string.empty, Toast.LENGTH_SHORT).show()
}
}
view.findViewById<Button>(R.id.register).setOnClickListener {
if(username.text.toString()!="" && password.text.toString()!=""){
val login = Login(username.text.toString(),password.text.toString())
if (username.text.toString() != "" && password.text.toString() != "") {
val login = Login(username.text.toString(), password.text.toString())
register(login)
}else{
Toast.makeText(context,R.string.empty, Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(context, R.string.empty, Toast.LENGTH_SHORT).show()
}
}
}
val typedValue = TypedValue()
this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true)
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
val appName = HtmlCompat.fromHtml(
"Libre<span style='color:$hexColor';>Tube</span>",
HtmlCompat.FROM_HTML_MODE_COMPACT
)
view.findViewById<TextView>(R.id.title).text = appName
builder.setView(view)
builder.create()
} ?: throw IllegalStateException("Activity cannot be null")
}
private fun login(login: Login){
private fun login(login: Login) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.login(login)
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context,R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context,R.string.server_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: Exception) {
Log.e(TAG,"dafaq?"+e.toString())
Log.e(TAG, "dafaq?" + e.toString())
return@launchWhenCreated
}
if (response.error!= null){
if (response.error != null) {
Toast.makeText(context, response.error, Toast.LENGTH_SHORT).show()
}else if(response.token!=null){
Toast.makeText(context,R.string.loggedIn, Toast.LENGTH_SHORT).show()
val sharedPref = context?.getSharedPreferences("token",Context.MODE_PRIVATE)
with (sharedPref!!.edit()) {
putString("token",response.token)
} else if (response.token != null) {
Toast.makeText(context, R.string.loggedIn, Toast.LENGTH_SHORT).show()
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
with(sharedPref!!.edit()) {
putString("token", response.token)
apply()
}
val sharedPref2 = context?.getSharedPreferences("username",Context.MODE_PRIVATE)
with (sharedPref2!!.edit()) {
putString("username",login.username)
val sharedPref2 =
context?.getSharedPreferences("username", Context.MODE_PRIVATE)
with(sharedPref2!!.edit()) {
putString("username", login.username)
apply()
}
dialog?.dismiss()
}
}
}
run()
}
private fun register(login: Login){
private fun register(login: Login) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.register(login)
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context,R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context,R.string.server_error, Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: Exception) {
Log.e(TAG,"dafaq?"+e.toString())
Log.e(TAG, "dafaq?" + e.toString())
return@launchWhenCreated
}
if (response.error!= null){
if (response.error != null) {
Toast.makeText(context, response.error, Toast.LENGTH_SHORT).show()
}else if(response.token!=null){
Toast.makeText(context,R.string.registered, Toast.LENGTH_SHORT).show()
val sharedPref = context?.getSharedPreferences("token",Context.MODE_PRIVATE)
with (sharedPref!!.edit()) {
putString("token",response.token)
} else if (response.token != null) {
Toast.makeText(context, R.string.registered, Toast.LENGTH_SHORT).show()
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
with(sharedPref!!.edit()) {
putString("token", response.token)
apply()
}
val sharedPref2 = context?.getSharedPreferences("username",Context.MODE_PRIVATE)
with (sharedPref2!!.edit()) {
putString("username",login.username)
val sharedPref2 =
context?.getSharedPreferences("username", Context.MODE_PRIVATE)
with(sharedPref2!!.edit()) {
putString("username", login.username)
apply()
}
dialog?.dismiss()
}
}
}
run()
}
}

View File

@ -2,18 +2,24 @@ package com.github.libretube
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.ActivityInfo
import android.content.res.Configuration
import android.net.ConnectivityManager
import android.net.Uri
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.util.Log
import android.view.*
import android.util.TypedValue
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsController
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import android.widget.Button
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.constraintlayout.widget.ConstraintLayout
@ -21,50 +27,81 @@ import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.navigation.findNavController
import androidx.navigation.ui.setupWithNavController
import androidx.preference.PreferenceManager
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.color.DynamicColors
import java.lang.Exception
class MainActivity : AppCompatActivity() {
val TAG = "MainActivity"
lateinit var bottomNavigationView: BottomNavigationView
lateinit var toolbar: Toolbar
lateinit var navController : NavController
lateinit var navController: NavController
override fun onCreate(savedInstanceState: Bundle?) {
DynamicColors.applyToActivityIfAvailable(this)
super.onCreate(savedInstanceState)
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
RetrofitInstance.url = sharedPreferences.getString("instance", "https://pipedapi.kavin.rocks/")!!
DynamicColors.applyToActivitiesIfAvailable(application)
setContentView(R.layout.activity_main)
when (sharedPreferences.getString("theme_togglee", "A")!!) {
"A" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
"L" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
"D" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
RetrofitInstance.url =
sharedPreferences.getString("instance", "https://pipedapi.kavin.rocks/")!!
SponsorBlockSettings.sponsorBlockEnabled =
sharedPreferences.getBoolean("sb_enabled_key", false)
SponsorBlockSettings.sponsorNotificationsEnabled =
sharedPreferences.getBoolean("sb_notifications_key", false)
SponsorBlockSettings.introEnabled =
sharedPreferences.getBoolean("intro_category_key", false)
SponsorBlockSettings.selfPromoEnabled =
sharedPreferences.getBoolean("selfpromo_category_key", false)
SponsorBlockSettings.interactionEnabled =
sharedPreferences.getBoolean("interaction_category_key", false)
SponsorBlockSettings.sponsorsEnabled =
sharedPreferences.getBoolean("sponsors_category_key", false)
SponsorBlockSettings.outroEnabled =
sharedPreferences.getBoolean("outro_category_key", false)
updateAccentColor(this)
updateThemeMode(this)
updateLanguage(this)
val connectivityManager =
this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val networkInfo = connectivityManager.activeNetworkInfo
val isConnected = networkInfo != null && networkInfo.isConnected
if (!isConnected) {
setContentView(R.layout.activity_nointernet)
findViewById<Button>(R.id.retry_button).setOnClickListener {
recreate()
}
} else {
setContentView(R.layout.activity_main)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
bottomNavigationView = findViewById(R.id.bottomNav)
navController = findNavController(R.id.fragment)
bottomNavigationView.setupWithNavController(navController)
when (sharedPreferences.getString("default_tab", "home")!!) {
"home" -> navController.navigate(R.id.home2)
"subscriptions" -> navController.navigate(R.id.subscriptions)
"library" -> navController.navigate(R.id.library)
}
bottomNavigationView.setOnItemSelectedListener {
when(it.itemId){
when (it.itemId) {
R.id.home2 -> {
navController.backQueue.clear()
navController.navigate(R.id.home2)
true
}
R.id.subscriptions -> {
//navController.backQueue.clear()
// navController.backQueue.clear()
navController.navigate(R.id.subscriptions)
true
}
R.id.library -> {
//navController.backQueue.clear()
// navController.backQueue.clear()
navController.navigate(R.id.library)
true
}
@ -73,21 +110,24 @@ class MainActivity : AppCompatActivity() {
}
toolbar = findViewById(R.id.toolbar)
val hexColor = String.format("#%06X", 0xFFFFFF and 0xcc322d)
val typedValue = TypedValue()
this.theme.resolveAttribute(R.attr.colorPrimary, typedValue, true)
val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data))
val appName = HtmlCompat.fromHtml(
"Libre<span style='color:$hexColor';>Tube</span>",
HtmlCompat.FROM_HTML_MODE_COMPACT
)
toolbar.title= appName
toolbar.title = appName
toolbar.setNavigationOnClickListener{
//settings fragment stuff
navController.navigate(R.id.settings)
toolbar.setNavigationOnClickListener {
// settings activity stuff
val intent = Intent(this, SettingsActivity::class.java)
startActivity(intent)
true
}
toolbar.setOnMenuItemClickListener{
when (it.itemId){
toolbar.setOnMenuItemClickListener {
when (it.itemId) {
R.id.action_search -> {
navController.navigate(R.id.searchFragment)
true
@ -95,47 +135,54 @@ class MainActivity : AppCompatActivity() {
}
false
}
}
}
override fun onStart() {
super.onStart()
val action: String? = intent?.action
val data: Uri? = intent?.data
Log.d(TAG, "dafaq"+data.toString())
Log.d(TAG, "dafaq" + data.toString())
if (data != null) {
Log.d("dafaq",data.host+" ${data.path} ")
if(data.host != null){
if(data.path != null){
//channel
if(data.path!!.contains("/channel/") || data.path!!.contains("/c/") || data.path!!.contains("/user/")){
Log.d("dafaq", data.host + " ${data.path} ")
if (data.host != null) {
if (data.path != null) {
// channel
if (data.path!!.contains("/channel/") ||
data.path!!.contains("/c/") ||
data.path!!.contains("/user/")
) {
var channel = data.path
channel = channel!!.replace("/c/","")
channel = channel!!.replace("/user/","")
channel = channel!!.replace("/c/", "")
channel = channel.replace("/user/", "")
val bundle = bundleOf("channel_id" to channel)
navController.navigate(R.id.channel,bundle)
}else if(data.path!!.contains("/playlist")){
navController.navigate(R.id.channel, bundle)
} else if (data.path!!.contains("/playlist")) {
var playlist = data.query!!
if (playlist.contains("&"))
{
if (playlist.contains("&")) {
var playlists = playlist.split("&")
for (v in playlists){
if (v.contains("list=")){
for (v in playlists) {
if (v.contains("list=")) {
playlist = v
break
}
}
}
playlist = playlist.replace("list=","")
playlist = playlist.replace("list=", "")
val bundle = bundleOf("playlist_id" to playlist)
navController.navigate(R.id.playlistFragment,bundle)
}else if(data.path!!.contains("/shorts/") || data.path!!.contains("/embed/") || data.path!!.contains("/v/")){
var watch = data.path!!.replace("/shorts/","").replace("/v/","").replace("/embed/","")
var bundle = Bundle()
bundle.putString("videoId",watch)
var frag = PlayerFragment()
navController.navigate(R.id.playlistFragment, bundle)
} else if (data.path!!.contains("/shorts/") ||
data.path!!.contains("/embed/") ||
data.path!!.contains("/v/")
) {
val watch = data.path!!
.replace("/shorts/", "")
.replace("/v/", "")
.replace("/embed/", "")
val bundle = Bundle()
bundle.putString("videoId", watch)
val frag = PlayerFragment()
frag.arguments = bundle
supportFragmentManager.beginTransaction()
.remove(PlayerFragment())
@ -148,21 +195,20 @@ class MainActivity : AppCompatActivity() {
motionLayout.transitionToEnd()
motionLayout.transitionToStart()
}, 100)
}else if(data.path!!.contains("/watch") && data.query != null){
Log.d("dafaq",data.query!!)
} else if (data.path!!.contains("/watch") && data.query != null) {
Log.d("dafaq", data.query!!)
var watch = data.query!!
if (watch.contains("&"))
{
if (watch.contains("&")) {
var watches = watch.split("&")
for (v in watches){
if (v.contains("v=")){
for (v in watches) {
if (v.contains("v=")) {
watch = v
break
}
}
}
var bundle = Bundle()
bundle.putString("videoId",watch.replace("v=",""))
bundle.putString("videoId", watch.replace("v=", ""))
var frag = PlayerFragment()
frag.arguments = bundle
supportFragmentManager.beginTransaction()
@ -176,11 +222,10 @@ class MainActivity : AppCompatActivity() {
motionLayout.transitionToEnd()
motionLayout.transitionToStart()
}, 100)
}else{
var watch = data.path!!.replace("/","")
} else {
var watch = data.path!!.replace("/", "")
var bundle = Bundle()
bundle.putString("videoId",watch)
bundle.putString("videoId", watch)
var frag = PlayerFragment()
frag.arguments = bundle
supportFragmentManager.beginTransaction()
@ -196,40 +241,39 @@ class MainActivity : AppCompatActivity() {
}, 100)
}
}
}
}
}
override fun onBackPressed() {
try{
try {
val mainMotionLayout = findViewById<MotionLayout>(R.id.mainMotionLayout)
if (mainMotionLayout.progress == 0.toFloat()){
if (mainMotionLayout.progress == 0.toFloat()) {
mainMotionLayout.transitionToEnd()
findViewById<ConstraintLayout>(R.id.main_container).isClickable=false
findViewById<ConstraintLayout>(R.id.main_container).isClickable = false
val motionLayout = findViewById<MotionLayout>(R.id.playerMotionLayout)
motionLayout.transitionToEnd()
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
with(motionLayout) {
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
enableTransition(R.id.yt_transition,true)
enableTransition(R.id.yt_transition, true)
}
findViewById<LinearLayout>(R.id.linLayout).visibility=View.VISIBLE
isFullScreen=false
}else{
findViewById<LinearLayout>(R.id.linLayout).visibility = View.VISIBLE
isFullScreen = false
} else {
navController.popBackStack()
if (navController.currentBackStackEntry == null){
if (navController.currentBackStackEntry == null &&
(parent as View).id != R.id.settings
) {
super.onBackPressed()
}
}
}catch (e: Exception){
} catch (e: Exception) {
navController.popBackStack()
if (navController.currentBackStackEntry == null){
super.onBackPressed()
}
moveTaskToBack(true)
}
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
val orientation = newConfig.orientation
@ -241,6 +285,7 @@ class MainActivity : AppCompatActivity() {
setFullscreen()
}
}
private fun setFullscreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.attributes.layoutInDisplayCutoutMode =
@ -255,15 +300,18 @@ class MainActivity : AppCompatActivity() {
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_FULLSCREEN
window.decorView.systemUiVisibility = (
View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_IMMERSIVE
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
)
}
}
private fun unsetFullscreen(){
private fun unsetFullscreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.attributes.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
@ -277,11 +325,19 @@ class MainActivity : AppCompatActivity() {
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_VISIBLE or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
window.decorView.systemUiVisibility =
(View.SYSTEM_UI_FLAG_VISIBLE or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
}
}
override fun onUserLeaveHint() {
super.onUserLeaveHint()
supportFragmentManager.fragments.forEach { fragment ->
(fragment as? PlayerFragment)?.onUserLeaveHint()
}
}
}
fun Fragment.hideKeyboard() {
view?.let { activity?.hideKeyboard(it) }
}

View File

@ -1,7 +1,28 @@
package com.github.libretube
import com.github.libretube.obj.*
import retrofit2.http.*
import com.github.libretube.obj.Channel
import com.github.libretube.obj.CommentsPage
import com.github.libretube.obj.Instances
import com.github.libretube.obj.Login
import com.github.libretube.obj.Message
import com.github.libretube.obj.Playlist
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.Playlists
import com.github.libretube.obj.SearchResult
import com.github.libretube.obj.Segments
import com.github.libretube.obj.StreamItem
import com.github.libretube.obj.Streams
import com.github.libretube.obj.Subscribe
import com.github.libretube.obj.Subscribed
import com.github.libretube.obj.Subscription
import com.github.libretube.obj.Token
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import retrofit2.http.Url
interface PipedApi {
@GET("trending")
@ -10,12 +31,34 @@ interface PipedApi {
@GET("streams/{videoId}")
suspend fun getStreams(@Path("videoId") videoId: String): Streams
@GET("comments/{videoId}")
suspend fun getComments(@Path("videoId") videoId: String): CommentsPage
@GET("sponsors/{videoId}")
suspend fun getSegments(
@Path("videoId") videoId: String,
@Query("category") category: String
): Segments
@GET("nextpage/comments/{videoId}")
suspend fun getCommentsNextPage(
@Path("videoId") videoId: String,
@Query("nextpage") nextPage: String
): CommentsPage
@GET("search")
suspend fun getSearchResults(
@Query("q") searchQuery: String,
@Query("filter") filter: String
): SearchResult
@GET("nextpage/search")
suspend fun getSearchResultsNextPage(
@Query("q") searchQuery: String,
@Query("filter") filter: String,
@Query("nextpage") nextPage: String
): SearchResult
@GET("suggestions")
suspend fun getSuggestions(@Query("query") query: String): List<String>
@ -23,13 +66,19 @@ interface PipedApi {
suspend fun getChannel(@Path("channelId") channelId: String): Channel
@GET("nextpage/channel/{channelId}")
suspend fun getChannelNextPage(@Path("channelId") channelId: String, @Query("nextpage") nextPage: String): Channel
suspend fun getChannelNextPage(
@Path("channelId") channelId: String,
@Query("nextpage") nextPage: String
): Channel
@GET("playlists/{playlistId}")
suspend fun getPlaylist(@Path("playlistId") playlistId: String): Playlist
@GET("nextpage/playlists/{playlistId}")
suspend fun getPlaylistNextPage(@Path("playlistId") playlistId: String, @Query("nextpage") nextPage: String): Playlist
suspend fun getPlaylistNextPage(
@Path("playlistId") playlistId: String,
@Query("nextpage") nextPage: String
): Playlist
@POST("login")
suspend fun login(@Body login: Login): Token
@ -41,39 +90,61 @@ interface PipedApi {
suspend fun getFeed(@Query("authToken") token: String?): List<StreamItem>
@GET("subscribed")
suspend fun isSubscribed(@Query("channelId") channelId: String, @Header("Authorization") token: String): Subscribed
suspend fun isSubscribed(
@Query("channelId") channelId: String,
@Header("Authorization") token: String
): Subscribed
@GET("subscriptions")
suspend fun subscriptions(@Header("Authorization") token: String): List<Subscription>
@POST("subscribe")
suspend fun subscribe(@Header("Authorization") token: String, @Body subscribe: Subscribe): Message
suspend fun subscribe(
@Header("Authorization") token: String,
@Body subscribe: Subscribe
): Message
@POST("unsubscribe")
suspend fun unsubscribe(@Header("Authorization") token: String, @Body subscribe: Subscribe): Message
suspend fun unsubscribe(
@Header("Authorization") token: String,
@Body subscribe: Subscribe
): Message
@POST("import")
suspend fun importSubscriptions(@Query("override") override: Boolean, @Header("Authorization") token: String, @Body channels: List<String>): Message
suspend fun importSubscriptions(
@Query("override") override: Boolean,
@Header("Authorization") token: String,
@Body channels: List<String>
): Message
@GET("user/playlists")
suspend fun playlists(@Header("Authorization") token: String): List<Playlists>
@POST("user/playlists/delete")
suspend fun deletePlaylist(@Header("Authorization") token: String, @Body playlistId: PlaylistId): Message
suspend fun deletePlaylist(
@Header("Authorization") token: String,
@Body playlistId: PlaylistId
): Message
@POST("user/playlists/create")
suspend fun createPlaylist(@Header("Authorization") token: String, @Body name: Playlists): PlaylistId
suspend fun createPlaylist(
@Header("Authorization") token: String,
@Body name: Playlists
): PlaylistId
@POST("user/playlists/add")
suspend fun addToPlaylist(@Header("Authorization") token: String, @Body playlistId: PlaylistId): Message
suspend fun addToPlaylist(
@Header("Authorization") token: String,
@Body playlistId: PlaylistId
): Message
@POST("user/playlists/remove")
suspend fun removeFromPlaylist(@Header("Authorization") token: String, @Body playlistId: PlaylistId): Message
suspend fun removeFromPlaylist(
@Header("Authorization") token: String,
@Body playlistId: PlaylistId
): Message
//only for fetching servers list
// only for fetching servers list
@GET
suspend fun getInstances(@Url url: String): List<Instances>
}

View File

@ -1,25 +1,14 @@
package com.github.libretube
import android.app.Activity
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.google.android.material.color.DynamicColors
class Player : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
DynamicColors.applyToActivityIfAvailable(this)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_player)
}
}

View File

@ -2,25 +2,34 @@ package com.github.libretube
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.ActivityInfo
import android.content.pm.PackageManager
import android.graphics.Rect
import android.net.Uri
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import android.os.Environment
import android.text.Html
import android.text.TextUtils
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.appcompat.app.AlertDialog
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation
import android.widget.FrameLayout
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.ScrollView
import android.widget.TextView
import android.widget.Toast
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.app.ActivityCompat
@ -31,15 +40,21 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.adapters.CommentsAdapter
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.obj.PipedStream
import com.github.libretube.obj.Segment
import com.github.libretube.obj.Segments
import com.github.libretube.obj.Subscribe
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration
import com.google.android.exoplayer2.MediaItem.fromUri
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.audio.AudioAttributes
import com.google.android.exoplayer2.ext.cronet.CronetDataSource
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
import com.google.android.exoplayer2.source.MediaSource
@ -49,15 +64,16 @@ import com.google.android.exoplayer2.ui.StyledPlayerView
import com.google.android.exoplayer2.upstream.DataSource
import com.google.android.exoplayer2.upstream.DefaultDataSource
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
import com.google.android.exoplayer2.util.RepeatModeUtil
import com.google.android.material.button.MaterialButton
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.squareup.picasso.Picasso
import org.chromium.net.CronetEngine
import retrofit2.HttpException
import java.io.IOException
import java.net.URLEncoder
import java.util.concurrent.Executors
import kotlin.math.abs
import org.chromium.net.CronetEngine
import retrofit2.HttpException
var isFullScreen = false
@ -75,12 +91,18 @@ class PlayerFragment : Fragment() {
var isSubscribed: Boolean = false
private lateinit var relatedRecView: RecyclerView
private lateinit var commentsRecView: RecyclerView
private var commentsAdapter: CommentsAdapter? = null
private var commentsLoaded: Boolean? = false
private var nextPage: String? = null
private var isLoading = true
private lateinit var exoPlayerView: StyledPlayerView
private lateinit var motionLayout: MotionLayout
private lateinit var exoPlayer: ExoPlayer
private lateinit var mediaSource: MediaSource
private lateinit var segmentData: Segments
private lateinit var relDownloadVideo: RelativeLayout
private lateinit var relDownloadVideo: LinearLayout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -191,11 +213,39 @@ class PlayerFragment : Fragment() {
}
}
view.findViewById<ConstraintLayout>(R.id.player_title_layout).setOnClickListener {
var visible = playerDescription.isVisible
playerDescription.visibility = if (visible) View.GONE else View.VISIBLE
view.findViewById<RelativeLayout>(R.id.player_title_layout).setOnClickListener {
if (playerDescription.isVisible) {
val image = view.findViewById<ImageView>(R.id.player_description_arrow)
image.clearAnimation()
playerDescription.visibility = View.GONE
} else {
// toggle button
val rotate = RotateAnimation(
0F,
180F,
Animation.RELATIVE_TO_SELF,
0.5f,
Animation.RELATIVE_TO_SELF,
0.5f
)
rotate.duration = 100
rotate.interpolator = LinearInterpolator()
rotate.fillAfter = true
val image = view.findViewById<ImageView>(R.id.player_description_arrow)
image.startAnimation(rotate)
playerDescription.visibility = View.VISIBLE
}
}
view.findViewById<com.google.android.material.card.MaterialCardView>(R.id.comments_toggle)
.setOnClickListener {
commentsRecView.visibility =
if (commentsRecView.isVisible) View.GONE else View.VISIBLE
relatedRecView.visibility =
if (relatedRecView.isVisible) View.GONE else View.VISIBLE
if (!commentsLoaded!!) fetchComments()
}
// FullScreen button trigger
view.findViewById<ImageButton>(R.id.fullscreen).setOnClickListener {
// remember to hide everything when new thing added
@ -221,23 +271,67 @@ class PlayerFragment : Fragment() {
isFullScreen = false
}
}
val scrollView = view.findViewById<ScrollView>(R.id.player_scrollView)
scrollView.viewTreeObserver
.addOnScrollChangedListener {
if (scrollView.getChildAt(0).bottom
== (scrollView.height + scrollView.scrollY) &&
nextPage != null
) {
fetchNextComments()
}
}
commentsRecView = view.findViewById(R.id.comments_recView)
commentsRecView.layoutManager = LinearLayoutManager(view.context)
commentsRecView.setItemViewCacheSize(20)
commentsRecView.isDrawingCacheEnabled = true
commentsRecView.drawingCacheQuality = View.DRAWING_CACHE_QUALITY_HIGH
relatedRecView = view.findViewById(R.id.player_recView)
relatedRecView.layoutManager =
GridLayoutManager(view.context, resources.getInteger(R.integer.grid_items))
}
override fun onStop() {
try {
// exoPlayer.pause() // breaks background play
} catch (e: Exception) {
}
super.onStop()
}
override fun onDestroy() {
super.onDestroy()
try {
exoPlayer.stop()
exoPlayer.release()
} catch (e: Exception) {
}
}
private fun checkForSegments() {
if (!exoPlayer.isPlaying || !SponsorBlockSettings.sponsorBlockEnabled) return
exoPlayerView.postDelayed(this::checkForSegments, 100)
if (!::segmentData.isInitialized || segmentData.segments.isEmpty())
return
segmentData.segments.forEach { segment: Segment ->
val segmentStart = (segment.segment!![0] * 1000.0f).toLong()
val segmentEnd = (segment.segment[1] * 1000.0f).toLong()
val currentPosition = exoPlayer.currentPosition
if (currentPosition in segmentStart until segmentEnd) {
if (SponsorBlockSettings.sponsorNotificationsEnabled) {
Toast.makeText(context, R.string.segment_skipped, Toast.LENGTH_SHORT).show()
}
exoPlayer.seekTo(segmentEnd)
}
}
}
private fun fetchJson(view: View) {
fun run() {
lifecycleScope.launchWhenCreated {
@ -253,6 +347,46 @@ class PlayerFragment : Fragment() {
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
if (SponsorBlockSettings.sponsorBlockEnabled) {
val categories: ArrayList<String> = arrayListOf()
if (SponsorBlockSettings.introEnabled) {
categories.add("intro")
}
if (SponsorBlockSettings.selfPromoEnabled) {
categories.add("selfpromo")
}
if (SponsorBlockSettings.interactionEnabled) {
categories.add("interaction")
}
if (SponsorBlockSettings.sponsorsEnabled) {
categories.add("sponsor")
}
if (SponsorBlockSettings.outroEnabled) {
categories.add("outro")
}
if (categories.size > 0) {
segmentData = try {
RetrofitInstance.api.getSegments(
videoId!!,
"[\"" + TextUtils.join("\",\"", categories) + "\"]"
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT)
.show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT)
.show()
return@launchWhenCreated
}
}
}
isLoading = false
var videosNameArray: Array<CharSequence> = arrayOf()
videosNameArray += "HLS"
for (vid in response.videoStreams!!) {
@ -262,10 +396,10 @@ class PlayerFragment : Fragment() {
runOnUiThread {
var subtitle = mutableListOf<SubtitleConfiguration>()
if (response.subtitles!!.isNotEmpty()) {
subtitle?.add(
SubtitleConfiguration.Builder(response.subtitles!![0].url!!.toUri())
.setMimeType(response.subtitles!![0].mimeType!!) // The correct MIME type (required).
.setLanguage(response.subtitles!![0].code) // The subtitle language (optional).
subtitle.add(
SubtitleConfiguration.Builder(response.subtitles[0].url!!.toUri())
.setMimeType(response.subtitles[0].mimeType!!) // The correct MIME type (required).
.setLanguage(response.subtitles[0].code) // The subtitle language (optional).
.build()
)
}
@ -280,6 +414,10 @@ class PlayerFragment : Fragment() {
cronetDataSourceFactory
)
val audioAttributes = AudioAttributes.Builder()
.setUsage(C.USAGE_MEDIA)
.setContentType(C.CONTENT_TYPE_MOVIE)
.build()
exoPlayer = ExoPlayer.Builder(view.context)
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory))
@ -289,8 +427,10 @@ class PlayerFragment : Fragment() {
exoPlayerView.setShowSubtitleButton(true)
exoPlayerView.setShowNextButton(false)
exoPlayerView.setShowPreviousButton(false)
exoPlayerView.setRepeatToggleModes(RepeatModeUtil.REPEAT_TOGGLE_MODE_ALL)
// exoPlayerView.controllerShowTimeoutMs = 1500
exoPlayerView.controllerHideOnTouch = true
exoPlayer.setAudioAttributes(audioAttributes, true)
exoPlayerView.player = exoPlayer
val sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(requireContext())
@ -299,7 +439,7 @@ class PlayerFragment : Fragment() {
defres != "" -> {
var foundRes = false
run lit@{
response.videoStreams!!.forEachIndexed { index, pipedStream ->
response.videoStreams.forEachIndexed { index, pipedStream ->
if (pipedStream.quality!!.contains(defres)) {
foundRes = true
val dataSourceFactory: DataSource.Factory =
@ -313,15 +453,22 @@ class PlayerFragment : Fragment() {
.createMediaSource(videoItem)
var audioSource: MediaSource =
DefaultMediaSourceFactory(dataSourceFactory)
.createMediaSource(fromUri(response.audioStreams!![0].url!!))
if (response.videoStreams[index].quality == "720p" || response.videoStreams[index].quality == "1080p" || response.videoStreams[index].quality == "480p") {
.createMediaSource(
fromUri(response.audioStreams!![0].url!!)
)
if (response.videoStreams[index].quality == "720p" ||
response.videoStreams[index].quality == "1080p" ||
response.videoStreams[index].quality == "480p"
) {
audioSource =
ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(
fromUri(
response.audioStreams!![getMostBitRate(
response.audioStreams[
getMostBitRate(
response.audioStreams
)].url!!
)
].url!!
)
)
}
@ -361,13 +508,18 @@ class PlayerFragment : Fragment() {
var audioSource: MediaSource =
DefaultMediaSourceFactory(dataSourceFactory)
.createMediaSource(fromUri(response.audioStreams!![0].url!!))
if (response.videoStreams[0].quality == "720p" || response.videoStreams[0].quality == "1080p" || response.videoStreams[0].quality == "480p") {
if (response.videoStreams[0].quality == "720p" ||
response.videoStreams[0].quality == "1080p" ||
response.videoStreams[0].quality == "480p"
) {
audioSource = ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(
fromUri(
response.audioStreams!![getMostBitRate(
response.audioStreams[
getMostBitRate(
response.audioStreams
)].url!!
)
].url!!
)
)
}
@ -388,21 +540,24 @@ class PlayerFragment : Fragment() {
view.findViewById<ImageButton>(R.id.quality_select).setOnClickListener {
// Dialog for quality selection
val builder: AlertDialog.Builder? = activity?.let {
AlertDialog.Builder(it)
val builder: MaterialAlertDialogBuilder? = activity?.let {
MaterialAlertDialogBuilder(it)
}
var lastPosition = exoPlayer.currentPosition
builder!!.setTitle(R.string.choose_quality_dialog)
.setItems(
videosNameArray,
DialogInterface.OnClickListener { _, which ->
whichQuality = which
if (response.subtitles!!.isNotEmpty()) {
if (response.subtitles.isNotEmpty()) {
var subtitle =
mutableListOf<SubtitleConfiguration>()
subtitle?.add(
SubtitleConfiguration.Builder(response.subtitles!![0].url!!.toUri())
.setMimeType(response.subtitles!![0].mimeType!!) // The correct MIME type (required).
.setLanguage(response.subtitles!![0].code) // The subtitle language (optional).
subtitle.add(
SubtitleConfiguration.Builder(
response.subtitles[0].url!!.toUri()
)
.setMimeType(response.subtitles[0].mimeType!!) // The correct MIME type (required).
.setLanguage(response.subtitles[0].code) // The subtitle language (optional).
.build()
)
}
@ -424,15 +579,22 @@ class PlayerFragment : Fragment() {
.createMediaSource(videoItem)
var audioSource: MediaSource =
DefaultMediaSourceFactory(dataSourceFactory)
.createMediaSource(fromUri(response.audioStreams!![0].url!!))
if (response.videoStreams[which - 1].quality == "720p" || response.videoStreams[which - 1].quality == "1080p" || response.videoStreams[which - 1].quality == "480p") {
.createMediaSource(
fromUri(response.audioStreams!![0].url!!)
)
if (response.videoStreams[which - 1].quality == "720p" ||
response.videoStreams[which - 1].quality == "1080p" ||
response.videoStreams[which - 1].quality == "480p"
) {
audioSource =
ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(
fromUri(
response.audioStreams!![getMostBitRate(
response.audioStreams[
getMostBitRate(
response.audioStreams
)].url!!
)
].url!!
)
)
}
@ -440,22 +602,33 @@ class PlayerFragment : Fragment() {
MergingMediaSource(videoSource, audioSource)
exoPlayer.setMediaSource(mergeSource)
}
exoPlayer.seekTo(lastPosition)
view.findViewById<TextView>(R.id.quality_text).text =
videosNameArray[which]
}
)
val dialog: AlertDialog? = builder?.create()
dialog?.show()
val dialog = builder.create()
dialog.show()
}
// Listener for play and pause icon change
exoPlayer!!.addListener(object : com.google.android.exoplayer2.Player.Listener {
exoPlayer.addListener(object : com.google.android.exoplayer2.Player.Listener {
override fun onIsPlayingChanged(isPlaying: Boolean) {
if (isPlaying && SponsorBlockSettings.sponsorBlockEnabled) {
exoPlayerView.postDelayed(
this@PlayerFragment::checkForSegments,
100
)
}
}
override fun onPlayerStateChanged(
playWhenReady: Boolean,
playbackState: Int
) {
exoPlayerView.keepScreenOn = !(
playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED ||
playbackState == Player.STATE_IDLE ||
playbackState == Player.STATE_ENDED ||
!playWhenReady
)
@ -476,12 +649,13 @@ class PlayerFragment : Fragment() {
}
}
})
relatedRecView.adapter = TrendingAdapter(response.relatedStreams!!, childFragmentManager)
view.findViewById<TextView>(R.id.player_description).text =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(response.description, Html.FROM_HTML_MODE_COMPACT)
Html.fromHtml(response.description, Html.FROM_HTML_MODE_COMPACT).trim()
} else {
Html.fromHtml(response.description)
Html.fromHtml(response.description).trim()
}
view.findViewById<TextView>(R.id.player_views_info).text =
response.views.formatShort() + " views • " + response.uploadDate
@ -502,7 +676,7 @@ class PlayerFragment : Fragment() {
val channelId = response.uploaderUrl?.replace("/channel/", "")
val subButton = view.findViewById<MaterialButton>(R.id.player_subscribe)
isSubscribed(subButton, channelId!!)
view.findViewById<RelativeLayout>(R.id.save).setOnClickListener {
view.findViewById<LinearLayout>(R.id.save).setOnClickListener {
val newFragment = AddtoPlaylistDialog()
var bundle = Bundle()
bundle.putString("videoId", videoId)
@ -511,22 +685,39 @@ class PlayerFragment : Fragment() {
}
}
// share button
view.findViewById<RelativeLayout>(R.id.relPlayer_share).setOnClickListener {
view.findViewById<LinearLayout>(R.id.relPlayer_share).setOnClickListener {
val sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(requireContext())
val intent = Intent()
intent.action = Intent.ACTION_SEND
var url = "https://piped.kavin.rocks/watch?v=$videoId"
val instance = sharedPreferences.getString(
val instancePref = sharedPreferences.getString(
"instance",
"https://pipedapi.kavin.rocks"
)!!
if (instance != "https://pipedapi.kavin.rocks")
url += "&instance=${URLEncoder.encode(instance, "UTF-8")}"
val instance = "&instance=${URLEncoder.encode(instancePref, "UTF-8")}"
val shareOptions = arrayOf(
getString(R.string.piped),
getString(R.string.instance),
getString(R.string.youtube)
)
MaterialAlertDialogBuilder(requireContext())
.setTitle(getString(R.string.share))
.setItems(
shareOptions,
DialogInterface.OnClickListener { _, id ->
val url = when (id) {
0 -> "https://piped.kavin.rocks/watch?v=$videoId"
1 -> "https://piped.kavin.rocks/watch?v=$videoId$instance"
2 -> "https://youtu.be/$videoId"
else -> "https://piped.kavin.rocks/watch?v=$videoId"
}
val intent = Intent()
intent.action = Intent.ACTION_SEND
intent.putExtra(Intent.EXTRA_TEXT, url)
intent.type = "text/plain"
startActivity(Intent.createChooser(intent, "Share Url To:"))
}
)
.show()
}
// check if livestream
if (response.duration!! > 0) {
// download clicked
@ -550,7 +741,8 @@ class PlayerFragment : Fragment() {
if (ActivityCompat.checkSelfPermission(
requireContext(),
Manifest.permission.READ_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(
) != PackageManager.PERMISSION_GRANTED ||
ActivityCompat.checkSelfPermission(
requireContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED
@ -569,7 +761,7 @@ class PlayerFragment : Fragment() {
vidName.add("No video")
var vidUrl = arrayListOf<String>()
vidUrl.add("")
for (vid in response.videoStreams!!) {
for (vid in response.videoStreams) {
val name = vid.quality + " " + vid.format
vidName.add(name)
vidUrl.add(vid.url!!)
@ -602,7 +794,7 @@ class PlayerFragment : Fragment() {
Toast.makeText(context, R.string.cannotDownload, Toast.LENGTH_SHORT).show()
}
if (response.hls != null) {
view.findViewById<RelativeLayout>(R.id.relPlayer_vlc).setOnClickListener {
view.findViewById<LinearLayout>(R.id.relPlayer_vlc).setOnClickListener {
exoPlayer.pause()
try {
val vlcRequestCode = 42
@ -644,36 +836,20 @@ class PlayerFragment : Fragment() {
Log.e(TAG, "HttpException, unexpected response")
return@launchWhenCreated
}
val colorPrimary = TypedValue()
(context as Activity).theme.resolveAttribute(
android.R.attr.colorPrimary,
colorPrimary,
true
)
val ColorText = TypedValue()
(context as Activity).theme.resolveAttribute(
R.attr.colorOnSurface,
ColorText,
true
)
runOnUiThread {
if (response.subscribed == true) {
isSubscribed = true
button.text = getString(R.string.unsubscribe)
button.setTextColor(ColorText.data)
}
if (response.subscribed != null) {
button.setOnClickListener {
if (isSubscribed) {
unsubscribe(channel_id)
button.text = getString(R.string.subscribe)
button.setTextColor(colorPrimary.data)
} else {
subscribe(channel_id)
button.text = getString(R.string.unsubscribe)
button.setTextColor(colorPrimary.data)
}
}
}
@ -748,7 +924,85 @@ class PlayerFragment : Fragment() {
return index
}
override fun onResume() {
super.onResume()
private fun fetchComments() {
lifecycleScope.launchWhenCreated {
val commentsResponse = try {
RetrofitInstance.api.getComments(videoId!!)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
commentsAdapter = CommentsAdapter(commentsResponse.comments)
commentsRecView.adapter = commentsAdapter
nextPage = commentsResponse.nextpage
commentsLoaded = true
}
}
private fun fetchNextComments() {
lifecycleScope.launchWhenCreated {
if (!isLoading) {
isLoading = true
val response = try {
RetrofitInstance.api.getCommentsNextPage(videoId!!, nextPage!!)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage
commentsAdapter?.updateItems(response.comments)
isLoading = false
}
}
}
override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) {
super.onPictureInPictureModeChanged(isInPictureInPictureMode)
if (isInPictureInPictureMode) {
exoPlayerView.hideController()
with(motionLayout) {
getConstraintSet(R.id.start).constrainHeight(R.id.player, -1)
enableTransition(R.id.yt_transition, false)
}
view?.findViewById<ConstraintLayout>(R.id.main_container)?.isClickable = true
view?.findViewById<LinearLayout>(R.id.linLayout)?.visibility = View.GONE
view?.findViewById<FrameLayout>(R.id.top_bar)?.visibility = View.GONE
val mainActivity = activity as MainActivity
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
isFullScreen = false
} else {
with(motionLayout) {
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
enableTransition(R.id.yt_transition, true)
}
view?.findViewById<ConstraintLayout>(R.id.main_container)?.isClickable = false
view?.findViewById<LinearLayout>(R.id.linLayout)?.visibility = View.VISIBLE
view?.findViewById<FrameLayout>(R.id.top_bar)?.visibility = View.VISIBLE
}
}
fun onUserLeaveHint() {
val bounds = Rect()
val scrollView = view?.findViewById<ScrollView>(R.id.player_scrollView)
scrollView?.getHitRect(bounds)
if (SDK_INT >= Build.VERSION_CODES.N &&
exoPlayer.isPlaying && (
scrollView?.getLocalVisibleRect(bounds) == true ||
isFullScreen
)
) {
requireActivity().enterPictureInPictureMode()
}
}
}

View File

@ -3,27 +3,23 @@ package com.github.libretube
import android.content.Context
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.ScrollView
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.adapters.PlaylistAdapter
import com.squareup.picasso.Picasso
import retrofit2.HttpException
import java.io.IOException
import retrofit2.HttpException
class PlaylistFragment : Fragment() {
private var playlist_id: String? = null
private val TAG = "PlaylistFragment"
var nextPage: String? =null
var nextPage: String? = null
var playlistAdapter: PlaylistAdapter? = null
var isLoading = true
override fun onCreate(savedInstanceState: Bundle?) {
@ -34,7 +30,8 @@ class PlaylistFragment : Fragment() {
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
@ -44,19 +41,20 @@ class PlaylistFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
playlist_id = playlist_id!!.replace("/playlist?list=","")
view.findViewById<TextView>(R.id.playlist_name).text=playlist_id
playlist_id = playlist_id!!.replace("/playlist?list=", "")
view.findViewById<TextView>(R.id.playlist_name).text = playlist_id
val recyclerView = view.findViewById<RecyclerView>(R.id.playlist_recView)
recyclerView.layoutManager = LinearLayoutManager(context)
fetchPlaylist(view)
}
private fun fetchPlaylist(view: View){
private fun fetchPlaylist(view: View) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getPlaylist(playlist_id!!)
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
@ -65,32 +63,39 @@ class PlaylistFragment : Fragment() {
return@launchWhenCreated
}
nextPage = response.nextpage
isLoading=false
isLoading = false
runOnUiThread {
view.findViewById<TextView>(R.id.playlist_name).text=response.name
view.findViewById<TextView>(R.id.playlist_uploader).text=response.uploader
view.findViewById<TextView>(R.id.playlist_totVideos).text=response.videos.toString()+" Videos"
val sharedPref2 = context?.getSharedPreferences("username", Context.MODE_PRIVATE)
val user = sharedPref2?.getString("username","")
view.findViewById<TextView>(R.id.playlist_name).text = response.name
view.findViewById<TextView>(R.id.playlist_uploader).text = response.uploader
view.findViewById<TextView>(R.id.playlist_totVideos).text =
response.videos.toString() + " Videos"
val sharedPref2 =
context?.getSharedPreferences("username", Context.MODE_PRIVATE)
val user = sharedPref2?.getString("username", "")
var isOwner = false
if(response.uploaderUrl == null && response.uploader == user){
if (response.uploaderUrl == null && response.uploader.equals(user, true)) {
isOwner = true
}
playlistAdapter = PlaylistAdapter(response.relatedStreams!!.toMutableList(), playlist_id!!, isOwner, requireActivity())
playlistAdapter = PlaylistAdapter(
response.relatedStreams!!.toMutableList(),
playlist_id!!,
isOwner,
requireActivity()
)
view.findViewById<RecyclerView>(R.id.playlist_recView).adapter = playlistAdapter
val scrollView = view.findViewById<ScrollView>(R.id.playlist_scrollview)
scrollView.viewTreeObserver
.addOnScrollChangedListener {
if (scrollView.getChildAt(0).bottom
== (scrollView.height + scrollView.scrollY)) {
//scroll view is at bottom
if(nextPage!=null && !isLoading){
isLoading=true
== (scrollView.height + scrollView.scrollY)
) {
// scroll view is at bottom
if (nextPage != null && !isLoading) {
isLoading = true
fetchNextPage()
}
} else {
//scroll view is not at bottom
// scroll view is not at bottom
}
}
}
@ -99,24 +104,23 @@ class PlaylistFragment : Fragment() {
run()
}
private fun fetchNextPage(){
private fun fetchNextPage() {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getPlaylistNextPage(playlist_id!!,nextPage!!)
RetrofitInstance.api.getPlaylistNextPage(playlist_id!!, nextPage!!)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response,"+e.response())
Log.e(TAG, "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage
playlistAdapter?.updateItems(response.relatedStreams!!)
isLoading=false
isLoading = false
}
}
run()

View File

@ -1,6 +1,6 @@
package com.github.libretube
import java.util.*
import java.util.LinkedList
import kotlin.reflect.KProperty
class ResettableLazyManager {
@ -8,13 +8,13 @@ class ResettableLazyManager {
val managedDelegates = LinkedList<Resettable>()
fun register(managed: Resettable) {
synchronized (managedDelegates) {
synchronized(managedDelegates) {
managedDelegates.add(managed)
}
}
fun reset() {
synchronized (managedDelegates) {
synchronized(managedDelegates) {
managedDelegates.forEach { it.reset() }
managedDelegates.clear()
}
@ -25,8 +25,10 @@ interface Resettable {
fun reset()
}
class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: ()->PROPTYPE): Resettable {
@Volatile var lazyHolder = makeInitBlock()
class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: () -> PROPTYPE) :
Resettable {
@Volatile
var lazyHolder = makeInitBlock()
operator fun getValue(thisRef: Any?, property: KProperty<*>): PROPTYPE {
return lazyHolder.value
@ -44,7 +46,8 @@ class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: ()-
}
}
fun <PROPTYPE> resettableLazy(manager: ResettableLazyManager, init: ()->PROPTYPE): ResettableLazy<PROPTYPE> {
fun <PROPTYPE> resettableLazy(manager: ResettableLazyManager, init: () -> PROPTYPE):
ResettableLazy<PROPTYPE> {
return ResettableLazy(manager, init)
}

View File

@ -13,5 +13,4 @@ object RetrofitInstance {
.build()
.create(PipedApi::class.java)
}
}

View File

@ -1,6 +1,7 @@
package com.github.libretube
import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
@ -8,51 +9,127 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import android.widget.ImageView
import android.widget.TextView.GONE
import android.widget.TextView.OnEditorActionListener
import android.widget.TextView.VISIBLE
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.adapters.SearchAdapter
import com.github.libretube.adapters.SearchHistoryAdapter
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
class SearchFragment : Fragment() {
private val TAG = "SearchFragment"
private var selectedFilter = 0
private var apiSearchFilter = "all"
private var nextPage: String? = null
private lateinit var searchRecView: RecyclerView
private var searchAdapter: SearchAdapter? = null
private var isLoading: Boolean = true
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_search, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val recyclerView = view.findViewById<RecyclerView>(R.id.search_recycler)
recyclerView.layoutManager = GridLayoutManager(view.context, 1)
searchRecView = view.findViewById<RecyclerView>(R.id.search_recycler)
val autoTextView = view.findViewById<AutoCompleteTextView>(R.id.autoCompleteTextView)
val historyRecycler = view.findViewById<RecyclerView>(R.id.history_recycler)
val filterImageView = view.findViewById<ImageView>(R.id.filterMenu_imageView)
var tempSelectedItem = 0
filterImageView.setOnClickListener {
val filterOptions = arrayOf(
getString(R.string.all),
getString(R.string.videos),
getString(R.string.channels),
getString(R.string.playlists),
getString(R.string.music_songs),
getString(R.string.music_videos),
getString(R.string.music_albums),
getString(R.string.music_playlists)
)
MaterialAlertDialogBuilder(view.context)
.setTitle(getString(R.string.choose_filter))
.setSingleChoiceItems(
filterOptions, selectedFilter,
DialogInterface.OnClickListener { _, id ->
tempSelectedItem = id
}
)
.setPositiveButton(
getString(R.string.okay),
DialogInterface.OnClickListener { _, _ ->
selectedFilter = tempSelectedItem
apiSearchFilter = when (selectedFilter) {
0 -> "all"
1 -> "videos"
2 -> "channels"
3 -> "playlists"
4 -> "music_songs"
5 -> "music_videos"
6 -> "music_albums"
7 -> "music_playlists"
else -> "all"
}
fetchSearch(autoTextView.text.toString())
}
)
.setNegativeButton(getString(R.string.cancel), null)
.create()
.show()
}
// show search history
searchRecView.visibility = GONE
historyRecycler.visibility = VISIBLE
historyRecycler.layoutManager = LinearLayoutManager(view.context)
var historylist = getHistory()
if (historylist.isNotEmpty()) {
historyRecycler.adapter =
SearchHistoryAdapter(requireContext(), historylist, autoTextView)
}
searchRecView.layoutManager = GridLayoutManager(view.context, 1)
autoTextView.requestFocus()
val imm = requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm!!.showSoftInput(autoTextView, InputMethodManager.SHOW_IMPLICIT)
val imm =
requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(autoTextView, InputMethodManager.SHOW_IMPLICIT)
autoTextView.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(
s: CharSequence?,
@ -60,38 +137,64 @@ class SearchFragment : Fragment() {
count: Int,
after: Int
) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if(s!! != ""){
if (s!! != "") {
searchRecView.visibility = VISIBLE
historyRecycler.visibility = GONE
searchRecView.adapter = null
searchRecView.viewTreeObserver
.addOnScrollChangedListener {
if (!searchRecView.canScrollVertically(1)) {
fetchNextSearchItems(autoTextView.text.toString())
}
}
GlobalScope.launch {
fetchSuggestions(s.toString(), autoTextView)
delay(3000)
fetchSearch(s.toString(),recyclerView)
delay(1000)
val sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(requireContext())
if (sharedPreferences.getBoolean(
"search_history_toggle",
true
)
) addtohistory(s.toString())
fetchSearch(s.toString())
}
}
}
override fun afterTextChanged(s: Editable?) {
if (s!!.isEmpty()) {
searchRecView.visibility = GONE
historyRecycler.visibility = VISIBLE
var historylist = getHistory()
if (historylist.isNotEmpty()) {
historyRecycler.adapter =
SearchHistoryAdapter(requireContext(), historylist, autoTextView)
}
}
}
})
autoTextView.setOnEditorActionListener(OnEditorActionListener { _, actionId, _ ->
autoTextView.setOnEditorActionListener(
OnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
hideKeyboard();
autoTextView.dismissDropDown();
hideKeyboard()
autoTextView.dismissDropDown()
return@OnEditorActionListener true
}
false
})
}
)
autoTextView.setOnItemClickListener { _, _, _, _ ->
hideKeyboard()
}
}
private fun fetchSuggestions(query: String, autoTextView: AutoCompleteTextView){
private fun fetchSuggestions(query: String, autoTextView: AutoCompleteTextView) {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getSuggestions(query)
@ -103,14 +206,16 @@ class SearchFragment : Fragment() {
Log.e(TAG, "HttpException, unexpected response")
return@launchWhenCreated
}
val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_list_item_1, response)
val adapter =
ArrayAdapter(requireContext(), android.R.layout.simple_list_item_1, response)
autoTextView.setAdapter(adapter)
}
}
private fun fetchSearch(query: String, recyclerView: RecyclerView){
private fun fetchSearch(query: String) {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getSearchResults(query, "all")
RetrofitInstance.api.getSearchResults(query, apiSearchFilter)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection $e")
@ -119,12 +224,39 @@ class SearchFragment : Fragment() {
Log.e(TAG, "HttpException, unexpected response")
return@launchWhenCreated
}
if(response.items!!.isNotEmpty()){
nextPage = response.nextpage
if (response.items!!.isNotEmpty()) {
runOnUiThread {
recyclerView.adapter = SearchAdapter(response.items)
searchAdapter = SearchAdapter(response.items)
searchRecView.adapter = searchAdapter
}
}
isLoading = false
}
}
private fun fetchNextSearchItems(query: String) {
lifecycleScope.launchWhenCreated {
if (!isLoading) {
isLoading = true
val response = try {
RetrofitInstance.api.getSearchResultsNextPage(
query,
apiSearchFilter,
nextPage!!
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage
searchAdapter?.updateItems(response.items!!)
isLoading = false
}
}
}
@ -136,11 +268,44 @@ class SearchFragment : Fragment() {
override fun onResume() {
super.onResume()
requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
requireActivity().window.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN)
}
override fun onStop() {
super.onStop()
hideKeyboard()
}
private fun addtohistory(query: String) {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
var historyList = getHistory()
if (historyList.size != 0 && query == historyList.get(historyList.size - 1)) {
return
} else if (query == "") {
return
} else {
historyList = historyList + query
}
if (historyList.size > 10) {
historyList = historyList.takeLast(10)
}
var set: Set<String> = HashSet(historyList)
sharedPreferences.edit().putStringSet("search_history", set)
.apply()
}
private fun getHistory(): List<String> {
try {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
val set: Set<String> = sharedPreferences.getStringSet("search_history", HashSet())!!
return set.toList()
} catch (e: Exception) {
return emptyList()
}
}
}

View File

@ -1,257 +0,0 @@
package com.github.libretube
import android.Manifest
import android.content.ContentResolver
import android.content.Context
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import retrofit2.HttpException
import java.io.*
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
class Settings : PreferenceFragmentCompat() {
val TAG = "Settings"
companion object {
lateinit var getContent: ActivityResultLauncher<String>
}
override fun onCreate(savedInstanceState: Bundle?) {
getContent = registerForActivityResult(ActivityResultContracts.GetContent()) { uri: Uri? ->
if (uri != null) {
try {
// Open a specific media item using ParcelFileDescriptor.
val resolver: ContentResolver =
requireActivity()
.contentResolver
// "rw" for read-and-write;
// "rwt" for truncating or overwriting existing file contents.
val readOnlyMode = "r"
// uri - I have got from onActivityResult
val type = resolver.getType(uri)
var inputStream: InputStream? = resolver.openInputStream(uri)
if (type == "application/zip") {
val zis = ZipInputStream(inputStream)
var entry: ZipEntry? = zis.nextEntry
while (entry != null) {
if (entry.name.endsWith(".csv")) {
inputStream = zis
break
}
entry = zis.nextEntry
}
}
val channels = ArrayList<String>()
inputStream?.bufferedReader()?.readLines()?.forEach {
if (it.isNotBlank()) {
val channelId = it.substringBefore(",")
if (channelId.length == 24)
channels.add(channelId)
}
}
inputStream?.close()
subscribe(channels)
} catch (e: Exception) {
Log.e(TAG, e.toString())
Toast.makeText(
context,
R.string.error,
Toast.LENGTH_SHORT
).show()
}
}
}
super.onCreate(savedInstanceState)
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.settings, rootKey)
val instance = findPreference<ListPreference>("instance")
fetchInstance()
instance?.setOnPreferenceChangeListener { _, newValue ->
RetrofitInstance.url = newValue.toString()
RetrofitInstance.lazyMgr.reset()
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
if (sharedPref?.getString("token", "") != "") {
with(sharedPref!!.edit()) {
putString("token", "")
apply()
}
Toast.makeText(context, R.string.loggedout, Toast.LENGTH_SHORT).show()
}
true
}
val login = findPreference<Preference>("login_register")
login?.setOnPreferenceClickListener {
val newFragment = LoginDialog()
newFragment.show(childFragmentManager, "Login")
true
}
val importFromYt = findPreference<Preference>("import_from_yt")
importFromYt?.setOnPreferenceClickListener {
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
val token = sharedPref?.getString("token", "")!!
//check StorageAccess
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Log.d("myz", "" + Build.VERSION.SDK_INT)
if (ContextCompat.checkSelfPermission(
this.requireContext(),
Manifest.permission.READ_EXTERNAL_STORAGE
)
!= PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this.requireActivity(), arrayOf(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.MANAGE_EXTERNAL_STORAGE
), 1
) //permission request code is just an int
} else if (token != "") {
getContent.launch("*/*")
} else {
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
}
} else {
if (ActivityCompat.checkSelfPermission(
requireContext(),
Manifest.permission.READ_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(
requireContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this.requireActivity(),
arrayOf(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
),
1
)
} else if (token != "") {
getContent.launch("*/*")
} else {
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
}
}
true
}
val themeToggle = findPreference<ListPreference>("theme_togglee")
themeToggle?.setOnPreferenceChangeListener { _, newValue ->
when (newValue.toString()) {
"A" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
"L" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
"D" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
}
true
}
}
private fun fetchInstance() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getInstances("https://instances.tokhmi.xyz/")
} catch (e: IOException) {
println(e)
Log.e("settings", "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e("settings", "HttpException, unexpected response $e")
return@launchWhenCreated
} catch (e: Exception) {
Log.e("settings", e.toString())
return@launchWhenCreated
}
val listEntries: MutableList<String> = ArrayList()
val listEntryValues: MutableList<String> = ArrayList()
for (item in response) {
listEntries.add(item.name!!)
listEntryValues.add(item.api_url!!)
}
val entries = listEntries.toTypedArray<CharSequence>()
val entryValues = listEntryValues.toTypedArray<CharSequence>()
runOnUiThread {
val instance = findPreference<ListPreference>("instance")
instance?.entries = entries
instance?.entryValues = entryValues
instance?.summaryProvider =
Preference.SummaryProvider<ListPreference> { preference ->
val text = preference.entry
if (TextUtils.isEmpty(text)) {
"kavin.rocks (Official)"
} else {
text
}
}
}
}
}
private fun Fragment?.runOnUiThread(action: () -> Unit) {
this ?: return
if (!isAdded) return // Fragment not attached to an Activity
activity?.runOnUiThread(action)
}
private fun subscribe(channels: List<String>) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
RetrofitInstance.api.importSubscriptions(
false,
sharedPref?.getString("token", "")!!,
channels
)
} catch (e: IOException) {
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response$e")
return@launchWhenCreated
}
if (response.message == "ok") {
Toast.makeText(
context,
R.string.importsuccess,
Toast.LENGTH_SHORT
).show()
}
}
}
run()
}
}

View File

@ -0,0 +1,396 @@
package com.github.libretube
import android.Manifest
import android.content.ContentResolver
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.Html
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager
import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import java.io.InputStream
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import org.json.JSONObject
import org.json.JSONTokener
import retrofit2.HttpException
private var isCurrentViewMainSettings = true
class SettingsActivity :
AppCompatActivity(),
SharedPreferences.OnSharedPreferenceChangeListener {
override fun onCreate(savedInstanceState: Bundle?) {
DynamicColors.applyToActivityIfAvailable(this)
updateAccentColor(this)
updateThemeMode(this)
super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
overridePendingTransition(50, 50)
}
val view = this.findViewById<View>(android.R.id.content)
view.alpha = 0F
view.animate().alpha(1F).duration = 300
setContentView(R.layout.activity_settings)
if (savedInstanceState == null) {
supportFragmentManager
.beginTransaction()
.replace(R.id.settings, SettingsFragment())
.commit()
}
PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(this)
}
override fun onSharedPreferenceChanged(
sharedPreferences: SharedPreferences?,
rootKey: String?
) {
}
class SettingsFragment : PreferenceFragmentCompat() {
val TAG = "Settings"
companion object {
lateinit var getContent: ActivityResultLauncher<String>
}
override fun onCreate(savedInstanceState: Bundle?) {
getContent =
registerForActivityResult(ActivityResultContracts.GetContent()) { uri: Uri? ->
if (uri != null) {
try {
// Open a specific media item using ParcelFileDescriptor.
val resolver: ContentResolver =
requireActivity()
.contentResolver
// "rw" for read-and-write;
// "rwt" for truncating or overwriting existing file contents.
// val readOnlyMode = "r"
// uri - I have got from onActivityResult
val type = resolver.getType(uri)
var inputStream: InputStream? = resolver.openInputStream(uri)
val channels = ArrayList<String>()
if (type == "application/json") {
val json = inputStream?.bufferedReader()?.readLines()?.get(0)
val jsonObject = JSONTokener(json).nextValue() as JSONObject
Log.e(TAG, jsonObject.getJSONArray("subscriptions").toString())
for (
i in 0 until jsonObject.getJSONArray("subscriptions")
.length()
) {
var url =
jsonObject.getJSONArray("subscriptions").getJSONObject(i)
.getString("url")
url = url.replace("https://www.youtube.com/channel/", "")
Log.e(TAG, url)
channels.add(url)
}
} else {
if (type == "application/zip") {
val zis = ZipInputStream(inputStream)
var entry: ZipEntry? = zis.nextEntry
while (entry != null) {
if (entry.name.endsWith(".csv")) {
inputStream = zis
break
}
entry = zis.nextEntry
}
}
inputStream?.bufferedReader()?.readLines()?.forEach {
if (it.isNotBlank()) {
val channelId = it.substringBefore(",")
if (channelId.length == 24)
channels.add(channelId)
}
}
}
inputStream?.close()
subscribe(channels)
} catch (e: Exception) {
Log.e(TAG, e.toString())
Toast.makeText(
context,
R.string.error,
Toast.LENGTH_SHORT
).show()
}
}
}
super.onCreate(savedInstanceState)
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.settings, rootKey)
val instance = findPreference<ListPreference>("instance")
fetchInstance()
instance?.setOnPreferenceChangeListener { _, newValue ->
RetrofitInstance.url = newValue.toString()
RetrofitInstance.lazyMgr.reset()
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
if (sharedPref?.getString("token", "") != "") {
with(sharedPref!!.edit()) {
putString("token", "")
apply()
}
Toast.makeText(context, R.string.loggedout, Toast.LENGTH_SHORT).show()
}
true
}
val login = findPreference<Preference>("login_register")
login?.setOnPreferenceClickListener {
val newFragment = LoginDialog()
newFragment.show(childFragmentManager, "Login")
true
}
val sponsorblock = findPreference<Preference>("sponsorblock")
sponsorblock?.setOnPreferenceClickListener {
isCurrentViewMainSettings = false
val newFragment = SponsorBlockSettings()
parentFragmentManager.beginTransaction()
.replace(R.id.settings, newFragment)
.commitNow()
true
}
val importFromYt = findPreference<Preference>("import_from_yt")
importFromYt?.setOnPreferenceClickListener {
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
val token = sharedPref?.getString("token", "")!!
// check StorageAccess
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Log.d("myz", "" + Build.VERSION.SDK_INT)
if (ContextCompat.checkSelfPermission(
this.requireContext(),
Manifest.permission.READ_EXTERNAL_STORAGE
)
!= PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this.requireActivity(),
arrayOf(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.MANAGE_EXTERNAL_STORAGE
),
1
) // permission request code is just an int
} else if (token != "") {
getContent.launch("*/*")
} else {
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
}
} else {
if (ActivityCompat.checkSelfPermission(
requireContext(),
Manifest.permission.READ_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED ||
ActivityCompat.checkSelfPermission(
requireContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this.requireActivity(),
arrayOf(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
),
1
)
} else if (token != "") {
getContent.launch("*/*")
} else {
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
}
}
true
}
val themeToggle = findPreference<ListPreference>("theme_togglee")
themeToggle?.setOnPreferenceChangeListener { _, _ ->
val refresh = Intent(context, SettingsActivity::class.java)
startActivity(refresh)
true
}
val accentColor = findPreference<Preference>("accent_color")
accentColor?.setOnPreferenceChangeListener { _, _ ->
val refresh = Intent(context, SettingsActivity::class.java)
startActivity(refresh)
true
}
val iconChange = findPreference<ListPreference>("icon_change")
iconChange?.setOnPreferenceChangeListener { _, newValue ->
changeIcon(requireContext(), newValue.toString())
true
}
val changeLanguage = findPreference<ListPreference>("language")
changeLanguage?.setOnPreferenceChangeListener { _, _ ->
restartMainActivity(requireContext())
true
}
val clearHistory = findPreference<Preference>("clear_history")
clearHistory?.setOnPreferenceClickListener {
val sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(requireContext())
sharedPreferences.edit().remove("search_history").commit()
true
}
val about = findPreference<Preference>("about")
about?.setOnPreferenceClickListener {
val uri = Uri.parse("https://libre-tube.github.io/")
val intent = Intent(Intent.ACTION_VIEW).setData(uri)
startActivity(intent)
true
}
val license = findPreference<Preference>("license")
license?.setOnPreferenceClickListener {
val licenseString = view?.context?.assets!!.open("gpl3.html").bufferedReader().use {
it.readText()
}
val licenseHtml = if (Build.VERSION.SDK_INT >= 24) {
Html.fromHtml(licenseString, 1)
} else {
Html.fromHtml(licenseString)
}
MaterialAlertDialogBuilder(view?.context!!)
.setPositiveButton(
getString(R.string.okay),
DialogInterface.OnClickListener { _, _ -> }
)
.setMessage(licenseHtml)
.create()
.show()
true
}
}
private fun fetchInstance() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getInstances("https://instances.tokhmi.xyz/")
} catch (e: IOException) {
println(e)
Log.e("settings", "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e("settings", "HttpException, unexpected response $e")
return@launchWhenCreated
} catch (e: Exception) {
Log.e("settings", e.toString())
return@launchWhenCreated
}
val listEntries: MutableList<String> = ArrayList()
val listEntryValues: MutableList<String> = ArrayList()
for (item in response) {
listEntries.add(item.name!!)
listEntryValues.add(item.api_url!!)
}
val entries = listEntries.toTypedArray<CharSequence>()
val entryValues = listEntryValues.toTypedArray<CharSequence>()
runOnUiThread {
val instance = findPreference<ListPreference>("instance")
instance?.entries = entries
instance?.entryValues = entryValues
instance?.summaryProvider =
Preference.SummaryProvider<ListPreference> { preference ->
val text = preference.entry
if (TextUtils.isEmpty(text)) {
"kavin.rocks (Official)"
} else {
text
}
}
}
}
}
private fun Fragment?.runOnUiThread(action: () -> Unit) {
this ?: return
if (!isAdded) return // Fragment not attached to an Activity
activity?.runOnUiThread(action)
}
private fun subscribe(channels: List<String>) {
fun run() {
lifecycleScope.launchWhenCreated {
val response = try {
val sharedPref =
context?.getSharedPreferences("token", Context.MODE_PRIVATE)
RetrofitInstance.api.importSubscriptions(
false,
sharedPref?.getString("token", "")!!,
channels
)
} catch (e: IOException) {
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response$e")
return@launchWhenCreated
}
if (response.message == "ok") {
Toast.makeText(
context,
R.string.importsuccess,
Toast.LENGTH_SHORT
).show()
}
}
}
run()
}
}
override fun onBackPressed() {
if (isCurrentViewMainSettings) {
PreferenceManager.getDefaultSharedPreferences(this)
.unregisterOnSharedPreferenceChangeListener(this)
restartMainActivity(this)
} else {
isCurrentViewMainSettings = true
supportFragmentManager
.beginTransaction()
.replace(R.id.settings, SettingsFragment())
.commit()
}
}
}

View File

@ -3,13 +3,10 @@ package com.github.libretube
import android.content.Context
import android.graphics.Rect
import android.util.AttributeSet
import android.util.Log
import android.view.GestureDetector
import android.view.MotionEvent
import android.view.View
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.recyclerview.widget.RecyclerView
/**
*
@ -17,10 +14,11 @@ import androidx.recyclerview.widget.RecyclerView
*
*/
class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeSet? = null) : MotionLayout(context, attributeSet) {
class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeSet? = null) :
MotionLayout(context, attributeSet) {
private val viewToDetectTouch by lazy {
findViewById<View>(R.id.main_container) //TODO move to Attributes
findViewById<View>(R.id.main_container) // TODO move to Attributes
}
private val viewRect = Rect()
private var touchStarted = false
@ -33,7 +31,6 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
startId: Int,
endId: Int
) {
}
override fun onTransitionChange(p0: MotionLayout?, p1: Int, p2: Int, p3: Float) {
@ -49,7 +46,6 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
positive: Boolean,
progress: Float
) {
}
})
@ -59,7 +55,6 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
startId: Int,
endId: Int
) {
}
override fun onTransitionChange(p0: MotionLayout?, p1: Int, p2: Int, p3: Float) {
@ -78,7 +73,6 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
positive: Boolean,
progress: Float
) {
}
})
}
@ -91,15 +85,18 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
transitionListenerList += listener
}
private val gestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() {
private val gestureDetector = GestureDetector(
context,
object : GestureDetector.SimpleOnGestureListener() {
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
transitionToEnd()
return false
}
})
}
)
override fun onTouchEvent(event: MotionEvent): Boolean {
//gestureDetector.onTouchEvent(event)
// gestureDetector.onTouchEvent(event)
when (event.actionMasked) {
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
touchStarted = false

View File

@ -0,0 +1,63 @@
package com.github.libretube
import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
class SponsorBlockSettings : PreferenceFragmentCompat() {
private val TAG = "SponsorBlockDialog"
companion object {
var sponsorBlockEnabled: Boolean = false
var sponsorNotificationsEnabled: Boolean = false
var sponsorsEnabled: Boolean = false
var selfPromoEnabled: Boolean = false
var interactionEnabled: Boolean = false
var introEnabled: Boolean = false
var outroEnabled: Boolean = false
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.sponsorblock_settings, rootKey)
val sponsorBlockToggle = findPreference<SwitchPreferenceCompat>("sb_enabled_key")
sponsorBlockToggle?.setOnPreferenceChangeListener { _, newValue ->
sponsorBlockEnabled = newValue as Boolean
true
}
val notificationsToggle = findPreference<SwitchPreferenceCompat>("sb_notifications_key")
notificationsToggle?.setOnPreferenceChangeListener { _, newValue ->
sponsorNotificationsEnabled = newValue as Boolean
true
}
val sponsorToggle = findPreference<SwitchPreferenceCompat>("sponsors_category_key")
sponsorToggle?.setOnPreferenceChangeListener { _, newValue ->
sponsorsEnabled = newValue as Boolean
true
}
val selfPromoToggle = findPreference<SwitchPreferenceCompat>("selfpromo_category_key")
selfPromoToggle?.setOnPreferenceChangeListener { _, newValue ->
selfPromoEnabled = newValue as Boolean
true
}
val interactionToggle = findPreference<SwitchPreferenceCompat>("interaction_category_key")
interactionToggle?.setOnPreferenceChangeListener { _, newValue ->
interactionEnabled = newValue as Boolean
true
}
val introToggle = findPreference<SwitchPreferenceCompat>("intro_category_key")
introToggle?.setOnPreferenceChangeListener { _, newValue ->
introEnabled = newValue as Boolean
true
}
val outroToggle = findPreference<SwitchPreferenceCompat>("outro_category_key")
outroToggle?.setOnPreferenceChangeListener { _, newValue ->
outroEnabled = newValue as Boolean
true
}
}
}

View File

@ -3,27 +3,35 @@ package com.github.libretube
import android.content.Context
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.RelativeLayout
import android.widget.ScrollView
import android.widget.TextView
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.github.libretube.adapters.SubscriptionAdapter
import com.github.libretube.adapters.SubscriptionChannelAdapter
import retrofit2.HttpException
import java.io.IOException
import retrofit2.HttpException
class Subscriptions : Fragment() {
val TAG = "SubFragment"
lateinit var token: String
var isLoaded = false
private var subscriptionAdapter: SubscriptionAdapter? =null
private var subscriptionAdapter: SubscriptionAdapter? = null
private var refreshLayout: SwipeRefreshLayout? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -32,7 +40,8 @@ class Subscriptions : Fragment() {
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
@ -42,22 +51,22 @@ class Subscriptions : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
token = sharedPref?.getString("token","")!!
token = sharedPref?.getString("token", "")!!
refreshLayout = view.findViewById(R.id.sub_refresh)
if(token!=""){
view.findViewById<RelativeLayout>(R.id.loginOrRegister).visibility=View.GONE
if (token != "") {
view.findViewById<RelativeLayout>(R.id.loginOrRegister).visibility = View.GONE
refreshLayout?.isEnabled = true
var progressBar = view.findViewById<ProgressBar>(R.id.sub_progress)
progressBar.visibility=View.VISIBLE
progressBar.visibility = View.VISIBLE
var channelRecView = view.findViewById<RecyclerView>(R.id.sub_channels)
channelRecView?.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
fetchChannels(channelRecView)
var feedRecView = view.findViewById<RecyclerView>(R.id.sub_feed)
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
val grid = sharedPreferences.getString("grid", resources.getInteger(R.integer.grid_items).toString())!!
val grid = sharedPreferences.getString(
"grid", resources.getInteger(R.integer.grid_items).toString()
)!!
feedRecView.layoutManager = GridLayoutManager(view.context, grid.toInt())
fetchFeed(feedRecView, progressBar, view)
@ -66,18 +75,55 @@ class Subscriptions : Fragment() {
fetchFeed(feedRecView, progressBar, view)
}
var toggleSubs = view.findViewById<RelativeLayout>(R.id.toggle_subs)
toggleSubs.visibility = View.VISIBLE
var loadedSubbedChannels = false
toggleSubs.setOnClickListener {
if (!channelRecView.isVisible) {
if (!loadedSubbedChannels) {
channelRecView?.layoutManager = GridLayoutManager(context, 4)
fetchChannels(channelRecView)
loadedSubbedChannels = true
}
channelRecView.visibility = View.VISIBLE
feedRecView.visibility = View.GONE
// toggle button
val rotate = RotateAnimation(
0F,
180F,
Animation.RELATIVE_TO_SELF,
0.5f,
Animation.RELATIVE_TO_SELF,
0.5f
)
rotate.duration = 100
rotate.interpolator = LinearInterpolator()
rotate.fillAfter = true
val image = view.findViewById<ImageView>(R.id.toggle)
image.startAnimation(rotate)
} else {
channelRecView.visibility = View.GONE
feedRecView.visibility = View.VISIBLE
// toggle button
val image = view.findViewById<ImageView>(R.id.toggle)
image.clearAnimation()
}
}
val scrollView = view.findViewById<ScrollView>(R.id.scrollview_sub)
scrollView.viewTreeObserver
.addOnScrollChangedListener {
if (scrollView.getChildAt(0).bottom
== (scrollView.height + scrollView.scrollY)) {
//scroll view is at bottom
if(isLoaded){
== (scrollView.height + scrollView.scrollY)
) {
// scroll view is at bottom
if (isLoaded) {
refreshLayout?.isRefreshing = true
subscriptionAdapter?.updateItems()
refreshLayout?.isRefreshing = false
}
}
}
} else {
@ -90,8 +136,8 @@ class Subscriptions : Fragment() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.getFeed(token)
}catch(e: IOException) {
Log.e(TAG,e.toString())
} catch (e: IOException) {
Log.e(TAG, e.toString())
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
@ -100,25 +146,26 @@ class Subscriptions : Fragment() {
} finally {
refreshLayout?.isRefreshing = false
}
if (response.isNotEmpty()){
if (response.isNotEmpty()) {
subscriptionAdapter = SubscriptionAdapter(response)
feedRecView?.adapter= subscriptionAdapter
feedRecView.adapter = subscriptionAdapter
subscriptionAdapter?.updateItems()
}else{
} else {
runOnUiThread {
with(view.findViewById<ImageView>(R.id.boogh)){
visibility=View.VISIBLE
with(view.findViewById<ImageView>(R.id.boogh)) {
visibility = View.VISIBLE
setImageResource(R.drawable.ic_list)
}
with(view.findViewById<TextView>(R.id.textLike)){
visibility=View.VISIBLE
with(view.findViewById<TextView>(R.id.textLike)) {
visibility = View.VISIBLE
text = getString(R.string.emptyList)
}
view.findViewById<RelativeLayout>(R.id.loginOrRegister).visibility=View.VISIBLE
view.findViewById<RelativeLayout>(R.id.loginOrRegister)
.visibility = View.VISIBLE
}
}
progressBar.visibility=View.GONE
isLoaded=true
progressBar.visibility = View.GONE
isLoaded = true
}
}
run()
@ -129,8 +176,8 @@ class Subscriptions : Fragment() {
lifecycleScope.launchWhenCreated {
val response = try {
RetrofitInstance.api.subscriptions(token)
}catch(e: IOException) {
Log.e(TAG,e.toString())
} catch (e: IOException) {
Log.e(TAG, e.toString())
Log.e(TAG, "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
@ -139,25 +186,26 @@ class Subscriptions : Fragment() {
} finally {
refreshLayout?.isRefreshing = false
}
if (response.isNotEmpty()){
channelRecView?.adapter=SubscriptionChannelAdapter(response.toMutableList())
}else{
Toast.makeText(context,R.string.subscribeIsEmpty, Toast.LENGTH_SHORT).show()
if (response.isNotEmpty()) {
channelRecView.adapter = SubscriptionChannelAdapter(response.toMutableList())
} else {
Toast.makeText(context, R.string.subscribeIsEmpty, Toast.LENGTH_SHORT).show()
}
}
}
run()
}
override fun onDestroy() {
Log.e(TAG,"Destroyed")
Log.e(TAG, "Destroyed")
super.onDestroy()
subscriptionAdapter = null
view?.findViewById<RecyclerView>(R.id.sub_feed)?.adapter=null
view?.findViewById<RecyclerView>(R.id.sub_feed)?.adapter = null
}
private fun Fragment?.runOnUiThread(action: () -> Unit) {
this ?: return
if (!isAdded) return // Fragment not attached to an Activity
activity?.runOnUiThread(action)
}
}

View File

@ -0,0 +1,84 @@
package com.github.libretube
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.PreferenceManager
import java.util.*
fun updateAccentColor(context: Context) {
val colorAccent =
PreferenceManager.getDefaultSharedPreferences(context).getString("accent_color", "red")
when (colorAccent) {
"my" -> context.setTheme(R.style.Theme_MY)
"red" -> context.setTheme(R.style.Theme_Red)
"blue" -> context.setTheme(R.style.Theme_Blue)
"yellow" -> context.setTheme(R.style.Theme_Yellow)
"green" -> context.setTheme(R.style.Theme_Green)
"purple" -> context.setTheme(R.style.Theme_Purple)
}
}
fun updateThemeMode(context: Context) {
val themeMode =
PreferenceManager.getDefaultSharedPreferences(context).getString("theme_togglee", "A")
when (themeMode) {
"A" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
"L" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
"D" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
"O" -> oledMode(context)
}
}
fun oledMode(context: Context) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
context.setTheme(R.style.Theme_OLED)
}
fun updateLanguage(context: Context) {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val languageName = sharedPreferences.getString("language", "sys")
if (languageName != "") {
var locale = if (languageName != "sys" && "$languageName".length < 3) {
Locale(languageName)
} else if ("$languageName".length > 3) {
Locale(languageName?.substring(0, 2), languageName?.substring(4, 6))
} else {
Locale.getDefault()
}
val res = context.resources
val dm = res.displayMetrics
val conf = res.configuration
conf.setLocale(locale)
Locale.setDefault(locale)
res.updateConfiguration(conf, dm)
}
}
fun changeIcon(context: Context, newLogoActivityAlias: String) {
val activityAliases = context.resources.getStringArray(R.array.iconsValue)
// Disable Old Icon(s)
for (activityAlias in activityAliases) {
context.packageManager.setComponentEnabledSetting(
ComponentName(context.packageName, "com.github.libretube.$activityAlias"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP
)
}
// Enable New Icon
context.packageManager.setComponentEnabledSetting(
ComponentName(context.packageName, "com.github.libretube.$newLogoActivityAlias"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP
)
}
// Needed due to different MainActivity Aliases because of the app icons
fun restartMainActivity(context: Context) {
val pm: PackageManager = context.packageManager
val intent = pm.getLaunchIntentForPackage(context.packageName)
intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
context.startActivity(intent)
}

View File

@ -9,37 +9,42 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.RecyclerView
import com.squareup.picasso.Picasso
import com.github.libretube.PlayerFragment
import com.github.libretube.R
import com.github.libretube.obj.StreamItem
import com.github.libretube.formatShort
import com.github.libretube.obj.StreamItem
import com.squareup.picasso.Picasso
class ChannelAdapter(private val videoFeed: MutableList<StreamItem>): RecyclerView.Adapter<ChannelViewHolder>() {
class ChannelAdapter(private val videoFeed: MutableList<StreamItem>) :
RecyclerView.Adapter<ChannelViewHolder>() {
override fun getItemCount(): Int {
return videoFeed.size
}
fun updateItems(newItems: List<StreamItem>){
fun updateItems(newItems: List<StreamItem>) {
videoFeed.addAll(newItems)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChannelViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(R.layout.video_channel_row,parent,false)
val cell = layoutInflater.inflate(R.layout.video_channel_row, parent, false)
return ChannelViewHolder(cell)
}
override fun onBindViewHolder(holder: ChannelViewHolder, position: Int) {
val trending = videoFeed[position]
holder.v.findViewById<TextView>(R.id.channel_description).text = trending.title
holder.v.findViewById<TextView>(R.id.channel_views).text = trending.views.formatShort()+""+ DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
holder.v.findViewById<TextView>(R.id.channel_duration).text = DateUtils.formatElapsedTime(trending.duration!!)
holder.v.findViewById<TextView>(R.id.channel_views).text =
trending.views.formatShort() + "" +
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
holder.v.findViewById<TextView>(R.id.channel_duration).text =
DateUtils.formatElapsedTime(trending.duration!!)
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.channel_thumbnail)
Picasso.get().load(trending.thumbnail).into(thumbnailImage)
holder.v.setOnClickListener{
holder.v.setOnClickListener {
var bundle = Bundle()
bundle.putString("videoId",trending.url!!.replace("/watch?v=",""))
bundle.putString("videoId", trending.url!!.replace("/watch?v=", ""))
var frag = PlayerFragment()
frag.arguments = bundle
val activity = holder.v.context as AppCompatActivity
@ -52,7 +57,8 @@ class ChannelAdapter(private val videoFeed: MutableList<StreamItem>): RecyclerVi
}
}
}
class ChannelViewHolder(val v: View): RecyclerView.ViewHolder(v){
class ChannelViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -0,0 +1,74 @@
package com.github.libretube.adapters
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.MainActivity
import com.github.libretube.R
import com.github.libretube.formatShort
import com.github.libretube.obj.Comment
import com.squareup.picasso.Picasso
class CommentsAdapter(private val comments: MutableList<Comment>) :
RecyclerView.Adapter<ViewHolder>() {
fun updateItems(newItems: List<Comment>) {
var commentsSize = comments.size
comments.addAll(newItems)
notifyItemRangeInserted(commentsSize, newItems.size)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
var commentsView =
LayoutInflater.from(parent.context).inflate(R.layout.comments_row, parent, false)
return ViewHolder(commentsView)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.v.findViewById<TextView>(R.id.comment_infos).text =
comments[position].author.toString() +
"" + comments[position].commentedTime.toString()
holder.v.findViewById<TextView>(R.id.comment_text).text =
comments[position].commentText.toString()
val channelImage = holder.v.findViewById<ImageView>(R.id.commentor_image)
Picasso.get().load(comments[position].thumbnail).fit().centerCrop().into(channelImage)
holder.v.findViewById<TextView>(R.id.likes_textView).text =
comments[position].likeCount?.toLong().formatShort()
if (comments[position].verified == true) {
holder.v.findViewById<ImageView>(R.id.verified_imageView).visibility = View.VISIBLE
}
if (comments[position].pinned == true) {
holder.v.findViewById<ImageView>(R.id.pinned_imageView).visibility = View.VISIBLE
}
if (comments[position].hearted == true) {
holder.v.findViewById<ImageView>(R.id.hearted_imageView).visibility = View.VISIBLE
}
channelImage.setOnClickListener {
val activity = holder.v.context as MainActivity
val bundle = bundleOf("channel_id" to comments[position].commentorUrl)
activity.navController.navigate(R.id.channel, bundle)
try {
val mainMotionLayout = activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
if (mainMotionLayout.progress == 0.toFloat()) {
mainMotionLayout.transitionToEnd()
activity.findViewById<MotionLayout>(R.id.playerMotionLayout).transitionToEnd()
}
} catch (e: Exception) {
}
}
}
override fun getItemCount(): Int {
return comments.size
}
}
class ViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -12,30 +12,36 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.RecyclerView
import com.squareup.picasso.Picasso
import com.github.libretube.PlayerFragment
import com.github.libretube.R
import com.github.libretube.RetrofitInstance
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.StreamItem
import com.squareup.picasso.Picasso
import java.io.IOException
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
class PlaylistAdapter(private val videoFeed: MutableList<StreamItem>, private val playlistId: String, private val isOwner: Boolean, private val activity: Activity): RecyclerView.Adapter<PlaylistViewHolder>() {
class PlaylistAdapter(
private val videoFeed: MutableList<StreamItem>,
private val playlistId: String,
private val isOwner: Boolean,
private val activity: Activity
) : RecyclerView.Adapter<PlaylistViewHolder>() {
private val TAG = "PlaylistAdapter"
override fun getItemCount(): Int {
return videoFeed.size
}
fun updateItems(newItems: List<StreamItem>){
fun updateItems(newItems: List<StreamItem>) {
videoFeed.addAll(newItems)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PlaylistViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(R.layout.playlist_row,parent,false)
val cell = layoutInflater.inflate(R.layout.playlist_row, parent, false)
return PlaylistViewHolder(cell)
}
@ -43,12 +49,13 @@ class PlaylistAdapter(private val videoFeed: MutableList<StreamItem>, private va
val streamItem = videoFeed[position]
holder.v.findViewById<TextView>(R.id.playlist_title).text = streamItem.title
holder.v.findViewById<TextView>(R.id.playlist_description).text = streamItem.uploaderName
holder.v.findViewById<TextView>(R.id.playlist_duration).text = DateUtils.formatElapsedTime(streamItem.duration!!)
holder.v.findViewById<TextView>(R.id.playlist_duration).text =
DateUtils.formatElapsedTime(streamItem.duration!!)
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.playlist_thumbnail)
Picasso.get().load(streamItem.thumbnail).into(thumbnailImage)
holder.v.setOnClickListener{
holder.v.setOnClickListener {
var bundle = Bundle()
bundle.putString("videoId",streamItem.url!!.replace("/watch?v=",""))
bundle.putString("videoId", streamItem.url!!.replace("/watch?v=", ""))
var frag = PlayerFragment()
frag.arguments = bundle
val activity = holder.v.context as AppCompatActivity
@ -59,34 +66,40 @@ class PlaylistAdapter(private val videoFeed: MutableList<StreamItem>, private va
.replace(R.id.container, frag)
.commitNow()
}
if(isOwner){
if (isOwner) {
val delete = holder.v.findViewById<ImageView>(R.id.delete_playlist)
delete.visibility = View.VISIBLE
delete.setOnClickListener {
val sharedPref = holder.v.context.getSharedPreferences("token", Context.MODE_PRIVATE)
val token = sharedPref?.getString("token","")!!
val sharedPref = holder.v.context.getSharedPreferences(
"token",
Context.MODE_PRIVATE
)
val token = sharedPref?.getString("token", "")!!
removeFromPlaylist(token, position)
}
}
}
private fun removeFromPlaylist(token: String, position: Int) {
fun run() {
GlobalScope.launch{
GlobalScope.launch {
val response = try {
RetrofitInstance.api.removeFromPlaylist(token, PlaylistId(playlistId = playlistId, index = position))
}catch(e: IOException) {
RetrofitInstance.api.removeFromPlaylist(
token,
PlaylistId(playlistId = playlistId, index = position)
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launch
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
return@launch
}finally {
} finally {
}
try{
if(response.message == "ok"){
Log.d(TAG,"deleted!")
try {
if (response.message == "ok") {
Log.d(TAG, "deleted!")
videoFeed.removeAt(position)
// FIXME: This needs to run on UI thread?
activity.runOnUiThread { notifyDataSetChanged() }
@ -95,17 +108,16 @@ class PlaylistAdapter(private val videoFeed: MutableList<StreamItem>, private va
view.findViewById<ImageView>(R.id.boogh2).visibility=View.VISIBLE
}*/
}
}catch (e:Exception){
Log.e(TAG,e.toString())
} catch (e: Exception) {
Log.e(TAG, e.toString())
}
}
}
run()
}
}
class PlaylistViewHolder(val v: View): RecyclerView.ViewHolder(v){
class PlaylistViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -2,38 +2,43 @@ package com.github.libretube.adapters
import android.app.Activity
import android.content.Context
import android.os.Handler
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.appcompat.app.AlertDialog
import android.widget.ImageView
import android.widget.TextView
import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.*
import com.github.libretube.MainActivity
import com.github.libretube.R
import com.github.libretube.RetrofitInstance
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.Playlists
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.squareup.picasso.Picasso
import java.io.IOException
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
class PlaylistsAdapter(private val playlists: MutableList<Playlists>, private val activity: Activity): RecyclerView.Adapter<PlaylistsViewHolder>() {
class PlaylistsAdapter(
private val playlists: MutableList<Playlists>,
private val activity: Activity
) : RecyclerView.Adapter<PlaylistsViewHolder>() {
val TAG = "PlaylistsAdapter"
override fun getItemCount(): Int {
return playlists.size
}
fun updateItems(newItems: List<Playlists>){
fun updateItems(newItems: List<Playlists>) {
playlists.addAll(newItems)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PlaylistsViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(R.layout.playlists_row,parent,false)
val cell = layoutInflater.inflate(R.layout.playlists_row, parent, false)
return PlaylistsViewHolder(cell)
}
@ -43,12 +48,15 @@ class PlaylistsAdapter(private val playlists: MutableList<Playlists>, private va
Picasso.get().load(playlist.thumbnail).into(thumbnailImage)
holder.v.findViewById<TextView>(R.id.playlist_title).text = playlist.name
holder.v.findViewById<ImageView>(R.id.delete_playlist).setOnClickListener {
val builder = AlertDialog.Builder(holder.v.context)
val builder = MaterialAlertDialogBuilder(holder.v.context)
builder.setTitle(R.string.deletePlaylist)
builder.setMessage(R.string.areYouSure)
builder.setPositiveButton(R.string.yes) { dialog, which ->
val sharedPref = holder.v.context.getSharedPreferences("token", Context.MODE_PRIVATE)
val token = sharedPref?.getString("token","")!!
val sharedPref = holder.v.context.getSharedPreferences(
"token",
Context.MODE_PRIVATE
)
val token = sharedPref?.getString("token", "")!!
deletePlaylist(playlist.id!!, token, position)
}
builder.setNegativeButton(R.string.cancel) { dialog, which ->
@ -56,31 +64,30 @@ class PlaylistsAdapter(private val playlists: MutableList<Playlists>, private va
builder.show()
}
holder.v.setOnClickListener {
//playlists clicked
// playlists clicked
val activity = holder.v.context as MainActivity
val bundle = bundleOf("playlist_id" to playlist.id)
activity.navController.navigate(R.id.playlistFragment,bundle)
activity.navController.navigate(R.id.playlistFragment, bundle)
}
}
}
private fun deletePlaylist(id: String, token: String, position: Int) {
fun run() {
GlobalScope.launch{
GlobalScope.launch {
val response = try {
RetrofitInstance.api.deletePlaylist(token, PlaylistId(id))
}catch(e: IOException) {
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
return@launch
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
return@launch
}finally {
} finally {
}
try{
if(response.message == "ok"){
Log.d(TAG,"deleted!")
try {
if (response.message == "ok") {
Log.d(TAG, "deleted!")
playlists.removeAt(position)
// FIXME: This needs to run on UI thread?
activity.runOnUiThread { notifyDataSetChanged() }
@ -89,18 +96,16 @@ class PlaylistsAdapter(private val playlists: MutableList<Playlists>, private va
view.findViewById<ImageView>(R.id.boogh2).visibility=View.VISIBLE
}*/
}
}catch (e:Exception){
Log.e(TAG,e.toString())
} catch (e: Exception) {
Log.e(TAG, e.toString())
}
}
}
run()
}
}
class PlaylistsViewHolder(val v: View): RecyclerView.ViewHolder(v){
class PlaylistsViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -1,7 +1,7 @@
package com.github.libretube.adapters
import android.os.Bundle
import android.text.format.DateUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -11,14 +11,21 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.MainActivity
import com.squareup.picasso.Picasso
import com.github.libretube.PlayerFragment
import com.github.libretube.R
import com.github.libretube.obj.SearchItem
import com.github.libretube.formatShort
import com.github.libretube.obj.SearchItem
import com.squareup.picasso.Picasso
class SearchAdapter(private val searchItems: MutableList<SearchItem>) :
RecyclerView.Adapter<CustomViewHolder1>() {
fun updateItems(newItems: List<SearchItem>) {
var searchItemsSize = searchItems.size
searchItems.addAll(newItems)
notifyItemRangeInserted(searchItemsSize, newItems.size)
}
class SearchAdapter(private val searchItems: List<SearchItem>): RecyclerView.Adapter<CustomViewHolder1>() {
override fun getItemCount(): Int {
return searchItems.size
}
@ -31,7 +38,7 @@ class SearchAdapter(private val searchItems: List<SearchItem>): RecyclerView.Ada
else -> throw IllegalArgumentException("Invalid type")
}
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(layout,parent,false)
val cell = layoutInflater.inflate(layout, parent, false)
return CustomViewHolder1(cell)
}
@ -41,29 +48,38 @@ class SearchAdapter(private val searchItems: List<SearchItem>): RecyclerView.Ada
override fun getItemViewType(position: Int): Int {
return when {
searchItems[position].url!!.startsWith("/watch",false) -> 0
searchItems[position].url!!.startsWith("/channel",false) -> 1
searchItems[position].url!!.startsWith("/playlist",false) -> 2
searchItems[position].url!!.startsWith("/watch", false) -> 0
searchItems[position].url!!.startsWith("/channel", false) -> 1
searchItems[position].url!!.startsWith("/playlist", false) -> 2
else -> 3
}
}
}
class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){
class CustomViewHolder1(private val v: View) : RecyclerView.ViewHolder(v) {
private fun bindWatch(item: SearchItem) {
val thumbnailImage = v.findViewById<ImageView>(R.id.search_thumbnail)
Picasso.get().load(item.thumbnail).into(thumbnailImage)
Picasso.get().load(item.thumbnail).fit().centerCrop().into(thumbnailImage)
val thumbnailDuration = v.findViewById<TextView>(R.id.search_thumbnail_duration)
thumbnailDuration.text = DateUtils.formatElapsedTime(item.duration!!)
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
Picasso.get().load(item.uploaderAvatar).into(channelImage)
Picasso.get().load(item.uploaderAvatar).fit().centerCrop().into(channelImage)
val title = v.findViewById<TextView>(R.id.search_description)
title.text = item.title
val views = v.findViewById<TextView>(R.id.search_views)
views.text = item.views.formatShort() +""+item.uploadedDate
val viewsString = if (item.views?.toInt() != -1) item.views.formatShort() else ""
val uploadDate = if (item.uploadedDate != null) item.uploadedDate else ""
views.text =
if (viewsString != "" && uploadDate != "")
"$viewsString$uploadDate"
else
viewsString + uploadDate
val channelName = v.findViewById<TextView>(R.id.search_channel_name)
channelName.text = item.uploaderName
v.setOnClickListener{
v.setOnClickListener {
var bundle = Bundle()
bundle.putString("videoId",item.url!!.replace("/watch?v=",""))
bundle.putString("videoId", item.url!!.replace("/watch?v=", ""))
var frag = PlayerFragment()
frag.arguments = bundle
val activity = v.context as AppCompatActivity
@ -80,44 +96,51 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){
activity.navController.navigate(R.id.channel, bundle)
}
}
private fun bindChannel(item: SearchItem) {
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
Picasso.get().load(item.thumbnail).into(channelImage)
Picasso.get().load(item.thumbnail).fit().centerCrop().into(channelImage)
val channelName = v.findViewById<TextView>(R.id.search_channel_name)
channelName.text = item.name
val channelViews = v.findViewById<TextView>(R.id.search_views)
channelViews.text = item.subscribers.formatShort() + " subscribers • "+ item.videos + " videos"
channelViews.text = v.context.getString(
R.string.subscribers,
item.subscribers.formatShort()
) + "" + v.context.getString(R.string.videoCount, item.videos.toString())
v.setOnClickListener {
val activity = v.context as MainActivity
val bundle = bundleOf("channel_id" to item.url)
activity.navController.navigate(R.id.channel,bundle)
activity.navController.navigate(R.id.channel, bundle)
}
//todo sub button
// todo sub button
}
private fun bindPlaylist(item: SearchItem) {
val playlistImage = v.findViewById<ImageView>(R.id.search_thumbnail)
Picasso.get().load(item.thumbnail).into(playlistImage)
Picasso.get().load(item.thumbnail).fit().centerCrop().into(playlistImage)
val playlistNumber = v.findViewById<TextView>(R.id.search_playlist_number)
playlistNumber.text = item.videos.toString()
if (item.videos?.toInt() != -1) playlistNumber.text = item.videos.toString()
val playlistName = v.findViewById<TextView>(R.id.search_description)
playlistName.text = item.name
val playlistChannelName = v.findViewById<TextView>(R.id.search_name)
playlistChannelName.text = item.uploaderName
val playlistVideosNumber = v.findViewById<TextView>(R.id.search_playlist_videos)
playlistVideosNumber.text = item.videos.toString()+" videos"
if (item.videos?.toInt() != -1)
playlistVideosNumber.text =
v.context.getString(R.string.videoCount, item.videos.toString())
v.setOnClickListener {
//playlist clicked
// playlist clicked
val activity = v.context as MainActivity
val bundle = bundleOf("playlist_id" to item.url)
activity.navController.navigate(R.id.playlistFragment,bundle)
activity.navController.navigate(R.id.playlistFragment, bundle)
}
}
fun bind(searchItem: SearchItem) {
when {
searchItem.url!!.startsWith("/watch",false) -> bindWatch(searchItem)
searchItem.url!!.startsWith("/channel",false) -> bindChannel(searchItem)
searchItem.url!!.startsWith("/playlist",false) -> bindPlaylist(searchItem)
searchItem.url!!.startsWith("/watch", false) -> bindWatch(searchItem)
searchItem.url!!.startsWith("/channel", false) -> bindChannel(searchItem)
searchItem.url!!.startsWith("/playlist", false) -> bindPlaylist(searchItem)
else -> {
}
}

View File

@ -0,0 +1,55 @@
package com.github.libretube.adapters
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.AutoCompleteTextView
import android.widget.TextView
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.google.android.material.imageview.ShapeableImageView
class SearchHistoryAdapter(
private val context: Context,
private var historyList: List<String>,
private val editText: AutoCompleteTextView
) :
RecyclerView.Adapter<SearchHistoryViewHolder>() {
override fun getItemCount(): Int {
return historyList.size
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SearchHistoryViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(R.layout.searchhistory_row, parent, false)
return SearchHistoryViewHolder(cell)
}
override fun onBindViewHolder(holder: SearchHistoryViewHolder, position: Int) {
val history = historyList[position]
holder.v.findViewById<TextView>(R.id.history_text).text = history
holder.v.findViewById<ShapeableImageView>(R.id.delete_history).setOnClickListener {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
historyList = historyList - history
sharedPreferences.edit().putStringSet("search_history", HashSet(historyList))
.apply()
notifyDataSetChanged()
}
holder.v.setOnClickListener {
editText.setText(history)
}
}
}
class SearchHistoryViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -12,41 +12,46 @@ import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.MainActivity
import com.squareup.picasso.Picasso
import com.github.libretube.PlayerFragment
import com.github.libretube.R
import com.github.libretube.obj.StreamItem
import com.github.libretube.formatShort
import com.github.libretube.obj.StreamItem
import com.squareup.picasso.Picasso
class SubscriptionAdapter(private val videoFeed: List<StreamItem>): RecyclerView.Adapter<SubscriptionViewHolder>() {
//private var limitedVideoFeed: MutableList<String> = [""].toMutableList()
class SubscriptionAdapter(private val videoFeed: List<StreamItem>) :
RecyclerView.Adapter<SubscriptionViewHolder>() {
// private var limitedVideoFeed: MutableList<String> = [""].toMutableList()
var i = 0
override fun getItemCount(): Int {
return i
}
fun updateItems(){
//limitedVideoFeed.add("")
fun updateItems() {
// limitedVideoFeed.add("")
i += 10
if(i>videoFeed.size)
i=videoFeed.size
if (i > videoFeed.size)
i = videoFeed.size
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(R.layout.trending_row,parent,false)
val cell = layoutInflater.inflate(R.layout.trending_row, parent, false)
return SubscriptionViewHolder(cell)
}
override fun onBindViewHolder(holder: SubscriptionViewHolder, position: Int) {
val trending = videoFeed[position]
holder.v.findViewById<TextView>(R.id.textView_title).text = trending.title
holder.v.findViewById<TextView>(R.id.textView_channel).text = trending.uploaderName +""+ trending.views.formatShort()+""+ DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
holder.v.findViewById<TextView>(R.id.textView_channel).text =
trending.uploaderName + "" +
trending.views.formatShort() + "" +
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.thumbnail)
holder.v.findViewById<TextView>(R.id.thumbnail_duration).text = DateUtils.formatElapsedTime(trending.duration!!)
holder.v.findViewById<TextView>(R.id.thumbnail_duration).text =
DateUtils.formatElapsedTime(trending.duration!!)
val channelImage = holder.v.findViewById<ImageView>(R.id.channel_image)
channelImage.setOnClickListener{
channelImage.setOnClickListener {
val activity = holder.v.context as MainActivity
val bundle = bundleOf("channel_id" to trending.uploaderUrl)
activity.navController.navigate(R.id.channel, bundle)
@ -56,15 +61,14 @@ class SubscriptionAdapter(private val videoFeed: List<StreamItem>): RecyclerView
mainMotionLayout.transitionToEnd()
activity.findViewById<MotionLayout>(R.id.playerMotionLayout).transitionToEnd()
}
}catch (e: Exception){
} catch (e: Exception) {
}
}
Picasso.get().load(trending.thumbnail).into(thumbnailImage)
Picasso.get().load(trending.uploaderAvatar).into(channelImage)
holder.v.setOnClickListener{
holder.v.setOnClickListener {
var bundle = Bundle()
bundle.putString("videoId",trending.url!!.replace("/watch?v=",""))
bundle.putString("videoId", trending.url!!.replace("/watch?v=", ""))
var frag = PlayerFragment()
frag.arguments = bundle
val activity = holder.v.context as AppCompatActivity
@ -77,7 +81,8 @@ class SubscriptionAdapter(private val videoFeed: List<StreamItem>): RecyclerView
}
}
}
class SubscriptionViewHolder(val v: View): RecyclerView.ViewHolder(v){
class SubscriptionViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -1,45 +1,44 @@
package com.github.libretube.adapters
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.MainActivity
import com.github.libretube.PlayerFragment
import com.github.libretube.R
import com.github.libretube.obj.Subscription
import com.squareup.picasso.Picasso
import org.w3c.dom.Text
class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscription>): RecyclerView.Adapter<SubscriptionChannelViewHolder>() {
class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscription>) :
RecyclerView.Adapter<SubscriptionChannelViewHolder>() {
override fun getItemCount(): Int {
return subscriptions.size
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionChannelViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int):
SubscriptionChannelViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(R.layout.channel_subscription_row,parent,false)
val cell = layoutInflater.inflate(R.layout.channel_subscription_row, parent, false)
return SubscriptionChannelViewHolder(cell)
}
override fun onBindViewHolder(holder: SubscriptionChannelViewHolder, position: Int) {
val subscription = subscriptions[position]
holder.v.findViewById<TextView>(R.id.subscription_channel_name).text=subscription.name
holder.v.findViewById<TextView>(R.id.subscription_channel_name).text = subscription.name
val avatar = holder.v.findViewById<ImageView>(R.id.subscription_channel_image)
Picasso.get().load(subscription.avatar).into(avatar)
holder.v.setOnClickListener{
holder.v.setOnClickListener {
val activity = holder.v.context as MainActivity
val bundle = bundleOf("channel_id" to subscription.url)
activity.navController.navigate(R.id.channel,bundle)
activity.navController.navigate(R.id.channel, bundle)
}
}
}
class SubscriptionChannelViewHolder(val v: View): RecyclerView.ViewHolder(v){
class SubscriptionChannelViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -16,8 +16,9 @@ import com.github.libretube.*
import com.squareup.picasso.Picasso
import com.github.libretube.PlayerFragment
import com.github.libretube.R
import com.github.libretube.obj.StreamItem
import com.github.libretube.formatShort
import com.github.libretube.obj.StreamItem
import com.squareup.picasso.Picasso
class TrendingAdapter(
private val videoFeed: List<StreamItem>,
@ -29,18 +30,22 @@ class TrendingAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cell = layoutInflater.inflate(R.layout.trending_row,parent,false)
val cell = layoutInflater.inflate(R.layout.trending_row, parent, false)
return CustomViewHolder(cell)
}
override fun onBindViewHolder(holder: CustomViewHolder, position: Int) {
val trending = videoFeed[position]
holder.v.findViewById<TextView>(R.id.textView_title).text = trending.title
holder.v.findViewById<TextView>(R.id.textView_channel).text = trending.uploaderName +""+ trending.views.formatShort()+""+DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
holder.v.findViewById<TextView>(R.id.textView_channel).text =
trending.uploaderName + "" +
trending.views.formatShort() + "" +
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.thumbnail)
holder.v.findViewById<TextView>(R.id.thumbnail_duration).text = DateUtils.formatElapsedTime(trending.duration!!)
holder.v.findViewById<TextView>(R.id.thumbnail_duration).text =
DateUtils.formatElapsedTime(trending.duration!!)
val channelImage = holder.v.findViewById<ImageView>(R.id.channel_image)
channelImage.setOnClickListener{
channelImage.setOnClickListener {
val activity = holder.v.context as MainActivity
val bundle = bundleOf("channel_id" to trending.uploaderUrl)
activity.navController.navigate(R.id.channel, bundle)
@ -50,23 +55,21 @@ class TrendingAdapter(
mainMotionLayout.transitionToEnd()
activity.findViewById<MotionLayout>(R.id.playerMotionLayout).transitionToEnd()
}
}catch (e: Exception){
} catch (e: Exception) {
}
}
if (trending.thumbnail!!.isEmpty()) {
} else{
} else {
Picasso.get().load(trending.thumbnail).into(thumbnailImage)
}
if (trending.uploaderAvatar!!.isEmpty()) {
} else{
} else {
Picasso.get().load(trending.uploaderAvatar).into(channelImage)
}
holder.v.setOnClickListener{
holder.v.setOnClickListener {
var bundle = Bundle()
bundle.putString("videoId",trending.url!!.replace("/watch?v=",""))
bundle.putString("videoId", trending.url!!.replace("/watch?v=", ""))
var frag = PlayerFragment()
frag.arguments = bundle
val activity = holder.v.context as AppCompatActivity
@ -84,7 +87,8 @@ class TrendingAdapter(
}
}
}
class CustomViewHolder(val v: View): RecyclerView.ViewHolder(v){
class CustomViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
init {
}
}

View File

@ -7,6 +7,6 @@ data class ChapterSegment(
var title: String?,
var image: String?,
var start: Int?
){
constructor(): this("","",-1)
) {
constructor() : this("", "", -1)
}

View File

@ -1,22 +0,0 @@
package com.github.libretube.obj;
public class Comment {
public String author, thumbnail, commentId, commentText, commentedTime, commentorUrl, repliesPage;
public int likeCount;
public boolean hearted, pinned, verified;
public Comment(String author, String thumbnail, String commentId, String commentText, String commentedTime,
String commentorUrl, String repliesPage, int likeCount, boolean hearted, boolean pinned, boolean verified) {
this.author = author;
this.thumbnail = thumbnail;
this.commentId = commentId;
this.commentText = commentText;
this.commentedTime = commentedTime;
this.commentorUrl = commentorUrl;
this.repliesPage = repliesPage;
this.likeCount = likeCount;
this.hearted = hearted;
this.pinned = pinned;
this.verified = verified;
}
}

View File

@ -0,0 +1,20 @@
package com.github.libretube.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class Comment(
val author: String?,
val commentId: String?,
val commentText: String?,
val commentedTime: String?,
val commentorUrl: String?,
val repliesPage: String?,
val hearted: Boolean?,
val likeCount: Int?,
val pinned: Boolean?,
val thumbnail: String?,
val verified: Boolean?
) {
constructor() : this("", "", "", "", "", "", null, 0, null, "", null)
}

View File

@ -1,16 +0,0 @@
package com.github.libretube.obj;
import java.util.List;
public class CommentsPage {
public List<Comment> comments;
public String nextpage;
public boolean disabled;
public CommentsPage(List<Comment> comments, String nextpage, boolean disabled) {
this.comments = comments;
this.nextpage = nextpage;
this.disabled = disabled;
}
}

View File

@ -0,0 +1,12 @@
package com.github.libretube.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class CommentsPage(
val comments: MutableList<Comment> = arrayListOf(),
val disabled: Boolean? = null,
val nextpage: String? = "",
) {
constructor() : this(arrayListOf(), null, "")
}

View File

@ -1,23 +0,0 @@
package com.github.libretube.obj;
public class FeedItem {
public String url, title, thumbnail, uploaderUrl, uploaderName, uploaderAvatar;
public long views, duration, uploaded;
public boolean uploaderVerified;
public FeedItem(String url, String title, String thumbnail, String uploaderUrl, String uploaderName,
String uploaderAvatar, long views, long duration, long uploaded, boolean uploaderVerified) {
this.url = url;
this.title = title;
this.thumbnail = thumbnail;
this.uploaderUrl = uploaderUrl;
this.uploaderName = uploaderName;
this.uploaderAvatar = uploaderAvatar;
this.views = views;
this.duration = duration;
this.uploaded = uploaded;
this.uploaderVerified = uploaderVerified;
}
}

View File

@ -18,6 +18,6 @@ data class PipedStream(
var width: Int?,
var height: Int?,
var fps: Int?
){
constructor(): this("","","","","",null,-1,-1,-1,-1,-1,-1,-1,-1)
) {
constructor() : this("", "", "", "", "", null, -1, -1, -1, -1, -1, -1, -1, -1)
}

View File

@ -9,7 +9,7 @@ data class SearchItem(
var uploaderName: String?,
var uploaded: Long?,
var shortDescription: String?,
//Video only attributes
// Video only attributes
var title: String?,
var uploaderUrl: String?,
var uploaderAvatar: String?,
@ -17,12 +17,12 @@ data class SearchItem(
var duration: Long?,
var views: Long?,
var uploaderVerified: Boolean?,
//Channel and Playlist attributes
// Channel and Playlist attributes
var name: String? = null,
var description: String? = null,
var subscribers: Long? = -1,
var videos: Long? = -1,
var verified: Boolean? = null
){
constructor() : this("","","",0,"","","","","",0,0,null)
) {
constructor() : this("", "", "", 0, "", "", "", "", "", 0, 0, null)
}

View File

@ -4,8 +4,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class SearchResult(
val items: List<SearchItem>? = listOf(),
val nextpage: String? ="",
val suggestion: String?="",
val items: MutableList<SearchItem>? = arrayListOf(),
val nextpage: String? = "",
val suggestion: String? = "",
val corrected: Boolean? = null
)

View File

@ -0,0 +1,12 @@
package com.github.libretube.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class Segment(
val actionType: String?,
val category: String?,
val segment: List<Float>?
) {
constructor() : this("", "", arrayListOf())
}

View File

@ -0,0 +1,10 @@
package com.github.libretube.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class Segments(
val segments: MutableList<Segment> = arrayListOf()
) {
constructor() : this(arrayListOf())
}

View File

@ -16,6 +16,6 @@ data class StreamItem(
var uploaderVerified: Boolean?,
var uploaded: Long?,
var shortDescription: String?
){
constructor() : this("","","","","","","",0,0,null,0,"")
) {
constructor() : this("", "", "", "", "", "", "", 0, 0, null, 0, "")
}

View File

@ -26,7 +26,9 @@ data class Streams(
val livestream: Boolean?,
val proxyUrl: String?,
val chapters: List<ChapterSegment>?
){
constructor(): this("","","","","","","","","","",null,-1,-1,-1,-1, emptyList(), emptyList(),
emptyList(), emptyList(), null,"", emptyList())
) {
constructor() : this(
"", "", "", "", "", "", "", "", "", "", null, -1, -1, -1, -1, emptyList(), emptyList(),
emptyList(), emptyList(), null, "", emptyList()
)
}

View File

@ -9,6 +9,6 @@ data class Subtitle(
val name: String?,
val code: String?,
val autoGenerated: Boolean?
){
constructor(): this("","","","",null)
) {
constructor() : this("", "", "", "", null)
}

View File

@ -4,27 +4,27 @@
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<group android:scaleX="0.084375"
android:scaleY="0.084375">
<path
android:pathData="M0,0h1280v1280h-1280z"
android:fillColor="#161316"/>
<path
android:pathData="M880,639.6C880,637.1 878.6,634.7 876.4,633.4L495,410.4C488.4,406.5 480,411.3 480,419V515.2C480,518.8 481.9,522.1 485.1,523.9L675.1,631.2C681.9,635 681.9,644.8 675.1,648.6L485.1,755.9C481.9,757.7 480,761 480,764.6V860.8C480,868.5 488.4,873.3 495.1,869.4L876.4,645.9C878.6,644.6 880,642.2 880,639.6Z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:startX="680"
android:startY="409"
android:endX="680"
android:endY="870.8"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
<item android:offset="0" android:color="#FFFF5A8B"/>
<item android:offset="1" android:color="#FFFFD1A7"/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
android:pathData="M614.7,631.1C621.4,634.9 621.4,644.7 614.7,648.5L494.9,716.4C488.3,720.2 480,715.3 480,707.7V571.9C480,564.2 488.3,559.4 494.9,563.2L614.7,631.1Z"
android:fillColor="#F2EEFF"/>
</group>
</vector>

View File

@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
android:tint="?attr/colorSurface">
<path
android:fillColor="@android:color/white"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="14dp"
android:width="14dp"
android:viewportHeight="160"
android:viewportWidth="160"
android:tint="?attr/colorControlNormal">
<path android:fillColor="#FF000000" android:pathData="M30.24,64.96C27.52,67.61 23.16,67.55 20.51,64.82 17.86,62.1 17.92,57.74 20.64,55.09L75.43,1.97 80.23,6.9 75.42,1.95c2.74,-2.65 7.1,-2.58 9.76,0.15 0.08,0.08 0.15,0.16 0.23,0.24L139.36,55.1c2.72,2.65 2.78,7.01 0.13,9.73 -2.65,2.72 -7,2.78 -9.73,0.14L80.21,16.5Z"/>
<path android:fillColor="#FF000000" android:pathData="M129.76,95.05C132.48,92.4 136.84,92.46 139.49,95.19 142.14,97.91 142.08,102.27 139.36,104.92L84.57,158.04 79.77,153.11 84.58,158.06c-2.74,2.65 -7.1,2.58 -9.76,-0.15 -0.08,-0.08 -0.15,-0.16 -0.23,-0.24L20.64,104.91c-2.72,-2.65 -2.78,-7.01 -0.13,-9.73 2.65,-2.72 7,-2.78 9.73,-0.14L79.79,143.51Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="20dp"
android:viewportWidth="18"
android:viewportHeight="20">
<path
android:pathData="M8.625,0H9.375C9.5821,0 9.75,0.1679 9.75,0.375C9.75,0.5821 9.9179,0.75 10.125,0.75C10.3321,0.75 10.5,0.9179 10.5,1.125V1.875C10.5,2.4963 11.0088,3.0566 11.5685,3.3265C12.4353,3.7446 13.5132,4.5489 14.0889,5.6503C14.2067,5.8758 14.25,6.1307 14.25,6.3852V12.0512C14.25,12.9156 14.8488,13.6151 15.5614,14.1044C15.8681,14.315 16.102,14.5525 16.3642,14.8462C16.4522,14.9448 16.5,15.0728 16.5,15.2049C16.5,15.506 16.256,15.75 15.955,15.75H2.051C1.7467,15.75 1.5,15.5033 1.5,15.199C1.5,15.0704 1.5445,14.9452 1.6287,14.848C1.8916,14.5448 2.1396,14.3062 2.4619,14.0946C3.1737,13.6273 3.75,12.9293 3.75,12.0778V6.3852C3.75,6.1307 3.7933,5.8758 3.9111,5.6503C4.4868,4.5489 5.5648,3.7446 6.4316,3.3265C6.9912,3.0566 7.5,2.4963 7.5,1.875V1.125C7.5,0.9179 7.6679,0.75 7.875,0.75C8.0821,0.75 8.25,0.5821 8.25,0.375C8.25,0.1679 8.4179,0 8.625,0ZM9,19.4998C7.7574,19.4998 6.7501,18.4925 6.75,17.2499H11.25C11.2499,18.4925 10.2426,19.4998 9,19.4998ZM0.0558,7.5132C-0.1246,6.2857 0.1356,5.034 0.7902,3.9801C1.4447,2.9262 2.4513,2.1382 3.6315,1.7557L3.9552,2.7546C3.0111,3.0605 2.2058,3.691 1.6821,4.5341C1.1585,5.3772 0.9503,6.3786 1.0946,7.3605L0.0558,7.5132ZM17.1808,3.934C16.5153,2.8869 15.5006,2.1094 14.3165,1.7392L14.0032,2.7414C14.9504,3.0375 15.7623,3.6596 16.2946,4.4972C16.827,5.3348 17.0455,6.334 16.9115,7.3174L17.9519,7.4592C18.1194,6.2299 17.8463,4.981 17.1808,3.934Z"
android:fillColor="#E6E1E5"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="16dp"
android:viewportWidth="18"
android:viewportHeight="20">
<path
android:pathData="M8.625,0H9.375C9.5821,0 9.75,0.1679 9.75,0.375C9.75,0.5821 9.9179,0.75 10.125,0.75C10.3321,0.75 10.5,0.9179 10.5,1.125V1.875C10.5,2.4963 11.0088,3.0566 11.5685,3.3265C12.4353,3.7446 13.5132,4.5489 14.0889,5.6503C14.2067,5.8758 14.25,6.1307 14.25,6.3852V12.0512C14.25,12.9156 14.8488,13.6151 15.5614,14.1044C15.8681,14.315 16.102,14.5525 16.3642,14.8462C16.4522,14.9448 16.5,15.0728 16.5,15.2049C16.5,15.506 16.256,15.75 15.955,15.75H2.051C1.7467,15.75 1.5,15.5033 1.5,15.199C1.5,15.0704 1.5445,14.9452 1.6287,14.848C1.8916,14.5448 2.1396,14.3062 2.4619,14.0946C3.1737,13.6273 3.75,12.9293 3.75,12.0778V6.3852C3.75,6.1307 3.7933,5.8758 3.9111,5.6503C4.4868,4.5489 5.5648,3.7446 6.4316,3.3265C6.9912,3.0566 7.5,2.4963 7.5,1.875V1.125C7.5,0.9179 7.6679,0.75 7.875,0.75C8.0821,0.75 8.25,0.5821 8.25,0.375C8.25,0.1679 8.4179,0 8.625,0ZM9,19.4998C7.7574,19.4998 6.7501,18.4925 6.75,17.2499H11.25C11.2499,18.4925 10.2426,19.4998 9,19.4998ZM0.0558,7.5132C-0.1246,6.2857 0.1356,5.034 0.7902,3.9801C1.4447,2.9262 2.4513,2.1382 3.6315,1.7557L3.9552,2.7546C3.0111,3.0605 2.2058,3.691 1.6821,4.5341C1.1585,5.3772 0.9503,6.3786 1.0946,7.3605L0.0558,7.5132ZM17.1808,3.934C16.5153,2.8869 15.5006,2.1094 14.3165,1.7392L14.0032,2.7414C14.9504,3.0375 15.7623,3.6596 16.2946,4.4972C16.827,5.3348 17.0455,6.334 16.9115,7.3174L17.9519,7.4592C18.1194,6.2299 17.8463,4.981 17.1808,3.934Z"
android:fillColor="#E6E1E5"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="48"
android:viewportHeight="48"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="#FF000000"
android:pathData="M7,24Q7,27.05 8.1,29.875Q9.2,32.7 11.05,34.95L34.95,11.05Q32.65,9.1 29.85,8.05Q27.05,7 24,7Q16.9,7 11.95,11.95Q7,16.9 7,24ZM13.05,37Q15.3,38.95 18.125,39.975Q20.95,41 24,41Q31.1,41 36.05,36.05Q41,31.1 41,24Q41,20.95 39.95,18.15Q38.9,15.35 37,13.05ZM4,24Q4,19.85 5.575,16.2Q7.15,12.55 9.85,9.85Q12.55,7.15 16.2,5.575Q19.85,4 24,4Q28.15,4 31.8,5.575Q35.45,7.15 38.15,9.85Q40.85,12.55 42.425,16.2Q44,19.85 44,24Q44,28.15 42.425,31.8Q40.85,35.45 38.15,38.15Q35.45,40.85 31.8,42.425Q28.15,44 24,44Q19.85,44 16.2,42.425Q12.55,40.85 9.85,38.15Q7.15,35.45 5.575,31.8Q4,28.15 4,24Z" />
</vector>

View File

@ -1,5 +1,11 @@
<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="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
</vector>

View File

@ -0,0 +1,11 @@
<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="#FF000000"
android:pathData="M12,22Q9.95,22 8.125,21.212Q6.3,20.425 4.938,19.062Q3.575,17.7 2.788,15.875Q2,14.05 2,12Q2,9.925 2.812,8.1Q3.625,6.275 5.013,4.925Q6.4,3.575 8.25,2.787Q10.1,2 12.2,2Q14.2,2 15.975,2.688Q17.75,3.375 19.087,4.588Q20.425,5.8 21.212,7.463Q22,9.125 22,11.05Q22,13.925 20.25,15.462Q18.5,17 16,17H14.15Q13.925,17 13.838,17.125Q13.75,17.25 13.75,17.4Q13.75,17.7 14.125,18.262Q14.5,18.825 14.5,19.55Q14.5,20.8 13.812,21.4Q13.125,22 12,22ZM12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12ZM6.5,13Q7.15,13 7.575,12.575Q8,12.15 8,11.5Q8,10.85 7.575,10.425Q7.15,10 6.5,10Q5.85,10 5.425,10.425Q5,10.85 5,11.5Q5,12.15 5.425,12.575Q5.85,13 6.5,13ZM9.5,9Q10.15,9 10.575,8.575Q11,8.15 11,7.5Q11,6.85 10.575,6.425Q10.15,6 9.5,6Q8.85,6 8.425,6.425Q8,6.85 8,7.5Q8,8.15 8.425,8.575Q8.85,9 9.5,9ZM14.5,9Q15.15,9 15.575,8.575Q16,8.15 16,7.5Q16,6.85 15.575,6.425Q15.15,6 14.5,6Q13.85,6 13.425,6.425Q13,6.85 13,7.5Q13,8.15 13.425,8.575Q13.85,9 14.5,9ZM17.5,13Q18.15,13 18.575,12.575Q19,12.15 19,11.5Q19,10.85 18.575,10.425Q18.15,10 17.5,10Q16.85,10 16.425,10.425Q16,10.85 16,11.5Q16,12.15 16.425,12.575Q16.85,13 17.5,13ZM12,20Q12.225,20 12.363,19.875Q12.5,19.75 12.5,19.55Q12.5,19.2 12.125,18.725Q11.75,18.25 11.75,17.3Q11.75,16.25 12.475,15.625Q13.2,15 14.25,15H16Q17.65,15 18.825,14.037Q20,13.075 20,11.05Q20,8.025 17.688,6.012Q15.375,4 12.2,4Q8.8,4 6.4,6.325Q4,8.65 4,12Q4,15.325 6.338,17.663Q8.675,20 12,20Z"/>
</vector>

View File

@ -4,7 +4,8 @@
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8,9h8v10L8,19L8,9zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/>
<path
android:fillColor="#FF000000"
android:pathData="M7,21Q6.175,21 5.588,20.413Q5,19.825 5,19V6Q4.575,6 4.287,5.713Q4,5.425 4,5Q4,4.575 4.287,4.287Q4.575,4 5,4H9Q9,3.575 9.288,3.287Q9.575,3 10,3H14Q14.425,3 14.713,3.287Q15,3.575 15,4H19Q19.425,4 19.712,4.287Q20,4.575 20,5Q20,5.425 19.712,5.713Q19.425,6 19,6V19Q19,19.825 18.413,20.413Q17.825,21 17,21ZM7,6V19Q7,19 7,19Q7,19 7,19H17Q17,19 17,19Q17,19 17,19V6ZM7,6V19Q7,19 7,19Q7,19 7,19Q7,19 7,19Q7,19 7,19V6ZM12,13.9 L13.9,15.8Q14.2,16.075 14.613,16.075Q15.025,16.075 15.3,15.8Q15.6,15.5 15.6,15.087Q15.6,14.675 15.3,14.4L13.4,12.5L15.3,10.6Q15.6,10.3 15.6,9.887Q15.6,9.475 15.3,9.2Q15.025,8.9 14.613,8.9Q14.2,8.9 13.9,9.2L12,11.1L10.1,9.2Q9.825,8.9 9.413,8.9Q9,8.9 8.7,9.2Q8.425,9.475 8.425,9.887Q8.425,10.3 8.7,10.6L10.6,12.5L8.7,14.4Q8.425,14.675 8.425,15.087Q8.425,15.5 8.7,15.8Q9,16.075 9.413,16.075Q9.825,16.075 10.1,15.8Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">
<path
android:fillColor="@android:color/white"
android:pathData="M10,18h4v-2h-4v2zM3,6v2h18L21,6L3,6zM6,13h12v-2L6,11v2z"/>
</vector>

View File

@ -0,0 +1,11 @@
<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="#FF000000"
android:pathData="M5,11Q4.175,11 3.587,10.412Q3,9.825 3,9V5Q3,4.175 3.587,3.587Q4.175,3 5,3H9Q9.825,3 10.413,3.587Q11,4.175 11,5V9Q11,9.825 10.413,10.412Q9.825,11 9,11ZM5,21Q4.175,21 3.587,20.413Q3,19.825 3,19V15Q3,14.175 3.587,13.587Q4.175,13 5,13H9Q9.825,13 10.413,13.587Q11,14.175 11,15V19Q11,19.825 10.413,20.413Q9.825,21 9,21ZM15,11Q14.175,11 13.588,10.412Q13,9.825 13,9V5Q13,4.175 13.588,3.587Q14.175,3 15,3H19Q19.825,3 20.413,3.587Q21,4.175 21,5V9Q21,9.825 20.413,10.412Q19.825,11 19,11ZM15,21Q14.175,21 13.588,20.413Q13,19.825 13,19V15Q13,14.175 13.588,13.587Q14.175,13 15,13H19Q19.825,13 20.413,13.587Q21,14.175 21,15V19Q21,19.825 20.413,20.413Q19.825,21 19,21ZM5,9H9V5H5ZM15,9H19V5H15ZM15,19H19V15H15ZM5,19H9V15H5ZM15,9ZM15,15ZM9,15ZM9,9Z"/>
</vector>

View File

@ -4,7 +4,8 @@
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM11,15L9.5,15v-2h-2v2L6,15L6,9h1.5v2.5h2L9.5,9L11,9v6zM13,9h4c0.55,0 1,0.45 1,1v4c0,0.55 -0.45,1 -1,1h-4L13,9zM14.5,13.5h2v-3h-2v3z"/>
<path
android:fillColor="#FF000000"
android:pathData="M6.75,15Q7.075,15 7.287,14.787Q7.5,14.575 7.5,14.25V13H9.5V14.25Q9.5,14.575 9.713,14.787Q9.925,15 10.25,15Q10.575,15 10.788,14.787Q11,14.575 11,14.25V9.75Q11,9.425 10.788,9.212Q10.575,9 10.25,9Q9.925,9 9.713,9.212Q9.5,9.425 9.5,9.75V11.5H7.5V9.75Q7.5,9.425 7.287,9.212Q7.075,9 6.75,9Q6.425,9 6.213,9.212Q6,9.425 6,9.75V14.25Q6,14.575 6.213,14.787Q6.425,15 6.75,15ZM13.5,15H17Q17.425,15 17.712,14.712Q18,14.425 18,14V10Q18,9.575 17.712,9.287Q17.425,9 17,9H13.5Q13.3,9 13.15,9.15Q13,9.3 13,9.5V14.5Q13,14.7 13.15,14.85Q13.3,15 13.5,15ZM14.5,13.5V10.5H16.5Q16.5,10.5 16.5,10.5Q16.5,10.5 16.5,10.5V13.5Q16.5,13.5 16.5,13.5Q16.5,13.5 16.5,13.5ZM4,20Q3.175,20 2.588,19.413Q2,18.825 2,18V6Q2,5.175 2.588,4.588Q3.175,4 4,4H20Q20.825,4 21.413,4.588Q22,5.175 22,6V18Q22,18.825 21.413,19.413Q20.825,20 20,20ZM4,18Q4,18 4,18Q4,18 4,18V6Q4,6 4,6Q4,6 4,6Q4,6 4,6Q4,6 4,6V18Q4,18 4,18Q4,18 4,18ZM4,18H20Q20,18 20,18Q20,18 20,18V6Q20,6 20,6Q20,6 20,6H4Q4,6 4,6Q4,6 4,6V18Q4,18 4,18Q4,18 4,18Z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="66.911dp"
android:height="66.911dp"
android:viewportWidth="66.911"
android:viewportHeight="66.911">
<path
android:pathData="M66.911,22.831c0,-10.563 -8.558,-19.122 -19.118,-19.122c-5.658,0 -10.721,2.473 -14.223,6.377c-0.037,0.043 -0.076,0.085 -0.113,0.128c-3.5,-3.98 -8.618,-6.505 -14.334,-6.505C8.561,3.709 0.005,12.268 0,22.831c0,5.834 2.629,11.059 6.758,14.565H6.751l27.104,25.806l26.308,-25.806h-0.012C64.279,33.89 66.911,28.669 66.911,22.831z"
android:fillColor="#E34326"/>
</vector>

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.25,2.52 0.77,-1.28 -3.52,-2.09L13.5,8z" />
</vector>

View File

@ -1,10 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:viewportWidth="48"
android:width="24dp"
android:viewportHeight="48"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
<path
android:fillColor="#FF000000"
android:pathData="M11,42Q9.75,42 8.875,41.125Q8,40.25 8,39V19.5Q8,18.8 8.325,18.15Q8.65,17.5 9.2,17.1L22.2,7.35Q22.6,7.05 23.05,6.9Q23.5,6.75 24,6.75Q24.5,6.75 24.95,6.9Q25.4,7.05 25.8,7.35L38.8,17.1Q39.35,17.5 39.675,18.15Q40,18.8 40,19.5V39Q40,40.25 39.125,41.125Q38.25,42 37,42H28V28H20V42Z" />
</vector>

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="48"
android:viewportHeight="48"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="#FF000000"
android:pathData="M11,39H18.5V26.5H29.5V39H37V19.5L24,9.75L11,19.5ZM11,42Q9.75,42 8.875,41.125Q8,40.25 8,39V19.5Q8,18.8 8.325,18.15Q8.65,17.5 9.2,17.1L22.2,7.35Q22.6,7.05 23.05,6.9Q23.5,6.75 24,6.75Q24.5,6.75 24.95,6.9Q25.4,7.05 25.8,7.35L38.8,17.1Q39.35,17.5 39.675,18.15Q40,18.8 40,19.5V39Q40,40.25 39.125,41.125Q38.25,42 37,42H26.5V29.5H21.5V42ZM24,24.35Z" />
</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,17Q12.425,17 12.713,16.712Q13,16.425 13,16V11.975Q13,11.55 12.713,11.275Q12.425,11 12,11Q11.575,11 11.288,11.287Q11,11.575 11,12V16.025Q11,16.45 11.288,16.725Q11.575,17 12,17ZM12,9Q12.425,9 12.713,8.712Q13,8.425 13,8Q13,7.575 12.713,7.287Q12.425,7 12,7Q11.575,7 11.288,7.287Q11,7.575 11,8Q11,8.425 11.288,8.712Q11.575,9 12,9ZM12,22Q9.925,22 8.1,21.212Q6.275,20.425 4.925,19.075Q3.575,17.725 2.788,15.9Q2,14.075 2,12Q2,9.925 2.788,8.1Q3.575,6.275 4.925,4.925Q6.275,3.575 8.1,2.787Q9.925,2 12,2Q14.075,2 15.9,2.787Q17.725,3.575 19.075,4.925Q20.425,6.275 21.212,8.1Q22,9.925 22,12Q22,14.075 21.212,15.9Q20.425,17.725 19.075,19.075Q17.725,20.425 15.9,21.212Q14.075,22 12,22ZM12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12ZM12,20Q15.325,20 17.663,17.663Q20,15.325 20,12Q20,8.675 17.663,6.337Q15.325,4 12,4Q8.675,4 6.338,6.337Q4,8.675 4,12Q4,15.325 6.338,17.663Q8.675,20 12,20Z"/>
</vector>

View File

@ -1,170 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>

View File

@ -1,10 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:viewportWidth="48"
android:width="24dp"
android:viewportHeight="48"
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"/>
<path
android:fillColor="#FF000000"
android:pathData="M23.5,27.85 L32.25,22.25Q32.95,21.8 32.95,21Q32.95,20.2 32.25,19.75L23.5,14.15Q22.75,13.65 21.975,14.075Q21.2,14.5 21.2,15.4V26.6Q21.2,27.5 21.975,27.925Q22.75,28.35 23.5,27.85ZM13,38Q11.8,38 10.9,37.1Q10,36.2 10,35V7Q10,5.8 10.9,4.9Q11.8,4 13,4H41Q42.2,4 43.1,4.9Q44,5.8 44,7V35Q44,36.2 43.1,37.1Q42.2,38 41,38ZM7,44Q5.8,44 4.9,43.1Q4,42.2 4,41V11.5Q4,10.85 4.425,10.425Q4.85,10 5.5,10Q6.15,10 6.575,10.425Q7,10.85 7,11.5V41Q7,41 7,41Q7,41 7,41H36.5Q37.15,41 37.575,41.425Q38,41.85 38,42.5Q38,43.15 37.575,43.575Q37.15,44 36.5,44Z" />
</vector>

View File

@ -1,92 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.14132813"
android:scaleY="0.14132813"
android:translateX="17.82"
android:translateY="17.82">
<path
android:pathData="M0,0l512,0l0,512l-512,0z"
android:strokeLineJoin="round"
android:strokeWidth="13.6290655"
android:fillColor="#cd5757"/>
<path
android:pathData="m186.287,194.05c-12.78,-7.379 -12.779,-137.951 0,-145.329 12.779,-7.378 139.519,58.645 139.457,73.399 -0.061,14.755 -126.677,79.308 -139.457,71.929z"
android:strokeWidth="1.1805346"
android:fillColor="#5e3d3d"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:pathData="m250.679,163.821c-6.755,-3.766 46.913,-21.2 47.077,-41.779 0.167,-20.877 -53.389,-38.674 -47.077,-43.089 6.159,-4.308 67.244,34.247 67.215,42.864 -0.029,8.616 -60.627,45.677 -67.215,42.005z"
android:strokeWidth="0.4697333"
android:fillColor="#ffffff"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:fillColor="#5e3d3d"
android:pathData="m212.553,211.009c-8.922,2.015 -15.168,5.152 -15.168,9.296l0,24.176c0,3.885 5.468,6.879 13.469,8.922 -2.446,3.598 -1.554,5.929 -0.518,8.318 0.72,1.641 1.439,3.367 1.238,5.871 -0.029,0.863 -0.489,1.612 -0.979,2.504 -0.748,1.324 -1.612,2.821 -1.209,4.922 0.23,1.381 0.892,2.302 1.525,3.08 0.576,0.748 1.094,1.41 1.209,2.475 0.144,0.921 0.029,1.928 -0.086,2.964 -0.201,1.698 -0.374,3.454 0.403,5.209 0.518,1.151 1.295,1.813 2.015,2.389 0.662,0.576 1.209,1.007 1.381,1.813 0.201,0.863 0.173,1.756 0.144,2.705 -0.029,1.41 -0.058,2.878 0.662,4.375 0.921,1.928 3.569,4.058 4.519,4.806 0.086,1.842 0.547,9.21 0.604,11.512 0.086,3.511 1.525,6.13 4.231,7.857 4.288,2.705 9.383,2.59 11.368,2.418 0.777,2.993 3.425,13.844 4.403,17.24 2.389,8.548 4.058,17.412 5.699,25.989l2.705,14.131c1.497,7.742 3.051,15.513 4.605,23.255 -12.203,13.383 -21.758,29.788 -30.047,45.301 -1.9,3.569 -2.763,7.339 -1.18,11.052 2.015,4.806 4.288,9.498 7.08,13.93 1.842,2.936 4.26,5.699 5.756,8.778 2.907,6.015 -4.029,9.987 -3.108,15.772 0.633,3.972 2.821,7.224 5.843,9.929l248.351,0c-2.043,-3.972 -4.95,-7.425 -7.8,-10.764 -1.094,-1.295 -2.187,-2.562 -3.223,-3.885 -0.806,-1.007 -1.641,-2.043 -2.504,-3.08 -4.26,-5.181 -9.095,-11.052 -10.476,-17.412 -0.604,-2.821 0.489,-5.468 1.641,-8.289 0.662,-1.583 1.324,-3.195 1.669,-4.864 1.612,-7.397 -0.777,-12.808 -3.31,-18.535 -1.094,-2.504 -2.245,-5.094 -3.08,-7.915 -1.324,-4.663 -0.23,-9.181 0.95,-13.959 0.921,-3.799 1.871,-7.742 1.525,-11.771 -0.259,-2.964 -0.835,-5.929 -1.583,-8.836l49.762,-20.607c0.748,-0.317 1.122,-1.094 0.892,-1.842 -0.201,-0.748 -0.863,-1.238 -1.698,-1.151l-55.173,6.792c-0.921,-1.928 -1.784,-3.828 -2.677,-5.641 -1.122,-2.302 -2.389,-4.749 -3.799,-7.195l36.926,-39.631c0.547,-0.576 0.576,-1.468 0.086,-2.043 -0.489,-0.604 -1.381,-0.777 -2.043,-0.345L438.253,358.828C435.577,356.036 432.583,353.475 429.159,351.46 427.259,350.337 425.244,349.416 423.23,348.495l11.225,-56.353c0.144,-0.777 -0.259,-1.525 -1.007,-1.784 -0.748,-0.288 -1.554,0.086 -1.9,0.777l-26.335,52.295c-2.648,-0.317 -5.296,-0.518 -8.001,-0.518 -2.533,0 -4.95,0.201 -7.368,0.489L359.163,289.437c-0.374,-0.662 -1.209,-0.979 -1.957,-0.662 -0.72,0.288 -1.122,1.065 -0.921,1.842l14.678,58.195c-5.209,2.562 -9.958,5.871 -14.074,9.958 -0.173,0.173 -0.288,0.345 -0.432,0.489L303.99,334.076c-0.691,-0.345 -1.525,-0.115 -1.986,0.547 -0.403,0.662 -0.288,1.525 0.288,2.043L345.579,374.427c-0.892,1.784 -1.698,3.511 -2.302,5.209 -1.324,3.626 -2.187,7.483 -2.734,11.426l-34.364,10.361c-1.007,-6.188 -1.986,-12.376 -4.346,-17.988 -1.353,-3.252 -4.749,-2.475 -7.598,-1.698 -1.698,0.46 -3.31,1.007 -4.922,1.554 -11.081,-30.076 -20.032,-55.087 -20.118,-57.274 0,-0.576 -0.23,-2.072 -0.604,-4.144 -1.007,-6.015 -2.907,-17.269 -1.928,-25.097 0.72,-5.843 -1.036,-19.427 -1.813,-25.011 -0.892,-6.389 -1.957,-12.433 -4.231,-16.722 12.289,-1.842 21.73,-5.411 21.73,-10.534l0,-24.176c0,-4.547 -7.425,-7.857 -17.671,-9.843 -34.94,-4.403 -52.122,0.518 -52.122,0.518zM310.466,418.922C309.257,415.987 308.451,412.907 307.789,409.828l32.868,-0.748c0.432,3.77 0.892,7.541 1.381,11.311l-21.614,11.685c-3.626,-4.202 -7.857,-8.087 -9.958,-13.153zM353.781,468.023c-3.482,-5.468 -6.965,-11.023 -12.462,-14.65 -2.13,-1.381 -5.584,-2.418 -8.03,-2.964 -1.036,-0.23 -2.187,0.144 -3.252,0.029 -0.979,-0.115 -1.525,-0.691 -2.59,-0.662 -0.432,-3.799 -0.835,-6.677 -1.842,-9.44l18.103,-4.144c0.317,4.547 0.806,9.124 2.619,12.894 1.065,2.216 3.08,3.252 4.893,4.173 1.554,0.806 3.022,1.554 3.799,2.964 0.748,1.381 0.173,6.476 -1.238,11.8z"/>
<group>
<clip-path
android:pathData="m212.553,211.009c-8.922,2.015 -15.168,5.152 -15.168,9.296l0,24.176c0,3.885 5.468,6.879 13.469,8.922 -2.446,3.598 -1.554,5.929 -0.518,8.318 0.72,1.641 1.439,3.367 1.238,5.871 -0.029,0.863 -0.489,1.612 -0.979,2.504 -0.748,1.324 -1.612,2.821 -1.209,4.922 0.23,1.381 0.892,2.302 1.525,3.08 0.576,0.748 1.094,1.41 1.209,2.475 0.144,0.921 0.029,1.928 -0.086,2.964 -0.201,1.698 -0.374,3.454 0.403,5.209 0.518,1.151 1.295,1.813 2.015,2.389 0.662,0.576 1.209,1.007 1.381,1.813 0.201,0.863 0.173,1.756 0.144,2.705 -0.029,1.41 -0.058,2.878 0.662,4.375 0.921,1.928 3.569,4.058 4.519,4.806 0.086,1.842 0.547,9.21 0.604,11.512 0.086,3.511 1.525,6.13 4.231,7.857 4.288,2.705 9.383,2.59 11.368,2.418 0.777,2.993 3.425,13.844 4.403,17.24 2.389,8.548 4.058,17.412 5.699,25.989l2.705,14.131c1.497,7.742 3.051,15.513 4.605,23.255 -12.203,13.383 -21.758,29.788 -30.047,45.301 -1.9,3.569 -2.763,7.339 -1.18,11.052 2.015,4.806 4.288,9.498 7.08,13.93 1.842,2.936 4.26,5.699 5.756,8.778 2.907,6.015 -4.029,9.987 -3.108,15.772 0.633,3.972 2.821,7.224 5.843,9.929l248.351,0c-2.043,-3.972 -4.95,-7.425 -7.8,-10.764 -1.094,-1.295 -2.187,-2.562 -3.223,-3.885 -0.806,-1.007 -1.641,-2.043 -2.504,-3.08 -4.26,-5.181 -9.095,-11.052 -10.476,-17.412 -0.604,-2.821 0.489,-5.468 1.641,-8.289 0.662,-1.583 1.324,-3.195 1.669,-4.864 1.612,-7.397 -0.777,-12.808 -3.31,-18.535 -1.094,-2.504 -2.245,-5.094 -3.08,-7.915 -1.324,-4.663 -0.23,-9.181 0.95,-13.959 0.921,-3.799 1.871,-7.742 1.525,-11.771 -0.259,-2.964 -0.835,-5.929 -1.583,-8.836l49.762,-20.607c0.748,-0.317 1.122,-1.094 0.892,-1.842 -0.201,-0.748 -0.863,-1.238 -1.698,-1.151l-55.173,6.792c-0.921,-1.928 -1.784,-3.828 -2.677,-5.641 -1.122,-2.302 -2.389,-4.749 -3.799,-7.195l36.926,-39.631c0.547,-0.576 0.576,-1.468 0.086,-2.043 -0.489,-0.604 -1.381,-0.777 -2.043,-0.345L438.253,358.828C435.577,356.036 432.583,353.475 429.159,351.46 427.259,350.337 425.244,349.416 423.23,348.495l11.225,-56.353c0.144,-0.777 -0.259,-1.525 -1.007,-1.784 -0.748,-0.288 -1.554,0.086 -1.9,0.777l-26.335,52.295c-2.648,-0.317 -5.296,-0.518 -8.001,-0.518 -2.533,0 -4.95,0.201 -7.368,0.489L359.163,289.437c-0.374,-0.662 -1.209,-0.979 -1.957,-0.662 -0.72,0.288 -1.122,1.065 -0.921,1.842l14.678,58.195c-5.209,2.562 -9.958,5.871 -14.074,9.958 -0.173,0.173 -0.288,0.345 -0.432,0.489L303.99,334.076c-0.691,-0.345 -1.525,-0.115 -1.986,0.547 -0.403,0.662 -0.288,1.525 0.288,2.043L345.579,374.427c-0.892,1.784 -1.698,3.511 -2.302,5.209 -1.324,3.626 -2.187,7.483 -2.734,11.426l-34.364,10.361c-1.007,-6.188 -1.986,-12.376 -4.346,-17.988 -1.353,-3.252 -4.749,-2.475 -7.598,-1.698 -1.698,0.46 -3.31,1.007 -4.922,1.554 -11.081,-30.076 -20.032,-55.087 -20.118,-57.274 0,-0.576 -0.23,-2.072 -0.604,-4.144 -1.007,-6.015 -2.907,-17.269 -1.928,-25.097 0.72,-5.843 -1.036,-19.427 -1.813,-25.011 -0.892,-6.389 -1.957,-12.433 -4.231,-16.722 12.289,-1.842 21.73,-5.411 21.73,-10.534l0,-24.176c0,-4.547 -7.425,-7.857 -17.671,-9.843 -34.94,-4.403 -52.122,0.518 -52.122,0.518zM310.466,418.922C309.257,415.987 308.451,412.907 307.789,409.828l32.868,-0.748c0.432,3.77 0.892,7.541 1.381,11.311l-21.614,11.685c-3.626,-4.202 -7.857,-8.087 -9.958,-13.153zM353.781,468.023c-3.482,-5.468 -6.965,-11.023 -12.462,-14.65 -2.13,-1.381 -5.584,-2.418 -8.03,-2.964 -1.036,-0.23 -2.187,0.144 -3.252,0.029 -0.979,-0.115 -1.525,-0.691 -2.59,-0.662 -0.432,-3.799 -0.835,-6.677 -1.842,-9.44l18.103,-4.144c0.317,4.547 0.806,9.124 2.619,12.894 1.065,2.216 3.08,3.252 4.893,4.173 1.554,0.806 3.022,1.554 3.799,2.964 0.748,1.381 0.173,6.476 -1.238,11.8z"/>
<path
android:pathData="m328.713,480.945c-1.209,2.101 -2.13,3.943 -2.533,4.806 -3.655,7.8 -10.908,21.528 -9.21,30.45 0.173,0.835 7.08,0.23 7.569,0.23 3.799,0 7.454,0.403 11.167,0.547 6.13,0.201 12.261,-0.662 18.391,-0.086 2.533,0.23 4.547,1.209 7.138,0.835 2.619,-0.374 5.181,-1.209 7.8,-1.727 1.381,-0.259 2.389,-0.086 3.022,-1.554 -1.094,2.533 -15.283,-7.771 -16.635,-9.152 -5.9,-5.871 -12.059,-15.081 -13.009,-23.313 -0.259,-2.245 -0.259,-6.389 -1.583,-8.346 -3.569,-5.296 -8.893,1.813 -12.117,7.31z"
android:fillColor="#ffffff"/>
</group>
<path
android:pathData="m390.189,461.95c-4.749,0 -9.095,-1.468 -12.203,-4.173 -0.489,-0.432 -1.065,-0.806 -1.641,-1.151L374.849,455.561c-2.015,-1.727 -3.799,-4.001 -5.296,-6.735l-0.691,-1.238c-2.59,-4.691 -5.612,-10.246 -6.533,-15.657 -0.086,-0.518 -0.173,-1.036 -0.201,-1.554 -0.058,-0.547 -0.058,-1.065 -0.058,-1.612 0,-0.46 -0.029,-0.95 0,-1.41 0.086,-0.748 0.23,-1.468 0.489,-2.13 0.288,-0.72 0.72,-1.41 1.122,-2.101 0.374,-0.633 0.748,-1.266 1.065,-1.928 0.288,-0.23 0.604,-0.46 0.892,-0.691 0.46,-0.345 0.892,-0.662 1.324,-0.979 0.345,-0.23 0.691,-0.46 1.007,-0.633 0.115,-0.058 0.259,-0.058 0.374,-0.115 1.928,-0.777 5.209,-0.345 6.332,-1.784 2.331,-3.022 -1.065,-10.994 -1.784,-14.016 -4.979,-0.576 -9.699,1.266 -13.268,4.461 -0.403,0.374 -0.863,0.748 -1.238,1.151 -0.662,0.691 -1.238,1.468 -1.784,2.274 -0.029,-0.23 -0.086,-0.432 -0.115,-0.691 0,-0.489 0.144,-1.007 0.173,-1.497 0.058,-0.518 0.058,-1.036 0.173,-1.554 0.23,-1.122 0.633,-2.187 1.094,-3.281 0.374,-0.892 0.806,-1.727 1.295,-2.59 0.835,-1.497 1.727,-2.964 2.59,-4.346l1.036,-1.641c2.159,-3.454 4.691,-6.476 7.339,-9.67l1.957,-2.331c1.698,-2.13 4.058,-5.037 6.936,-5.468 1.036,0 2.187,0.547 3.31,1.065l1.065,0.489c3.051,1.266 6.245,2.274 9.383,3.223 4.749,1.497 9.67,3.022 14.016,5.526 0.835,0.489 1.698,1.065 2.562,1.641 -7.512,1.238 -22.075,-0.144 -24.636,8.692 -1.151,4.087 -0.892,8.375 -1.238,12.606 -0.173,2.101 -0.489,4.202 -1.209,6.188 -0.748,1.957 -1.41,2.562 -3.454,3.195 -1.525,0.489 -2.072,1.583 -2.187,3.08 -0.115,1.381 0,2.792 0,4.173 0,4.001 2.993,5.065 6.073,4.95 -1.957,0.979 -3.569,2.36 -4.202,4.087 -0.403,1.036 -1.381,3.281 -1.036,4.375 0.691,1.986 4.029,0 5.296,-0.317 1.353,-0.317 2.734,-0.72 4.058,-1.094 2.389,-0.633 4.72,-1.468 7.195,-1.554 1.065,-0.029 4.432,0.374 4.95,-1.065 0.748,-2.015 -1.468,-3.511 -3.569,-4.49 -0.95,-0.489 -1.928,-0.806 -2.533,-1.065 -1.238,-0.489 -2.821,-0.576 -4.461,-0.46 4.202,-2.418 4.375,-7.138 4.691,-12.117 0.489,-7.972 5.353,-11.973 13.383,-10.822 8.807,1.266 12.232,9.325 12.289,17.269 -0.173,1.554 -0.345,3.08 -0.691,4.576 -3.828,17.643 -10.735,27.774 -21.183,30.968 -2.187,0.72 -4.461,1.036 -6.764,1.036z"
android:fillColor="#ffffff"/>
<path
android:pathData="m395.283,442.868c-0.748,-0.403 -1.928,-0.345 -2.821,-0.259 -1.669,0.173 -3.281,0.432 -4.835,0.979 -0.95,0.345 -4.806,2.072 -4.001,3.713 0.921,1.784 6.245,0.863 7.685,0.432 1.525,-0.46 4.403,-1.18 4.749,-3.022 0.173,-0.979 -0.173,-1.554 -0.777,-1.842z"
android:fillColor="#cd5757"/>
<path
android:pathData="m391.743,354.223c-0.029,-0.115 -0.058,-0.259 -0.086,-0.374 -0.144,-0.863 -0.432,-1.986 -1.497,-1.986 -1.41,0 -2.878,0.23 -4.231,0.46 -0.892,0.144 -1.957,0.086 -2.792,0.518 -1.036,0.547 -0.95,1.9 -0.777,2.907 0.23,1.468 0.086,2.936 0.432,4.403 0.173,0.777 0.144,1.669 0.489,2.389 0.863,1.756 2.331,2.245 4.231,2.245 1.641,0 3.454,-1.036 4.029,-2.648 0.863,-2.418 0.633,-5.353 0.201,-7.915z"
android:fillColor="#ffffff"/>
<path
android:pathData="m358.616,369.045c-0.46,-0.115 -0.95,0 -1.353,0.46 -0.604,0.691 -1.18,1.41 -1.727,2.13 -0.604,0.806 -1.266,1.698 -1.525,2.705 -0.46,1.669 1.007,7.972 3.626,7.138 2.936,-0.921 3.195,-6.62 2.792,-8.951 -0.144,-0.95 -0.317,-1.957 -0.863,-2.763 -0.23,-0.374 -0.576,-0.633 -0.95,-0.72z"
android:fillColor="#ffffff"/>
<path
android:pathData="m348.428,384.587c-0.201,-0.029 -0.432,0.029 -0.662,0.201 -1.727,1.18 -2.418,5.584 -2.446,7.454 0,1.497 0.835,2.993 1.669,4.202 1.468,2.187 2.936,-1.439 3.166,-2.59 0.317,-1.957 0.144,-3.885 -0.259,-5.814 -0.173,-0.691 -0.403,-3.339 -1.468,-3.454z"
android:fillColor="#ffffff"/>
<path
android:pathData="M373.381,360.699C373.18,359.49 372.777,358.367 371.971,358.137c-0.518,-0.144 -0.892,0.086 -1.324,0.374 -0.863,0.547 -1.698,1.122 -2.533,1.727 -0.662,0.489 -1.324,1.007 -1.957,1.468 -0.863,0.633 -1.036,1.871 -0.95,2.878 0.201,1.698 0.835,3.684 2.072,4.893 1.065,1.065 2.849,0.317 3.885,-0.374 1.928,-1.238 2.446,-3.425 2.389,-5.584 0.029,-0.576 0,-1.727 -0.173,-2.821z"
android:fillColor="#ffffff"/>
<path
android:pathData="m446.571,382.083c-0.489,-0.259 -0.979,-0.23 -1.525,0.317 -0.835,0.835 -1.151,2.101 -1.525,3.166 -0.489,1.41 -1.007,3.252 -0.576,4.749 0.403,1.525 1.813,4.231 3.828,3.626 1.928,-0.576 2.878,-4.288 2.59,-6.044 -0.288,-1.525 -0.777,-3.08 -1.554,-4.432 -0.317,-0.518 -0.748,-1.094 -1.238,-1.381z"
android:fillColor="#ffffff"/>
<path
android:pathData="M441.39,373.391C441.045,372.614 440.469,371.837 439.721,371.031c-0.633,-0.662 -1.295,-1.353 -1.986,-2.015 -0.403,-0.374 -1.18,-1.151 -1.727,-1.238 -1.036,-0.201 -1.641,2.043 -1.9,2.677 -0.547,1.295 -1.065,2.59 -1.525,3.914 -0.835,2.187 -1.381,4.029 0.201,6.015 0.892,1.122 2.533,2.446 4.087,2.245 1.871,-0.259 3.396,-2.734 4.116,-4.288 0.95,-1.928 1.065,-3.454 0.403,-4.95z"
android:fillColor="#ffffff"/>
<path
android:pathData="m401.961,352.698c-1.122,0.835 -1.065,4.173 -1.209,5.44 -0.288,2.245 -0.863,6.274 1.151,7.944 0.95,0.806 3.31,1.324 4.605,1.266 3.108,-0.173 3.281,-7.31 3.54,-9.786 0.144,-1.353 0.46,-3.281 -0.863,-4.231 -1.007,-0.748 -2.446,-0.72 -3.626,-0.863 -0.95,-0.115 -2.705,-0.46 -3.598,0.23z"
android:fillColor="#ffffff"/>
<path
android:pathData="m420.006,357.216c-1.209,0.576 -1.266,2.504 -1.583,3.742 -0.432,1.698 -0.835,3.396 -0.979,5.152 -0.173,2.159 -0.863,4.691 1.41,5.9 0.806,0.432 2.101,0.835 3.339,0.921 1.266,0.058 2.446,-0.23 3.022,-1.238 1.295,-2.302 3.137,-6.303 2.878,-9.037 -0.058,-0.662 -0.173,-1.439 -0.604,-1.957 -1.065,-1.324 -5.324,-4.001 -7.08,-3.626 -0.144,0.029 -0.259,0.086 -0.403,0.144z"
android:fillColor="#ffffff"/>
<path
android:pathData="m291.355,400.79c-7.138,-0.979 -20.377,10.073 -20.233,17.412 0.058,2.705 1.784,4.922 3.252,7.08 5.209,7.627 18.161,1.094 20.895,12.002 1.928,7.742 -5.555,14.534 -8.49,20.981 -1.353,2.936 -4.576,8.059 0.748,8.663 2.418,0.259 4.605,-1.353 6.562,-2.562 4.461,-2.734 7.742,-6.735 11.915,-9.67 2.504,-1.727 7.713,-3.281 9.095,-6.188 0.921,-1.9 -0.288,-4.95 -1.036,-6.677 -1.439,-3.281 -3.569,-5.727 -5.785,-8.346 -5.929,-6.994 -10.822,-13.297 -12.203,-22.708 -0.892,-5.986 -1.9,-9.613 -4.72,-9.987z"
android:fillColor="#ffffff"/>
<path
android:pathData="m250.342,252.569c-2.389,-2.619 -6.504,-7.397 -10.188,-7.972 -1.957,-0.317 -3.195,1.353 -3.425,3.108 -0.345,2.446 1.641,4.058 3.166,5.699 2.216,2.446 4.288,5.181 5.382,8.318 2.446,7.051 -2.446,15.024 0.662,21.845 1.525,3.396 6.217,12.923 10.879,12.376 4.173,-0.489 2.993,-6.792 2.792,-9.498 -0.489,-6.13 -1.238,-12.232 -2.159,-18.305 -0.748,-4.634 -2.159,-9.296 -5.008,-13.095 -0.662,-0.835 -1.381,-1.669 -2.101,-2.475z"
android:fillColor="#ffffff"/>
<path
android:pathData="m226.857,254.612c-1.842,-2.072 -6.994,0 -8.663,1.525 -1.209,1.122 -1.439,2.734 -0.518,4.116 1.007,1.525 2.619,1.698 4.231,1.151 1.468,-0.518 3.252,-0.691 4.547,-1.698 1.41,-1.151 1.669,-3.684 0.403,-5.094z"
android:fillColor="#ffffff"/>
<path
android:pathData="m225.332,274.874c2.792,-0.633 6.562,-1.756 5.267,-5.555 -1.18,-3.425 -6.735,-0.777 -8.807,-0.086 -1.957,0.633 -3.713,1.381 -3.857,3.655 -0.086,1.18 0,1.813 1.209,2.216 1.871,0.604 4.375,0.173 6.188,-0.23z"
android:fillColor="#ffffff"/>
<path
android:pathData="m223.087,286.127c2.705,-0.029 5.843,-0.115 8.404,-1.18 1.324,-0.547 3.137,-1.122 2.849,-2.849 -0.173,-1.18 -1.266,-2.677 -2.475,-2.993 -2.389,-0.633 -5.209,1.266 -7.483,1.813 -2.101,0.518 -4.72,0.777 -4.058,3.626 0.317,1.324 1.583,1.583 2.763,1.583z"
android:fillColor="#ffffff"/>
<path
android:pathData="m229.62,298.388c2.015,0 4.778,-0.259 6.159,-1.928 1.238,-1.525 0.863,-4.001 -0.691,-5.181 -1.957,-1.468 -5.296,0.23 -7.368,0.748 -1.353,0.317 -3.166,0.633 -4.173,1.756 -0.72,0.806 -1.007,2.677 -0.173,3.425 1.439,1.209 4.461,1.151 6.245,1.18z"
android:fillColor="#ffffff"/>
<path
android:pathData="m380.663,476.513c-0.95,-2.101 -2.015,-4.202 -3.051,-6.332 4.547,4.49 10.966,7.944 17.211,7.195 2.389,-0.288 4.749,-0.835 7.109,-1.353 19.197,-4.288 14.16,13.757 9.929,26.594 -13.556,-3.885 -23.37,-8.721 -31.199,-26.104z"
android:fillColor="#ffffff"/>
<path
android:pathData="m353.206,502.848c-5.152,-5.814 -10.016,-13.642 -10.822,-20.837 -0.259,-2.245 -0.259,-6.389 -1.583,-8.346 -3.54,-5.296 -8.836,1.813 -12.059,7.31 -1.238,2.101 -2.159,3.943 -2.533,4.806 -2.072,4.432 -5.209,10.793 -7.282,17.096l34.278,0z"
android:fillColor="#ffffff"/>
</group>
</vector>

View File

@ -4,7 +4,8 @@
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5,-5L11,7zM20,19h-8v2h8c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2h-8v2h8V19z"/>
<path
android:fillColor="#FF000000"
android:pathData="M9.325,16.275Q9.05,15.95 9.05,15.537Q9.05,15.125 9.325,14.85L11.175,13H4Q3.575,13 3.288,12.712Q3,12.425 3,12Q3,11.575 3.288,11.287Q3.575,11 4,11H11.175L9.325,9.15Q9.025,8.85 9.025,8.438Q9.025,8.025 9.325,7.725Q9.6,7.425 10.013,7.425Q10.425,7.425 10.7,7.7L14.3,11.3Q14.45,11.45 14.513,11.625Q14.575,11.8 14.575,12Q14.575,12.2 14.513,12.375Q14.45,12.55 14.3,12.7L10.7,16.3Q10.4,16.6 10,16.575Q9.6,16.55 9.325,16.275ZM13,21Q12.575,21 12.288,20.712Q12,20.425 12,20Q12,19.575 12.288,19.288Q12.575,19 13,19H19Q19,19 19,19Q19,19 19,19V5Q19,5 19,5Q19,5 19,5H13Q12.575,5 12.288,4.712Q12,4.425 12,4Q12,3.575 12.288,3.287Q12.575,3 13,3H19Q19.825,3 20.413,3.587Q21,4.175 21,5V19Q21,19.825 20.413,20.413Q19.825,21 19,21Z"/>
</vector>

View File

@ -6,5 +6,6 @@
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10,18h5L15,5h-5v13zM4,18h5L9,5L4,5v13zM16,5v13h5L21,5h-5z"/>
android:pathData="M16,9V4l1,0c0.55,0 1,-0.45 1,-1v0c0,-0.55 -0.45,-1 -1,-1H7C6.45,2 6,2.45 6,3v0c0,0.55 0.45,1 1,1l1,0v5c0,1.66 -1.34,3 -3,3h0v2h5.97v7l1,1l1,-1v-7H19v-2h0C17.34,12 16,10.66 16,9z"
android:fillType="evenOdd"/>
</vector>

View File

@ -6,5 +6,5 @@
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,12v7L5,19v-7L3,12v7c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2zM13,12.67l2.59,-2.58L17,11.5l-5,5 -5,-5 1.41,-1.41L11,12.67L11,3h2z"/>
android:pathData="M14,10L2,10v2h12v-2zM14,6L2,6v2h12L14,6zM18,14v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM2,16h8v-2L2,14v2z"/>
</vector>

View File

@ -4,10 +4,8 @@
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M14.17,13.71l1.4,-2.42c0.09,-0.15 0.05,-0.34 -0.08,-0.45l-1.48,-1.16c0.03,-0.22 0.05,-0.45 0.05,-0.68s-0.02,-0.46 -0.05,-0.69l1.48,-1.16c0.13,-0.11 0.17,-0.3 0.08,-0.45l-1.4,-2.42c-0.09,-0.15 -0.27,-0.21 -0.43,-0.15L12,4.83c-0.36,-0.28 -0.75,-0.51 -1.18,-0.69l-0.26,-1.85C10.53,2.13 10.38,2 10.21,2h-2.8C7.24,2 7.09,2.13 7.06,2.3L6.8,4.15C6.38,4.33 5.98,4.56 5.62,4.84l-1.74,-0.7c-0.16,-0.06 -0.34,0 -0.43,0.15l-1.4,2.42C1.96,6.86 2,7.05 2.13,7.16l1.48,1.16C3.58,8.54 3.56,8.77 3.56,9s0.02,0.46 0.05,0.69l-1.48,1.16C2,10.96 1.96,11.15 2.05,11.3l1.4,2.42c0.09,0.15 0.27,0.21 0.43,0.15l1.74,-0.7c0.36,0.28 0.75,0.51 1.18,0.69l0.26,1.85C7.09,15.87 7.24,16 7.41,16h2.8c0.17,0 0.32,-0.13 0.35,-0.3l0.26,-1.85c0.42,-0.18 0.82,-0.41 1.18,-0.69l1.74,0.7C13.9,13.92 14.08,13.86 14.17,13.71zM8.81,11c-1.1,0 -2,-0.9 -2,-2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2C10.81,10.1 9.91,11 8.81,11z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M21.92,18.67l-0.96,-0.74c0.02,-0.14 0.04,-0.29 0.04,-0.44c0,-0.15 -0.01,-0.3 -0.04,-0.44l0.95,-0.74c0.08,-0.07 0.11,-0.19 0.05,-0.29l-0.9,-1.55c-0.05,-0.1 -0.17,-0.13 -0.28,-0.1l-1.11,0.45c-0.23,-0.18 -0.48,-0.33 -0.76,-0.44l-0.17,-1.18C18.73,13.08 18.63,13 18.53,13h-1.79c-0.11,0 -0.21,0.08 -0.22,0.19l-0.17,1.18c-0.27,0.12 -0.53,0.26 -0.76,0.44l-1.11,-0.45c-0.1,-0.04 -0.22,0 -0.28,0.1l-0.9,1.55c-0.05,0.1 -0.04,0.22 0.05,0.29l0.95,0.74c-0.02,0.14 -0.03,0.29 -0.03,0.44c0,0.15 0.01,0.3 0.03,0.44l-0.95,0.74c-0.08,0.07 -0.11,0.19 -0.05,0.29l0.9,1.55c0.05,0.1 0.17,0.13 0.28,0.1l1.11,-0.45c0.23,0.18 0.48,0.33 0.76,0.44l0.17,1.18c0.02,0.11 0.11,0.19 0.22,0.19h1.79c0.11,0 0.21,-0.08 0.22,-0.19l0.17,-1.18c0.27,-0.12 0.53,-0.26 0.75,-0.44l1.12,0.45c0.1,0.04 0.22,0 0.28,-0.1l0.9,-1.55C22.03,18.86 22,18.74 21.92,18.67zM17.63,18.83c-0.74,0 -1.35,-0.6 -1.35,-1.35s0.6,-1.35 1.35,-1.35s1.35,0.6 1.35,1.35S18.37,18.83 17.63,18.83z"/>
<path
android:fillColor="#FF000000"
android:pathData="M7.5,6Q6.875,6 6.438,6.438Q6,6.875 6,7.5Q6,8.125 6.438,8.562Q6.875,9 7.5,9Q8.125,9 8.562,8.562Q9,8.125 9,7.5Q9,6.875 8.562,6.438Q8.125,6 7.5,6ZM7.5,16Q6.875,16 6.438,16.438Q6,16.875 6,17.5Q6,18.125 6.438,18.562Q6.875,19 7.5,19Q8.125,19 8.562,18.562Q9,18.125 9,17.5Q9,16.875 8.562,16.438Q8.125,16 7.5,16ZM4,3H20Q20.425,3 20.712,3.287Q21,3.575 21,4V11Q21,11.425 20.712,11.712Q20.425,12 20,12H4Q3.575,12 3.288,11.712Q3,11.425 3,11V4Q3,3.575 3.288,3.287Q3.575,3 4,3ZM5,5V10H19V5ZM4,13H20Q20.425,13 20.712,13.287Q21,13.575 21,14V21Q21,21.425 20.712,21.712Q20.425,22 20,22H4Q3.575,22 3.288,21.712Q3,21.425 3,21V14Q3,13.575 3.288,13.287Q3.575,13 4,13ZM5,15V20H19V15ZM5,5V10ZM5,15V20Z"/>
</vector>

View File

@ -1,6 +1,12 @@
<vector android:height="24dp" android:tint="?attr/colorControlNormal"
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
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="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M13.875,22H10.125Q9.75,22 9.475,21.75Q9.2,21.5 9.15,21.125L8.85,18.8Q8.525,18.675 8.238,18.5Q7.95,18.325 7.675,18.125L5.5,19.025Q5.15,19.15 4.8,19.05Q4.45,18.95 4.25,18.625L2.4,15.4Q2.2,15.075 2.275,14.7Q2.35,14.325 2.65,14.1L4.525,12.675Q4.5,12.5 4.5,12.337Q4.5,12.175 4.5,12Q4.5,11.825 4.5,11.662Q4.5,11.5 4.525,11.325L2.65,9.9Q2.35,9.675 2.275,9.3Q2.2,8.925 2.4,8.6L4.25,5.375Q4.425,5.025 4.787,4.937Q5.15,4.85 5.5,4.975L7.675,5.875Q7.95,5.675 8.25,5.5Q8.55,5.325 8.85,5.2L9.15,2.875Q9.2,2.5 9.475,2.25Q9.75,2 10.125,2H13.875Q14.25,2 14.525,2.25Q14.8,2.5 14.85,2.875L15.15,5.2Q15.475,5.325 15.763,5.5Q16.05,5.675 16.325,5.875L18.5,4.975Q18.85,4.85 19.2,4.95Q19.55,5.05 19.75,5.375L21.6,8.6Q21.8,8.925 21.725,9.3Q21.65,9.675 21.35,9.9L19.475,11.325Q19.5,11.5 19.5,11.662Q19.5,11.825 19.5,12Q19.5,12.175 19.5,12.337Q19.5,12.5 19.45,12.675L21.325,14.1Q21.625,14.325 21.7,14.7Q21.775,15.075 21.575,15.4L19.725,18.6Q19.525,18.925 19.163,19.038Q18.8,19.15 18.45,19.025L16.325,18.125Q16.05,18.325 15.75,18.5Q15.45,18.675 15.15,18.8L14.85,21.125Q14.8,21.5 14.525,21.75Q14.25,22 13.875,22ZM12.05,15.5Q13.5,15.5 14.525,14.475Q15.55,13.45 15.55,12Q15.55,10.55 14.525,9.525Q13.5,8.5 12.05,8.5Q10.575,8.5 9.562,9.525Q8.55,10.55 8.55,12Q8.55,13.45 9.562,14.475Q10.575,15.5 12.05,15.5Z" />
/>
</vector>

View File

@ -0,0 +1,13 @@
<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="#FF000000"
android:pathData="M12,22.7994C11.55,22.7994 11.1,22.7094 10.74,22.4394 4.89,18.8394 1.29,12.6294 1.2,5.7894 1.2,4.8894 1.65,3.9894 2.46,3.5394 8.4,0.3894 15.6,0.3894 21.54,3.6294 22.35,3.9894 22.8,4.8894 22.8,5.7894 22.71,12.6294 19.11,18.8394 13.35,22.4394 12.9,22.7094 12.45,22.7994 12,22.7994ZM12,1.9194c-3.15,0 -6.3,0.81 -9.18,2.34 -0.54,0.27 -0.9,0.9 -0.9,1.53 0.09,6.57 3.51,12.51 9.18,16.02 0.54,0.36 1.26,0.36 1.8,0C18.57,18.3894 21.9,12.3594 22.08,5.7894 22.08,5.1594 21.72,4.5294 21.18,4.2594 18.3,2.7294 15.15,1.9194 12,1.9194Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M20.73,4.9794C15.24,2.0994 8.76,2.0994 3.27,4.9794 3,5.1594 2.82,5.4294 2.82,5.7894c0.09,6.48 3.51,12.06 8.73,15.3 0.27,0.18 0.63,0.18 0.9,0 5.13,-3.15 8.64,-8.82 8.73,-15.3C21.18,5.4294 21,5.1594 20.73,4.9794ZM9.66,15.1494L9.66,6.7794l7.29,4.23z"/>
</vector>

View File

@ -1,10 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:viewportWidth="48"
android:width="24dp"
android:viewportHeight="48"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,8L4,8L4,6h16v2zM18,2L6,2v2h12L18,2zM22,12v8c0,1.1 -0.9,2 -2,2L4,22c-1.1,0 -2,-0.9 -2,-2v-8c0,-1.1 0.9,-2 2,-2h16c1.1,0 2,0.9 2,2zM16,16l-6,-3.27v6.53L16,16z"/>
<path
android:fillColor="#FF000000"
android:pathData="M15.5,7Q14.85,7 14.425,6.575Q14,6.15 14,5.5Q14,4.85 14.425,4.425Q14.85,4 15.5,4H32.5Q33.15,4 33.575,4.425Q34,4.85 34,5.5Q34,6.15 33.575,6.575Q33.15,7 32.5,7ZM8.95,13Q8.3,13 7.875,12.575Q7.45,12.15 7.45,11.5Q7.45,10.85 7.875,10.425Q8.3,10 8.95,10H39.05Q39.7,10 40.125,10.425Q40.55,10.85 40.55,11.5Q40.55,12.15 40.125,12.575Q39.7,13 39.05,13ZM7,44Q5.8,44 4.9,43.1Q4,42.2 4,41V19Q4,17.8 4.9,16.9Q5.8,16 7,16H41Q42.2,16 43.1,16.9Q44,17.8 44,19V41Q44,42.2 43.1,43.1Q42.2,44 41,44ZM22.7,35.85 L29.55,31.25Q30.25,30.8 30.25,30Q30.25,29.2 29.55,28.75L22.7,24.15Q21.95,23.65 21.15,24.075Q20.35,24.5 20.35,25.4V34.65Q20.35,35.55 21.15,35.975Q21.95,36.4 22.7,35.85Z" />
</vector>

View File

@ -1,10 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:viewportWidth="48"
android:width="24dp"
android:viewportHeight="48"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,15.31L23.31,12 20,8.69V4h-4.69L12,0.69 8.69,4H4v4.69L0.69,12 4,15.31V20h4.69L12,23.31 15.31,20H20v-4.69zM12,18c-3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6 6,2.69 6,6 -2.69,6 -6,6z"/>
<path
android:fillColor="#FF000000"
android:pathData="M24,42Q16.5,42 11.25,36.75Q6,31.5 6,24Q6,17.25 9.975,12.55Q13.95,7.85 20.4,6.5Q22.45,6.1 23.2,7.2Q23.95,8.3 23.15,10.2Q22.7,11.35 22.45,12.55Q22.2,13.75 22.2,15Q22.2,19.5 25.35,22.65Q28.5,25.8 33,25.8Q34.25,25.8 35.425,25.575Q36.6,25.35 37.7,24.95Q39.85,24.15 40.9,25.025Q41.95,25.9 41.45,28Q40.1,34.05 35.4,38.025Q30.7,42 24,42ZM24,39Q29.45,39 33.5,35.625Q37.55,32.25 38.55,27.7Q37.3,28.25 35.875,28.525Q34.45,28.8 33,28.8Q27.25,28.8 23.225,24.775Q19.2,20.75 19.2,15Q19.2,13.8 19.45,12.425Q19.7,11.05 20.35,9.3Q15.45,10.65 12.225,14.775Q9,18.9 9,24Q9,30.25 13.375,34.625Q17.75,39 24,39ZM23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Q23.8,24.15 23.8,24.15Z" />
</vector>

View File

@ -6,5 +6,5 @@
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9,3L5,6.99h3L8,14h2L10,6.99h3L9,3zM16,17.01L16,10h-2v7.01h-3L15,21l4,-3.99h-3z"/>
android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-2z"/>
</vector>

View File

@ -0,0 +1,11 @@
<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="#FF000000"
android:pathData="M13.35,22Q12.75,22 12.488,21.613Q12.225,21.225 12.425,20.65L16.075,10.975Q16.225,10.575 16.638,10.287Q17.05,10 17.5,10Q17.925,10 18.35,10.287Q18.775,10.575 18.925,10.975L22.575,20.65Q22.775,21.225 22.513,21.613Q22.25,22 21.625,22Q21.35,22 21.125,21.825Q20.9,21.65 20.8,21.4L19.95,18.95H15.1L14.225,21.4Q14.125,21.65 13.875,21.825Q13.625,22 13.35,22ZM15.7,17.2H19.3L17.55,12.25H17.45ZM7.15,8.55Q7.55,9.275 8,9.887Q8.45,10.5 9.05,11.15Q10.15,9.95 10.875,8.688Q11.6,7.425 12.1,6H2Q1.575,6 1.288,5.713Q1,5.425 1,5Q1,4.575 1.288,4.287Q1.575,4 2,4H8V3Q8,2.575 8.288,2.287Q8.575,2 9,2Q9.425,2 9.713,2.287Q10,2.575 10,3V4H16Q16.425,4 16.712,4.287Q17,4.575 17,5Q17,5.425 16.712,5.713Q16.425,6 16,6H14.1Q13.575,7.775 12.675,9.45Q11.775,11.125 10.45,12.6L12.85,15.05L12.1,17.1L9,14L4.7,18.3Q4.425,18.575 4,18.575Q3.575,18.575 3.3,18.3Q3.025,18.025 3.025,17.6Q3.025,17.175 3.3,16.9L7.65,12.55Q6.975,11.775 6.4,10.987Q5.825,10.2 5.375,9.325Q5.1,8.8 5.35,8.4Q5.6,8 6.225,8Q6.475,8 6.75,8.162Q7.025,8.325 7.15,8.55Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8.46,11.88l1.41,-1.41L12,12.59l2.12,-2.12 1.41,1.41L13.41,14l2.12,2.12 -1.41,1.41L12,15.41l-2.12,2.12 -1.41,-1.41L10.59,14l-2.13,-2.12zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/>
</vector>

View File

@ -0,0 +1,11 @@
<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="#FF000000"
android:pathData="M12,16Q11.575,16 11.288,15.712Q11,15.425 11,15V7.85L9.125,9.725Q8.825,10.025 8.425,10.025Q8.025,10.025 7.7,9.7Q7.4,9.4 7.413,8.987Q7.425,8.575 7.7,8.3L11.3,4.7Q11.45,4.55 11.625,4.487Q11.8,4.425 12,4.425Q12.2,4.425 12.375,4.487Q12.55,4.55 12.7,4.7L16.3,8.3Q16.6,8.6 16.587,9.012Q16.575,9.425 16.3,9.7Q16,10 15.588,10.012Q15.175,10.025 14.875,9.725L13,7.85V15Q13,15.425 12.713,15.712Q12.425,16 12,16ZM6,20Q5.175,20 4.588,19.413Q4,18.825 4,18V16Q4,15.575 4.287,15.287Q4.575,15 5,15Q5.425,15 5.713,15.287Q6,15.575 6,16V18Q6,18 6,18Q6,18 6,18H18Q18,18 18,18Q18,18 18,18V16Q18,15.575 18.288,15.287Q18.575,15 19,15Q19.425,15 19.712,15.287Q20,15.575 20,16V18Q20,18.825 19.413,19.413Q18.825,20 18,20Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M23,12l-2.44,-2.79l0.34,-3.69l-3.61,-0.82L15.4,1.5L12,2.96L8.6,1.5L6.71,4.69L3.1,5.5L3.44,9.2L1,12l2.44,2.79l-0.34,3.7l3.61,0.82L8.6,22.5l3.4,-1.47l3.4,1.46l1.89,-3.19l3.61,-0.82l-0.34,-3.69L23,12zM10.09,16.72l-3.8,-3.81l1.48,-1.48l2.32,2.33l5.85,-5.87l1.48,1.48L10.09,16.72z"/>
</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="M22.99,9C19.15,5.16 13.8,3.76 8.84,4.78l2.52,2.52c3.47,-0.17 6.99,1.05 9.63,3.7l2,-2zM18.99,13c-1.29,-1.29 -2.84,-2.13 -4.49,-2.56l3.53,3.53 0.96,-0.97zM2,3.05L5.07,6.1C3.6,6.82 2.22,7.78 1,9l1.99,2c1.24,-1.24 2.67,-2.16 4.2,-2.77l2.24,2.24C7.81,10.89 6.27,11.73 5,13v0.01L6.99,15c1.36,-1.36 3.14,-2.04 4.92,-2.06L18.98,20l1.27,-1.26L3.29,1.79 2,3.05zM9,17l3,3 3,-3c-1.65,-1.66 -4.34,-1.66 -6,0z"/>
</vector>

Some files were not shown because too many files have changed in this diff Show More