Compare commits
161 Commits
Author | SHA1 | Date |
---|---|---|
Thomas | e19526dbf6 | |
Thomas | f6192881d3 | |
Thomas | 309c6aa890 | |
Thomas | 9f6ac90074 | |
Thomas | 8d4418bf2b | |
Thomas | 3d85e74957 | |
Thomas | fda17ee8fe | |
Thomas | 5696809c1d | |
Thomas | e03147c6da | |
Thomas | 7c695f5f82 | |
Thomas | 1c6f7858ca | |
Thomas | 1ef0389997 | |
Thomas | 1c54d44a22 | |
Thomas | 724b43ca4d | |
Thomas | ed3d978b03 | |
Thomas | af53071b08 | |
Thomas | bd8e2a50d9 | |
Thomas | e5c918af51 | |
Thomas | 4077c5bc55 | |
Thomas | 2b43f32772 | |
Thomas | 1e0eafef9b | |
Thomas | 45b35d0718 | |
Thomas | a9286ab150 | |
Thomas | fcb1974e78 | |
Thomas | 2456e8f782 | |
Thomas | ce4913452b | |
Thomas | e605dd8417 | |
Thomas | 8434f9ee00 | |
Thomas | 61bb7d962d | |
Thomas | 35aec32070 | |
Thomas | 274bcc8be7 | |
Thomas | ce70df5137 | |
Thomas | d9dca3ef23 | |
Thomas | e3635c3f01 | |
Thomas | 2cdabbcb70 | |
Thomas | d5ad9b181b | |
Thomas | 540fb3e2dc | |
Thomas | edbe65593b | |
Thomas | d5f394dfea | |
Thomas | d5a5fdf52e | |
Thomas | a7f9256947 | |
Thomas | d769729901 | |
Thomas | b2026c8784 | |
Thomas | b29de141ef | |
Thomas | 6d4772da75 | |
Thomas | 2344fe0942 | |
Thomas | 7c309b68b8 | |
Thomas | c8c5e56a17 | |
Thomas | cef227ba42 | |
Thomas | 02296b038a | |
Thomas | b76a4cfcf5 | |
Thomas | f168f101bc | |
Thomas | 2e8a86fe20 | |
Thomas | fe0d2fe726 | |
Thomas | 9b322cc922 | |
Thomas | 346656e53d | |
Thomas | 6e6187175a | |
Thomas | 5e832fa046 | |
Thomas | 34007d4507 | |
Thomas | fd400f025e | |
Thomas | f3f474ee13 | |
Thomas | d971032d52 | |
Thomas | 961c77103e | |
Thomas | b22b21c47a | |
Thomas | 6d70bd758a | |
Thomas | 087ac92f15 | |
Thomas | 99fe789f30 | |
Thomas | 10892f92f1 | |
Thomas | 0a919c85ab | |
Thomas | 761abc013f | |
Thomas | 327f6f0e8d | |
Thomas | d6f1a360d2 | |
Thomas | 24ec69d7f7 | |
Thomas | c80692bd34 | |
Thomas | b5e9f70be6 | |
Thomas | d446081331 | |
Thomas | 8178cff72c | |
Thomas | 950d99b5de | |
Thomas | b7855cb1a2 | |
Thomas | b298fbfa3e | |
Thomas | d83929f80a | |
Thomas | b932ed2c13 | |
Thomas | 36073d340d | |
Thomas | 0e14540b69 | |
Thomas | 57327a8ad0 | |
Thomas | bbfa278d6b | |
Thomas | 439decf6a9 | |
Thomas | 2277cc5f05 | |
Thomas | 4204ffccee | |
Thomas | 31407e709d | |
Thomas | 44d26bb1cf | |
Thomas | 8a8a433023 | |
Thomas | 5c27292543 | |
Thomas | e475348d39 | |
Thomas | 9f8358e471 | |
Thomas | 4fd8d42d85 | |
Thomas | 498990c48a | |
Thomas | 1cddf26c9a | |
Thomas | 325a239b86 | |
Thomas | 2c4ef9c3ce | |
Thomas | 4dbd191c4f | |
Thomas | 01e489da10 | |
Thomas | 53a7062c6d | |
Thomas | 3425e1e593 | |
Thomas | 9970635ff8 | |
Thomas | c1f174a5b8 | |
Thomas | 3587e7c524 | |
Thomas | 3911ad15a6 | |
Thomas | d40b35da59 | |
Thomas | ccb6e184cc | |
Thomas | 74e45b1820 | |
Thomas | 0a1336f0e0 | |
Thomas | d5a0dcb980 | |
Thomas | 83e7c41ca0 | |
Thomas | 1d1b0c11a9 | |
Thomas | 3b2c4e2ac6 | |
Thomas | 2d77fe580f | |
Thomas | 7ae20f43f8 | |
Thomas | f03c1b206b | |
Thomas | d99a58f2cf | |
Thomas | 5aeaf7f34b | |
Thomas | af0b484d16 | |
Thomas | 0a6791b752 | |
Thomas | e73e306d05 | |
Thomas | 52189abbff | |
Thomas | d721f12d74 | |
Thomas | 69f28bb647 | |
Thomas | 2b2295d831 | |
Thomas | 179586b8c4 | |
Thomas | 1afad9e06a | |
Thomas | 59c73fd864 | |
Thomas | 6820344750 | |
Thomas | 680504791c | |
Thomas | 41e500a8f8 | |
Thomas | 448af1ef9a | |
Thomas | 041e8c0bd6 | |
Thomas | 0b7300e93a | |
Thomas | 94c5f5a705 | |
Thomas | fa2f8a7b05 | |
Thomas | aeb288142e | |
Thomas | 635c43f458 | |
Thomas | d36138431b | |
Thomas | 9cdf857730 | |
Thomas | 52a6152af6 | |
Thomas | 9d3312c081 | |
Thomas | 1146236f46 | |
Thomas | ec19ee1e55 | |
Thomas | cc37e40158 | |
Thomas | bdd12de34d | |
Thomas | e64692d0d3 | |
Thomas | 7da8c0f664 | |
Thomas | fc41c077dc | |
Thomas | 50800da4b9 | |
Thomas | a9219e8a91 | |
Thomas | 5eedadef47 | |
Thomas | 14cde8e625 | |
Thomas | 1f2ecd591d | |
Thomas | 9a2eb6cd49 | |
Thomas | aa38514bcb | |
Thomas | d3ffc32d9b | |
Thomas | a6dfd842e3 |
|
@ -0,0 +1,17 @@
|
||||||
|
# Number of days of inactivity before an issue becomes stale
|
||||||
|
daysUntilStale: 60
|
||||||
|
# Number of days of inactivity before a stale issue is closed
|
||||||
|
daysUntilClose: 7
|
||||||
|
# Issues with these labels will never be considered stale
|
||||||
|
exemptLabels:
|
||||||
|
- pinned
|
||||||
|
- security
|
||||||
|
# Label to use when marking an issue as stale
|
||||||
|
staleLabel: inactive
|
||||||
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. Thank you
|
||||||
|
for your contributions.
|
||||||
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||||
|
closeComment: false
|
|
@ -9,5 +9,4 @@
|
||||||
.cxx
|
.cxx
|
||||||
/app/release/
|
/app/release/
|
||||||
/app/fdroid_full/release/
|
/app/fdroid_full/release/
|
||||||
/app/google_full/
|
/frostwire-jlibtorrent/
|
||||||
/app/google_acad/
|
|
||||||
|
|
|
@ -76,11 +76,11 @@ assembleDebug:
|
||||||
|
|
||||||
# Basic android and gradle stuff
|
# Basic android and gradle stuff
|
||||||
# Check linting
|
# Check linting
|
||||||
lintFdroid_acadDebug:
|
lintfdroid_acadDebug:
|
||||||
interruptible: true
|
interruptible: true
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- ./gradlew -Pci --console=plain :app:lintFdroid_acadDebug -PbuildDir=lint
|
- ./gradlew -Pci --console=plain :app:lintfdroid_acadDebug -PbuildDir=lint
|
||||||
except:
|
except:
|
||||||
- tags
|
- tags
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ Crowdin will not pick up changes in develop branch, that's why all translations
|
||||||
|
|
||||||
### Issues:
|
### Issues:
|
||||||
|
|
||||||
Issues are handled on Github at: https://github.com/stom79/TubeLab/issues, before opening an issue, please check it has not yet been submitted by someone else
|
Issues are handled on Framagit at: https://framagit.org/imattau/fedilab-tube/-/issues, before opening an issue, please check it has not yet been submitted by someone else
|
||||||
|
|
||||||
### Contribution to code:
|
### Contribution to code:
|
||||||
|
|
||||||
|
|
146
app/build.gradle
|
@ -1,16 +1,17 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: "androidx.navigation.safeargs"
|
apply plugin: "androidx.navigation.safeargs"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
buildToolsVersion "30.0.2"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode 31
|
versionCode 45
|
||||||
versionName "1.10.1"
|
versionName "1.15.0"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -30,7 +31,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding true
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
|
@ -38,6 +39,7 @@ android {
|
||||||
checkReleaseBuilds false
|
checkReleaseBuilds false
|
||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
|
//boolean full_instances if set to false means TubeAcad
|
||||||
productFlavors {
|
productFlavors {
|
||||||
fdroid_acad {
|
fdroid_acad {
|
||||||
applicationId "app.fedilab.fedilabtube"
|
applicationId "app.fedilab.fedilabtube"
|
||||||
|
@ -49,6 +51,10 @@ android {
|
||||||
buildConfigField "boolean", "surfing_mode", "false"
|
buildConfigField "boolean", "surfing_mode", "false"
|
||||||
buildConfigField "boolean", "sepia_search", "false"
|
buildConfigField "boolean", "sepia_search", "false"
|
||||||
buildConfigField "boolean", "instance_switcher", "true"
|
buildConfigField "boolean", "instance_switcher", "true"
|
||||||
|
buildConfigField "boolean", "allow_remote_connections", "false"
|
||||||
|
buildConfigField "boolean", "google_cast_lib", "false"
|
||||||
|
buildConfigField "int", "cast_enabled", "0"
|
||||||
|
buildConfigField "int", "default_theme", "2"
|
||||||
}
|
}
|
||||||
google_acad {
|
google_acad {
|
||||||
applicationId "app.fedilab.fedilabtube"
|
applicationId "app.fedilab.fedilabtube"
|
||||||
|
@ -60,6 +66,10 @@ android {
|
||||||
buildConfigField "boolean", "surfing_mode", "false"
|
buildConfigField "boolean", "surfing_mode", "false"
|
||||||
buildConfigField "boolean", "sepia_search", "false"
|
buildConfigField "boolean", "sepia_search", "false"
|
||||||
buildConfigField "boolean", "instance_switcher", "true"
|
buildConfigField "boolean", "instance_switcher", "true"
|
||||||
|
buildConfigField "boolean", "allow_remote_connections", "false"
|
||||||
|
buildConfigField "boolean", "google_cast_lib", "true"
|
||||||
|
buildConfigField "int", "cast_enabled", "1"
|
||||||
|
buildConfigField "int", "default_theme", "2"
|
||||||
}
|
}
|
||||||
fdroid_full {
|
fdroid_full {
|
||||||
applicationId "app.fedilab.tubelab"
|
applicationId "app.fedilab.tubelab"
|
||||||
|
@ -71,6 +81,10 @@ android {
|
||||||
buildConfigField "boolean", "surfing_mode", "true"
|
buildConfigField "boolean", "surfing_mode", "true"
|
||||||
buildConfigField "boolean", "sepia_search", "true"
|
buildConfigField "boolean", "sepia_search", "true"
|
||||||
buildConfigField "boolean", "instance_switcher", "true"
|
buildConfigField "boolean", "instance_switcher", "true"
|
||||||
|
buildConfigField "boolean", "allow_remote_connections", "true"
|
||||||
|
buildConfigField "boolean", "google_cast_lib", "false"
|
||||||
|
buildConfigField "int", "cast_enabled", "0"
|
||||||
|
buildConfigField "int", "default_theme", "2"
|
||||||
}
|
}
|
||||||
google_full {
|
google_full {
|
||||||
applicationId "app.fedilab.tubelab"
|
applicationId "app.fedilab.tubelab"
|
||||||
|
@ -82,50 +96,31 @@ android {
|
||||||
buildConfigField "boolean", "surfing_mode", "true"
|
buildConfigField "boolean", "surfing_mode", "true"
|
||||||
buildConfigField "boolean", "sepia_search", "true"
|
buildConfigField "boolean", "sepia_search", "true"
|
||||||
buildConfigField "boolean", "instance_switcher", "true"
|
buildConfigField "boolean", "instance_switcher", "true"
|
||||||
|
buildConfigField "boolean", "allow_remote_connections", "true"
|
||||||
|
buildConfigField "boolean", "google_cast_lib", "true"
|
||||||
|
buildConfigField "int", "cast_enabled", "1"
|
||||||
|
buildConfigField "int", "default_theme", "2"
|
||||||
}
|
}
|
||||||
queermotion {
|
|
||||||
applicationId "org.queermotion.peertube"
|
|
||||||
resValue "string", "app_name", "QueerMotion"
|
|
||||||
resValue "string", "app_id", "org.queermotion.peertube"
|
|
||||||
buildConfigField "String", "version", "\"queermotion\""
|
|
||||||
buildConfigField "boolean", "full_instances", "true"
|
|
||||||
buildConfigField "boolean", "google_restriction", "false"
|
|
||||||
buildConfigField "boolean", "surfing_mode", "false"
|
|
||||||
buildConfigField "boolean", "sepia_search", "false"
|
|
||||||
buildConfigField "boolean", "instance_switcher", "false"
|
|
||||||
}
|
|
||||||
bittube {
|
|
||||||
applicationId "app.fedilab.bittube"
|
|
||||||
resValue "string", "app_name", "Bittube"
|
|
||||||
resValue "string", "app_id", "app.fedilab.bittube"
|
|
||||||
buildConfigField "String", "version", "\"bittube\""
|
|
||||||
buildConfigField "boolean", "full_instances", "true"
|
|
||||||
buildConfigField "boolean", "google_restriction", "true"
|
|
||||||
buildConfigField "boolean", "surfing_mode", "false"
|
|
||||||
buildConfigField "boolean", "sepia_search", "false"
|
|
||||||
buildConfigField "boolean", "instance_switcher", "true"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|
||||||
fdroid_acad {
|
fdroid_acad {
|
||||||
res.srcDirs = ['src/main/res', 'src/acad/res']
|
res.srcDirs = ['src/main/res', 'src/no_google_cast_lib/res', 'src/acad/res']
|
||||||
|
java.srcDirs = ['src/main/java', 'src/acad/java', 'src/no_google_donation/java', 'src/no_google_cast_lib/java']
|
||||||
}
|
}
|
||||||
google_acad {
|
google_acad {
|
||||||
res.srcDirs = ['src/main/res', 'src/acad/res']
|
res.srcDirs = ['src/main/res', 'src/google_cast_lib/res', 'src/acad/res']
|
||||||
|
java.srcDirs = ['src/main/java', 'src/acad/java', 'src/no_google_donation/java', 'src/google_cast_lib/java']
|
||||||
}
|
}
|
||||||
fdroid_full {
|
fdroid_full {
|
||||||
res.srcDirs = ['src/main/res', 'src/full/res']
|
res.srcDirs = ['src/main/res', 'src/no_google_cast_lib/res', 'src/full/res']
|
||||||
|
java.srcDirs = ['src/main/java', 'src/full/java', 'src/no_google_donation/java', 'src/no_google_cast_lib/java']
|
||||||
}
|
}
|
||||||
google_full {
|
google_full {
|
||||||
res.srcDirs = ['src/main/res', 'src/full/res']
|
res.srcDirs = ['src/main/res', 'src/google_donation/res', 'src/google_cast_lib/res', 'src/full/res']
|
||||||
}
|
java.srcDirs = ['src/main/java', 'src/full/java', 'src/google_donation/java', 'src/google_cast_lib/java']
|
||||||
queermotion {
|
|
||||||
res.srcDirs = ['src/main/res', 'src/queermotion/res']
|
|
||||||
}
|
|
||||||
bittube {
|
|
||||||
res.srcDirs = ['src/main/res', 'src/bittube/res']
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,52 +136,77 @@ allprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "androidx.multidex:multidex:2.0.1"
|
implementation "androidx.multidex:multidex:2.0.1"
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||||
implementation 'androidx.preference:preference:1.1.1'
|
implementation 'androidx.preference:preference:1.2.0'
|
||||||
implementation 'com.google.android.material:material:1.2.1'
|
implementation 'com.google.android.material:material:1.5.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||||
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
|
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||||
implementation 'androidx.navigation:navigation-fragment:2.3.2'
|
implementation 'androidx.navigation:navigation-fragment:2.4.2'
|
||||||
implementation "androidx.fragment:fragment:1.2.5"
|
implementation "androidx.fragment:fragment:1.4.1"
|
||||||
implementation 'androidx.navigation:navigation-ui:2.3.2'
|
implementation 'androidx.navigation:navigation-ui:2.4.2'
|
||||||
implementation ("androidx.navigation:navigation-dynamic-features-fragment:2.3.2")
|
implementation ("androidx.navigation:navigation-dynamic-features-fragment:2.4.2")
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
implementation 'androidx.browser:browser:1.3.0'
|
implementation 'androidx.browser:browser:1.4.0'
|
||||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||||
testImplementation 'junit:junit:4.13.1'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
|
||||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
implementation 'com.github.amoskorir:avatarimagegenerator:1.5.0'
|
||||||
implementation 'com.github.GrenderG:Toasty:1.4.2'
|
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
|
||||||
implementation 'com.google.android.exoplayer:exoplayer:2.12.1'
|
implementation 'com.github.GrenderG:Toasty:1.5.2'
|
||||||
implementation 'com.google.android.exoplayer:extension-mediasession:2.12.1'
|
implementation 'com.google.android.exoplayer:exoplayer:2.12.2'
|
||||||
|
implementation 'com.google.android.exoplayer:extension-mediasession:2.12.2'
|
||||||
implementation "com.github.mabbas007:TagsEditText:1.0.5"
|
implementation "com.github.mabbas007:TagsEditText:1.0.5"
|
||||||
implementation "com.github.bumptech.glide:glide:4.11.0"
|
implementation "com.github.bumptech.glide:glide:4.11.0"
|
||||||
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
|
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
|
||||||
|
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
||||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||||
implementation "net.gotev:uploadservice:4.5.1"
|
implementation "net.gotev:uploadservice:4.5.1"
|
||||||
implementation "net.gotev:uploadservice-okhttp:4.5.1"
|
implementation "net.gotev:uploadservice-okhttp:4.5.1"
|
||||||
implementation "com.google.code.gson:gson:2.8.6"
|
implementation "com.google.code.gson:gson:2.8.6"
|
||||||
implementation 'androidx.media:media:1.2.1'
|
implementation 'androidx.media:media:1.6.0'
|
||||||
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
|
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
|
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
|
||||||
|
|
||||||
implementation "com.github.TorrentStream:TorrentStream-Android:2.7.0"
|
|
||||||
|
|
||||||
implementation "io.github.kobakei:ratethisapp:1.2.0"
|
implementation "io.github.kobakei:ratethisapp:1.2.0"
|
||||||
implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.0'
|
implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.0'
|
||||||
|
|
||||||
implementation "androidx.work:work-runtime:2.4.0"
|
implementation "androidx.work:work-runtime:2.7.1"
|
||||||
implementation "androidx.work:work-runtime-ktx:2.4.0"
|
|
||||||
|
|
||||||
//custom cast feature
|
|
||||||
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
|
||||||
implementation 'su.litvak.chromecast:api-v2:0.11.3'
|
|
||||||
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
|
||||||
implementation 'org.slf4j:slf4j-simple:1.7.30'
|
|
||||||
|
|
||||||
|
//************ DONATION GOOGLE ONLY **************//
|
||||||
|
google_fullImplementation "com.android.billingclient:billing:4.1.0"
|
||||||
|
|
||||||
|
//************ MATOMO --> acad instances only **************//
|
||||||
|
|
||||||
|
fdroid_acadImplementation 'org.matomo.sdk:tracker:4.1.2'
|
||||||
|
google_acadImplementation 'org.matomo.sdk:tracker:4.1.2'
|
||||||
|
|
||||||
|
//************ CAST **************///
|
||||||
|
|
||||||
|
//---> Google libs (google_full)
|
||||||
|
google_acadImplementation "com.google.android.gms:play-services-cast-tv:19.0.1"
|
||||||
|
google_acadImplementation "com.google.android.gms:play-services-cast:21.0.1"
|
||||||
|
google_acadImplementation "androidx.mediarouter:mediarouter:1.3.0"
|
||||||
|
google_acadImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1'
|
||||||
|
|
||||||
|
google_fullImplementation "com.google.android.gms:play-services-cast-tv:19.0.1"
|
||||||
|
google_fullImplementation "com.google.android.gms:play-services-cast:21.0.1"
|
||||||
|
google_fullImplementation "androidx.mediarouter:mediarouter:1.3.0"
|
||||||
|
google_fullImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1'
|
||||||
|
|
||||||
|
//----> Other flavors
|
||||||
|
fdroid_acadImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||||
|
fdroid_acadImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||||
|
fdroid_acadImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||||
|
fdroid_acadImplementation 'com.github.evozi:Cyanea:1.0.7'
|
||||||
|
|
||||||
|
fdroid_fullImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||||
|
fdroid_fullImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||||
|
fdroid_fullImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.matomo.sdk.Matomo;
|
||||||
|
import org.matomo.sdk.Tracker;
|
||||||
|
import org.matomo.sdk.TrackerBuilder;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class FedilabTube extends BaseFedilabTube {
|
||||||
|
|
||||||
|
private Tracker mMatomoTracker;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized Tracker getTracker() {
|
||||||
|
if (mMatomoTracker != null) return mMatomoTracker;
|
||||||
|
mMatomoTracker = TrackerBuilder.createDefault("https://wa.phm.education.gouv.fr/snp/matomo.php", 11).build(Matomo.getInstance(this));
|
||||||
|
return mMatomoTracker;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import org.matomo.sdk.Tracker;
|
||||||
|
import org.matomo.sdk.extra.TrackHelper;
|
||||||
|
|
||||||
|
public class Matomo {
|
||||||
|
|
||||||
|
public static void sendScreen(Context _mcontext, String path, String title) {
|
||||||
|
Tracker tracker = ((FedilabTube) ((Activity) _mcontext).getApplication()).getTracker();
|
||||||
|
TrackHelper.track().screen(path).title(title).with(tracker);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendEvent(Context _mcontext, String category, String action, String label, float value) {
|
||||||
|
Tracker tracker = ((FedilabTube) ((Activity) _mcontext).getApplication()).getTracker();
|
||||||
|
TrackHelper.track().event(category, action).name(label).value(value).with(tracker);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void sendValue(Context _mcontext, String path, int index, String dimensionValue) {
|
||||||
|
Tracker tracker = ((FedilabTube) ((Activity) _mcontext).getApplication()).getTracker();
|
||||||
|
TrackHelper.track().screen(path).dimension(index, dimensionValue).with(tracker);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void trackInstall(Context _mcontext) {
|
||||||
|
Tracker tracker = ((FedilabTube) ((Activity) _mcontext).getApplication()).getTracker();
|
||||||
|
TrackHelper.track().download().with(tracker);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package app.fedilab.fedilabtube.activities;
|
||||||
|
/* Copyright 2022 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
|
||||||
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package app.fedilab.fedilabtube.helper;
|
||||||
|
/* Copyright 2022 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
|
||||||
|
public class Theme {
|
||||||
|
|
||||||
|
public static void setTheme(AppCompatActivity activity, String instance, boolean noActionBar) {
|
||||||
|
|
||||||
|
switch (instance) {
|
||||||
|
case "tube-institutionnel.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar? R.style.InstitutionnelNoActionBar:R.style.Institutionnel);
|
||||||
|
break;
|
||||||
|
case "tube-maternelle.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.MaternelleNoActionBar:R.style.Maternelle);
|
||||||
|
break;
|
||||||
|
case "tube-arts-lettres-sciences-humaines.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.ArtNoActionBar:R.style.Art);
|
||||||
|
break;
|
||||||
|
case "tube-sciences-technologies.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.SciencesNoActionBar:R.style.Sciences);
|
||||||
|
break;
|
||||||
|
case "tube-education-physique-et-sportive.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.EducationNoActionBar:R.style.Education);
|
||||||
|
break;
|
||||||
|
case "tube-enseignement-professionnel.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.EnseignementProNoActionBar:R.style.EnseignementPro);
|
||||||
|
break;
|
||||||
|
case "tube-langues-vivantes.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.LanguesNoActionBar:R.style.Langues);
|
||||||
|
break;
|
||||||
|
case "tube-action-educative.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.ActionEducativeNoActionBar:R.style.ActionEducative);
|
||||||
|
break;
|
||||||
|
case "tube-cycle-2.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.Cycle2NoActionBar:R.style.Cycle2);
|
||||||
|
break;
|
||||||
|
case "tube-cycle-3.apps.education.fr":
|
||||||
|
activity.setTheme(noActionBar?R.style.Cycle3NoActionBar:R.style.Cycle3);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
activity.setTheme(noActionBar?R.style.AppThemeNoActionBar:R.style.AppTheme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<attr name="backgroundView" format="color" />
|
||||||
|
|
||||||
|
<style name="BaseTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
|
||||||
|
<item name="backgroundView">@color/backgroundDark</item>
|
||||||
|
</style>
|
||||||
|
<style name="BaseThemeNoAction" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||||
|
<item name="backgroundView">@color/backgroundDark</item>
|
||||||
|
</style>
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="BaseTheme">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppThemeNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Institutionnel theme. -->
|
||||||
|
<style name="Institutionnel" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_institutionnel</item>
|
||||||
|
</style>
|
||||||
|
<style name="InstitutionnelNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_institutionnel</item>
|
||||||
|
</style>
|
||||||
|
<!-- Maternelle theme. -->
|
||||||
|
<style name="Maternelle" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_maternelle</item>
|
||||||
|
</style>
|
||||||
|
<style name="MaternelleNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_maternelle</item>
|
||||||
|
</style>
|
||||||
|
<!-- Art theme. -->
|
||||||
|
<style name="Art" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_art</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_art</item>
|
||||||
|
</style>
|
||||||
|
<style name="ArtNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_art</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_art</item>
|
||||||
|
</style>
|
||||||
|
<!-- Sciences theme. -->
|
||||||
|
<style name="Sciences" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_sciences</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_sciences</item>
|
||||||
|
</style>
|
||||||
|
<style name="SciencesNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_sciences</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_sciences</item>
|
||||||
|
</style>
|
||||||
|
<!-- Education theme. -->
|
||||||
|
<style name="Education" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_education</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_education</item>
|
||||||
|
</style>
|
||||||
|
<style name="EducationNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_education</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_education</item>
|
||||||
|
</style>
|
||||||
|
<!-- Enseignement Pro theme. -->
|
||||||
|
<style name="EnseignementPro" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
|
||||||
|
</style>
|
||||||
|
<style name="EnseignementProNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
|
||||||
|
</style>
|
||||||
|
<!-- Langues theme. -->
|
||||||
|
<style name="Langues" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_langues</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_langues</item>
|
||||||
|
</style>
|
||||||
|
<style name="LanguesNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_langues</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_langues</item>
|
||||||
|
</style>
|
||||||
|
<!-- ActionEducative theme. -->
|
||||||
|
<style name="ActionEducative" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_action_educative</item>
|
||||||
|
</style>
|
||||||
|
<style name="ActionEducativeNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_action_educative</item>
|
||||||
|
</style>
|
||||||
|
<!-- Cycle 2 theme. -->
|
||||||
|
<style name="Cycle2" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle2</item>
|
||||||
|
</style>
|
||||||
|
<style name="Cycle2NoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle2</item>
|
||||||
|
</style>
|
||||||
|
<!-- Cycle 3 theme. -->
|
||||||
|
<style name="Cycle3" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle3</item>
|
||||||
|
</style>
|
||||||
|
<style name="Cycle3NoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle3</item>
|
||||||
|
</style>
|
||||||
|
<style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" />
|
||||||
|
|
||||||
|
<style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.DayNight" />
|
||||||
|
|
||||||
|
<style name="progress" parent="SpinKitView.Circle" />
|
||||||
|
|
||||||
|
<style name="progressBottom" parent="SpinKitView.ThreeBounce" />
|
||||||
|
|
||||||
|
<style name="searchBarSepia" parent="MaterialSearchBarDark" />
|
||||||
|
</resources>
|
|
@ -1,14 +1,61 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<color name="colorPrimary">#512DA8</color>
|
<color name="colorPrimary">#512DA8</color>
|
||||||
<color name="colorPrimaryDark">#4527A0</color>
|
<color name="colorPrimaryDark">#4527A0</color>
|
||||||
<color name="colorAccent">#9C27B0</color>
|
<color name="colorAccent">#9C27B0</color>
|
||||||
|
|
||||||
|
<!-- Institutionnel -->
|
||||||
|
<color name="colorPrimary_institutionnel">#1B2E35</color>
|
||||||
|
<color name="colorPrimaryDark_institutionnel">#1B2E35</color>
|
||||||
|
<color name="colorAccent_institutionnel">#35A8E0</color>
|
||||||
|
<!-- maternelle -->
|
||||||
|
<color name="colorPrimary_maternelle">#341047</color>
|
||||||
|
<color name="colorPrimaryDark_maternelle">#341047</color>
|
||||||
|
<color name="colorAccent_maternelle">#D3135D</color>
|
||||||
|
<!-- art -->
|
||||||
|
<color name="colorPrimary_art">#0d3b5f</color>
|
||||||
|
<color name="colorPrimaryDark_art">#0d3b5f</color>
|
||||||
|
<color name="colorAccent_art">#E61B72</color>
|
||||||
|
<!-- sciences -->
|
||||||
|
<color name="colorPrimary_sciences">#0d3b5f</color>
|
||||||
|
<color name="colorPrimaryDark_sciences">#0d3b5f</color>
|
||||||
|
<color name="colorAccent_sciences">#59b700</color>
|
||||||
|
<!-- education -->
|
||||||
|
<color name="colorPrimary_education">#0d3b5f</color>
|
||||||
|
<color name="colorPrimaryDark_education">#0d3b5f</color>
|
||||||
|
<color name="colorAccent_education">#EA3700</color>
|
||||||
|
<!-- enseignement pro -->
|
||||||
|
<color name="colorPrimary_enseignement_pro">#0d3b5f</color>
|
||||||
|
<color name="colorPrimaryDark_enseignement_pro">#0d3b5f</color>
|
||||||
|
<color name="colorAccent_enseignement_pro">#730FBA</color>
|
||||||
|
<!-- langues -->
|
||||||
|
<color name="colorPrimary_langues">#0d3b5f</color>
|
||||||
|
<color name="colorPrimaryDark_langues">#0d3b5f</color>
|
||||||
|
<color name="colorAccent_langues">#F69622</color>
|
||||||
|
<!-- Action éducative -->
|
||||||
|
<color name="colorPrimary_action_educative">#1B2E35</color>
|
||||||
|
<color name="colorPrimaryDark_action_educative">#1B2E35</color>
|
||||||
|
<color name="colorAccent_action_educative">#E52928</color>
|
||||||
|
<!-- cycle2 -->
|
||||||
|
<color name="colorPrimary_cycle2">#341047</color>
|
||||||
|
<color name="colorPrimaryDark_cycle2">#341047</color>
|
||||||
|
<color name="colorAccent_cycle2">#39A935</color>
|
||||||
|
<!-- cycle3 -->
|
||||||
|
<color name="colorPrimary_cycle3">#341047</color>
|
||||||
|
<color name="colorPrimaryDark_cycle3">#341047</color>
|
||||||
|
<color name="colorAccent_cycle3">#C1661B</color>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<color name="tag_color">#bbF2690D</color>
|
<color name="tag_color">#bbF2690D</color>
|
||||||
<color name="tag_color_text">#FAFAFA</color>
|
<color name="tag_color_text">#FAFAFA</color>
|
||||||
<color name="positive_thumbs">#2b90d9</color>
|
<color name="positive_thumbs">#2b90d9</color>
|
||||||
|
<color name="favorite">#ca8f04</color>
|
||||||
|
<color name="bookmark">#795548</color>
|
||||||
<color name="negative_thumbs">#F44336</color>
|
<color name="negative_thumbs">#F44336</color>
|
||||||
<color name="backgroundDark">#DD000000</color>
|
<color name="backgroundLight">#DDFFFFFF</color>
|
||||||
|
<color name="backgroundDark">#DD222222</color>
|
||||||
<color name="red_1">#F44336</color>
|
<color name="red_1">#F44336</color>
|
||||||
<color name="gray_light">#80808080</color>
|
<color name="gray_light">#80808080</color>
|
||||||
</resources>
|
</resources>
|
|
@ -0,0 +1,145 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<attr name="backgroundView" format="color" />
|
||||||
|
|
||||||
|
|
||||||
|
<style name="BaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<item name="backgroundView">@color/backgroundLight</item>
|
||||||
|
</style>
|
||||||
|
<style name="BaseThemeNoAction" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="backgroundView">@color/backgroundLight</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppThemeNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Institutionnel theme. -->
|
||||||
|
<style name="Institutionnel" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_institutionnel</item>
|
||||||
|
</style>
|
||||||
|
<style name="InstitutionnelNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_institutionnel</item>
|
||||||
|
</style>
|
||||||
|
<!-- Maternelle theme. -->
|
||||||
|
<style name="Maternelle" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_maternelle</item>
|
||||||
|
</style>
|
||||||
|
<style name="MaternelleNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_maternelle</item>
|
||||||
|
</style>
|
||||||
|
<!-- Art theme. -->
|
||||||
|
<style name="Art" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_art</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_art</item>
|
||||||
|
</style>
|
||||||
|
<style name="ArtNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_art</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_art</item>
|
||||||
|
</style>
|
||||||
|
<!-- Sciences theme. -->
|
||||||
|
<style name="Sciences" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_sciences</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_sciences</item>
|
||||||
|
</style>
|
||||||
|
<style name="SciencesNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_sciences</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_sciences</item>
|
||||||
|
</style>
|
||||||
|
<!-- Education theme. -->
|
||||||
|
<style name="Education" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_education</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_education</item>
|
||||||
|
</style>
|
||||||
|
<style name="EducationNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_education</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_education</item>
|
||||||
|
</style>
|
||||||
|
<!-- Enseignement Pro theme. -->
|
||||||
|
<style name="EnseignementPro" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
|
||||||
|
</style>
|
||||||
|
<style name="EnseignementProNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
|
||||||
|
</style>
|
||||||
|
<!-- Langues theme. -->
|
||||||
|
<style name="Langues" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_langues</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_langues</item>
|
||||||
|
</style>
|
||||||
|
<style name="LanguesNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_langues</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_langues</item>
|
||||||
|
</style>
|
||||||
|
<!-- ActionEducative theme. -->
|
||||||
|
<style name="ActionEducative" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_action_educative</item>
|
||||||
|
</style>
|
||||||
|
<style name="ActionEducativeNoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_action_educative</item>
|
||||||
|
</style>
|
||||||
|
<!-- Cycle 2 theme. -->
|
||||||
|
<style name="Cycle2" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle2</item>
|
||||||
|
</style>
|
||||||
|
<style name="Cycle2NoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle2</item>
|
||||||
|
</style>
|
||||||
|
<!-- Cycle 3 theme. -->
|
||||||
|
<style name="Cycle3" parent="BaseTheme">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle3</item>
|
||||||
|
</style>
|
||||||
|
<style name="Cycle3NoActionBar" parent="BaseThemeNoAction">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent_cycle3</item>
|
||||||
|
</style>
|
||||||
|
<style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" />
|
||||||
|
|
||||||
|
<style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.DayNight" />
|
||||||
|
|
||||||
|
<style name="progress" parent="SpinKitView.Circle" />
|
||||||
|
|
||||||
|
<style name="progressBottom" parent="SpinKitView.ThreeBounce" />
|
||||||
|
|
||||||
|
<style name="searchBarSepia" parent="MaterialSearchBarDark" />
|
||||||
|
</resources>
|
|
@ -3,4 +3,9 @@
|
||||||
<external-path
|
<external-path
|
||||||
name="my_images"
|
name="my_images"
|
||||||
path="/TubeAcad/" />
|
path="/TubeAcad/" />
|
||||||
|
|
||||||
|
<external-path
|
||||||
|
name="external_files"
|
||||||
|
path="/"/>
|
||||||
|
|
||||||
</paths>
|
</paths>
|
Before Width: | Height: | Size: 169 KiB |
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:color="@color/colorAccent" android:state_checked="true" />
|
|
||||||
<item android:color="@android:color/tab_indicator_text" />
|
|
||||||
</selector>
|
|
|
@ -1,864 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<group
|
|
||||||
android:scaleX="0.66"
|
|
||||||
android:scaleY="0.66"
|
|
||||||
android:translateX="21"
|
|
||||||
android:translateY="21">
|
|
||||||
<path android:pathData="M85.355,14.645C75.91,5.201 63.354,0 50,0C36.644,0 24.088,5.201 14.645,14.645S0,36.644 0,50c0,13.357 5.201,25.913 14.645,35.355C24.087,94.799 36.643,100 50,100c13.357,0 25.913,-5.201 35.355,-14.645C94.799,75.912 100,63.356 100,50C100,36.646 94.799,24.09 85.355,14.645z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="15.7699"
|
|
||||||
android:endY="86.8818"
|
|
||||||
android:startX="83.2562"
|
|
||||||
android:startY="14.1677"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FF28D1BC"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#FF00ABFF"
|
|
||||||
android:offset="0.6" />
|
|
||||||
<item
|
|
||||||
android:color="#FF2A5ED6"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M3.151,32.464L13.3,46.493L30.239,4.045c-5.75,2.474 -11.035,6.041 -15.595,10.6C9.504,19.786 5.623,25.851 3.151,32.464z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="24.2938"
|
|
||||||
android:endY="39.2239"
|
|
||||||
android:startX="-4.1098"
|
|
||||||
android:startY="-39.1612"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.5762" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M2.3,34.893c-1.5,4.8 -2.3,9.8 -2.3,15c0,2.8 0.2,5.5 0.7,8.2l7.8,10l36.878,-26.896L2.3,34.893z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="26.5038"
|
|
||||||
android:endY="54.332794"
|
|
||||||
android:startX="-2.655"
|
|
||||||
android:startY="33.41799"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.006" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M40.8,5.893l27.6,28.3l8.9,-26.2c-5.8,-3.8 -12.3,-6.3 -19.2,-7.4L40.8,5.893z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="62.8149"
|
|
||||||
android:endY="14.768093"
|
|
||||||
android:startX="84.794"
|
|
||||||
android:startY="0.65519285"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M42.79,46.347l25.8,0.6l-27.6,-28.3z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="45.013"
|
|
||||||
android:endY="42.08"
|
|
||||||
android:startX="59.9387"
|
|
||||||
android:startY="27.9081"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M96.88,67.451C98.928,61.941 100,56.054 100,50c0,-0.202 -0.005,-0.402 -0.007,-0.604L68.806,34.399L96.88,67.451z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="79.7008"
|
|
||||||
android:endY="33.716"
|
|
||||||
android:startX="107.2237"
|
|
||||||
android:startY="81.6425"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0029" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M27.8,15.893l17.4,11.8l3.7,-21.1z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.8608"
|
|
||||||
android:endY="17.1429"
|
|
||||||
android:startX="27.8"
|
|
||||||
android:startY="17.1429"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="8.440641E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M97.976,35.848l-5.312,-1.255l3.7,24l3.329,-3.044C99.895,53.719 100,51.868 100,50C100,45.14 99.308,40.386 97.976,35.848z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="93.5393"
|
|
||||||
android:endY="46.7512"
|
|
||||||
android:startX="101.8224"
|
|
||||||
android:startY="45.4073"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0017" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M72.998,85.447l2.742,7.442c2.87,-1.729 5.579,-3.761 8.092,-6.075L72.998,85.447z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="77.1128"
|
|
||||||
android:endY="79.7658"
|
|
||||||
android:startX="81.8324"
|
|
||||||
android:startY="102.8394"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9982" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M87.435,83.143c2.349,-2.646 4.393,-5.5 6.108,-8.522l-28.357,2.776L87.435,83.143z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="65.4945"
|
|
||||||
android:endY="79.3595"
|
|
||||||
android:startX="123.109"
|
|
||||||
android:startY="78.2586"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0022" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9966" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M72.9,85.193l-56.3,-11.1l7.2,18.4c1.6,1 3.3,1.9 5.1,2.7L72.9,85.193z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="38.2047"
|
|
||||||
android:endY="89.4249"
|
|
||||||
android:startX="58.4365"
|
|
||||||
android:startY="59.1884"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0015" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M79.09,58.897l-21,1.5l10.3,18.9z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="61.745285"
|
|
||||||
android:endY="71.03565"
|
|
||||||
android:startX="78.23818"
|
|
||||||
android:startY="57.920563"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9993" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<group>
|
|
||||||
<clip-path android:pathData="M50,50m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0" />
|
|
||||||
<path android:pathData="M31.304,22.589v0.7c0,0.1 0,0.1 -0.1,0.2l-1.9,0.8c0,0 0,0 -0.1,0s0,0 -0.1,0l-0.4,-0.2l19.7,27l2.4,-1.7L31.304,22.589z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.7969"
|
|
||||||
android:endY="36.839092"
|
|
||||||
android:startX="28.7808"
|
|
||||||
android:startY="36.839092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.006" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M65.409,20.005l-0.005,-1.116l-17,30.7l2.5,1.4l16.722,-30.026L65.409,20.005z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.3499"
|
|
||||||
android:endY="34.939095"
|
|
||||||
android:startX="67.5984"
|
|
||||||
android:startY="34.939095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M79.625,18.344l-0.021,-1.254l-31.3,32.1l2.1,2l31.2,-32L79.625,18.344z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.3039"
|
|
||||||
android:endY="34.138992"
|
|
||||||
android:startX="81.6039"
|
|
||||||
android:startY="34.138992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="7.851759E-5" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M90.104,35.389c-0.1,0 -0.1,-0.1 -0.1,-0.2v-2l-41.1,15.7l1,2.7l41.3,-15.8L90.104,35.389z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.8205"
|
|
||||||
android:endY="42.388992"
|
|
||||||
android:startX="91.2039"
|
|
||||||
android:startY="42.388992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0038" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M11.804,27.989v1.8c0,0.1 -0.1,0.2 -0.1,0.2l-1.2,0.5l38.5,20.9l1.4,-2.6L11.804,27.989z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.3298"
|
|
||||||
android:endY="39.689095"
|
|
||||||
android:startX="10.4298"
|
|
||||||
android:startY="39.689095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0025" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M17.265,50.089c0.1,0 0.1,0.2 0.1,0.2v2.5c0,0.1 -0.1,0.2 -0.1,0.2l32.439,-1.3l-0.1,-2.9L17.265,50.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.6603"
|
|
||||||
android:endY="50.888992"
|
|
||||||
android:startX="17.2212"
|
|
||||||
android:startY="50.888992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="3.140703E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M7.668,60.675c0.036,0.014 0.234,0.056 0.236,0.214l0,0l0,0v1.9l42.1,-11.2l-0.9,-2.8l-42.8,11.4C6.304,60.189 7.632,60.661 7.668,60.675z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.0039"
|
|
||||||
android:endY="55.789093"
|
|
||||||
android:startX="6.304"
|
|
||||||
android:startY="55.789093"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0047" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M33.904,62.147v1.942l16.7,-11.95l-1.8,-2.3L32.611,61.406L33.904,62.147z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.5851"
|
|
||||||
android:endY="56.964092"
|
|
||||||
android:startX="32.571"
|
|
||||||
android:startY="56.964092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.003" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M35.804,35.789v1.2c0,0.1 -0.1,0.2 -0.1,0.2l-1.8,0.8l14.5,13.4l2,-2.1L35.804,35.789z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.3668"
|
|
||||||
android:endY="43.589092"
|
|
||||||
android:startX="33.8669"
|
|
||||||
android:startY="43.589092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0048" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M55.804,33.089C55.804,33.089 55.704,33.089 55.804,33.089c-0.1,0 -0.1,0 -0.2,0l-1.9,-0.8l0,0l-5.4,17.5l2.8,0.9l5.5,-17.9L55.804,33.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.2319"
|
|
||||||
android:endY="41.489094"
|
|
||||||
android:startX="56.5588"
|
|
||||||
android:startY="41.489094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M64.804,45.489l-13.8,3.2l0.7,2.8l13.8,-3.2L64.804,45.489z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.9512"
|
|
||||||
android:endY="48.489094"
|
|
||||||
android:startX="65.4322"
|
|
||||||
android:startY="48.489094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0032" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M74.107,63.536L74.107,63.536L74.107,63.536c0,-0.098 0,-0.098 0.098,-0.195l0,0l0,0l0,0l1.172,-0.391L50.571,49.278l-1.367,2.441l24.903,13.77C74.107,65.489 74.107,63.536 74.107,63.536z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.2177"
|
|
||||||
android:endY="57.3833"
|
|
||||||
android:startX="75.4526"
|
|
||||||
android:startY="57.3833"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="5.496231E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M81.904,79.089L81.904,79.089L81.904,79.089L81.904,79.089l2,-0.6c0,0 0,0 0.1,0l-33.7,-29.4l-1.9,2.2l33.3,29v-1C81.704,79.289 81.694,79.141 81.904,79.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.4039"
|
|
||||||
android:endY="64.689095"
|
|
||||||
android:startX="84.0039"
|
|
||||||
android:startY="64.689095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0012" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M54.404,79.689l2,-0.6h0.1l0.7,0.2l-6.2,-29.7l-2.8,0.6L54.404,79.689L54.404,79.689z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.1377"
|
|
||||||
android:endY="64.63899"
|
|
||||||
android:startX="57.3221"
|
|
||||||
android:startY="64.63899"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0025" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M64.804,46.689l-15.6,2.1l0.4,2.9l30.2,-4.1l-0.4,-0.1c-0.1,0 -0.1,-0.1 -0.1,-0.2v-2.5l0,0l0,0l0,0L64.804,46.689">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.1732"
|
|
||||||
android:endY="48.239094"
|
|
||||||
android:startX="79.7731"
|
|
||||||
android:startY="48.239094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.003" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
</group>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M51.639,0.029l-10.172,9.922l38.598,0.091"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M65.366,2.397L67.311,16.642"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M77.224,8.046L71.304,14.042"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.609,16.642L69.609,17.642"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M83.78,13.139L82.883,14.965"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M85.325,14.615c0.096,0.097 -3.374,29.468 -3.374,29.468"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M89.811,35.231L68.98,45.442"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M81.157,19.065L67.957,44.865"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M89.66,32.342l-48.193,-22.391l23.922,7.289"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M69.592,19.841L93.523,25.345"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M91.096,21.502L91.699,31.585"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M95.08,28.318L93.554,32.271"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M92.657,35.991L91.055,78.558"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M78.616,65.137L96.149,69.308"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.904,46.935L78.571,63.748"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.296,41.575c-0.585,0.17 -15.743,4.529 -15.743,4.529l16.414,5.629"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.766,54.87l-15.164,16.679l5.749,7.991"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M77.456,66.713L83.427,78.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M84.31,82.536L83.75,86.889"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M85.28,82.142L86.327,84.354"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M81.12,48.139l-4.73,14.382l-8.132,-14.106"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.18,45.887L68.951,46.291"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.305,47.596L17.837,88.283"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.335,79.846L33.835,64.846"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M65.137,48.23L16.967,87.533"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M75.145,66.556c-0.008,0.074 -16.683,13.266 -16.683,13.266"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M74.354,66.171L62.454,98.371"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M67.749,96.77L22.551,91.808"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.293,81.937L19.29,89.467"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.846,82.756l-18.767,15.187l48.523,-26.394"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M25.193,93.341L55.115,99.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.046,65.521L15.515,86.205"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.466,32.642L33.573,61.932"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M34.116,62.841L64.78,47.542"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M64.799,46.436L17.528,51.124"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M17.481,52.92L29.665,61.822"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M7.972,61.193L64.229,47.287"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M29.602,63.342L8.042,62.247"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M32.453,37.508L14.288,84.989"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M28.519,23.938L11.678,82.116"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M6.456,64.297L5.153,72.159"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M3.605,62.036L1.439,61.984"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M0.08,52.807L13.108,51.842"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M9.157,30.693L6.857,59.693"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M14.243,53.353L6.765,60.325"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M27.926,23.641L16.156,49.667"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M16.351,27.987L15.502,49.442"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.704,37.136L17.432,50.364"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M1.452,37.962L13.741,49.851"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M8.149,30.316L0.472,43.105"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M0.306,44.454L13.082,50.537"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M14.188,15.113L10.004,26.542"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M11.786,27.339L14.886,26.239"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M16.953,12.477L16.651,24.087"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M19.154,24.807L27.254,21.972"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M20.361,9.72L28.536,20.331"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.069,29.329L27.064,5.547"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.287,22.039L53.587,29.739"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M53.593,30.937L35.793,34.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M64.821,45.539L35.934,36.076"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M81.802,15.419l-1.317,0.456l1.327,0.511l1.327,-0.511L81.802,15.419zM80.162,18.059l1.476,0.588v-1.92l-1.476,-0.588V18.059zM82.004,16.705v1.942l1.441,-0.584v-1.924L82.004,16.705z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M67.443,17.033l-1.317,0.456L67.453,18l1.327,-0.511L67.443,17.033zM65.804,19.673l1.476,0.588v-1.92l-1.476,-0.588V19.673zM67.646,18.319v1.942l1.441,-0.584v-1.924L67.646,18.319z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M55.737,29.211l-1.317,0.456l1.327,0.511l1.327,-0.511L55.737,29.211zM54.098,31.851l1.476,0.588v-1.92l-1.476,-0.588V31.851zM55.94,30.497v1.942l1.441,-0.584v-1.924L55.94,30.497z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M29.251,20.523l-1.317,0.456l1.327,0.511l1.327,-0.511L29.251,20.523zM27.611,23.164l1.476,0.588v-1.92l-1.476,-0.588V23.164zM29.453,21.81v1.942l1.441,-0.584v-1.924L29.453,21.81z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M15.227,49.775l-1.317,0.456l1.327,0.511l1.327,-0.511L15.227,49.775zM13.587,52.415l1.476,0.588v-1.92l-1.476,-0.588V52.415zM15.429,51.062v1.942l1.441,-0.584v-1.924L15.429,51.062z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M9.601,26.95l-1.317,0.456l1.327,0.511l1.327,-0.511L9.601,26.95zM7.962,29.59l1.476,0.588v-1.92L7.962,27.67V29.59zM9.804,28.236v1.942l1.441,-0.584V27.67L9.804,28.236z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M56.429,79.561l-1.317,0.456l1.327,0.511l1.327,-0.511L56.429,79.561zM54.79,82.201l1.476,0.588v-1.92l-1.476,-0.588V82.201zM56.632,80.847v1.942l1.441,-0.584v-1.924L56.632,80.847z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M33.602,34.175l-1.317,0.456l1.327,0.511l1.327,-0.511L33.602,34.175zM31.963,36.815l1.476,0.588v-1.92l-1.476,-0.588V36.815zM33.804,35.462v1.942l1.441,-0.584v-1.924L33.804,35.462z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M31.796,61.722l-1.317,0.456l1.327,0.511l1.327,-0.511L31.796,61.722zM30.156,64.362l1.476,0.588v-1.92l-1.476,-0.588V64.362zM31.998,63.009v1.942l1.441,-0.584v-1.924L31.998,63.009z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M83.96,79.141l-1.317,0.456l1.327,0.511l1.327,-0.511L83.96,79.141zM82.321,81.781l1.476,0.588v-1.92l-1.476,-0.588V81.781zM84.162,80.428v1.942l1.441,-0.584v-1.924L84.162,80.428z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M76.393,63.075l-1.317,0.456l1.327,0.511l1.327,-0.511L76.393,63.075zM74.754,65.715l1.476,0.588v-1.92l-1.476,-0.588V65.715zM76.596,64.362v1.942l1.441,-0.584v-1.924L76.596,64.362z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M81.202,44.475l-1.317,0.456l1.327,0.511l1.327,-0.511L81.202,44.475zM79.563,47.115l1.476,0.588v-1.92l-1.476,-0.588V47.115zM81.404,45.762v1.942l1.441,-0.584v-1.924L81.404,45.762z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M92.296,32.228l-1.317,0.456l1.327,0.511l1.327,-0.511L92.296,32.228zM90.656,34.868l1.476,0.588v-1.92l-1.476,-0.588V34.868zM92.498,33.515v1.942l1.441,-0.584v-1.924L92.498,33.515z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M5.806,60.518l-1.317,0.456l1.327,0.511l1.327,-0.511L5.806,60.518zM4.167,63.158l1.476,0.588v-1.92l-1.476,-0.588V63.158zM6.009,61.804v1.942l1.441,-0.584v-1.924L6.009,61.804z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M24.691,30.255c-0.615,0.788 -0.538,1.99 0.329,2.667c0.867,0.677 1.99,0.538 2.667,-0.329c6.397,-8.2 16.796,-12.263 27.125,-10.546c0.658,0.133 1.342,-0.095 1.773,-0.646c0.185,-0.237 0.29,-0.535 0.396,-0.833c0.088,-0.438 0.019,-1 -0.314,-1.386s-0.727,-0.694 -1.165,-0.782C43.638,16.373 31.949,20.952 24.691,30.255z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M71.1,47.4L41.3,29.2c-1,-0.5 -2.2,-0.5 -3.2,0.1s-1.6,1.6 -1.6,2.8v36.2c0,1.1 0.6,2.2 1.6,2.8c0.5,0.3 1.1,0.5 1.6,0.5s1.1,-0.1 1.6,-0.4L71.1,53c1,-0.6 1.6,-1.6 1.6,-2.8C72.7,49.1 72.1,48 71.1,47.4zM68.5,50.2L40.3,67.4V33L68.5,50.2z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M79.6,20.4C71.7,12.6 61.2,8.2 50,8.2s-21.7,4.3 -29.6,12.2C12.6,28.3 8.2,38.8 8.2,50s4.3,21.7 12.2,29.6S38.8,91.8 50,91.8s21.7,-4.3 29.6,-12.2S91.8,61.2 91.8,50S87.4,28.3 79.6,20.4zM88.1,50c0,10.2 -4,19.7 -11.2,26.9C69.7,84.1 60.2,88.1 50,88.1s-19.7,-4 -26.9,-11.2C15.9,69.7 11.9,60.2 11.9,50s4,-19.7 11.2,-26.9S39.9,11.9 50,11.9c10.2,0 19.7,4 26.9,11.2C84.1,30.3 88.1,39.8 88.1,50z" />
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
||||||
|
|
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.5 KiB |
|
@ -1,862 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<group
|
|
||||||
android:scaleX="0.66"
|
|
||||||
android:scaleY="0.66"
|
|
||||||
android:translateX="21"
|
|
||||||
android:translateY="21">
|
|
||||||
<path android:pathData="M85.355,14.645C75.91,5.201 63.354,0 50,0C36.644,0 24.088,5.201 14.645,14.645S0,36.644 0,50c0,13.357 5.201,25.913 14.645,35.355C24.087,94.799 36.643,100 50,100c13.357,0 25.913,-5.201 35.355,-14.645C94.799,75.912 100,63.356 100,50C100,36.646 94.799,24.09 85.355,14.645z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="15.7699"
|
|
||||||
android:endY="86.8818"
|
|
||||||
android:startX="83.2562"
|
|
||||||
android:startY="14.1677"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FF28D1BC"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#FF00ABFF"
|
|
||||||
android:offset="0.6" />
|
|
||||||
<item
|
|
||||||
android:color="#FF2A5ED6"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M3.151,32.464L13.3,46.493L30.239,4.045c-5.75,2.474 -11.035,6.041 -15.595,10.6C9.504,19.786 5.623,25.851 3.151,32.464z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="24.2938"
|
|
||||||
android:endY="39.2239"
|
|
||||||
android:startX="-4.1098"
|
|
||||||
android:startY="-39.1612"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.5762" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M2.3,34.893c-1.5,4.8 -2.3,9.8 -2.3,15c0,2.8 0.2,5.5 0.7,8.2l7.8,10l36.878,-26.896L2.3,34.893z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="26.5038"
|
|
||||||
android:endY="54.332794"
|
|
||||||
android:startX="-2.655"
|
|
||||||
android:startY="33.41799"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.006" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M40.8,5.893l27.6,28.3l8.9,-26.2c-5.8,-3.8 -12.3,-6.3 -19.2,-7.4L40.8,5.893z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="62.8149"
|
|
||||||
android:endY="14.768093"
|
|
||||||
android:startX="84.794"
|
|
||||||
android:startY="0.65519285"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M42.79,46.347l25.8,0.6l-27.6,-28.3z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="45.013"
|
|
||||||
android:endY="42.08"
|
|
||||||
android:startX="59.9387"
|
|
||||||
android:startY="27.9081"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M96.88,67.451C98.928,61.941 100,56.054 100,50c0,-0.202 -0.005,-0.402 -0.007,-0.604L68.806,34.399L96.88,67.451z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="79.7008"
|
|
||||||
android:endY="33.716"
|
|
||||||
android:startX="107.2237"
|
|
||||||
android:startY="81.6425"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0029" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M27.8,15.893l17.4,11.8l3.7,-21.1z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.8608"
|
|
||||||
android:endY="17.1429"
|
|
||||||
android:startX="27.8"
|
|
||||||
android:startY="17.1429"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="8.440641E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M97.976,35.848l-5.312,-1.255l3.7,24l3.329,-3.044C99.895,53.719 100,51.868 100,50C100,45.14 99.308,40.386 97.976,35.848z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="93.5393"
|
|
||||||
android:endY="46.7512"
|
|
||||||
android:startX="101.8224"
|
|
||||||
android:startY="45.4073"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0017" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M72.998,85.447l2.742,7.442c2.87,-1.729 5.579,-3.761 8.092,-6.075L72.998,85.447z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="77.1128"
|
|
||||||
android:endY="79.7658"
|
|
||||||
android:startX="81.8324"
|
|
||||||
android:startY="102.8394"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9982" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M87.435,83.143c2.349,-2.646 4.393,-5.5 6.108,-8.522l-28.357,2.776L87.435,83.143z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="65.4945"
|
|
||||||
android:endY="79.3595"
|
|
||||||
android:startX="123.109"
|
|
||||||
android:startY="78.2586"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0022" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9966" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M72.9,85.193l-56.3,-11.1l7.2,18.4c1.6,1 3.3,1.9 5.1,2.7L72.9,85.193z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="38.2047"
|
|
||||||
android:endY="89.4249"
|
|
||||||
android:startX="58.4365"
|
|
||||||
android:startY="59.1884"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0015" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M79.09,58.897l-21,1.5l10.3,18.9z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="61.745285"
|
|
||||||
android:endY="71.03565"
|
|
||||||
android:startX="78.23818"
|
|
||||||
android:startY="57.920563"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9993" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<group>
|
|
||||||
<clip-path android:pathData="M50,50m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0" />
|
|
||||||
<path android:pathData="M31.304,22.589v0.7c0,0.1 0,0.1 -0.1,0.2l-1.9,0.8c0,0 0,0 -0.1,0s0,0 -0.1,0l-0.4,-0.2l19.7,27l2.4,-1.7L31.304,22.589z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.7969"
|
|
||||||
android:endY="36.839092"
|
|
||||||
android:startX="28.7808"
|
|
||||||
android:startY="36.839092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.006" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M65.409,20.005l-0.005,-1.116l-17,30.7l2.5,1.4l16.722,-30.026L65.409,20.005z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.3499"
|
|
||||||
android:endY="34.939095"
|
|
||||||
android:startX="67.5984"
|
|
||||||
android:startY="34.939095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M79.625,18.344l-0.021,-1.254l-31.3,32.1l2.1,2l31.2,-32L79.625,18.344z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.3039"
|
|
||||||
android:endY="34.138992"
|
|
||||||
android:startX="81.6039"
|
|
||||||
android:startY="34.138992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="7.851759E-5" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M90.104,35.389c-0.1,0 -0.1,-0.1 -0.1,-0.2v-2l-41.1,15.7l1,2.7l41.3,-15.8L90.104,35.389z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.8205"
|
|
||||||
android:endY="42.388992"
|
|
||||||
android:startX="91.2039"
|
|
||||||
android:startY="42.388992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0038" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M11.804,27.989v1.8c0,0.1 -0.1,0.2 -0.1,0.2l-1.2,0.5l38.5,20.9l1.4,-2.6L11.804,27.989z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.3298"
|
|
||||||
android:endY="39.689095"
|
|
||||||
android:startX="10.4298"
|
|
||||||
android:startY="39.689095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0025" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M17.265,50.089c0.1,0 0.1,0.2 0.1,0.2v2.5c0,0.1 -0.1,0.2 -0.1,0.2l32.439,-1.3l-0.1,-2.9L17.265,50.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.6603"
|
|
||||||
android:endY="50.888992"
|
|
||||||
android:startX="17.2212"
|
|
||||||
android:startY="50.888992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="3.140703E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M7.668,60.675c0.036,0.014 0.234,0.056 0.236,0.214l0,0l0,0v1.9l42.1,-11.2l-0.9,-2.8l-42.8,11.4C6.304,60.189 7.632,60.661 7.668,60.675z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.0039"
|
|
||||||
android:endY="55.789093"
|
|
||||||
android:startX="6.304"
|
|
||||||
android:startY="55.789093"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0047" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M33.904,62.147v1.942l16.7,-11.95l-1.8,-2.3L32.611,61.406L33.904,62.147z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.5851"
|
|
||||||
android:endY="56.964092"
|
|
||||||
android:startX="32.571"
|
|
||||||
android:startY="56.964092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.003" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M35.804,35.789v1.2c0,0.1 -0.1,0.2 -0.1,0.2l-1.8,0.8l14.5,13.4l2,-2.1L35.804,35.789z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.3668"
|
|
||||||
android:endY="43.589092"
|
|
||||||
android:startX="33.8669"
|
|
||||||
android:startY="43.589092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0048" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M55.804,33.089C55.804,33.089 55.704,33.089 55.804,33.089c-0.1,0 -0.1,0 -0.2,0l-1.9,-0.8l0,0l-5.4,17.5l2.8,0.9l5.5,-17.9L55.804,33.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.2319"
|
|
||||||
android:endY="41.489094"
|
|
||||||
android:startX="56.5588"
|
|
||||||
android:startY="41.489094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M64.804,45.489l-13.8,3.2l0.7,2.8l13.8,-3.2L64.804,45.489z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.9512"
|
|
||||||
android:endY="48.489094"
|
|
||||||
android:startX="65.4322"
|
|
||||||
android:startY="48.489094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0032" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M74.107,63.536L74.107,63.536L74.107,63.536c0,-0.098 0,-0.098 0.098,-0.195l0,0l0,0l0,0l1.172,-0.391L50.571,49.278l-1.367,2.441l24.903,13.77C74.107,65.489 74.107,63.536 74.107,63.536z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.2177"
|
|
||||||
android:endY="57.3833"
|
|
||||||
android:startX="75.4526"
|
|
||||||
android:startY="57.3833"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="5.496231E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M81.904,79.089L81.904,79.089L81.904,79.089L81.904,79.089l2,-0.6c0,0 0,0 0.1,0l-33.7,-29.4l-1.9,2.2l33.3,29v-1C81.704,79.289 81.694,79.141 81.904,79.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.4039"
|
|
||||||
android:endY="64.689095"
|
|
||||||
android:startX="84.0039"
|
|
||||||
android:startY="64.689095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0012" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M54.404,79.689l2,-0.6h0.1l0.7,0.2l-6.2,-29.7l-2.8,0.6L54.404,79.689L54.404,79.689z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.1377"
|
|
||||||
android:endY="64.63899"
|
|
||||||
android:startX="57.3221"
|
|
||||||
android:startY="64.63899"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0025" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M64.804,46.689l-15.6,2.1l0.4,2.9l30.2,-4.1l-0.4,-0.1c-0.1,0 -0.1,-0.1 -0.1,-0.2v-2.5l0,0l0,0l0,0L64.804,46.689">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.1732"
|
|
||||||
android:endY="48.239094"
|
|
||||||
android:startX="79.7731"
|
|
||||||
android:startY="48.239094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.003" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
</group>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M51.639,0.029l-10.172,9.922l38.598,0.091"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M65.366,2.397L67.311,16.642"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M77.224,8.046L71.304,14.042"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.609,16.642L69.609,17.642"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M83.78,13.139L82.883,14.965"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M85.325,14.615c0.096,0.097 -3.374,29.468 -3.374,29.468"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M89.811,35.231L68.98,45.442"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M81.157,19.065L67.957,44.865"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M89.66,32.342l-48.193,-22.391l23.922,7.289"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M69.592,19.841L93.523,25.345"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M91.096,21.502L91.699,31.585"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M95.08,28.318L93.554,32.271"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M92.657,35.991L91.055,78.558"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M78.616,65.137L96.149,69.308"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.904,46.935L78.571,63.748"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.296,41.575c-0.585,0.17 -15.743,4.529 -15.743,4.529l16.414,5.629"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.766,54.87l-15.164,16.679l5.749,7.991"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M77.456,66.713L83.427,78.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M84.31,82.536L83.75,86.889"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M85.28,82.142L86.327,84.354"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M81.12,48.139l-4.73,14.382l-8.132,-14.106"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.18,45.887L68.951,46.291"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.305,47.596L17.837,88.283"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.335,79.846L33.835,64.846"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M65.137,48.23L16.967,87.533"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M75.145,66.556c-0.008,0.074 -16.683,13.266 -16.683,13.266"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M74.354,66.171L62.454,98.371"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M67.749,96.77L22.551,91.808"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.293,81.937L19.29,89.467"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.846,82.756l-18.767,15.187l48.523,-26.394"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M25.193,93.341L55.115,99.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.046,65.521L15.515,86.205"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.466,32.642L33.573,61.932"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M34.116,62.841L64.78,47.542"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M64.799,46.436L17.528,51.124"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M17.481,52.92L29.665,61.822"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M7.972,61.193L64.229,47.287"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M29.602,63.342L8.042,62.247"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M32.453,37.508L14.288,84.989"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M28.519,23.938L11.678,82.116"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M6.456,64.297L5.153,72.159"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M3.605,62.036L1.439,61.984"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M0.08,52.807L13.108,51.842"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M9.157,30.693L6.857,59.693"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M14.243,53.353L6.765,60.325"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M27.926,23.641L16.156,49.667"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M16.351,27.987L15.502,49.442"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.704,37.136L17.432,50.364"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M1.452,37.962L13.741,49.851"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M8.149,30.316L0.472,43.105"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M0.306,44.454L13.082,50.537"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M14.188,15.113L10.004,26.542"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M11.786,27.339L14.886,26.239"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M16.953,12.477L16.651,24.087"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M19.154,24.807L27.254,21.972"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M20.361,9.72L28.536,20.331"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.069,29.329L27.064,5.547"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.287,22.039L53.587,29.739"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M53.593,30.937L35.793,34.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M64.821,45.539L35.934,36.076"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M81.802,15.419l-1.317,0.456l1.327,0.511l1.327,-0.511L81.802,15.419zM80.162,18.059l1.476,0.588v-1.92l-1.476,-0.588V18.059zM82.004,16.705v1.942l1.441,-0.584v-1.924L82.004,16.705z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M67.443,17.033l-1.317,0.456L67.453,18l1.327,-0.511L67.443,17.033zM65.804,19.673l1.476,0.588v-1.92l-1.476,-0.588V19.673zM67.646,18.319v1.942l1.441,-0.584v-1.924L67.646,18.319z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M55.737,29.211l-1.317,0.456l1.327,0.511l1.327,-0.511L55.737,29.211zM54.098,31.851l1.476,0.588v-1.92l-1.476,-0.588V31.851zM55.94,30.497v1.942l1.441,-0.584v-1.924L55.94,30.497z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M29.251,20.523l-1.317,0.456l1.327,0.511l1.327,-0.511L29.251,20.523zM27.611,23.164l1.476,0.588v-1.92l-1.476,-0.588V23.164zM29.453,21.81v1.942l1.441,-0.584v-1.924L29.453,21.81z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M15.227,49.775l-1.317,0.456l1.327,0.511l1.327,-0.511L15.227,49.775zM13.587,52.415l1.476,0.588v-1.92l-1.476,-0.588V52.415zM15.429,51.062v1.942l1.441,-0.584v-1.924L15.429,51.062z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M9.601,26.95l-1.317,0.456l1.327,0.511l1.327,-0.511L9.601,26.95zM7.962,29.59l1.476,0.588v-1.92L7.962,27.67V29.59zM9.804,28.236v1.942l1.441,-0.584V27.67L9.804,28.236z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M56.429,79.561l-1.317,0.456l1.327,0.511l1.327,-0.511L56.429,79.561zM54.79,82.201l1.476,0.588v-1.92l-1.476,-0.588V82.201zM56.632,80.847v1.942l1.441,-0.584v-1.924L56.632,80.847z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M33.602,34.175l-1.317,0.456l1.327,0.511l1.327,-0.511L33.602,34.175zM31.963,36.815l1.476,0.588v-1.92l-1.476,-0.588V36.815zM33.804,35.462v1.942l1.441,-0.584v-1.924L33.804,35.462z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M31.796,61.722l-1.317,0.456l1.327,0.511l1.327,-0.511L31.796,61.722zM30.156,64.362l1.476,0.588v-1.92l-1.476,-0.588V64.362zM31.998,63.009v1.942l1.441,-0.584v-1.924L31.998,63.009z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M83.96,79.141l-1.317,0.456l1.327,0.511l1.327,-0.511L83.96,79.141zM82.321,81.781l1.476,0.588v-1.92l-1.476,-0.588V81.781zM84.162,80.428v1.942l1.441,-0.584v-1.924L84.162,80.428z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M76.393,63.075l-1.317,0.456l1.327,0.511l1.327,-0.511L76.393,63.075zM74.754,65.715l1.476,0.588v-1.92l-1.476,-0.588V65.715zM76.596,64.362v1.942l1.441,-0.584v-1.924L76.596,64.362z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M81.202,44.475l-1.317,0.456l1.327,0.511l1.327,-0.511L81.202,44.475zM79.563,47.115l1.476,0.588v-1.92l-1.476,-0.588V47.115zM81.404,45.762v1.942l1.441,-0.584v-1.924L81.404,45.762z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M92.296,32.228l-1.317,0.456l1.327,0.511l1.327,-0.511L92.296,32.228zM90.656,34.868l1.476,0.588v-1.92l-1.476,-0.588V34.868zM92.498,33.515v1.942l1.441,-0.584v-1.924L92.498,33.515z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M5.806,60.518l-1.317,0.456l1.327,0.511l1.327,-0.511L5.806,60.518zM4.167,63.158l1.476,0.588v-1.92l-1.476,-0.588V63.158zM6.009,61.804v1.942l1.441,-0.584v-1.924L6.009,61.804z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M24.691,30.255c-0.615,0.788 -0.538,1.99 0.329,2.667c0.867,0.677 1.99,0.538 2.667,-0.329c6.397,-8.2 16.796,-12.263 27.125,-10.546c0.658,0.133 1.342,-0.095 1.773,-0.646c0.185,-0.237 0.29,-0.535 0.396,-0.833c0.088,-0.438 0.019,-1 -0.314,-1.386s-0.727,-0.694 -1.165,-0.782C43.638,16.373 31.949,20.952 24.691,30.255z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M71.1,47.4L41.3,29.2c-1,-0.5 -2.2,-0.5 -3.2,0.1s-1.6,1.6 -1.6,2.8v36.2c0,1.1 0.6,2.2 1.6,2.8c0.5,0.3 1.1,0.5 1.6,0.5s1.1,-0.1 1.6,-0.4L71.1,53c1,-0.6 1.6,-1.6 1.6,-2.8C72.7,49.1 72.1,48 71.1,47.4zM68.5,50.2L40.3,67.4V33L68.5,50.2z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M79.6,20.4C71.7,12.6 61.2,8.2 50,8.2s-21.7,4.3 -29.6,12.2C12.6,28.3 8.2,38.8 8.2,50s4.3,21.7 12.2,29.6S38.8,91.8 50,91.8s21.7,-4.3 29.6,-12.2S91.8,61.2 91.8,50S87.4,28.3 79.6,20.4zM88.1,50c0,10.2 -4,19.7 -11.2,26.9C69.7,84.1 60.2,88.1 50,88.1s-19.7,-4 -26.9,-11.2C15.9,69.7 11.9,60.2 11.9,50s4,-19.7 11.2,-26.9S39.9,11.9 50,11.9c10.2,0 19.7,4 26.9,11.2C84.1,30.3 88.1,39.8 88.1,50z" />
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 9.2 KiB |
|
@ -1,856 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="100dp"
|
|
||||||
android:height="100dp"
|
|
||||||
android:viewportWidth="100"
|
|
||||||
android:viewportHeight="100">
|
|
||||||
<path android:pathData="M85.355,14.645C75.91,5.201 63.354,0 50,0C36.644,0 24.088,5.201 14.645,14.645S0,36.644 0,50c0,13.357 5.201,25.913 14.645,35.355C24.087,94.799 36.643,100 50,100c13.357,0 25.913,-5.201 35.355,-14.645C94.799,75.912 100,63.356 100,50C100,36.646 94.799,24.09 85.355,14.645z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="15.7699"
|
|
||||||
android:endY="86.8818"
|
|
||||||
android:startX="83.2562"
|
|
||||||
android:startY="14.1677"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FF28D1BC"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#FF00ABFF"
|
|
||||||
android:offset="0.6" />
|
|
||||||
<item
|
|
||||||
android:color="#FF2A5ED6"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M3.151,32.464L13.3,46.493L30.239,4.045c-5.75,2.474 -11.035,6.041 -15.595,10.6C9.504,19.786 5.623,25.851 3.151,32.464z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="24.2938"
|
|
||||||
android:endY="39.2239"
|
|
||||||
android:startX="-4.1098"
|
|
||||||
android:startY="-39.1612"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.5762" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M2.3,34.893c-1.5,4.8 -2.3,9.8 -2.3,15c0,2.8 0.2,5.5 0.7,8.2l7.8,10l36.878,-26.896L2.3,34.893z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="26.5038"
|
|
||||||
android:endY="54.332794"
|
|
||||||
android:startX="-2.655"
|
|
||||||
android:startY="33.41799"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.006" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M40.8,5.893l27.6,28.3l8.9,-26.2c-5.8,-3.8 -12.3,-6.3 -19.2,-7.4L40.8,5.893z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="62.8149"
|
|
||||||
android:endY="14.768093"
|
|
||||||
android:startX="84.794"
|
|
||||||
android:startY="0.65519285"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M42.79,46.347l25.8,0.6l-27.6,-28.3z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="45.013"
|
|
||||||
android:endY="42.08"
|
|
||||||
android:startX="59.9387"
|
|
||||||
android:startY="27.9081"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M96.88,67.451C98.928,61.941 100,56.054 100,50c0,-0.202 -0.005,-0.402 -0.007,-0.604L68.806,34.399L96.88,67.451z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="79.7008"
|
|
||||||
android:endY="33.716"
|
|
||||||
android:startX="107.2237"
|
|
||||||
android:startY="81.6425"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0029" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M27.8,15.893l17.4,11.8l3.7,-21.1z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.8608"
|
|
||||||
android:endY="17.1429"
|
|
||||||
android:startX="27.8"
|
|
||||||
android:startY="17.1429"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="8.440641E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M97.976,35.848l-5.312,-1.255l3.7,24l3.329,-3.044C99.895,53.719 100,51.868 100,50C100,45.14 99.308,40.386 97.976,35.848z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="93.5393"
|
|
||||||
android:endY="46.7512"
|
|
||||||
android:startX="101.8224"
|
|
||||||
android:startY="45.4073"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0017" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M72.998,85.447l2.742,7.442c2.87,-1.729 5.579,-3.761 8.092,-6.075L72.998,85.447z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="77.1128"
|
|
||||||
android:endY="79.7658"
|
|
||||||
android:startX="81.8324"
|
|
||||||
android:startY="102.8394"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9982" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M87.435,83.143c2.349,-2.646 4.393,-5.5 6.108,-8.522l-28.357,2.776L87.435,83.143z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="65.4945"
|
|
||||||
android:endY="79.3595"
|
|
||||||
android:startX="123.109"
|
|
||||||
android:startY="78.2586"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0022" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9966" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M72.9,85.193l-56.3,-11.1l7.2,18.4c1.6,1 3.3,1.9 5.1,2.7L72.9,85.193z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="38.2047"
|
|
||||||
android:endY="89.4249"
|
|
||||||
android:startX="58.4365"
|
|
||||||
android:startY="59.1884"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0015" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.71"
|
|
||||||
android:pathData="M79.09,58.897l-21,1.5l10.3,18.9z"
|
|
||||||
android:strokeAlpha="0.71">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="61.745285"
|
|
||||||
android:endY="71.03565"
|
|
||||||
android:startX="78.23818"
|
|
||||||
android:startY="57.920563"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="0.9993" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<group>
|
|
||||||
<clip-path android:pathData="M50,50m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0" />
|
|
||||||
<path android:pathData="M31.304,22.589v0.7c0,0.1 0,0.1 -0.1,0.2l-1.9,0.8c0,0 0,0 -0.1,0s0,0 -0.1,0l-0.4,-0.2l19.7,27l2.4,-1.7L31.304,22.589z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.7969"
|
|
||||||
android:endY="36.839092"
|
|
||||||
android:startX="28.7808"
|
|
||||||
android:startY="36.839092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.006" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M65.409,20.005l-0.005,-1.116l-17,30.7l2.5,1.4l16.722,-30.026L65.409,20.005z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.3499"
|
|
||||||
android:endY="34.939095"
|
|
||||||
android:startX="67.5984"
|
|
||||||
android:startY="34.939095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0013" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M79.625,18.344l-0.021,-1.254l-31.3,32.1l2.1,2l31.2,-32L79.625,18.344z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.3039"
|
|
||||||
android:endY="34.138992"
|
|
||||||
android:startX="81.6039"
|
|
||||||
android:startY="34.138992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="7.851759E-5" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M90.104,35.389c-0.1,0 -0.1,-0.1 -0.1,-0.2v-2l-41.1,15.7l1,2.7l41.3,-15.8L90.104,35.389z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.8205"
|
|
||||||
android:endY="42.388992"
|
|
||||||
android:startX="91.2039"
|
|
||||||
android:startY="42.388992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0038" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M11.804,27.989v1.8c0,0.1 -0.1,0.2 -0.1,0.2l-1.2,0.5l38.5,20.9l1.4,-2.6L11.804,27.989z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.3298"
|
|
||||||
android:endY="39.689095"
|
|
||||||
android:startX="10.4298"
|
|
||||||
android:startY="39.689095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0025" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M17.265,50.089c0.1,0 0.1,0.2 0.1,0.2v2.5c0,0.1 -0.1,0.2 -0.1,0.2l32.439,-1.3l-0.1,-2.9L17.265,50.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.6603"
|
|
||||||
android:endY="50.888992"
|
|
||||||
android:startX="17.2212"
|
|
||||||
android:startY="50.888992"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="3.140703E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M7.668,60.675c0.036,0.014 0.234,0.056 0.236,0.214l0,0l0,0v1.9l42.1,-11.2l-0.9,-2.8l-42.8,11.4C6.304,60.189 7.632,60.661 7.668,60.675z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.0039"
|
|
||||||
android:endY="55.789093"
|
|
||||||
android:startX="6.304"
|
|
||||||
android:startY="55.789093"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0047" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M33.904,62.147v1.942l16.7,-11.95l-1.8,-2.3L32.611,61.406L33.904,62.147z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.5851"
|
|
||||||
android:endY="56.964092"
|
|
||||||
android:startX="32.571"
|
|
||||||
android:startY="56.964092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.003" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M35.804,35.789v1.2c0,0.1 -0.1,0.2 -0.1,0.2l-1.8,0.8l14.5,13.4l2,-2.1L35.804,35.789z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.3668"
|
|
||||||
android:endY="43.589092"
|
|
||||||
android:startX="33.8669"
|
|
||||||
android:startY="43.589092"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0048" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M55.804,33.089C55.804,33.089 55.704,33.089 55.804,33.089c-0.1,0 -0.1,0 -0.2,0l-1.9,-0.8l0,0l-5.4,17.5l2.8,0.9l5.5,-17.9L55.804,33.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.2319"
|
|
||||||
android:endY="41.489094"
|
|
||||||
android:startX="56.5588"
|
|
||||||
android:startY="41.489094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M64.804,45.489l-13.8,3.2l0.7,2.8l13.8,-3.2L64.804,45.489z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="50.9512"
|
|
||||||
android:endY="48.489094"
|
|
||||||
android:startX="65.4322"
|
|
||||||
android:startY="48.489094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0032" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M74.107,63.536L74.107,63.536L74.107,63.536c0,-0.098 0,-0.098 0.098,-0.195l0,0l0,0l0,0l1.172,-0.391L50.571,49.278l-1.367,2.441l24.903,13.77C74.107,65.489 74.107,63.536 74.107,63.536z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.2177"
|
|
||||||
android:endY="57.3833"
|
|
||||||
android:startX="75.4526"
|
|
||||||
android:startY="57.3833"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="5.496231E-4" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M81.904,79.089L81.904,79.089L81.904,79.089L81.904,79.089l2,-0.6c0,0 0,0 0.1,0l-33.7,-29.4l-1.9,2.2l33.3,29v-1C81.704,79.289 81.694,79.141 81.904,79.089z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.4039"
|
|
||||||
android:endY="64.689095"
|
|
||||||
android:startX="84.0039"
|
|
||||||
android:startY="64.689095"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0012" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M54.404,79.689l2,-0.6h0.1l0.7,0.2l-6.2,-29.7l-2.8,0.6L54.404,79.689L54.404,79.689z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="48.1377"
|
|
||||||
android:endY="64.63899"
|
|
||||||
android:startX="57.3221"
|
|
||||||
android:startY="64.63899"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.0025" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path android:pathData="M64.804,46.689l-15.6,2.1l0.4,2.9l30.2,-4.1l-0.4,-0.1c-0.1,0 -0.1,-0.1 -0.1,-0.2v-2.5l0,0l0,0l0,0L64.804,46.689">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="49.1732"
|
|
||||||
android:endY="48.239094"
|
|
||||||
android:startX="79.7731"
|
|
||||||
android:startY="48.239094"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#FFFFFFFF"
|
|
||||||
android:offset="0.003" />
|
|
||||||
<item
|
|
||||||
android:color="#00FFFFFF"
|
|
||||||
android:offset="1" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
</group>
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M51.639,0.029l-10.172,9.922l38.598,0.091"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M65.366,2.397L67.311,16.642"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M77.224,8.046L71.304,14.042"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.609,16.642L69.609,17.642"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M83.78,13.139L82.883,14.965"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M85.325,14.615c0.096,0.097 -3.374,29.468 -3.374,29.468"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M89.811,35.231L68.98,45.442"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M81.157,19.065L67.957,44.865"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M89.66,32.342l-48.193,-22.391l23.922,7.289"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M69.592,19.841L93.523,25.345"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M91.096,21.502L91.699,31.585"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M95.08,28.318L93.554,32.271"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M92.657,35.991L91.055,78.558"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M78.616,65.137L96.149,69.308"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.904,46.935L78.571,63.748"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.296,41.575c-0.585,0.17 -15.743,4.529 -15.743,4.529l16.414,5.629"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M99.766,54.87l-15.164,16.679l5.749,7.991"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M77.456,66.713L83.427,78.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M84.31,82.536L83.75,86.889"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M85.28,82.142L86.327,84.354"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M81.12,48.139l-4.73,14.382l-8.132,-14.106"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.18,45.887L68.951,46.291"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M79.305,47.596L17.837,88.283"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.335,79.846L33.835,64.846"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M65.137,48.23L16.967,87.533"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M75.145,66.556c-0.008,0.074 -16.683,13.266 -16.683,13.266"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M74.354,66.171L62.454,98.371"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M67.749,96.77L22.551,91.808"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.293,81.937L19.29,89.467"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.846,82.756l-18.767,15.187l48.523,-26.394"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M25.193,93.341L55.115,99.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.046,65.521L15.515,86.205"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.466,32.642L33.573,61.932"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M34.116,62.841L64.78,47.542"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M64.799,46.436L17.528,51.124"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M17.481,52.92L29.665,61.822"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M7.972,61.193L64.229,47.287"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M29.602,63.342L8.042,62.247"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M32.453,37.508L14.288,84.989"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M28.519,23.938L11.678,82.116"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M6.456,64.297L5.153,72.159"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M3.605,62.036L1.439,61.984"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M0.08,52.807L13.108,51.842"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M9.157,30.693L6.857,59.693"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M14.243,53.353L6.765,60.325"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M27.926,23.641L16.156,49.667"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M16.351,27.987L15.502,49.442"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.704,37.136L17.432,50.364"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M1.452,37.962L13.741,49.851"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M8.149,30.316L0.472,43.105"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M0.306,44.454L13.082,50.537"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M14.188,15.113L10.004,26.542"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M11.786,27.339L14.886,26.239"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M16.953,12.477L16.651,24.087"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M19.154,24.807L27.254,21.972"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M20.361,9.72L28.536,20.331"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M54.069,29.329L27.064,5.547"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M31.287,22.039L53.587,29.739"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M53.593,30.937L35.793,34.637"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillAlpha="0.6"
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M64.821,45.539L35.934,36.076"
|
|
||||||
android:strokeAlpha="0.6" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M81.802,15.419l-1.317,0.456l1.327,0.511l1.327,-0.511L81.802,15.419zM80.162,18.059l1.476,0.588v-1.92l-1.476,-0.588V18.059zM82.004,16.705v1.942l1.441,-0.584v-1.924L82.004,16.705z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M67.443,17.033l-1.317,0.456L67.453,18l1.327,-0.511L67.443,17.033zM65.804,19.673l1.476,0.588v-1.92l-1.476,-0.588V19.673zM67.646,18.319v1.942l1.441,-0.584v-1.924L67.646,18.319z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M55.737,29.211l-1.317,0.456l1.327,0.511l1.327,-0.511L55.737,29.211zM54.098,31.851l1.476,0.588v-1.92l-1.476,-0.588V31.851zM55.94,30.497v1.942l1.441,-0.584v-1.924L55.94,30.497z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M29.251,20.523l-1.317,0.456l1.327,0.511l1.327,-0.511L29.251,20.523zM27.611,23.164l1.476,0.588v-1.92l-1.476,-0.588V23.164zM29.453,21.81v1.942l1.441,-0.584v-1.924L29.453,21.81z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M15.227,49.775l-1.317,0.456l1.327,0.511l1.327,-0.511L15.227,49.775zM13.587,52.415l1.476,0.588v-1.92l-1.476,-0.588V52.415zM15.429,51.062v1.942l1.441,-0.584v-1.924L15.429,51.062z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M9.601,26.95l-1.317,0.456l1.327,0.511l1.327,-0.511L9.601,26.95zM7.962,29.59l1.476,0.588v-1.92L7.962,27.67V29.59zM9.804,28.236v1.942l1.441,-0.584V27.67L9.804,28.236z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M56.429,79.561l-1.317,0.456l1.327,0.511l1.327,-0.511L56.429,79.561zM54.79,82.201l1.476,0.588v-1.92l-1.476,-0.588V82.201zM56.632,80.847v1.942l1.441,-0.584v-1.924L56.632,80.847z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M33.602,34.175l-1.317,0.456l1.327,0.511l1.327,-0.511L33.602,34.175zM31.963,36.815l1.476,0.588v-1.92l-1.476,-0.588V36.815zM33.804,35.462v1.942l1.441,-0.584v-1.924L33.804,35.462z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M31.796,61.722l-1.317,0.456l1.327,0.511l1.327,-0.511L31.796,61.722zM30.156,64.362l1.476,0.588v-1.92l-1.476,-0.588V64.362zM31.998,63.009v1.942l1.441,-0.584v-1.924L31.998,63.009z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M83.96,79.141l-1.317,0.456l1.327,0.511l1.327,-0.511L83.96,79.141zM82.321,81.781l1.476,0.588v-1.92l-1.476,-0.588V81.781zM84.162,80.428v1.942l1.441,-0.584v-1.924L84.162,80.428z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M76.393,63.075l-1.317,0.456l1.327,0.511l1.327,-0.511L76.393,63.075zM74.754,65.715l1.476,0.588v-1.92l-1.476,-0.588V65.715zM76.596,64.362v1.942l1.441,-0.584v-1.924L76.596,64.362z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M81.202,44.475l-1.317,0.456l1.327,0.511l1.327,-0.511L81.202,44.475zM79.563,47.115l1.476,0.588v-1.92l-1.476,-0.588V47.115zM81.404,45.762v1.942l1.441,-0.584v-1.924L81.404,45.762z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M92.296,32.228l-1.317,0.456l1.327,0.511l1.327,-0.511L92.296,32.228zM90.656,34.868l1.476,0.588v-1.92l-1.476,-0.588V34.868zM92.498,33.515v1.942l1.441,-0.584v-1.924L92.498,33.515z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M5.806,60.518l-1.317,0.456l1.327,0.511l1.327,-0.511L5.806,60.518zM4.167,63.158l1.476,0.588v-1.92l-1.476,-0.588V63.158zM6.009,61.804v1.942l1.441,-0.584v-1.924L6.009,61.804z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M24.691,30.255c-0.615,0.788 -0.538,1.99 0.329,2.667c0.867,0.677 1.99,0.538 2.667,-0.329c6.397,-8.2 16.796,-12.263 27.125,-10.546c0.658,0.133 1.342,-0.095 1.773,-0.646c0.185,-0.237 0.29,-0.535 0.396,-0.833c0.088,-0.438 0.019,-1 -0.314,-1.386s-0.727,-0.694 -1.165,-0.782C43.638,16.373 31.949,20.952 24.691,30.255z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M71.1,47.4L41.3,29.2c-1,-0.5 -2.2,-0.5 -3.2,0.1s-1.6,1.6 -1.6,2.8v36.2c0,1.1 0.6,2.2 1.6,2.8c0.5,0.3 1.1,0.5 1.6,0.5s1.1,-0.1 1.6,-0.4L71.1,53c1,-0.6 1.6,-1.6 1.6,-2.8C72.7,49.1 72.1,48 71.1,47.4zM68.5,50.2L40.3,67.4V33L68.5,50.2z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M79.6,20.4C71.7,12.6 61.2,8.2 50,8.2s-21.7,4.3 -29.6,12.2C12.6,28.3 8.2,38.8 8.2,50s4.3,21.7 12.2,29.6S38.8,91.8 50,91.8s21.7,-4.3 29.6,-12.2S91.8,61.2 91.8,50S87.4,28.3 79.6,20.4zM88.1,50c0,10.2 -4,19.7 -11.2,26.9C69.7,84.1 60.2,88.1 50,88.1s-19.7,-4 -26.9,-11.2C15.9,69.7 11.9,60.2 11.9,50s4,-19.7 11.2,-26.9S39.9,11.9 50,11.9c10.2,0 19.7,4 26.9,11.2C84.1,30.3 88.1,39.8 88.1,50z" />
|
|
||||||
</vector>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 45 KiB |
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="colorPrimary">#343434</color>
|
|
||||||
<color name="colorPrimaryDark">#343434</color>
|
|
||||||
<color name="colorAccent">#00abff</color>
|
|
||||||
|
|
||||||
<color name="tag_color">#bbF2690D</color>
|
|
||||||
<color name="tag_color_text">#FAFAFA</color>
|
|
||||||
<color name="positive_thumbs">#2b90d9</color>
|
|
||||||
<color name="negative_thumbs">#F44336</color>
|
|
||||||
<color name="backgroundDark">#DD000000</color>
|
|
||||||
<color name="red_1">#F44336</color>
|
|
||||||
<color name="gray_light">#80808080</color>
|
|
||||||
</resources>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="ic_launcher_background">#FFFFFF</color>
|
|
||||||
</resources>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<external-path
|
|
||||||
name="my_images"
|
|
||||||
path="/Bittube/" />
|
|
||||||
|
|
||||||
</paths>
|
|
|
@ -15,14 +15,16 @@
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".activities.MainActivity"
|
||||||
tools:node="merge">
|
tools:node="merge"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="content" />
|
<data android:scheme="content" />
|
||||||
<data android:scheme="file" />
|
<data android:scheme="file" />
|
||||||
|
<data android:host="*" />
|
||||||
<data android:mimeType="*/*" />
|
<data android:mimeType="*/*" />
|
||||||
<data android:pathPattern=".*\\.tubelab" />
|
<data android:pathPattern=".*\\.tubelab" />
|
||||||
<data android:pathPattern=".*\\..*\\.tubelab" />
|
<data android:pathPattern=".*\\..*\\.tubelab" />
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".PeertubeActivity"
|
android:name=".activities.PeertubeActivity"
|
||||||
|
android:exported="true"
|
||||||
tools:node="mergeOnlyAttributes">
|
tools:node="mergeOnlyAttributes">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class FedilabTube extends BaseFedilabTube {
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
|
public class Matomo {
|
||||||
|
|
||||||
|
public static void sendScreen(Context _mcontext, String path, String title) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendEvent(Context _mcontext, String category, String action, String label, float value) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void sendValue(Context _mcontext, String path, int index, String dimensionValue) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void trackInstall(Context _mcontext) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package app.fedilab.fedilabtube.activities;
|
||||||
|
/* Copyright 2022 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package app.fedilab.fedilabtube.helper;
|
||||||
|
/* Copyright 2022 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
|
||||||
|
public class Theme {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public static void setTheme(AppCompatActivity activity, String instance, boolean noActionBar) {
|
||||||
|
activity.setTheme(noActionBar?R.style.AppThemeNoActionBar:R.style.AppTheme);
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,9 @@
|
||||||
<item name="android:colorBackground">@android:color/black</item>
|
<item name="android:colorBackground">@android:color/black</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" />
|
<style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" />
|
||||||
|
|
||||||
<style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.Dark" />
|
<style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.Dark" />
|
|
@ -7,6 +7,8 @@
|
||||||
<color name="tag_color_text">#FAFAFA</color>
|
<color name="tag_color_text">#FAFAFA</color>
|
||||||
<color name="positive_thumbs">#2b90d9</color>
|
<color name="positive_thumbs">#2b90d9</color>
|
||||||
<color name="negative_thumbs">#F44336</color>
|
<color name="negative_thumbs">#F44336</color>
|
||||||
|
<color name="favorite">#ca8f04</color>
|
||||||
|
<color name="bookmark">#795548</color>
|
||||||
<color name="backgroundDark">#DD000000</color>
|
<color name="backgroundDark">#DD000000</color>
|
||||||
<color name="red_1">#F44336</color>
|
<color name="red_1">#F44336</color>
|
||||||
<color name="gray_light">#80808080</color>
|
<color name="gray_light">#80808080</color>
|
||||||
|
|
|
@ -15,15 +15,17 @@
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".activities.MainActivity"
|
||||||
tools:node="merge">
|
tools:node="merge"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="content" />
|
<data android:scheme="content" />
|
||||||
<data android:scheme="file" />
|
<data android:scheme="file" />
|
||||||
<data android:mimeType="*/*" />
|
<data android:host="*" />
|
||||||
|
<data android:mimeType="application/json" />
|
||||||
<data android:pathPattern=".*\\.tubelab" />
|
<data android:pathPattern=".*\\.tubelab" />
|
||||||
<data android:pathPattern=".*\\..*\\.tubelab" />
|
<data android:pathPattern=".*\\..*\\.tubelab" />
|
||||||
<data android:pathPattern=".*\\..*\\..*\\.tubelab" />
|
<data android:pathPattern=".*\\..*\\..*\\.tubelab" />
|
||||||
|
@ -32,6 +34,8 @@
|
||||||
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.tubelab" />
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.tubelab" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||||
|
android:value="app.fedilab.fedilabtube.provider.CastOptionsProvider" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
|
@ -0,0 +1,42 @@
|
||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* Copyright 2021 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.activities.BaseActivity;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityMainBinding;
|
||||||
|
|
||||||
|
public class BaseMainActivity extends BaseActivity {
|
||||||
|
|
||||||
|
protected ActivityMainBinding binding;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Method for discovering cast devices
|
||||||
|
public void discoverCast() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,182 @@
|
||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* Copyright 2021 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||||
|
import com.google.android.gms.cast.MediaInfo;
|
||||||
|
import com.google.android.gms.cast.MediaMetadata;
|
||||||
|
import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||||
|
import com.google.android.gms.cast.framework.CastContext;
|
||||||
|
import com.google.android.gms.cast.framework.CastSession;
|
||||||
|
import com.google.android.gms.cast.framework.SessionManagerListener;
|
||||||
|
import com.google.android.gms.cast.framework.media.RemoteMediaClient;
|
||||||
|
import com.google.android.gms.common.images.WebImage;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.activities.BaseActivity;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityPeertubeBinding;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
|
||||||
|
public class BasePeertubeActivity extends BaseActivity {
|
||||||
|
|
||||||
|
protected ActivityPeertubeBinding binding;
|
||||||
|
protected VideoData.Video peertube;
|
||||||
|
protected SimpleExoPlayer player;
|
||||||
|
protected String videoURL;
|
||||||
|
protected String subtitlesStr;
|
||||||
|
|
||||||
|
private CastContext mCastContext;
|
||||||
|
private CastSession mCastSession;
|
||||||
|
private SessionManagerListener<CastSession> mSessionManagerListener;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
int search_cast = sharedpreferences.getInt(getString(R.string.set_cast_choice), BuildConfig.cast_enabled);
|
||||||
|
if (search_cast == 1) {
|
||||||
|
setupCastListener();
|
||||||
|
mCastContext = CastContext.getSharedInstance(BasePeertubeActivity.this);
|
||||||
|
mCastSession = mCastContext.getSessionManager().getCurrentCastSession();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void loadCast() {
|
||||||
|
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
|
||||||
|
|
||||||
|
movieMetadata.putString(MediaMetadata.KEY_TITLE, peertube.getTitle());
|
||||||
|
movieMetadata.putString(MediaMetadata.KEY_ARTIST, peertube.getAccount().getDisplayName());
|
||||||
|
if (subtitlesStr != null) {
|
||||||
|
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subtitlesStr);
|
||||||
|
}
|
||||||
|
movieMetadata.addImage(new WebImage(Uri.parse("https://" + peertube.getChannel().getHost() + peertube.getPreviewPath())));
|
||||||
|
MediaInfo mediaInfo = new MediaInfo.Builder(videoURL)
|
||||||
|
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
|
||||||
|
.setMetadata(movieMetadata)
|
||||||
|
.setStreamDuration(peertube.getDuration() * 1000L)
|
||||||
|
.build();
|
||||||
|
if (mCastSession != null) {
|
||||||
|
RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
|
||||||
|
remoteMediaClient.load(mediaInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setupCastListener() {
|
||||||
|
mSessionManagerListener = new SessionManagerListener<CastSession>() {
|
||||||
|
@Override
|
||||||
|
public void onSessionStarting(@NonNull CastSession castSession) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionStarted(@NonNull CastSession castSession, String s) {
|
||||||
|
onApplicationConnected(castSession, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionStartFailed(@NonNull CastSession castSession, int i) {
|
||||||
|
onApplicationDisconnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionEnding(@NonNull CastSession castSession) {
|
||||||
|
onApplicationDisconnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionEnded(@NonNull CastSession castSession, int i) {
|
||||||
|
onApplicationDisconnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionResuming(@NonNull CastSession castSession, String s) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionResumed(@NonNull CastSession castSession, boolean b) {
|
||||||
|
onApplicationConnected(castSession, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionResumeFailed(@NonNull CastSession castSession, int i) {
|
||||||
|
onApplicationDisconnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionSuspended(@NonNull CastSession castSession, int i) {
|
||||||
|
onApplicationDisconnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onApplicationConnected(CastSession castSession, boolean hide) {
|
||||||
|
mCastSession = castSession;
|
||||||
|
supportInvalidateOptionsMenu();
|
||||||
|
player.setPlayWhenReady(false);
|
||||||
|
if (hide) {
|
||||||
|
binding.doubleTapPlayerView.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
binding.minController.castMiniController.setVisibility(View.VISIBLE);
|
||||||
|
loadCast();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onApplicationDisconnected() {
|
||||||
|
binding.doubleTapPlayerView.setVisibility(View.VISIBLE);
|
||||||
|
binding.minController.castMiniController.setVisibility(View.GONE);
|
||||||
|
supportInvalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
mCastContext.getSessionManager().addSessionManagerListener(
|
||||||
|
mSessionManagerListener, CastSession.class);
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
mCastContext.getSessionManager().removeSessionManagerListener(
|
||||||
|
mSessionManagerListener, CastSession.class);
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
getMenuInflater().inflate(R.menu.video_menu, menu);
|
||||||
|
CastButtonFactory.setUpMediaRouteButton(getApplicationContext(),
|
||||||
|
menu,
|
||||||
|
R.id.media_route_button);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Google LLC. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package app.fedilab.fedilabtube.expandedcontrols;
|
||||||
|
|
||||||
|
import android.view.Menu;
|
||||||
|
|
||||||
|
import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||||
|
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
|
||||||
|
|
||||||
|
public class ExpandedControlsActivity extends ExpandedControllerActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
getMenuInflater().inflate(R.menu.video_menu, menu);
|
||||||
|
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_button);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package app.fedilab.fedilabtube.provider;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.android.gms.cast.framework.CastOptions;
|
||||||
|
import com.google.android.gms.cast.framework.OptionsProvider;
|
||||||
|
import com.google.android.gms.cast.framework.SessionProvider;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
|
||||||
|
public class CastOptionsProvider implements OptionsProvider {
|
||||||
|
@Override
|
||||||
|
public CastOptions getCastOptions(@NonNull Context context) {
|
||||||
|
return new CastOptions.Builder()
|
||||||
|
.setReceiverApplicationId(Helper.CAST_ID)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<SessionProvider> getAdditionalSessionProviders(@NonNull Context context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/castMiniController"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/black"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/media_route_button"
|
||||||
|
android:title="@string/cast"
|
||||||
|
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
</menu>
|
|
@ -0,0 +1,278 @@
|
||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* Copyright 2021 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.android.billingclient.api.AcknowledgePurchaseParams;
|
||||||
|
import com.android.billingclient.api.BillingClient;
|
||||||
|
import com.android.billingclient.api.BillingClientStateListener;
|
||||||
|
import com.android.billingclient.api.BillingResult;
|
||||||
|
import com.android.billingclient.api.ConsumeParams;
|
||||||
|
import com.android.billingclient.api.ConsumeResponseListener;
|
||||||
|
import com.android.billingclient.api.Purchase;
|
||||||
|
import com.android.billingclient.api.PurchasesUpdatedListener;
|
||||||
|
import com.android.billingclient.api.SkuDetailsParams;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityDonationBinding;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.fragment.MySubscriptionDonationsFragment;
|
||||||
|
import app.fedilab.fedilabtube.fragment.DonationsFragment;
|
||||||
|
|
||||||
|
|
||||||
|
public class DonationActivity extends AppCompatActivity implements PurchasesUpdatedListener {
|
||||||
|
|
||||||
|
|
||||||
|
DonationsFragment donationsFragment;
|
||||||
|
DonationsFragment subscriptionDonationsFragment;
|
||||||
|
MySubscriptionDonationsFragment mySubscriptionDonationsFragment;
|
||||||
|
private ActivityDonationBinding binding;
|
||||||
|
private BillingClient billingClient;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityDonationBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
billingClient = BillingClient.newBuilder(this)
|
||||||
|
.setListener(this)
|
||||||
|
.enablePendingPurchases()
|
||||||
|
.build();
|
||||||
|
billingClient.startConnection(new BillingClientStateListener() {
|
||||||
|
@Override
|
||||||
|
public void onBillingSetupFinished(@NotNull BillingResult billingResult) {
|
||||||
|
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
||||||
|
// The BillingClient is ready. You can query purchases here.
|
||||||
|
donationsFragment.initialized(billingClient);
|
||||||
|
subscriptionDonationsFragment.initialized(billingClient);
|
||||||
|
|
||||||
|
List<Purchase> purchases = queryPurchases();
|
||||||
|
if (purchases != null) {
|
||||||
|
for (Purchase purchase : purchases) {
|
||||||
|
if (!purchase.isAutoRenewing()) {
|
||||||
|
ConsumeParams consumeParams =
|
||||||
|
ConsumeParams.newBuilder()
|
||||||
|
.setPurchaseToken(purchase.getPurchaseToken())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConsumeResponseListener listener = (billingResult1, purchaseToken) -> {
|
||||||
|
//noinspection StatementWithEmptyBody
|
||||||
|
if (billingResult1.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
||||||
|
// Handle the success of the consume operation.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
billingClient.consumeAsync(consumeParams, listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBillingServiceDisconnected() {
|
||||||
|
// Try to restart the connection on the next request to
|
||||||
|
// Google Play by calling the startConnection() method.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
donationsFragment = new DonationsFragment();
|
||||||
|
Bundle bundle1 = new Bundle();
|
||||||
|
bundle1.putSerializable("isSubscriptions", false);
|
||||||
|
donationsFragment.setArguments(bundle1);
|
||||||
|
|
||||||
|
|
||||||
|
subscriptionDonationsFragment = new DonationsFragment();
|
||||||
|
Bundle bundle2 = new Bundle();
|
||||||
|
bundle2.putSerializable("isSubscriptions", true);
|
||||||
|
subscriptionDonationsFragment.setArguments(bundle2);
|
||||||
|
|
||||||
|
mySubscriptionDonationsFragment = new MySubscriptionDonationsFragment();
|
||||||
|
|
||||||
|
binding.tablayout.addTab(binding.tablayout.newTab().setText(getString(R.string.one_time)));
|
||||||
|
binding.tablayout.addTab(binding.tablayout.newTab().setText(getString(R.string.subscriptions)));
|
||||||
|
binding.tablayout.addTab(binding.tablayout.newTab().setText(getString(R.string.my_subscriptions)));
|
||||||
|
binding.viewpager.setOffscreenPageLimit(3);
|
||||||
|
|
||||||
|
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||||
|
binding.viewpager.setAdapter(mPagerAdapter);
|
||||||
|
binding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
TabLayout.Tab tab = binding.tablayout.getTabAt(position);
|
||||||
|
if (tab != null)
|
||||||
|
tab.select();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
|
binding.viewpager.setCurrentItem(tab.getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Purchase> queryPurchases() {
|
||||||
|
Purchase.PurchasesResult purchasesResult = billingClient.queryPurchases(BillingClient.SkuType.SUBS);
|
||||||
|
List<Purchase> purchases = purchasesResult.getPurchasesList();
|
||||||
|
List<String> isSubscriptions = new ArrayList<>();
|
||||||
|
HashMap<String, Purchase> map = new HashMap<>();
|
||||||
|
if (purchases != null) {
|
||||||
|
for (Purchase purchase : purchases) {
|
||||||
|
try {
|
||||||
|
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||||
|
JSONObject purchaseJson = new JSONObject(purchase.getOriginalJson());
|
||||||
|
String productId = purchaseJson.getString("productId");
|
||||||
|
isSubscriptions.add(productId);
|
||||||
|
map.put(productId, purchase);
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SkuDetailsParams.Builder paramsSub = SkuDetailsParams.newBuilder();
|
||||||
|
paramsSub.setSkusList(isSubscriptions).setType(BillingClient.SkuType.SUBS);
|
||||||
|
billingClient.querySkuDetailsAsync(paramsSub.build(),
|
||||||
|
(billingResult2, skuDetailsList) -> mySubscriptionDonationsFragment.initialized(skuDetailsList, map, billingClient));
|
||||||
|
} else {
|
||||||
|
mySubscriptionDonationsFragment.initialized(new ArrayList<>(), map, billingClient);
|
||||||
|
}
|
||||||
|
return purchases;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> purchases) {
|
||||||
|
String message;
|
||||||
|
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK
|
||||||
|
&& purchases != null) {
|
||||||
|
for (Purchase purchase : purchases) {
|
||||||
|
if (!purchase.isAutoRenewing()) {
|
||||||
|
ConsumeParams consumeParams =
|
||||||
|
ConsumeParams.newBuilder()
|
||||||
|
.setPurchaseToken(purchase.getPurchaseToken())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConsumeResponseListener listener = (billingResult1, purchaseToken) -> {
|
||||||
|
};
|
||||||
|
billingClient.consumeAsync(consumeParams, listener);
|
||||||
|
} else {
|
||||||
|
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||||
|
if (!purchase.isAcknowledged()) {
|
||||||
|
AcknowledgePurchaseParams acknowledgePurchaseParams =
|
||||||
|
AcknowledgePurchaseParams.newBuilder()
|
||||||
|
.setPurchaseToken(purchase.getPurchaseToken())
|
||||||
|
.build();
|
||||||
|
billingClient.acknowledgePurchase(acknowledgePurchaseParams, b -> {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
queryPurchases();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message = getString(R.string.donation_succeeded_null);
|
||||||
|
} else if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED) {
|
||||||
|
message = getString(R.string.donation_cancelled);
|
||||||
|
} else {
|
||||||
|
message = getString(R.string.toast_error);
|
||||||
|
}
|
||||||
|
View parentLayout = findViewById(android.R.id.content);
|
||||||
|
Snackbar snackbar = Snackbar.make(parentLayout, message, Snackbar.LENGTH_INDEFINITE);
|
||||||
|
snackbar.setAction(R.string.close, view -> snackbar.dismiss());
|
||||||
|
snackbar.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pager adapter for the 2 fragments
|
||||||
|
*/
|
||||||
|
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
|
ScreenSlidePagerAdapter(FragmentManager fm) {
|
||||||
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
if (position == 0) {
|
||||||
|
return donationsFragment;
|
||||||
|
} else if (position == 1) {
|
||||||
|
return subscriptionDonationsFragment;
|
||||||
|
} else {
|
||||||
|
return mySubscriptionDonationsFragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package app.fedilab.fedilabtube.drawable;
|
||||||
|
/* Copyright 2021 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.android.billingclient.api.BillingClient;
|
||||||
|
import com.android.billingclient.api.BillingFlowParams;
|
||||||
|
import com.android.billingclient.api.SkuDetails;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.DonationActivity;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.databinding.DrawerDonationBinding;
|
||||||
|
|
||||||
|
|
||||||
|
public class DonationButtonAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private final List<SkuDetails> skuDetails;
|
||||||
|
private final BillingClient billingClient;
|
||||||
|
private Context context;
|
||||||
|
private final boolean isSubscription;
|
||||||
|
|
||||||
|
public DonationButtonAdapter(List<SkuDetails> skuDetails, BillingClient billingClient, boolean subscription) {
|
||||||
|
this.isSubscription = subscription;
|
||||||
|
this.skuDetails = skuDetails;
|
||||||
|
this.billingClient = billingClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
context = parent.getContext();
|
||||||
|
DrawerDonationBinding itemBinding = DrawerDonationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new ViewHolder(itemBinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
|
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||||
|
SkuDetails skuDetail = skuDetails.get(position);
|
||||||
|
String currency = skuDetail.getPriceCurrencyCode();
|
||||||
|
String price = skuDetail.getPrice();
|
||||||
|
if (isSubscription) {
|
||||||
|
holder.binding.buttonDonation.setText(String.format(Locale.getDefault(), "%s %s / %s", price, currency, context.getString(R.string.month)));
|
||||||
|
} else {
|
||||||
|
holder.binding.buttonDonation.setText(String.format(Locale.getDefault(), "%s %s", price, currency));
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.binding.buttonDonation.setOnClickListener(v -> {
|
||||||
|
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
|
||||||
|
.setSkuDetails(skuDetail)
|
||||||
|
.build();
|
||||||
|
billingClient.launchBillingFlow((DonationActivity) context, billingFlowParams);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return skuDetails.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
DrawerDonationBinding binding;
|
||||||
|
|
||||||
|
ViewHolder(DrawerDonationBinding itemView) {
|
||||||
|
super(itemView.getRoot());
|
||||||
|
binding = itemView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
package app.fedilab.fedilabtube.drawable;
|
||||||
|
/* Copyright 2021 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.android.billingclient.api.BillingClient;
|
||||||
|
import com.android.billingclient.api.ConsumeParams;
|
||||||
|
import com.android.billingclient.api.ConsumeResponseListener;
|
||||||
|
import com.android.billingclient.api.Purchase;
|
||||||
|
import com.android.billingclient.api.SkuDetails;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.databinding.DrawerMyDonationBinding;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
public class DonationHistoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private final List<SkuDetails> skuDetailsList;
|
||||||
|
private final BillingClient billingClient;
|
||||||
|
private Context context;
|
||||||
|
private final HashMap<String, Purchase> map;
|
||||||
|
|
||||||
|
public DonationHistoryAdapter(List<SkuDetails> SkuDetailsList, HashMap<String, Purchase> map, BillingClient billingClient) {
|
||||||
|
this.skuDetailsList = SkuDetailsList;
|
||||||
|
this.billingClient = billingClient;
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
context = parent.getContext();
|
||||||
|
DrawerMyDonationBinding itemBinding = DrawerMyDonationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new ViewHolder(itemBinding);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
|
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||||
|
SkuDetails skuDetails = skuDetailsList.get(position);
|
||||||
|
holder.binding.productTitle.setText(skuDetails.getTitle());
|
||||||
|
holder.binding.productName.setText(skuDetails.getDescription());
|
||||||
|
holder.binding.productInfo.setText(skuDetails.getOriginalPrice());
|
||||||
|
|
||||||
|
holder.binding.cancelDonation.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
|
||||||
|
dialogBuilder.setMessage(R.string.cancel_subscription_confirm);
|
||||||
|
|
||||||
|
dialogBuilder.setPositiveButton(R.string.cancel_subscription, (dialog, id) -> {
|
||||||
|
JSONObject skudetailsJson;
|
||||||
|
try {
|
||||||
|
skudetailsJson = new JSONObject(skuDetails.getOriginalJson());
|
||||||
|
String productId = skudetailsJson.getString("productId");
|
||||||
|
if (map.containsKey(productId)) {
|
||||||
|
Purchase purchase = map.get(productId);
|
||||||
|
if (purchase != null) {
|
||||||
|
ConsumeParams consumeParams =
|
||||||
|
ConsumeParams.newBuilder()
|
||||||
|
.setPurchaseToken(purchase.getPurchaseToken())
|
||||||
|
.build();
|
||||||
|
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||||
|
ConsumeResponseListener listener = (billingResult1, purchaseToken) -> {
|
||||||
|
if (billingResult1.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
||||||
|
Toasty.success(context, context.getString(R.string.subscription_cancelled), Toasty.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
skuDetailsList.remove(skuDetails);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
};
|
||||||
|
billingClient.consumeAsync(consumeParams, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||||
|
AlertDialog alertDialogLogoutAccount = dialogBuilder.create();
|
||||||
|
alertDialogLogoutAccount.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return skuDetailsList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
DrawerMyDonationBinding binding;
|
||||||
|
|
||||||
|
ViewHolder(DrawerMyDonationBinding itemView) {
|
||||||
|
super(itemView.getRoot());
|
||||||
|
binding = itemView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
package app.fedilab.fedilabtube.fragment;
|
||||||
|
/* Copyright 2021 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.android.billingclient.api.BillingClient;
|
||||||
|
import com.android.billingclient.api.SkuDetailsParams;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.databinding.FragmentDonationsBinding;
|
||||||
|
import app.fedilab.fedilabtube.drawable.DonationButtonAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
public class DonationsFragment extends Fragment {
|
||||||
|
|
||||||
|
public static final String[] donations = {"1", "2", "5", "10"};
|
||||||
|
private FragmentDonationsBinding binding;
|
||||||
|
private View rootView;
|
||||||
|
private Context context;
|
||||||
|
private boolean isSubscriptions;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
binding = FragmentDonationsBinding.inflate(LayoutInflater.from(context));
|
||||||
|
rootView = binding.getRoot();
|
||||||
|
context = getContext();
|
||||||
|
Bundle bundle = this.getArguments();
|
||||||
|
if (bundle != null) {
|
||||||
|
isSubscriptions = bundle.getBoolean("isSubscriptions", false);
|
||||||
|
}
|
||||||
|
int donationText;
|
||||||
|
if (isSubscriptions) {
|
||||||
|
donationText = R.string.recurrent_donation_text;
|
||||||
|
} else {
|
||||||
|
donationText = R.string.one_time_donation_text;
|
||||||
|
}
|
||||||
|
binding.donationText.setText(donationText);
|
||||||
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
|
binding.lvProducts.setVisibility(View.GONE);
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initialized(BillingClient bc) {
|
||||||
|
|
||||||
|
|
||||||
|
List<String> donationsList = new ArrayList<>();
|
||||||
|
for (String val : donations) {
|
||||||
|
donationsList.add("tubelab_donation_" + val + (isSubscriptions ? "_s" : ""));
|
||||||
|
}
|
||||||
|
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
|
||||||
|
if (isSubscriptions) {
|
||||||
|
params.setSkusList(donationsList).setType(BillingClient.SkuType.SUBS);
|
||||||
|
} else {
|
||||||
|
params.setSkusList(donationsList).setType(BillingClient.SkuType.INAPP);
|
||||||
|
}
|
||||||
|
bc.querySkuDetailsAsync(params.build(),
|
||||||
|
(billingResult, skuDetailsList) -> {
|
||||||
|
binding.loader.setVisibility(View.GONE);
|
||||||
|
binding.lvProducts.setVisibility(View.VISIBLE);
|
||||||
|
if (skuDetailsList != null) {
|
||||||
|
Collections.sort(skuDetailsList, (obj1, obj2) -> obj1.getPrice().compareTo(obj2.getPrice()));
|
||||||
|
}
|
||||||
|
DonationButtonAdapter donationButtonAdapter = new DonationButtonAdapter(skuDetailsList, bc, isSubscriptions);
|
||||||
|
binding.lvProducts.setAdapter(donationButtonAdapter);
|
||||||
|
binding.lvProducts.setLayoutManager(new LinearLayoutManager(context));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
rootView = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle saveInstance) {
|
||||||
|
super.onCreate(saveInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package app.fedilab.fedilabtube.fragment;
|
||||||
|
/* Copyright 2021 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.android.billingclient.api.BillingClient;
|
||||||
|
import com.android.billingclient.api.Purchase;
|
||||||
|
import com.android.billingclient.api.SkuDetails;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.databinding.FragmentMyDonationsBinding;
|
||||||
|
import app.fedilab.fedilabtube.drawable.DonationHistoryAdapter;
|
||||||
|
|
||||||
|
public class MySubscriptionDonationsFragment extends Fragment {
|
||||||
|
|
||||||
|
private FragmentMyDonationsBinding binding;
|
||||||
|
private View rootView;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
binding = FragmentMyDonationsBinding.inflate(LayoutInflater.from(context));
|
||||||
|
rootView = binding.getRoot();
|
||||||
|
context = getContext();
|
||||||
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
|
binding.lvPurchases.setVisibility(View.GONE);
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initialized(List<SkuDetails> skuDetailsList, HashMap<String, Purchase> map, BillingClient bc) {
|
||||||
|
binding.loader.setVisibility(View.GONE);
|
||||||
|
binding.lvPurchases.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
DonationHistoryAdapter donationHistoryAdapter = new DonationHistoryAdapter(skuDetailsList, map, bc);
|
||||||
|
binding.lvPurchases.setAdapter(donationHistoryAdapter);
|
||||||
|
binding.lvPurchases.setLayoutManager(new LinearLayoutManager(context));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
rootView = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle saveInstance) {
|
||||||
|
super.onCreate(saveInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Copyright 2021 Thomas Schneider
|
||||||
|
|
||||||
|
This file is a part of TubeLab
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
see <http://www.gnu.org/licenses>.
|
||||||
|
-->
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:context=".activities.ShowChannelActivity">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
app:contentScrim="?attr/colorPrimary"
|
||||||
|
app:expandedTitleMarginEnd="64dp"
|
||||||
|
app:expandedTitleMarginStart="48dp"
|
||||||
|
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||||
|
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tablayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:tabGravity="fill"
|
||||||
|
app:tabMode="fixed"
|
||||||
|
app:tabSelectedTextColor="?colorAccent"
|
||||||
|
app:tabTextColor="@android:color/white" />
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/viewpager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_donation"
|
||||||
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:paddingStart="40dp"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingEnd="40dp"
|
||||||
|
android:paddingBottom="15dp"
|
||||||
|
android:textSize="25sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
android:layout_margin="10dp">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/product_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/cancel_donation"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/product_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/cancel_donation"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/product_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/product_info"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/cancel_donation"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/product_name" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/cancel_donation"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/cancel"
|
||||||
|
android:src="@drawable/ic_baseline_delete_24"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Copyright 2021 Thomas Schneider
|
||||||
|
|
||||||
|
This file is a part of TubeLab
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
see <http://www.gnu.org/licenses>.
|
||||||
|
-->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingLeft="@dimen/fab_margin"
|
||||||
|
android:paddingRight="@dimen/fab_margin">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:id="@+id/donation_text" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/lv_products"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="@null"
|
||||||
|
android:scrollbars="none" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Main Loader -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/loader"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
style="@style/progress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
app:SpinKit_Color="?colorAccent" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Copyright 2021 Thomas Schneider
|
||||||
|
|
||||||
|
This file is a part of TubeLab
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
see <http://www.gnu.org/licenses>.
|
||||||
|
-->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingLeft="@dimen/fab_margin"
|
||||||
|
android:paddingRight="@dimen/fab_margin">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/donations_description" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/lv_purchases"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="@null"
|
||||||
|
android:scrollbars="none" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Main Loader -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/loader"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
style="@style/progress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
app:SpinKit_Color="?colorAccent" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="app.fedilab.fedilabtube">
|
package="app.fedilab.fedilabtube">
|
||||||
|
|
||||||
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
<application
|
<application
|
||||||
android:name=".FedilabTube"
|
android:name=".FedilabTube"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
|
@ -15,8 +15,9 @@
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".PeertubeActivity"
|
android:name=".activities.PeertubeActivity"
|
||||||
tools:node="mergeOnlyAttributes">
|
android:exported="true"
|
||||||
|
tools:node="merge">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
@ -28,7 +29,25 @@
|
||||||
android:pathPrefix="/videos/watch/"
|
android:pathPrefix="/videos/watch/"
|
||||||
android:scheme="https" />
|
android:scheme="https" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value=".activities.PeertubeActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".expandedcontrols.ExpandedControlsActivity"
|
||||||
|
android:theme="@style/AppThemeNoActionBar"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||||
|
android:value="app.fedilab.fedilabtube.provider.CastOptionsProvider" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".DonationActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/support_the_app"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
@ -26,10 +28,10 @@
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".activities.MainActivity"
|
||||||
android:theme="@style/AppThemeNoActionBar"
|
android:theme="@style/AppThemeNoActionBar"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name">
|
android:exported="true">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -39,117 +41,117 @@
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".PeertubeActivity"
|
android:name=".activities.PeertubeActivity"
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
android:supportsPictureInPicture="true"
|
android:supportsPictureInPicture="true"
|
||||||
tools:targetApi="n" />
|
tools:targetApi="n" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".PeertubeEditUploadActivity"
|
android:name=".activities.PeertubeEditUploadActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ShowChannelActivity"
|
android:name=".activities.ShowChannelActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ShowAccountActivity"
|
android:name=".activities.ShowAccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AccountActivity"
|
android:name=".activities.AccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MyAccountActivity"
|
android:name=".activities.MyAccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SearchActivity"
|
android:name=".activities.SearchActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AllPlaylistsActivity"
|
android:name=".activities.AllPlaylistsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AllLocalPlaylistsActivity"
|
android:name=".activities.AllLocalPlaylistsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".InstancePickerActivity"
|
android:name=".activities.InstancePickerActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".PlaylistsActivity"
|
android:name=".activities.PlaylistsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".LocalPlaylistsActivity"
|
android:name=".activities.LocalPlaylistsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".VideosTimelineActivity"
|
android:name=".activities.VideosTimelineActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SepiaSearchActivity"
|
android:name=".activities.SepiaSearchActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/sepia_search"
|
android:label="@string/sepia_search"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ManageInstancesActivity"
|
android:name=".activities.ManageInstancesActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/instances_picker"
|
android:label="@string/instances_picker"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".WebviewActivity"
|
android:name=".activities.WebviewActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
android:label="@string/app_name" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".WebviewConnectActivity"
|
android:name=".activities.WebviewConnectActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
android:label="@string/app_name" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".LoginActivity"
|
android:name=".activities.MastodonWebviewConnectActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
/>
|
||||||
|
<activity
|
||||||
|
android:name=".activities.LoginActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="backtotubelab"
|
||||||
|
android:scheme="tubelab" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".SettingsActivity"
|
android:name=".activities.SettingsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/settings"
|
android:label="@string/settings"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".PeertubeRegisterActivity"
|
android:name=".activities.PeertubeRegisterActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/register_account"
|
android:label="@string/register_account"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".PeertubeUploadActivity"
|
android:name=".activities.PeertubeUploadActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/upload_video"
|
android:label="@string/upload_video"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AboutActivity"
|
android:name=".activities.AboutActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/about_the_app"
|
android:label="@string/about_the_app"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
@ -158,12 +160,6 @@
|
||||||
android:name=".services.RetrieveInfoService"
|
android:name=".services.RetrieveInfoService"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
<provider
|
|
||||||
android:name="androidx.work.impl.WorkManagerInitializer"
|
|
||||||
android:authorities="${applicationId}.workmanager-init"
|
|
||||||
tools:node="remove"
|
|
||||||
android:exported="false" />
|
|
||||||
|
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
@ -174,6 +170,9 @@
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/file_paths" />
|
android:resource="@xml/file_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -0,0 +1 @@
|
||||||
|
{"1":"Music","2":"Films","3":"Vehicles","4":"Art","5":"Sports","6":"Travels","7":"Gaming","8":"People","9":"Comedy","10":"Entertainment","11":"News & Politics","12":"How To","13":"Education","14":"Activism","15":"Science & Technology","16":"Animals","17":"Kids","18":"Food"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"aa":"Afar","ab":"Abkhazian","af":"Afrikaans","ak":"Akan","am":"Amharic","ar":"Arabic","an":"Aragonese","ase":"American Sign Language","as":"Assamese","av":"Avaric","avk":"Kotava","ay":"Aymara","az":"Azerbaijani","ba":"Bashkir","bm":"Bambara","be":"Belarusian","bn":"Bengali","bfi":"British Sign Language","bi":"Bislama","bo":"Tibetan","bs":"Bosnian","br":"Breton","bg":"Bulgarian","bzs":"Brazilian Sign Language","ca":"Catalan","cs":"Czech","ch":"Chamorro","ce":"Chechen","cv":"Chuvash","kw":"Cornish","co":"Corsican","cr":"Cree","cse":"Czech Sign Language","csl":"Chinese Sign Language","cy":"Welsh","da":"Danish","de":"German","dv":"Dhivehi","dsl":"Danish Sign Language","dz":"Dzongkha","el":"Greek","en":"English","eo":"Esperanto","et":"Estonian","eu":"Basque","ee":"Ewe","fo":"Faroese","fa":"Persian","fj":"Fijian","fi":"Finnish","fr":"French","fy":"Western Frisian","fsl":"French Sign Language","ff":"Fulah","gd":"Scottish Gaelic","ga":"Irish","gl":"Galician","gv":"Manx","gn":"Guarani","gsg":"German Sign Language","gu":"Gujarati","ht":"Haitian","ha":"Hausa","sh":"Serbo-Croatian","he":"Hebrew","hz":"Herero","hi":"Hindi","ho":"Hiri Motu","hr":"Croatian","hu":"Hungarian","hy":"Armenian","ig":"Igbo","ii":"Sichuan Yi","iu":"Inuktitut","id":"Indonesian","ik":"Inupiaq","is":"Icelandic","it":"Italian","jv":"Javanese","jbo":"Lojban","ja":"Japanese","jsl":"Japanese Sign Language","kab":"Kabyle","kl":"Kalaallisut","kn":"Kannada","ks":"Kashmiri","ka":"Georgian","kr":"Kanuri","kk":"Kazakh","km":"Khmer","ki":"Kikuyu","rw":"Kinyarwanda","ky":"Kirghiz","kv":"Komi","kg":"Kongo","ko":"Korean","kj":"Kuanyama","ku":"Kurdish","lo":"Lao","la":"Latin","lv":"Latvian","li":"Limburgan","ln":"Lingala","lt":"Lithuanian","lb":"Luxembourgish","lu":"Luba-Katanga","lg":"Ganda","mh":"Marshallese","ml":"Malayalam","mr":"Marathi","mk":"Macedonian","mg":"Malagasy","mt":"Maltese","mn":"Mongolian","mi":"Maori","ms":"Malay (macrolanguage)","my":"Burmese","na":"Nauru","nv":"Navajo","nr":"South Ndebele","nd":"North Ndebele","ng":"Ndonga","ne":"Nepali (macrolanguage)","nl":"Dutch","nn":"Norwegian Nynorsk","nb":"Norwegian Bokmål","no":"Norwegian","ny":"Nyanja","oc":"Occitan","oj":"Ojibwa","or":"Oriya (macrolanguage)","om":"Oromo","os":"Ossetian","pa":"Panjabi","pks":"Pakistan Sign Language","pl":"Polish","pt":"Portuguese","ps":"Pushto","qu":"Quechua","rm":"Romansh","ro":"Romanian","rsl":"Russian Sign Language","rn":"Rundi","ru":"Russian","sg":"Sango","sdl":"Saudi Arabian Sign Language","sfs":"South African Sign Language","si":"Sinhala","sk":"Slovak","sl":"Slovenian","se":"Northern Sami","sm":"Samoan","sn":"Shona","sd":"Sindhi","so":"Somali","st":"Southern Sotho","es":"Spanish","sq":"Albanian","sc":"Sardinian","sr":"Serbian","ss":"Swati","su":"Sundanese","sw":"Swahili (macrolanguage)","sv":"Swedish","swl":"Swedish Sign Language","ty":"Tahitian","ta":"Tamil","tt":"Tatar","te":"Telugu","tg":"Tajik","tl":"Tagalog","th":"Thai","ti":"Tigrinya","tlh":"Klingon","to":"Tonga (Tonga Islands)","tn":"Tswana","ts":"Tsonga","tk":"Turkmen","tr":"Turkish","tw":"Twi","ug":"Uighur","uk":"Ukrainian","ur":"Urdu","uz":"Uzbek","ve":"Venda","vi":"Vietnamese","wa":"Walloon","wo":"Wolof","xh":"Xhosa","yi":"Yiddish","yo":"Yoruba","za":"Zhuang","zh":"Chinese","zu":"Zulu","zxx":"No linguistic content","zh-Hans":"Simplified Chinese","zh-Hant":"Traditional Chinese"}
|
|
@ -1,258 +0,0 @@
|
||||||
package app.fedilab.fedilabtube;
|
|
||||||
/* Copyright 2020 Thomas Schneider
|
|
||||||
*
|
|
||||||
* This file is a part of TubeLab
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
||||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
||||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
||||||
* Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.text.style.UnderlineSpan;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
|
||||||
import androidx.viewpager.widget.PagerAdapter;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment;
|
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
|
||||||
import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
|
||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
|
||||||
|
|
||||||
|
|
||||||
public class AccountActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
private ViewPager mPager;
|
|
||||||
private TabLayout tabLayout;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_account);
|
|
||||||
if (getSupportActionBar() != null)
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
|
|
||||||
SpannableString content_create = new SpannableString(getString(R.string.join_peertube));
|
|
||||||
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
|
||||||
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AccountActivity.this, Helper.getColorAccent())), 0, content_create.length(),
|
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
|
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
|
||||||
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
|
||||||
|
|
||||||
TextView instanceView = findViewById(R.id.instance);
|
|
||||||
Account account = new AccountDAO(AccountActivity.this, db).getAccountByToken(token);
|
|
||||||
|
|
||||||
if (account == null) {
|
|
||||||
Helper.logoutCurrentUser(AccountActivity.this, null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView profile_picture = findViewById(R.id.profile_picture);
|
|
||||||
TextView username = findViewById(R.id.username);
|
|
||||||
TextView displayname = findViewById(R.id.displayname);
|
|
||||||
|
|
||||||
setTitle(String.format("@%s", account.getUsername()));
|
|
||||||
|
|
||||||
Helper.loadGiF(AccountActivity.this, account.getAvatar().getPath(), profile_picture);
|
|
||||||
username.setText(String.format("@%s", account.getUsername()));
|
|
||||||
displayname.setText(account.getDisplayName());
|
|
||||||
|
|
||||||
instanceView.setText(account.getHost());
|
|
||||||
FloatingActionButton edit_profile = findViewById(R.id.edit_profile);
|
|
||||||
edit_profile.setOnClickListener(v -> startActivity(new Intent(AccountActivity.this, MyAccountActivity.class)));
|
|
||||||
|
|
||||||
Button logout_button = findViewById(R.id.logout_button);
|
|
||||||
logout_button.setOnClickListener(v -> {
|
|
||||||
AlertDialog.Builder dialogBuilderLogoutAccount = new AlertDialog.Builder(AccountActivity.this);
|
|
||||||
dialogBuilderLogoutAccount.setMessage(getString(R.string.logout_account_confirmation, account.getUsername(), account.getHost()));
|
|
||||||
dialogBuilderLogoutAccount.setPositiveButton(R.string.action_logout, (dialog, id) -> {
|
|
||||||
Helper.logoutCurrentUser(AccountActivity.this, account);
|
|
||||||
dialog.dismiss();
|
|
||||||
});
|
|
||||||
dialogBuilderLogoutAccount.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
|
||||||
AlertDialog alertDialogLogoutAccount = dialogBuilderLogoutAccount.create();
|
|
||||||
alertDialogLogoutAccount.show();
|
|
||||||
});
|
|
||||||
|
|
||||||
Button settings = findViewById(R.id.settings);
|
|
||||||
settings.setOnClickListener(v -> {
|
|
||||||
Intent intent = new Intent(AccountActivity.this, SettingsActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
});
|
|
||||||
|
|
||||||
tabLayout = findViewById(R.id.account_tabLayout);
|
|
||||||
mPager = findViewById(R.id.account_viewpager);
|
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.title_notifications)));
|
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.title_muted)));
|
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.title_channel)));
|
|
||||||
|
|
||||||
|
|
||||||
mPager.setOffscreenPageLimit(3);
|
|
||||||
|
|
||||||
|
|
||||||
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageSelected(int position) {
|
|
||||||
TabLayout.Tab tab = tabLayout.getTabAt(position);
|
|
||||||
if (tab != null)
|
|
||||||
tab.select();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int state) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
|
||||||
@Override
|
|
||||||
public void onTabSelected(TabLayout.Tab tab) {
|
|
||||||
mPager.setCurrentItem(tab.getPosition());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTabUnselected(TabLayout.Tab tab) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTabReselected(TabLayout.Tab tab) {
|
|
||||||
Fragment fragment = null;
|
|
||||||
if (mPager.getAdapter() != null)
|
|
||||||
fragment = (Fragment) mPager.getAdapter().instantiateItem(mPager, tab.getPosition());
|
|
||||||
switch (tab.getPosition()) {
|
|
||||||
case 0:
|
|
||||||
if (fragment != null) {
|
|
||||||
DisplayNotificationsFragment displayNotificationsFragment = ((DisplayNotificationsFragment) fragment);
|
|
||||||
displayNotificationsFragment.scrollToTop();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (fragment != null) {
|
|
||||||
DisplayAccountsFragment displayAccountsFragment = ((DisplayAccountsFragment) fragment);
|
|
||||||
displayAccountsFragment.scrollToTop();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (fragment != null) {
|
|
||||||
DisplayChannelsFragment displayChannelsFragment = ((DisplayChannelsFragment) fragment);
|
|
||||||
displayChannelsFragment.scrollToTop();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
PagerAdapter mPagerAdapter = new AccountsPagerAdapter(getSupportFragmentManager());
|
|
||||||
mPager.setAdapter(mPagerAdapter);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.main_profile, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == android.R.id.home) {
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_add_account) {
|
|
||||||
SwitchAccountHelper.switchDialog(AccountActivity.this, true);
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pager adapter for three tabs (notifications, muted, blocked)
|
|
||||||
*/
|
|
||||||
private static class AccountsPagerAdapter extends FragmentStatePagerAdapter {
|
|
||||||
|
|
||||||
AccountsPagerAdapter(FragmentManager fm) {
|
|
||||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Fragment getItem(int position) {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
switch (position) {
|
|
||||||
case 1:
|
|
||||||
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
|
|
||||||
bundle.putSerializable("accountFetch", RetrofitPeertubeAPI.DataType.MUTED);
|
|
||||||
displayAccountsFragment.setArguments(bundle);
|
|
||||||
return displayAccountsFragment;
|
|
||||||
case 2:
|
|
||||||
return new DisplayChannelsFragment();
|
|
||||||
default:
|
|
||||||
return new DisplayNotificationsFragment();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCount() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -22,8 +22,6 @@ import android.os.Build;
|
||||||
|
|
||||||
import androidx.multidex.MultiDex;
|
import androidx.multidex.MultiDex;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
import androidx.work.Configuration;
|
|
||||||
import androidx.work.WorkManager;
|
|
||||||
|
|
||||||
import net.gotev.uploadservice.UploadServiceConfig;
|
import net.gotev.uploadservice.UploadServiceConfig;
|
||||||
import net.gotev.uploadservice.observer.request.GlobalRequestObserver;
|
import net.gotev.uploadservice.observer.request.GlobalRequestObserver;
|
||||||
|
@ -35,9 +33,9 @@ import app.fedilab.fedilabtube.helper.ThemeHelper;
|
||||||
import app.fedilab.fedilabtube.services.GlobalUploadObserver;
|
import app.fedilab.fedilabtube.services.GlobalUploadObserver;
|
||||||
import app.fedilab.fedilabtube.worker.WorkHelper;
|
import app.fedilab.fedilabtube.worker.WorkHelper;
|
||||||
|
|
||||||
public class FedilabTube extends MultiDexApplication {
|
public class BaseFedilabTube extends MultiDexApplication {
|
||||||
|
|
||||||
static String UPLOAD_CHANNEL_ID = "upload_info_peertube";
|
public static String UPLOAD_CHANNEL_ID = "upload_info_peertube";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
@ -45,15 +43,11 @@ public class FedilabTube extends MultiDexApplication {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
int interval = sharedpreferences.getInt(Helper.NOTIFICATION_INTERVAL, 60);
|
int interval = sharedpreferences.getInt(Helper.NOTIFICATION_INTERVAL, 60);
|
||||||
|
|
||||||
Configuration myConfig = new Configuration.Builder()
|
|
||||||
.setMinimumLoggingLevel(android.util.Log.INFO)
|
|
||||||
.build();
|
|
||||||
WorkManager.initialize(FedilabTube.this, myConfig);
|
|
||||||
if (interval >= 15) {
|
if (interval >= 15) {
|
||||||
WorkHelper.fetchNotifications(this, interval);
|
WorkHelper.fetchNotifications(this, interval);
|
||||||
}
|
}
|
||||||
createNotificationChannel();
|
createNotificationChannel();
|
||||||
UploadServiceConfig.initialize(FedilabTube.this, UPLOAD_CHANNEL_ID, true);
|
UploadServiceConfig.initialize(BaseFedilabTube.this, UPLOAD_CHANNEL_ID, true);
|
||||||
|
|
||||||
new GlobalRequestObserver(this, new GlobalUploadObserver());
|
new GlobalRequestObserver(this, new GlobalUploadObserver());
|
||||||
}
|
}
|
||||||
|
@ -63,9 +57,9 @@ public class FedilabTube extends MultiDexApplication {
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
|
|
||||||
MultiDex.install(FedilabTube.this);
|
MultiDex.install(BaseFedilabTube.this);
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
int themePref = sharedpreferences.getInt(Helper.SET_THEME, Helper.DEFAULT_MODE);
|
int themePref = sharedpreferences.getInt(Helper.SET_THEME, BuildConfig.default_theme);
|
||||||
ThemeHelper.switchTo(themePref);
|
ThemeHelper.switchTo(themePref);
|
||||||
|
|
||||||
|
|
|
@ -1,298 +0,0 @@
|
||||||
package app.fedilab.fedilabtube;
|
|
||||||
/* Copyright 2020 Thomas Schneider
|
|
||||||
*
|
|
||||||
* This file is a part of TubeLab
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
||||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
||||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
||||||
* Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.text.style.UnderlineSpan;
|
|
||||||
import android.util.Patterns;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
|
||||||
import app.fedilab.fedilabtube.client.entities.Error;
|
|
||||||
import app.fedilab.fedilabtube.client.entities.Oauth;
|
|
||||||
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
|
||||||
import app.fedilab.fedilabtube.client.entities.Token;
|
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityLoginBinding;
|
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
|
||||||
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
|
||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
|
||||||
import es.dmoral.toasty.Toasty;
|
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
|
||||||
|
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
private static String client_id;
|
|
||||||
private static String client_secret;
|
|
||||||
private ActivityLoginBinding binding;
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
binding = ActivityLoginBinding.inflate(getLayoutInflater());
|
|
||||||
View view = binding.getRoot();
|
|
||||||
setContentView(view);
|
|
||||||
|
|
||||||
if (getSupportActionBar() != null)
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
|
|
||||||
SpannableString content_create;
|
|
||||||
if (BuildConfig.FLAVOR.compareTo("queermotion") == 0) {
|
|
||||||
content_create = new SpannableString(getString(R.string.register_account));
|
|
||||||
} else {
|
|
||||||
content_create = new SpannableString(getString(R.string.join_peertube));
|
|
||||||
}
|
|
||||||
|
|
||||||
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
|
||||||
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, Helper.getColorAccent())), 0, content_create.length(),
|
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
binding.createAnAccountPeertube.setText(content_create, TextView.BufferType.SPANNABLE);
|
|
||||||
|
|
||||||
binding.createAnAccountPeertube.setOnClickListener(v -> {
|
|
||||||
Intent mainActivity = new Intent(LoginActivity.this, PeertubeRegisterActivity.class);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
mainActivity.putExtras(b);
|
|
||||||
startActivity(mainActivity);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
if (BuildConfig.full_instances && BuildConfig.instance_switcher) {
|
|
||||||
binding.loginInstanceContainer.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
if (BuildConfig.FLAVOR.compareTo("queermotion") == 0) {
|
|
||||||
binding.loginInstance.setText("queermotion.org");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Helper.isTablet(LoginActivity.this)) {
|
|
||||||
|
|
||||||
ViewGroup.LayoutParams layoutParamsI = binding.loginInstanceContainer.getLayoutParams();
|
|
||||||
layoutParamsI.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
|
||||||
binding.loginInstanceContainer.setLayoutParams(layoutParamsI);
|
|
||||||
|
|
||||||
ViewGroup.LayoutParams layoutParamsU = binding.loginUidContainer.getLayoutParams();
|
|
||||||
layoutParamsU.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
|
||||||
binding.loginUidContainer.setLayoutParams(layoutParamsU);
|
|
||||||
|
|
||||||
ViewGroup.LayoutParams layoutParamsP = binding.loginPasswdContainer.getLayoutParams();
|
|
||||||
layoutParamsP.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
|
||||||
binding.loginPasswdContainer.setLayoutParams(layoutParamsP);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!BuildConfig.full_instances) {
|
|
||||||
binding.loginUid.setOnFocusChangeListener((v, hasFocus) -> {
|
|
||||||
if (!hasFocus) {
|
|
||||||
if (binding.loginUid.getText() != null && android.util.Patterns.EMAIL_ADDRESS.matcher(binding.loginUid.getText().toString().trim()).matches()) {
|
|
||||||
String[] emailArray = binding.loginUid.getText().toString().split("@");
|
|
||||||
if (emailArray.length > 1 && Arrays.asList(HelperAcadInstance.openid).contains(emailArray[1])) {
|
|
||||||
binding.loginButton.callOnClick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
binding.loginButton.setOnClickListener(v -> {
|
|
||||||
|
|
||||||
if (binding.loginUid.getText() != null && binding.loginUid.getText().toString().contains("@") && !android.util.Patterns.EMAIL_ADDRESS.matcher(binding.loginUid.getText().toString().trim()).matches()) {
|
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.email_error)).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
binding.loginButton.setEnabled(false);
|
|
||||||
String instance, host;
|
|
||||||
if (!BuildConfig.full_instances) {
|
|
||||||
String[] emailArray = binding.loginUid.getText().toString().split("@");
|
|
||||||
if (emailArray.length > 1 && !Arrays.asList(HelperAcadInstance.valideEmails).contains(emailArray[1])) {
|
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.email_error_domain, emailArray[1])).show();
|
|
||||||
binding.loginButton.setEnabled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
host = emailArray[1];
|
|
||||||
instance = HelperInstance.getPeertubeUrl(host);
|
|
||||||
} else {
|
|
||||||
if (binding.loginInstance.getText() == null || binding.loginInstance.getText().toString().trim().length() == 0) {
|
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
|
||||||
binding.loginButton.setEnabled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
instance = host = binding.loginInstance.getText().toString().trim().toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instance.startsWith("http")) {
|
|
||||||
try {
|
|
||||||
URL url = new URL(instance);
|
|
||||||
instance = url.getHost();
|
|
||||||
host = instance;
|
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else if (instance.endsWith("/")) {
|
|
||||||
try {
|
|
||||||
URL url = new URL("https://" + instance);
|
|
||||||
instance = url.getHost();
|
|
||||||
host = instance;
|
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Patterns.WEB_URL.matcher("https://" + instance).matches()) {
|
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
|
||||||
binding.loginButton.setEnabled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String finalInstance = instance;
|
|
||||||
String finalHost = host;
|
|
||||||
if (Arrays.asList(HelperAcadInstance.openid).contains(host) && !BuildConfig.full_instances) {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Oauth oauth = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).oauthClient(null, null, null, null);
|
|
||||||
if (oauth == null) {
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
binding.loginButton.setEnabled(true);
|
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.client_error), Toast.LENGTH_LONG).show();
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
client_id = oauth.getClient_id();
|
|
||||||
client_secret = oauth.getClient_secret();
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
editor.putString(Helper.CLIENT_ID, client_id);
|
|
||||||
editor.putString(Helper.CLIENT_SECRET, client_secret);
|
|
||||||
editor.apply();
|
|
||||||
Intent intent = new Intent(LoginActivity.this, WebviewConnectActivity.class);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
b.putString("url", "https://" + HelperInstance.getPeertubeUrl(finalHost) + "/plugins/auth-openid-connect/0.0.1/auth/openid-connect");
|
|
||||||
intent.putExtras(b);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
binding.loginButton.setEnabled(true);
|
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}).start();
|
|
||||||
} else {
|
|
||||||
new Thread(() -> {
|
|
||||||
Oauth oauth = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).oauthClient(Helper.CLIENT_NAME_VALUE, Helper.WEBSITE_VALUE, Helper.OAUTH_SCOPES_PEERTUBE, Helper.WEBSITE_VALUE);
|
|
||||||
if (oauth == null) {
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
binding.loginButton.setEnabled(true);
|
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.client_error), Toast.LENGTH_LONG).show();
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
client_id = oauth.getClient_id();
|
|
||||||
client_secret = oauth.getClient_secret();
|
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
editor.putString(Helper.CLIENT_ID, client_id);
|
|
||||||
editor.putString(Helper.CLIENT_SECRET, client_secret);
|
|
||||||
editor.apply();
|
|
||||||
OauthParams oauthParams = new OauthParams();
|
|
||||||
oauthParams.setClient_id(client_id);
|
|
||||||
oauthParams.setClient_secret(client_secret);
|
|
||||||
oauthParams.setGrant_type("password");
|
|
||||||
oauthParams.setScope("user");
|
|
||||||
oauthParams.setUsername(binding.loginUid.getText().toString().trim());
|
|
||||||
if (binding.loginPasswd.getText() != null) {
|
|
||||||
oauthParams.setPassword(binding.loginPasswd.getText().toString());
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Token token = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).manageToken(oauthParams);
|
|
||||||
proceedLogin(token, finalHost);
|
|
||||||
} catch (final Exception | Error e) {
|
|
||||||
oauthParams.setUsername(binding.loginUid.getText().toString().toLowerCase().trim());
|
|
||||||
try {
|
|
||||||
Token token = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).manageToken(oauthParams);
|
|
||||||
proceedLogin(token, finalHost);
|
|
||||||
} catch (Error error) {
|
|
||||||
Error.displayError(LoginActivity.this, error);
|
|
||||||
error.printStackTrace();
|
|
||||||
runOnUiThread(() -> binding.loginButton.setEnabled(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
|
||||||
private void proceedLogin(Token token, String host) {
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
if (token != null) {
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token.getAccess_token());
|
|
||||||
editor.putString(Helper.PREF_INSTANCE, host);
|
|
||||||
editor.commit();
|
|
||||||
//Update the account with the token;
|
|
||||||
updateCredential(LoginActivity.this, token.getAccess_token(), client_id, client_secret, token.getRefresh_token(), host);
|
|
||||||
} else {
|
|
||||||
binding.loginButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == android.R.id.home) {
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -28,17 +28,20 @@ import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
|
|
||||||
|
|
||||||
public class AboutActivity extends AppCompatActivity {
|
public class AboutActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_about);
|
setContentView(R.layout.activity_about);
|
||||||
|
|
||||||
|
@ -58,10 +61,10 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
//Developer click for Mastodon account
|
//Developer click for Mastodon account
|
||||||
TextView developer_mastodon = findViewById(R.id.developer_mastodon);
|
TextView developer_mastodon = findViewById(R.id.developer_mastodon);
|
||||||
SpannableString content = new SpannableString(developer_mastodon.getText().toString());
|
SpannableString content = new SpannableString(developer_mastodon.getText().toString());
|
||||||
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this, Helper.getColorAccent())), 0, content.length(), 0);
|
content.setSpan(new ForegroundColorSpan(Helper.fetchAccentColor(AboutActivity.this)), 0, content.length(), 0);
|
||||||
developer_mastodon.setText(content);
|
developer_mastodon.setText(content);
|
||||||
developer_mastodon.setOnClickListener(v -> {
|
developer_mastodon.setOnClickListener(v -> {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://toot.fedilab.app/@Tubelab"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://toot.fedilab.app/@apps"));
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -80,15 +83,6 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
TextView app_name = findViewById(R.id.app_name);
|
TextView app_name = findViewById(R.id.app_name);
|
||||||
app_name.setText(R.string.app_name);
|
app_name.setText(R.string.app_name);
|
||||||
|
|
||||||
//Developer Github
|
|
||||||
TextView github = findViewById(R.id.github);
|
|
||||||
content = new SpannableString(github.getText().toString());
|
|
||||||
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
|
||||||
github.setText(content);
|
|
||||||
github.setOnClickListener(v -> {
|
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/stom79"));
|
|
||||||
startActivity(browserIntent);
|
|
||||||
});
|
|
||||||
|
|
||||||
//Developer Framagit
|
//Developer Framagit
|
||||||
TextView framagit = findViewById(R.id.framagit);
|
TextView framagit = findViewById(R.id.framagit);
|
||||||
|
@ -100,15 +94,6 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Developer Codeberg
|
|
||||||
TextView codeberg = findViewById(R.id.codeberg);
|
|
||||||
content = new SpannableString(codeberg.getText().toString());
|
|
||||||
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
|
||||||
codeberg.setText(content);
|
|
||||||
codeberg.setOnClickListener(v -> {
|
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://codeberg.org/tom79"));
|
|
||||||
startActivity(browserIntent);
|
|
||||||
});
|
|
||||||
|
|
||||||
LinearLayout donation_container = findViewById(R.id.donation_container);
|
LinearLayout donation_container = findViewById(R.id.donation_container);
|
||||||
if (BuildConfig.google_restriction || !BuildConfig.full_instances) {
|
if (BuildConfig.google_restriction || !BuildConfig.full_instances) {
|
||||||
|
@ -122,19 +107,10 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.me/Mastalab"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.me/Mastalab"));
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
});
|
});
|
||||||
if (BuildConfig.FLAVOR.equals("queermotion")) {
|
|
||||||
donatePaypal.setVisibility(View.GONE);
|
|
||||||
LinearLayout dev_info = findViewById(R.id.dev_info);
|
|
||||||
dev_info.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
Button donateLiberapay = findViewById(R.id.donate_liberapay);
|
Button donateLiberapay = findViewById(R.id.donate_liberapay);
|
||||||
donateLiberapay.setOnClickListener(v -> {
|
donateLiberapay.setOnClickListener(v -> {
|
||||||
Intent browserIntent;
|
Intent browserIntent;
|
||||||
if (BuildConfig.FLAVOR.equals("queermotion")) {
|
|
||||||
browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://soutenir.queermotion.org"));
|
|
||||||
} else {
|
|
||||||
browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79"));
|
browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79"));
|
||||||
}
|
|
||||||
|
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
});
|
});
|
||||||
|
@ -142,7 +118,7 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
|
|
||||||
TextView license = findViewById(R.id.license);
|
TextView license = findViewById(R.id.license);
|
||||||
content = new SpannableString(license.getText().toString());
|
content = new SpannableString(license.getText().toString());
|
||||||
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this, Helper.getColorAccent())), 0, content.length(), 0);
|
content.setSpan(new ForegroundColorSpan(Helper.fetchAccentColor(AboutActivity.this)), 0, content.length(), 0);
|
||||||
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
||||||
license.setText(content);
|
license.setText(content);
|
||||||
license.setOnClickListener(v -> {
|
license.setOnClickListener(v -> {
|
|
@ -0,0 +1,302 @@
|
||||||
|
package app.fedilab.fedilabtube.activities;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.badgeCount;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.text.style.UnderlineSpan;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
|
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityAccountBinding;
|
||||||
|
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
||||||
|
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
||||||
|
import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
|
|
||||||
|
public class AccountActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
|
private ActivityAccountBinding binding;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityAccountBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
if (getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
SpannableString content_create = new SpannableString(getString(R.string.join_peertube));
|
||||||
|
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
||||||
|
content_create.setSpan(new ForegroundColorSpan(Helper.fetchAccentColor(AccountActivity.this)), 0, content_create.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
|
||||||
|
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||||
|
|
||||||
|
Account account = new AccountDAO(AccountActivity.this, db).getAccountByToken(token);
|
||||||
|
if (account == null) {
|
||||||
|
Helper.logoutCurrentUser(AccountActivity.this, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setTitle(String.format("@%s", account.getUsername()));
|
||||||
|
|
||||||
|
Helper.loadAvatar(AccountActivity.this, account, binding.profilePicture);
|
||||||
|
binding.username.setText(String.format("@%s", account.getUsername()));
|
||||||
|
binding.displayname.setText(account.getDisplayName());
|
||||||
|
|
||||||
|
binding.instance.setText(account.getHost());
|
||||||
|
|
||||||
|
binding.logoutButton.setOnClickListener(v -> {
|
||||||
|
AlertDialog.Builder dialogBuilderLogoutAccount = new AlertDialog.Builder(AccountActivity.this);
|
||||||
|
dialogBuilderLogoutAccount.setMessage(getString(R.string.logout_account_confirmation, account.getUsername(), account.getHost()));
|
||||||
|
dialogBuilderLogoutAccount.setPositiveButton(R.string.action_logout, (dialog, id) -> {
|
||||||
|
Helper.logoutCurrentUser(AccountActivity.this, account);
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
dialogBuilderLogoutAccount.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||||
|
AlertDialog alertDialogLogoutAccount = dialogBuilderLogoutAccount.create();
|
||||||
|
alertDialogLogoutAccount.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.settings.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(AccountActivity.this, SettingsActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
TabLayout.Tab notificationTab = binding.accountTabLayout.newTab();
|
||||||
|
if (Helper.isLoggedIn(AccountActivity.this)) {
|
||||||
|
if (badgeCount > 0) {
|
||||||
|
binding.accountTabLayout.addTab(notificationTab.setText(getString(R.string.title_notifications) + " (" + badgeCount + ")"));
|
||||||
|
} else {
|
||||||
|
binding.accountTabLayout.addTab(notificationTab.setText(getString(R.string.title_notifications)));
|
||||||
|
}
|
||||||
|
binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.title_muted)));
|
||||||
|
binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.title_channel)));
|
||||||
|
|
||||||
|
binding.accountViewpager.setOffscreenPageLimit(3);
|
||||||
|
|
||||||
|
|
||||||
|
binding.accountViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
TabLayout.Tab tab = binding.accountTabLayout.getTabAt(position);
|
||||||
|
if (tab != null)
|
||||||
|
tab.select();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
binding.accountTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
|
binding.accountViewpager.setCurrentItem(tab.getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
Fragment fragment = null;
|
||||||
|
if (binding.accountViewpager.getAdapter() != null)
|
||||||
|
fragment = (Fragment) binding.accountViewpager.getAdapter().instantiateItem(binding.accountViewpager, tab.getPosition());
|
||||||
|
switch (tab.getPosition()) {
|
||||||
|
case 0:
|
||||||
|
if (badgeCount > 0) {
|
||||||
|
android.app.AlertDialog.Builder builder;
|
||||||
|
builder = new android.app.AlertDialog.Builder(AccountActivity.this);
|
||||||
|
builder.setMessage(R.string.mark_all_notifications_as_read_confirm);
|
||||||
|
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.setPositiveButton(R.string.mark_all_as_read, (dialog, which) -> {
|
||||||
|
new Thread(() -> {
|
||||||
|
new RetrofitPeertubeAPI(AccountActivity.this).markAllAsRead();
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
badgeCount = 0;
|
||||||
|
Runnable myRunnable = () -> binding.accountTabLayout.getTabAt(0).setText(getString(R.string.title_notifications));
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
|
.show();
|
||||||
|
} else {
|
||||||
|
if (fragment != null) {
|
||||||
|
DisplayNotificationsFragment displayNotificationsFragment = ((DisplayNotificationsFragment) fragment);
|
||||||
|
displayNotificationsFragment.scrollToTop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (fragment != null) {
|
||||||
|
DisplayAccountsFragment displayAccountsFragment = ((DisplayAccountsFragment) fragment);
|
||||||
|
displayAccountsFragment.scrollToTop();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (fragment != null) {
|
||||||
|
DisplayChannelsFragment displayChannelsFragment = ((DisplayChannelsFragment) fragment);
|
||||||
|
displayChannelsFragment.scrollToTop();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
PagerAdapter mPagerAdapter = new AccountsPagerAdapter(getSupportFragmentManager());
|
||||||
|
binding.accountViewpager.setAdapter(mPagerAdapter);
|
||||||
|
} else {
|
||||||
|
binding.accountTabLayout.setVisibility(View.GONE);
|
||||||
|
binding.accountViewpager.setVisibility(View.GONE);
|
||||||
|
binding.remoteAccount.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
binding.remoteAccount.setText(Html.fromHtml(getString(R.string.remote_account_from, account.getSoftware()), Html.FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
binding.remoteAccount.setText(Html.fromHtml(getString(R.string.remote_account_from, account.getSoftware())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateCounter() {
|
||||||
|
if (badgeCount > 0) {
|
||||||
|
binding.accountTabLayout.getTabAt(0).setText(getString(R.string.title_notifications) + " (" + badgeCount + ")");
|
||||||
|
} else {
|
||||||
|
binding.accountTabLayout.getTabAt(0).setText(getString(R.string.title_notifications));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.main_profile, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||||
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.action_add_account) {
|
||||||
|
SwitchAccountHelper.switchDialog(AccountActivity.this, true);
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
|
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pager adapter for three tabs (notifications, muted, blocked)
|
||||||
|
*/
|
||||||
|
private static class AccountsPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
|
AccountsPagerAdapter(FragmentManager fm) {
|
||||||
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
switch (position) {
|
||||||
|
case 1:
|
||||||
|
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
|
||||||
|
bundle.putSerializable("accountFetch", RetrofitPeertubeAPI.DataType.MUTED);
|
||||||
|
displayAccountsFragment.setArguments(bundle);
|
||||||
|
return displayAccountsFragment;
|
||||||
|
case 2:
|
||||||
|
return new DisplayChannelsFragment();
|
||||||
|
default:
|
||||||
|
return new DisplayNotificationsFragment();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -21,7 +21,6 @@ import android.view.View;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -31,13 +30,16 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
|
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
|
import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
|
|
||||||
|
|
||||||
public class AllLocalPlaylistsActivity extends AppCompatActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
public class AllLocalPlaylistsActivity extends BaseActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
||||||
|
|
||||||
|
|
||||||
PlaylistAdapter playlistAdapter;
|
PlaylistAdapter playlistAdapter;
|
||||||
|
@ -45,10 +47,11 @@ public class AllLocalPlaylistsActivity extends AppCompatActivity implements Play
|
||||||
private RelativeLayout textviewNoAction;
|
private RelativeLayout textviewNoAction;
|
||||||
private List<Playlist> playlists;
|
private List<Playlist> playlists;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_all_playlist);
|
setContentView(R.layout.activity_all_playlist);
|
||||||
|
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -35,7 +38,6 @@ import android.widget.Button;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
@ -53,6 +55,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData;
|
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||||
|
@ -63,17 +66,17 @@ import app.fedilab.fedilabtube.databinding.ActivityAllPlaylistBinding;
|
||||||
import app.fedilab.fedilabtube.databinding.AddPlaylistBinding;
|
import app.fedilab.fedilabtube.databinding.AddPlaylistBinding;
|
||||||
import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
|
import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
public class AllPlaylistsActivity extends BaseActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
||||||
|
|
||||||
|
|
||||||
public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final int PICK_AVATAR = 467;
|
||||||
PlaylistAdapter playlistAdapter;
|
PlaylistAdapter playlistAdapter;
|
||||||
private HashMap<Integer, String> privacyToSend;
|
private HashMap<Integer, String> privacyToSend;
|
||||||
private String idChannel;
|
private String idChannel;
|
||||||
|
@ -81,15 +84,15 @@ public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistA
|
||||||
private Playlist playlistToEdit;
|
private Playlist playlistToEdit;
|
||||||
private List<ChannelData.Channel> myChannels;
|
private List<ChannelData.Channel> myChannels;
|
||||||
private ChannelData.Channel selectedChannel;
|
private ChannelData.Channel selectedChannel;
|
||||||
private static final int PICK_AVATAR = 467;
|
|
||||||
private AddPlaylistBinding bindingDialog;
|
private AddPlaylistBinding bindingDialog;
|
||||||
private Uri inputData;
|
private Uri inputData;
|
||||||
private ActivityAllPlaylistBinding binding;
|
private ActivityAllPlaylistBinding binding;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
binding = ActivityAllPlaylistBinding.inflate(getLayoutInflater());
|
binding = ActivityAllPlaylistBinding.inflate(getLayoutInflater());
|
||||||
View viewRoot = binding.getRoot();
|
View viewRoot = binding.getRoot();
|
||||||
setContentView(viewRoot);
|
setContentView(viewRoot);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -15,6 +15,8 @@ package app.fedilab.fedilabtube;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
@ -22,14 +24,10 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -40,18 +38,20 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.client.entities.InstanceParams;
|
import app.fedilab.fedilabtube.client.entities.InstanceParams;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityInstancePickerBinding;
|
||||||
import app.fedilab.fedilabtube.drawer.InstanceAdapter;
|
import app.fedilab.fedilabtube.drawer.InstanceAdapter;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
import app.fedilab.fedilabtube.helper.RoundedBackgroundSpan;
|
import app.fedilab.fedilabtube.helper.RoundedBackgroundSpan;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.InstancesVM;
|
import app.fedilab.fedilabtube.viewmodel.InstancesVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
public class InstancePickerActivity extends BaseActivity {
|
||||||
public class InstancePickerActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
boolean[] checkedItemsCategory;
|
boolean[] checkedItemsCategory;
|
||||||
|
@ -61,44 +61,37 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
String[] itemsKeyLanguage;
|
String[] itemsKeyLanguage;
|
||||||
String[] itemsLabelLanguage;
|
String[] itemsLabelLanguage;
|
||||||
InstanceParams instanceParams;
|
InstanceParams instanceParams;
|
||||||
private RelativeLayout mainLoader, textviewNoAction;
|
|
||||||
private TextView categories_view, languages_view;
|
|
||||||
private InstancesVM viewModel;
|
private InstancesVM viewModel;
|
||||||
|
private ActivityInstancePickerBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
binding = ActivityInstancePickerBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
setContentView(R.layout.activity_instance_picker);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
mainLoader = findViewById(R.id.loader);
|
|
||||||
textviewNoAction = findViewById(R.id.no_action);
|
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
|
||||||
Button pickup_categories = findViewById(R.id.pickup_categories);
|
|
||||||
Button pickup_languages = findViewById(R.id.pickup_languages);
|
|
||||||
categories_view = findViewById(R.id.categories_view);
|
|
||||||
languages_view = findViewById(R.id.languages_view);
|
|
||||||
Spinner sensitive = findViewById(R.id.sensitive);
|
|
||||||
|
|
||||||
String[] channelSensitive = new String[]{"do_not_list", "blur", "display", "no_opinion"};
|
String[] channelSensitive = new String[]{"do_not_list", "blur", "display", "no_opinion"};
|
||||||
String[] channelSensitivesLabel = new String[]{getString(R.string.do_not_list), getString(R.string.blur), getString(R.string.display), getString(R.string.no_opinion)};
|
String[] channelSensitivesLabel = new String[]{getString(R.string.do_not_list), getString(R.string.blur), getString(R.string.display), getString(R.string.no_opinion)};
|
||||||
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(InstancePickerActivity.this,
|
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(InstancePickerActivity.this,
|
||||||
android.R.layout.simple_spinner_dropdown_item, channelSensitivesLabel);
|
android.R.layout.simple_spinner_dropdown_item, channelSensitivesLabel);
|
||||||
sensitive.setAdapter(adapterChannel);
|
binding.sensitive.setAdapter(adapterChannel);
|
||||||
|
|
||||||
|
|
||||||
viewModel = new ViewModelProvider(InstancePickerActivity.this).get(InstancesVM.class);
|
viewModel = new ViewModelProvider(InstancePickerActivity.this).get(InstancesVM.class);
|
||||||
|
|
||||||
sensitive.setSelection(1, false);
|
binding.sensitive.setSelection(1, false);
|
||||||
sensitive.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
binding.sensitive.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
instanceParams.setNsfwPolicy(channelSensitive[position]);
|
instanceParams.setNsfwPolicy(channelSensitive[position]);
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, apiResponse -> manageVIewInstance(apiResponse));
|
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, apiResponse -> manageVIewInstance(apiResponse));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +107,7 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
itemsLabelLanguage = new String[languages.size()];
|
itemsLabelLanguage = new String[languages.size()];
|
||||||
itemsKeyLanguage = new String[languages.size()];
|
itemsKeyLanguage = new String[languages.size()];
|
||||||
|
|
||||||
pickup_languages.setOnClickListener(v -> {
|
binding.pickupLanguages.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(InstancePickerActivity.this);
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(InstancePickerActivity.this);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -157,13 +150,13 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
instanceParams.setLanguagesOr(langs);
|
instanceParams.setLanguagesOr(langs);
|
||||||
languages_view.setText(stringBuilder, TextView.BufferType.SPANNABLE);
|
binding.languagesView.setText(stringBuilder, TextView.BufferType.SPANNABLE);
|
||||||
if (languages_view.getText().toString().trim().length() > 0) {
|
if (binding.languagesView.getText().toString().trim().length() > 0) {
|
||||||
languages_view.setVisibility(View.VISIBLE);
|
binding.languagesView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
languages_view.setVisibility(View.GONE);
|
binding.languagesView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, this::manageVIewInstance);
|
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, this::manageVIewInstance);
|
||||||
});
|
});
|
||||||
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> dialog.dismiss());
|
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> dialog.dismiss());
|
||||||
|
@ -181,7 +174,7 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
itemsKeyCategory = new int[categories.size()];
|
itemsKeyCategory = new int[categories.size()];
|
||||||
|
|
||||||
|
|
||||||
pickup_categories.setOnClickListener(v -> {
|
binding.pickupCategories.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(InstancePickerActivity.this);
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(InstancePickerActivity.this);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (categories.size() > 0) {
|
if (categories.size() > 0) {
|
||||||
|
@ -222,13 +215,13 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
instanceParams.setCategoriesOr(cats);
|
instanceParams.setCategoriesOr(cats);
|
||||||
categories_view.setText(stringBuilder, TextView.BufferType.SPANNABLE);
|
binding.categoriesView.setText(stringBuilder, TextView.BufferType.SPANNABLE);
|
||||||
if (categories_view.getText().toString().trim().length() > 0) {
|
if (binding.categoriesView.getText().toString().trim().length() > 0) {
|
||||||
categories_view.setVisibility(View.VISIBLE);
|
binding.categoriesView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
categories_view.setVisibility(View.GONE);
|
binding.categoriesView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, this::manageVIewInstance);
|
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, this::manageVIewInstance);
|
||||||
});
|
});
|
||||||
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> dialog.dismiss());
|
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> dialog.dismiss());
|
||||||
|
@ -240,7 +233,7 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
setTitle(R.string.instances_picker);
|
setTitle(R.string.instances_picker);
|
||||||
|
|
||||||
|
@ -261,7 +254,7 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
public void manageVIewInstance(APIResponse apiResponse) {
|
public void manageVIewInstance(APIResponse apiResponse) {
|
||||||
mainLoader.setVisibility(View.GONE);
|
binding.loader.setVisibility(View.GONE);
|
||||||
if (apiResponse.getError() != null) {
|
if (apiResponse.getError() != null) {
|
||||||
Toasty.error(InstancePickerActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(InstancePickerActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
|
@ -269,10 +262,10 @@ public class InstancePickerActivity extends AppCompatActivity {
|
||||||
List<InstanceData.Instance> instances = apiResponse.getInstances();
|
List<InstanceData.Instance> instances = apiResponse.getInstances();
|
||||||
RecyclerView lv_instances = findViewById(R.id.lv_instances);
|
RecyclerView lv_instances = findViewById(R.id.lv_instances);
|
||||||
if ((instances == null || instances.size() == 0)) {
|
if ((instances == null || instances.size() == 0)) {
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
binding.noAction.setVisibility(View.VISIBLE);
|
||||||
lv_instances.setVisibility(View.GONE);
|
lv_instances.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
textviewNoAction.setVisibility(View.GONE);
|
binding.noAction.setVisibility(View.GONE);
|
||||||
lv_instances.setVisibility(View.VISIBLE);
|
lv_instances.setVisibility(View.VISIBLE);
|
||||||
InstanceAdapter instanceAdapter = new InstanceAdapter(instances);
|
InstanceAdapter instanceAdapter = new InstanceAdapter(instances);
|
||||||
lv_instances.setAdapter(instanceAdapter);
|
lv_instances.setAdapter(instanceAdapter);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -21,9 +21,12 @@ import android.widget.Toast;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
@ -34,7 +37,7 @@ public class LocalPlaylistsActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
|
@ -0,0 +1,422 @@
|
||||||
|
package app.fedilab.fedilabtube.activities;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.text.style.UnderlineSpan;
|
||||||
|
import android.util.Patterns;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
|
import app.fedilab.fedilabtube.client.data.PluginData;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.AcadInstances;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.Error;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.Oauth;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.Token;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.WellKnownNodeinfo;
|
||||||
|
import app.fedilab.fedilabtube.client.mastodon.RetrofitMastodonAPI;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityLoginBinding;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
public class LoginActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
|
private static String client_id;
|
||||||
|
private static String client_secret;
|
||||||
|
private ActivityLoginBinding binding;
|
||||||
|
private String acadInstance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityLoginBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
|
||||||
|
if (getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
SpannableString content_create;
|
||||||
|
content_create = new SpannableString(getString(R.string.join_peertube));
|
||||||
|
|
||||||
|
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
||||||
|
content_create.setSpan(new ForegroundColorSpan(Helper.fetchAccentColor(LoginActivity.this)), 0, content_create.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
binding.createAnAccountPeertube.setText(content_create, TextView.BufferType.SPANNABLE);
|
||||||
|
|
||||||
|
binding.createAnAccountPeertube.setOnClickListener(v -> {
|
||||||
|
Intent mainActivity = new Intent(LoginActivity.this, PeertubeRegisterActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
mainActivity.putExtras(b);
|
||||||
|
startActivity(mainActivity);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (BuildConfig.full_instances && BuildConfig.instance_switcher) {
|
||||||
|
binding.loginInstanceContainer.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Helper.isTablet(LoginActivity.this)) {
|
||||||
|
|
||||||
|
ViewGroup.LayoutParams layoutParamsI = binding.loginInstanceContainer.getLayoutParams();
|
||||||
|
layoutParamsI.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
||||||
|
binding.loginInstanceContainer.setLayoutParams(layoutParamsI);
|
||||||
|
|
||||||
|
ViewGroup.LayoutParams layoutParamsU = binding.loginUidContainer.getLayoutParams();
|
||||||
|
layoutParamsU.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
||||||
|
binding.loginUidContainer.setLayoutParams(layoutParamsU);
|
||||||
|
|
||||||
|
ViewGroup.LayoutParams layoutParamsP = binding.loginPasswdContainer.getLayoutParams();
|
||||||
|
layoutParamsP.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
||||||
|
binding.loginPasswdContainer.setLayoutParams(layoutParamsP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BuildConfig.full_instances) {
|
||||||
|
|
||||||
|
binding.loginUidContainer.setVisibility(View.GONE);
|
||||||
|
binding.loginPasswdContainer.setVisibility(View.GONE);
|
||||||
|
binding.loginInstanceContainer.setVisibility(View.GONE);
|
||||||
|
binding.createAnAccountPeertube.setVisibility(View.GONE);
|
||||||
|
binding.instancePickerTitle.setVisibility(View.VISIBLE);
|
||||||
|
binding.instancePicker.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
|
||||||
|
List<AcadInstances> acadInstances = AcadInstances.getInstances();
|
||||||
|
String[] academiesKey = new String[acadInstances.size()];
|
||||||
|
String[] academiesValue = new String[acadInstances.size()];
|
||||||
|
String acad = HelperInstance.getLiveInstance(LoginActivity.this);
|
||||||
|
int position = 0;
|
||||||
|
int i = 0;
|
||||||
|
for (AcadInstances ac : acadInstances) {
|
||||||
|
academiesKey[i] = ac.getName();
|
||||||
|
academiesValue[i] = ac.getUrl();
|
||||||
|
if (ac.getUrl().compareTo(acad) == 0) {
|
||||||
|
position = i;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(LoginActivity.this,
|
||||||
|
android.R.layout.simple_spinner_dropdown_item, academiesKey);
|
||||||
|
binding.instancePicker.setAdapter(adapterChannel);
|
||||||
|
binding.instancePicker.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
acadInstance = academiesValue[position];
|
||||||
|
binding.loginUidContainer.setVisibility(View.GONE);
|
||||||
|
binding.loginPasswdContainer.setVisibility(View.GONE);
|
||||||
|
binding.loginInstanceContainer.setVisibility(View.GONE);
|
||||||
|
binding.createAnAccountPeertube.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
binding.instancePicker.setSelection(position, true);
|
||||||
|
}
|
||||||
|
if (BuildConfig.allow_remote_connections) {
|
||||||
|
binding.loginInstance.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
|
if (!hasFocus) {
|
||||||
|
if (binding.loginInstance.getText() != null) {
|
||||||
|
new Thread(() -> {
|
||||||
|
String testInstance = binding.loginInstance.getText().toString().trim();
|
||||||
|
if (testInstance.length() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
WellKnownNodeinfo.NodeInfo instanceNodeInfo = null;
|
||||||
|
if (BuildConfig.allow_remote_connections) {
|
||||||
|
instanceNodeInfo = new RetrofitPeertubeAPI(LoginActivity.this, testInstance, null).getNodeInfo();
|
||||||
|
}
|
||||||
|
if (instanceNodeInfo != null &&
|
||||||
|
(instanceNodeInfo.getSoftware().getName().toUpperCase().trim().compareTo("MASTODON") == 0 ||
|
||||||
|
instanceNodeInfo.getSoftware().getName().toUpperCase().trim().compareTo("PLEROMA") == 0)
|
||||||
|
) {
|
||||||
|
connectToFediverse(testInstance, instanceNodeInfo);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.loginButton.setOnClickListener(v -> {
|
||||||
|
if (!BuildConfig.full_instances && AcadInstances.isOpenId(acadInstance)) {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
InstanceData.InstanceConfig instanceConfig = new RetrofitPeertubeAPI(LoginActivity.this).getConfigInstance();
|
||||||
|
PluginData.Plugin plugin = instanceConfig.getPlugin();
|
||||||
|
List<PluginData.PluginInfo> pluginInfos = plugin.getRegistered();
|
||||||
|
String openIdVersion = "0.0.7";
|
||||||
|
for(PluginData.PluginInfo pluginInfo: pluginInfos) {
|
||||||
|
if(pluginInfo.getName().toLowerCase().contains("openid")) {
|
||||||
|
openIdVersion = pluginInfo.getVersion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Oauth oauth = new RetrofitPeertubeAPI(LoginActivity.this, acadInstance, null).oauthClient(null, null, null, null);
|
||||||
|
if (oauth == null) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
binding.loginButton.setEnabled(true);
|
||||||
|
Toasty.error(LoginActivity.this, getString(R.string.client_error), Toast.LENGTH_LONG).show();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client_id = oauth.getClient_id();
|
||||||
|
client_secret = oauth.getClient_secret();
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.CLIENT_ID, client_id);
|
||||||
|
editor.putString(Helper.CLIENT_SECRET, client_secret);
|
||||||
|
editor.apply();
|
||||||
|
Intent intent = new Intent(LoginActivity.this, WebviewConnectActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putString("url", "https://" + acadInstance + "/plugins/auth-openid-connect/"+openIdVersion+"/auth/openid-connect");
|
||||||
|
intent.putExtras(b);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
binding.loginButton.setEnabled(true);
|
||||||
|
Toasty.error(LoginActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}).start();
|
||||||
|
} else {
|
||||||
|
if (binding.loginUid.getText() != null && binding.loginUid.getText().toString().contains("@") && !android.util.Patterns.EMAIL_ADDRESS.matcher(binding.loginUid.getText().toString().trim()).matches()) {
|
||||||
|
Toasty.error(LoginActivity.this, getString(R.string.email_error)).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
binding.loginButton.setEnabled(false);
|
||||||
|
String instance;
|
||||||
|
if (!BuildConfig.full_instances) {
|
||||||
|
String[] emailArray = binding.loginUid.getText().toString().split("@");
|
||||||
|
if (emailArray.length > 1 && !Arrays.asList(HelperAcadInstance.valideEmails).contains(emailArray[1])) {
|
||||||
|
Toasty.error(LoginActivity.this, getString(R.string.email_error_domain, emailArray[1])).show();
|
||||||
|
binding.loginButton.setEnabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
instance = HelperInstance.getLiveInstance(LoginActivity.this);
|
||||||
|
} else {
|
||||||
|
if (binding.loginInstance.getText() == null || binding.loginInstance.getText().toString().trim().length() == 0) {
|
||||||
|
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
||||||
|
binding.loginButton.setEnabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
instance = binding.loginInstance.getText().toString().trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instance.startsWith("http")) {
|
||||||
|
try {
|
||||||
|
URL url = new URL(instance);
|
||||||
|
instance = url.getHost();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else if (instance.endsWith("/")) {
|
||||||
|
try {
|
||||||
|
URL url = new URL("https://" + instance);
|
||||||
|
instance = url.getHost();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Patterns.WEB_URL.matcher("https://" + instance).matches()) {
|
||||||
|
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
||||||
|
binding.loginButton.setEnabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String finalInstance = instance;
|
||||||
|
new Thread(() -> {
|
||||||
|
WellKnownNodeinfo.NodeInfo instanceNodeInfo = null;
|
||||||
|
if (BuildConfig.allow_remote_connections) {
|
||||||
|
instanceNodeInfo = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).getNodeInfo();
|
||||||
|
}
|
||||||
|
connectToFediverse(finalInstance, instanceNodeInfo);
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Oauth process for Peertube
|
||||||
|
*
|
||||||
|
* @param finalInstance String
|
||||||
|
*/
|
||||||
|
private void connectToFediverse(String finalInstance, WellKnownNodeinfo.NodeInfo instanceNodeInfo) {
|
||||||
|
Oauth oauth = null;
|
||||||
|
String software;
|
||||||
|
if (instanceNodeInfo != null) {
|
||||||
|
software = instanceNodeInfo.getSoftware().getName().toUpperCase().trim();
|
||||||
|
switch (software) {
|
||||||
|
case "MASTODON":
|
||||||
|
case "PLEROMA":
|
||||||
|
oauth = new RetrofitMastodonAPI(LoginActivity.this, finalInstance, null).oauthClient(Helper.CLIENT_NAME_VALUE, Helper.REDIRECT_CONTENT_WEB, Helper.OAUTH_SCOPES_MASTODON, Helper.WEBSITE_VALUE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "FRIENDICA":
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
oauth = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).oauthClient(Helper.CLIENT_NAME_VALUE, Helper.WEBSITE_VALUE, Helper.OAUTH_SCOPES_PEERTUBE, Helper.WEBSITE_VALUE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
oauth = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).oauthClient(Helper.CLIENT_NAME_VALUE, Helper.WEBSITE_VALUE, Helper.OAUTH_SCOPES_PEERTUBE, Helper.WEBSITE_VALUE);
|
||||||
|
software = "PEERTUBE";
|
||||||
|
}
|
||||||
|
if (oauth == null) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
binding.loginButton.setEnabled(true);
|
||||||
|
Toasty.error(LoginActivity.this, getString(R.string.client_error), Toast.LENGTH_LONG).show();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client_id = oauth.getClient_id();
|
||||||
|
client_secret = oauth.getClient_secret();
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.CLIENT_ID, client_id);
|
||||||
|
editor.putString(Helper.CLIENT_SECRET, client_secret);
|
||||||
|
editor.apply();
|
||||||
|
OauthParams oauthParams = new OauthParams();
|
||||||
|
oauthParams.setClient_id(client_id);
|
||||||
|
oauthParams.setClient_secret(client_secret);
|
||||||
|
oauthParams.setGrant_type("password");
|
||||||
|
final boolean isMastodonAPI = software.compareTo("MASTODON") == 0 || software.compareTo("PLEROMA") == 0;
|
||||||
|
if (software.compareTo("PEERTUBE") == 0) {
|
||||||
|
oauthParams.setScope("user");
|
||||||
|
} else if (isMastodonAPI) {
|
||||||
|
oauthParams.setScope("read write follow");
|
||||||
|
}
|
||||||
|
if (binding.loginUid.getText() != null) {
|
||||||
|
oauthParams.setUsername(binding.loginUid.getText().toString().trim());
|
||||||
|
}
|
||||||
|
if (binding.loginPasswd.getText() != null) {
|
||||||
|
oauthParams.setPassword(binding.loginPasswd.getText().toString());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Token token = null;
|
||||||
|
if (software.compareTo("PEERTUBE") == 0) {
|
||||||
|
token = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).manageToken(oauthParams);
|
||||||
|
} else if (isMastodonAPI) {
|
||||||
|
Intent i = new Intent(LoginActivity.this, MastodonWebviewConnectActivity.class);
|
||||||
|
i.putExtra("software", software);
|
||||||
|
i.putExtra("instance", finalInstance);
|
||||||
|
i.putExtra("client_id", client_id);
|
||||||
|
i.putExtra("client_secret", client_secret);
|
||||||
|
startActivity(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
proceedLogin(token, finalInstance, software.compareTo("PEERTUBE") == 0 ? null : software);
|
||||||
|
} catch (final Exception | Error e) {
|
||||||
|
oauthParams.setUsername(binding.loginUid.getText().toString().toLowerCase().trim());
|
||||||
|
try {
|
||||||
|
if (software.compareTo("PEERTUBE") == 0) {
|
||||||
|
Token token = new RetrofitPeertubeAPI(LoginActivity.this, finalInstance, null).manageToken(oauthParams);
|
||||||
|
proceedLogin(token, finalInstance, software.compareTo("PEERTUBE") == 0 ? null : software);
|
||||||
|
}
|
||||||
|
} catch (Error error) {
|
||||||
|
Error.displayError(LoginActivity.this, error);
|
||||||
|
error.printStackTrace();
|
||||||
|
runOnUiThread(() -> binding.loginButton.setEnabled(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("ApplySharedPref")
|
||||||
|
private void proceedLogin(Token token, String host, String software) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
if (token != null) {
|
||||||
|
boolean remote_account = software != null && software.toUpperCase().trim().compareTo("PEERTUBE") != 0;
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token.getAccess_token());
|
||||||
|
editor.putString(Helper.PREF_SOFTWARE, remote_account ? software : null);
|
||||||
|
editor.putString(Helper.PREF_REMOTE_INSTANCE, remote_account ? host : null);
|
||||||
|
if (!remote_account) {
|
||||||
|
editor.putString(Helper.PREF_INSTANCE, host);
|
||||||
|
}
|
||||||
|
editor.commit();
|
||||||
|
//Update the account with the token;
|
||||||
|
updateCredential(LoginActivity.this, token.getAccess_token(), client_id, client_secret, token.getRefresh_token(), host, software);
|
||||||
|
} else {
|
||||||
|
binding.loginButton.setEnabled(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,35 +14,36 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.TypeOfConnection.NORMAL;
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.TypeOfConnection.SURFING;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.appcompat.widget.TooltipCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
||||||
import androidx.viewpager.widget.PagerAdapter;
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
@ -51,13 +52,7 @@ import com.kobakei.ratethisapp.RateThisApp;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -65,10 +60,15 @@ import java.util.TreeSet;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.BaseMainActivity;
|
||||||
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
|
import app.fedilab.fedilabtube.DonationActivity;
|
||||||
|
import app.fedilab.fedilabtube.Matomo;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.entities.AcadInstances;
|
||||||
import app.fedilab.fedilabtube.client.entities.Error;
|
import app.fedilab.fedilabtube.client.entities.Error;
|
||||||
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
||||||
import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
|
import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
|
||||||
|
@ -80,26 +80,20 @@ import app.fedilab.fedilabtube.databinding.ActivityMainBinding;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayOverviewFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayOverviewFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
|
import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
|
||||||
import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.services.RetrieveInfoService;
|
import app.fedilab.fedilabtube.services.RetrieveInfoService;
|
||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
|
||||||
import su.litvak.chromecast.api.v2.ChromeCasts;
|
|
||||||
import su.litvak.chromecast.api.v2.ChromeCastsListener;
|
|
||||||
import su.litvak.chromecast.api.v2.MediaStatus;
|
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.NORMAL;
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
import static app.fedilab.fedilabtube.helper.HelperAcadInstance.academies;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements ChromeCastsListener {
|
public class MainActivity extends BaseMainActivity {
|
||||||
|
|
||||||
|
|
||||||
public static int PICK_INSTANCE = 5641;
|
public static int PICK_INSTANCE = 5641;
|
||||||
|
@ -107,15 +101,41 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
public static UserMe userMe;
|
public static UserMe userMe;
|
||||||
public static InstanceData.InstanceConfig instanceConfig;
|
public static InstanceData.InstanceConfig instanceConfig;
|
||||||
public static TypeOfConnection typeOfConnection;
|
public static TypeOfConnection typeOfConnection;
|
||||||
|
public static int badgeCount;
|
||||||
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
||||||
private DisplayOverviewFragment overviewFragment;
|
private DisplayOverviewFragment overviewFragment;
|
||||||
private ActivityMainBinding binding;
|
private ActivityMainBinding binding;
|
||||||
private BroadcastReceiver manage_chromecast;
|
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
public static List<ChromeCast> chromeCasts;
|
= item -> {
|
||||||
public static ChromeCast chromeCast;
|
int itemId = item.getItemId();
|
||||||
private VideoData.Video castedTube;
|
String type = null;
|
||||||
|
if (itemId == R.id.navigation_discover) {
|
||||||
|
setTitleCustom(R.string.title_discover);
|
||||||
|
binding.viewpager.setCurrentItem(3);
|
||||||
|
type = HelperAcadInstance.DISCOVER;
|
||||||
|
} else if (itemId == R.id.navigation_subscription) {
|
||||||
|
binding.viewpager.setCurrentItem(4);
|
||||||
|
setTitleCustom(R.string.subscriptions);
|
||||||
|
type = HelperAcadInstance.SUBSCRIPTIONS;
|
||||||
|
} else if (itemId == R.id.navigation_trending) {
|
||||||
|
setTitleCustom(R.string.title_trending);
|
||||||
|
binding.viewpager.setCurrentItem(2);
|
||||||
|
type = HelperAcadInstance.TRENDING;
|
||||||
|
} else if (itemId == R.id.navigation_recently_added) {
|
||||||
|
setTitleCustom(R.string.title_recently_added);
|
||||||
|
binding.viewpager.setCurrentItem(1);
|
||||||
|
type = HelperAcadInstance.RECENTLY_ADDED;
|
||||||
|
} else if (itemId == R.id.navigation_local) {
|
||||||
|
setTitleCustom(R.string.title_local);
|
||||||
|
binding.viewpager.setCurrentItem(0);
|
||||||
|
type = HelperAcadInstance.LOCAL;
|
||||||
|
}
|
||||||
|
if (type != null) {
|
||||||
|
Matomo.sendScreen(MainActivity.this, "TIMELINE", type);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
public static boolean chromecastActivated = false;
|
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
@SuppressLint("ApplySharedPref")
|
||||||
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
||||||
|
@ -190,160 +210,28 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
|
||||||
= item -> {
|
|
||||||
int itemId = item.getItemId();
|
|
||||||
if (itemId == R.id.navigation_discover) {
|
|
||||||
setTitleCustom(R.string.title_discover);
|
|
||||||
binding.viewpager.setCurrentItem(0);
|
|
||||||
} else if (itemId == R.id.navigation_subscription) {
|
|
||||||
binding.viewpager.setCurrentItem(1);
|
|
||||||
setTitleCustom(R.string.subscriptions);
|
|
||||||
} else if (itemId == R.id.navigation_trending) {
|
|
||||||
setTitleCustom(R.string.title_trending);
|
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
|
||||||
binding.viewpager.setCurrentItem(2);
|
|
||||||
} else {
|
|
||||||
binding.viewpager.setCurrentItem(1);
|
|
||||||
}
|
|
||||||
} else if (itemId == R.id.navigation_most_liked) {
|
|
||||||
setTitleCustom(R.string.title_most_liked);
|
|
||||||
binding.viewpager.setCurrentItem(2);
|
|
||||||
} else if (itemId == R.id.navigation_recently_added) {
|
|
||||||
setTitleCustom(R.string.title_recently_added);
|
|
||||||
binding.viewpager.setCurrentItem(3);
|
|
||||||
} else if (itemId == R.id.navigation_local) {
|
|
||||||
setTitleCustom(R.string.title_local);
|
|
||||||
binding.viewpager.setCurrentItem(4);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void newChromeCastDiscovered(ChromeCast chromeCast) {
|
|
||||||
if (chromeCasts == null) {
|
|
||||||
chromeCasts = new ArrayList<>();
|
|
||||||
chromeCasts.add(chromeCast);
|
|
||||||
} else {
|
|
||||||
boolean canBeAdded = true;
|
|
||||||
for (ChromeCast cast : chromeCasts) {
|
|
||||||
if (cast.getName().compareTo(chromeCast.getName()) == 0) {
|
|
||||||
canBeAdded = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canBeAdded) {
|
|
||||||
chromeCasts.add(chromeCast);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (chromeCast.isAppRunning(Helper.CAST_ID) && chromeCast.getMediaStatus() != null && chromeCast.getMediaStatus().playerState != null) {
|
|
||||||
if (binding.castInfo.getVisibility() == View.GONE) {
|
|
||||||
binding.castInfo.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void chromeCastRemoved(ChromeCast chromeCast) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
binding = null;
|
binding = null;
|
||||||
ChromeCasts.unregisterListener(this);
|
|
||||||
if (manage_chromecast != null) {
|
|
||||||
LocalBroadcastManager.getInstance(MainActivity.this).unregisterReceiver(manage_chromecast);
|
|
||||||
|
|
||||||
new Thread(() -> {
|
|
||||||
if (chromeCasts != null && chromeCasts.size() > 0) {
|
|
||||||
for (ChromeCast cast : chromeCasts) {
|
|
||||||
try {
|
|
||||||
cast.stopApp();
|
|
||||||
cast.disconnect();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
if (chromeCasts != null) {
|
|
||||||
chromeCasts = null;
|
|
||||||
}
|
|
||||||
if (chromeCast != null) {
|
|
||||||
chromeCast = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Method for discovering cast devices
|
|
||||||
public void discoverCast() {
|
|
||||||
new Thread(() -> {
|
|
||||||
if (chromeCasts != null) {
|
|
||||||
for (ChromeCast cast : chromeCasts) {
|
|
||||||
try {
|
|
||||||
cast.disconnect();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
chromeCasts = null;
|
|
||||||
}
|
|
||||||
chromeCasts = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
List<NetworkInterface> interfaces;
|
|
||||||
interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
|
||||||
for (NetworkInterface ni : interfaces) {
|
|
||||||
if ((!ni.isLoopback()) && ni.isUp() && (ni.getName().equals("wlan0"))) {
|
|
||||||
Enumeration<InetAddress> inetAddressEnumeration = ni.getInetAddresses();
|
|
||||||
while (inetAddressEnumeration.hasMoreElements()) {
|
|
||||||
InetAddress inetAddress = inetAddressEnumeration.nextElement();
|
|
||||||
ChromeCasts.restartDiscovery(inetAddress);
|
|
||||||
int tryFind = 0;
|
|
||||||
while (ChromeCasts.get().isEmpty() && tryFind < 5) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
tryFind++;
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChromeCasts.stopDiscovery();
|
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
||||||
Runnable myRunnable = this::invalidateOptionsMenu;
|
|
||||||
mainHandler.post(myRunnable);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(MainActivity.this, HelperInstance.getLiveInstance(this),true);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
|
||||||
View view = binding.getRoot();
|
binding = super.binding;
|
||||||
setContentView(view);
|
|
||||||
ChromeCastsListener chromeCastsListener = this;
|
|
||||||
ChromeCasts.registerListener(chromeCastsListener);
|
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
typeOfConnection = TypeOfConnection.UNKNOWN;
|
typeOfConnection = TypeOfConnection.UNKNOWN;
|
||||||
|
badgeCount = 0;
|
||||||
|
|
||||||
BottomNavigationView navView = findViewById(R.id.nav_view);
|
binding.navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
|
|
||||||
navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
|
||||||
|
|
||||||
if (getSupportActionBar() != null) {
|
if (getSupportActionBar() != null) {
|
||||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||||
|
@ -379,8 +267,19 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
if (!Helper.isLoggedIn(MainActivity.this)) {
|
if (!Helper.isLoggedIn(MainActivity.this)) {
|
||||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||||
binding.viewpager.setAdapter(mPagerAdapter);
|
binding.viewpager.setAdapter(mPagerAdapter);
|
||||||
|
} else {
|
||||||
|
new Thread(() -> {
|
||||||
|
badgeCount = new RetrofitPeertubeAPI(MainActivity.this).unreadNotifications();
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
binding.viewpager.setOffscreenPageLimit(5);
|
binding.viewpager.setOffscreenPageLimit(5);
|
||||||
|
}else {
|
||||||
|
binding.viewpager.setOffscreenPageLimit(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
Matomo.sendEvent(MainActivity.this, "UTILISATEUR", "DEMARRAGE", HelperInstance.getLiveInstance(MainActivity.this), Helper.isLoggedIn(MainActivity.this) ? 1 : 0);
|
||||||
|
|
||||||
|
|
||||||
binding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
binding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
|
@ -416,11 +315,11 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
setTitleCustom(R.string.title_discover);
|
setTitleCustom(R.string.title_discover);
|
||||||
|
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
navView.inflateMenu(R.menu.bottom_nav_menu_connected);
|
binding.navView.inflateMenu(R.menu.bottom_nav_menu_connected);
|
||||||
refreshToken();
|
refreshToken();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
navView.inflateMenu(R.menu.bottom_nav_menu);
|
binding.navView.inflateMenu(R.menu.bottom_nav_menu);
|
||||||
}
|
}
|
||||||
peertubeInformation = new PeertubeInformation();
|
peertubeInformation = new PeertubeInformation();
|
||||||
peertubeInformation.setCategories(new LinkedHashMap<>());
|
peertubeInformation.setCategories(new LinkedHashMap<>());
|
||||||
|
@ -439,94 +338,18 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
PlaylistExportHelper.manageIntentUrl(MainActivity.this, getIntent());
|
PlaylistExportHelper.manageIntentUrl(MainActivity.this, getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.castClose.setOnClickListener(v -> {
|
|
||||||
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
b.putInt("displayed", 0);
|
|
||||||
intentBC.putExtras(b);
|
|
||||||
LocalBroadcastManager.getInstance(MainActivity.this).sendBroadcast(intentBC);
|
|
||||||
});
|
|
||||||
|
|
||||||
binding.castTogglePlay.setOnClickListener(v -> {
|
|
||||||
if (chromeCast != null) {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
||||||
Runnable myRunnable = () -> binding.castTogglePlay.setVisibility(View.GONE);
|
|
||||||
mainHandler.post(myRunnable);
|
|
||||||
int icon = -1;
|
|
||||||
if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
|
||||||
chromeCast.pause();
|
|
||||||
icon = R.drawable.ic_baseline_play_arrow_32;
|
|
||||||
} else if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PAUSED) {
|
|
||||||
chromeCast.play();
|
|
||||||
icon = R.drawable.ic_baseline_pause_32;
|
|
||||||
}
|
|
||||||
if (icon != -1) {
|
|
||||||
int finalIcon = icon;
|
|
||||||
myRunnable = () -> binding.castTogglePlay.setImageResource(finalIcon);
|
|
||||||
mainHandler.post(myRunnable);
|
|
||||||
}
|
|
||||||
myRunnable = () -> binding.castTogglePlay.setVisibility(View.VISIBLE);
|
|
||||||
mainHandler.post(myRunnable);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
manage_chromecast = new BroadcastReceiver() {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
Bundle b = intent.getExtras();
|
|
||||||
assert b != null;
|
|
||||||
int state = b.getInt("state_asked", -1);
|
|
||||||
int displayed = b.getInt("displayed", -1);
|
|
||||||
castedTube = b.getParcelable("castedTube");
|
|
||||||
|
|
||||||
if (state == 1) {
|
|
||||||
discoverCast();
|
|
||||||
} else if (state == 0) {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
if (chromeCast != null) {
|
|
||||||
chromeCast.stopApp();
|
|
||||||
chromeCast.disconnect();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
if (displayed == 1) {
|
|
||||||
chromecastActivated = true;
|
|
||||||
if (castedTube != null) {
|
|
||||||
binding.castInfo.setVisibility(View.VISIBLE);
|
|
||||||
Helper.loadGiF(MainActivity.this, castedTube.getThumbnailPath(), binding.castView);
|
|
||||||
binding.castTitle.setText(castedTube.getTitle());
|
|
||||||
binding.castDescription.setText(castedTube.getDescription());
|
|
||||||
}
|
|
||||||
} else if (displayed == 0) {
|
|
||||||
chromecastActivated = false;
|
|
||||||
binding.castInfo.setVisibility(View.GONE);
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
if (chromeCast != null) {
|
|
||||||
chromeCast.stopApp();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
|
||||||
LocalBroadcastManager.getInstance(MainActivity.this).registerReceiver(manage_chromecast, new IntentFilter(Helper.RECEIVE_CAST_SETTINGS));
|
|
||||||
int search_cast = sharedpreferences.getInt(getString(R.string.set_cast_choice), 0);
|
int search_cast = sharedpreferences.getInt(getString(R.string.set_cast_choice), BuildConfig.cast_enabled);
|
||||||
if (search_cast == 1) {
|
if (search_cast == 1) {
|
||||||
discoverCast();
|
super.discoverCast();
|
||||||
|
}
|
||||||
|
//Instance
|
||||||
|
if(HelperInstance.getLiveInstance(MainActivity.this) == null) {
|
||||||
|
Intent intent = new Intent(MainActivity.this, InstancePickerActivity.class);
|
||||||
|
startActivityForResult(intent, PICK_INSTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,10 +366,16 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshToken() {
|
private void refreshToken() {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String tokenStr = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
String tokenStr = Helper.getToken(MainActivity.this);
|
||||||
String instance = HelperInstance.getLiveInstance(MainActivity.this);
|
String instance = HelperInstance.getLiveInstance(MainActivity.this);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instanceShar = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instanceShar = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
|
@ -670,24 +499,31 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
MenuItem settingsItem = menu.findItem(R.id.action_settings);
|
MenuItem settingsItem = menu.findItem(R.id.action_settings);
|
||||||
MenuItem sepiaSearchItem = menu.findItem(R.id.action_sepia_search);
|
MenuItem sepiaSearchItem = menu.findItem(R.id.action_sepia_search);
|
||||||
MenuItem incognitoItem = menu.findItem(R.id.action_incognito);
|
MenuItem incognitoItem = menu.findItem(R.id.action_incognito);
|
||||||
MenuItem instanceItem = menu.findItem(R.id.action_change_instance);
|
|
||||||
MenuItem accountItem = menu.findItem(R.id.action_account);
|
MenuItem accountItem = menu.findItem(R.id.action_account);
|
||||||
|
MenuItem donateItem = menu.findItem(R.id.action_donate);
|
||||||
|
MenuItem changeInstanceItem = menu.findItem(R.id.action_change_instance);
|
||||||
|
|
||||||
|
FrameLayout rootView = (FrameLayout) accountItem.getActionView();
|
||||||
|
|
||||||
if (BuildConfig.surfing_mode && ((Helper.isLoggedIn(MainActivity.this) && typeOfConnection == NORMAL) || typeOfConnection == SURFING)) {
|
FrameLayout redCircle = rootView.findViewById(R.id.view_alert_red_circle);
|
||||||
binding.instances.setVisibility(View.VISIBLE);
|
TextView countTextView = rootView.findViewById(R.id.view_alert_count_textview);
|
||||||
binding.instances.setOnClickListener(null);
|
//change counter for notifications
|
||||||
binding.instances.setOnClickListener(v -> {
|
if (badgeCount > 0) {
|
||||||
Intent intent = new Intent(MainActivity.this, ManageInstancesActivity.class);
|
countTextView.setText(String.valueOf(badgeCount));
|
||||||
startActivity(intent);
|
redCircle.setVisibility(View.VISIBLE);
|
||||||
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
binding.instances.setVisibility(View.GONE);
|
redCircle.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
TooltipCompat.setTooltipText(accountItem.getActionView(), getText(R.string.account));
|
||||||
|
if (BuildConfig.FLAVOR.compareTo("google_full") == 0) {
|
||||||
|
donateItem.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BuildConfig.instance_switcher) {
|
||||||
|
changeInstanceItem.setVisible(false);
|
||||||
}
|
}
|
||||||
switch (typeOfConnection) {
|
switch (typeOfConnection) {
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
instanceItem.setVisible(false);
|
|
||||||
accountItem.setVisible(false);
|
accountItem.setVisible(false);
|
||||||
uploadItem.setVisible(false);
|
uploadItem.setVisible(false);
|
||||||
myVideosItem.setVisible(false);
|
myVideosItem.setVisible(false);
|
||||||
|
@ -697,10 +533,13 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
mostLikedItem.setVisible(false);
|
mostLikedItem.setVisible(false);
|
||||||
incognitoItem.setVisible(false);
|
incognitoItem.setVisible(false);
|
||||||
break;
|
break;
|
||||||
|
case REMOTE_ACCOUNT:
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
accountItem.setVisible(true);
|
accountItem.setVisible(true);
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
instanceItem.setVisible(false);
|
if (!BuildConfig.full_instances) {
|
||||||
|
changeInstanceItem.setVisible(false);
|
||||||
|
}
|
||||||
uploadItem.setVisible(true);
|
uploadItem.setVisible(true);
|
||||||
myVideosItem.setVisible(true);
|
myVideosItem.setVisible(true);
|
||||||
playslistItem.setVisible(true);
|
playslistItem.setVisible(true);
|
||||||
|
@ -712,18 +551,16 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
boolean checked = sharedpreferences.getBoolean(getString(R.string.set_store_in_history), true);
|
boolean checked = sharedpreferences.getBoolean(getString(R.string.set_store_in_history), true);
|
||||||
incognitoItem.setChecked(checked);
|
incognitoItem.setChecked(checked);
|
||||||
} else {
|
} else {
|
||||||
instanceItem.setVisible(true);
|
|
||||||
uploadItem.setVisible(false);
|
uploadItem.setVisible(false);
|
||||||
myVideosItem.setVisible(false);
|
myVideosItem.setVisible(false);
|
||||||
playslistItem.setVisible(!BuildConfig.full_instances);
|
playslistItem.setVisible(!BuildConfig.full_instances);
|
||||||
historyItem.setVisible(false);
|
historyItem.setVisible(false);
|
||||||
settingsItem.setVisible(true);
|
settingsItem.setVisible(true);
|
||||||
mostLikedItem.setVisible(false);
|
mostLikedItem.setVisible(true);
|
||||||
incognitoItem.setVisible(false);
|
incognitoItem.setVisible(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SURFING:
|
case SURFING:
|
||||||
instanceItem.setVisible(false);
|
|
||||||
accountItem.setVisible(true);
|
accountItem.setVisible(true);
|
||||||
uploadItem.setVisible(false);
|
uploadItem.setVisible(false);
|
||||||
myVideosItem.setVisible(false);
|
myVideosItem.setVisible(false);
|
||||||
|
@ -735,9 +572,6 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BuildConfig.instance_switcher) {
|
|
||||||
instanceItem.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!BuildConfig.sepia_search) {
|
if (!BuildConfig.sepia_search) {
|
||||||
sepiaSearchItem.setVisible(false);
|
sepiaSearchItem.setVisible(false);
|
||||||
|
@ -750,7 +584,7 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
typeOfConnection = NORMAL;
|
typeOfConnection = NORMAL;
|
||||||
if (!Helper.isLoggedIn(MainActivity.this)) {
|
if (!Helper.canMakeAction(MainActivity.this)) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Account> accounts = new AccountDAO(MainActivity.this, db).getAllAccount();
|
List<Account> accounts = new AccountDAO(MainActivity.this, db).getAllAccount();
|
||||||
if (accounts != null && accounts.size() > 0) {
|
if (accounts != null && accounts.size() > 0) {
|
||||||
|
@ -766,15 +600,29 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
final MenuItem accountItem = menu.findItem(R.id.action_account);
|
||||||
|
FrameLayout rootView = (FrameLayout) accountItem.getActionView();
|
||||||
|
rootView.setOnClickListener(v -> onOptionsItemSelected(accountItem));
|
||||||
|
return super.onPrepareOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
String type = null;
|
||||||
|
String action = "TIMELINE";
|
||||||
if (item.getItemId() == R.id.action_change_instance) {
|
if (item.getItemId() == R.id.action_change_instance) {
|
||||||
if (BuildConfig.full_instances) {
|
if (BuildConfig.full_instances) {
|
||||||
showRadioButtonDialogFullInstances(MainActivity.this, false);
|
Intent intent = new Intent(MainActivity.this, ManageInstancesActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
|
||||||
} else {
|
} else {
|
||||||
showRadioButtonDialog();
|
showRadioButtonDialog();
|
||||||
}
|
}
|
||||||
return true;
|
action = "CHANGE_INSTANCE";
|
||||||
|
type = "";
|
||||||
} else if (item.getItemId() == R.id.action_settings) {
|
} else if (item.getItemId() == R.id.action_settings) {
|
||||||
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
|
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -783,39 +631,40 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
if (typeOfConnection == SURFING) {
|
if (typeOfConnection == SURFING) {
|
||||||
SwitchAccountHelper.switchDialog(MainActivity.this, false);
|
SwitchAccountHelper.switchDialog(MainActivity.this, false);
|
||||||
} else {
|
} else {
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.canMakeAction(MainActivity.this)) {
|
||||||
intent = new Intent(MainActivity.this, AccountActivity.class);
|
intent = new Intent(MainActivity.this, AccountActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(MainActivity.this, LoginActivity.class);
|
intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||||
}
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
}
|
||||||
} else if (item.getItemId() == R.id.action_upload) {
|
} else if (item.getItemId() == R.id.action_upload) {
|
||||||
Intent intent = new Intent(MainActivity.this, PeertubeUploadActivity.class);
|
Intent intent = new Intent(MainActivity.this, PeertubeUploadActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_myvideos) {
|
} else if (item.getItemId() == R.id.action_myvideos) {
|
||||||
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("type", TimelineVM.TimelineType.MY_VIDEOS);
|
bundle.putSerializable("type", TimelineVM.TimelineType.MY_VIDEOS);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
type = HelperAcadInstance.MYVIDEOS;
|
||||||
} else if (item.getItemId() == R.id.action_history) {
|
} else if (item.getItemId() == R.id.action_history) {
|
||||||
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("type", TimelineVM.TimelineType.HISTORY);
|
bundle.putSerializable("type", TimelineVM.TimelineType.HISTORY);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
type = HelperAcadInstance.HISTORY;
|
||||||
} else if (item.getItemId() == R.id.action_most_liked) {
|
} else if (item.getItemId() == R.id.action_most_liked) {
|
||||||
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("type", TimelineVM.TimelineType.MOST_LIKED);
|
bundle.putSerializable("type", TimelineVM.TimelineType.MOST_LIKED);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
type = HelperAcadInstance.MOSTLIKED;
|
||||||
} else if (item.getItemId() == R.id.action_playlist) {
|
} else if (item.getItemId() == R.id.action_playlist) {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
@ -824,15 +673,15 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
intent = new Intent(MainActivity.this, AllLocalPlaylistsActivity.class);
|
intent = new Intent(MainActivity.this, AllLocalPlaylistsActivity.class);
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_sepia_search) {
|
} else if (item.getItemId() == R.id.action_sepia_search) {
|
||||||
Intent intent = new Intent(MainActivity.this, SepiaSearchActivity.class);
|
Intent intent = new Intent(MainActivity.this, SepiaSearchActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_about) {
|
} else if (item.getItemId() == R.id.action_about) {
|
||||||
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
} else if (item.getItemId() == R.id.action_donate) {
|
||||||
|
Intent intent = new Intent(MainActivity.this, DonationActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
} else if (item.getItemId() == R.id.action_incognito) {
|
} else if (item.getItemId() == R.id.action_incognito) {
|
||||||
item.setChecked(!item.isChecked());
|
item.setChecked(!item.isChecked());
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
@ -851,8 +700,10 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
}).start();
|
}).start();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (type != null) {
|
||||||
return super.onOptionsItemSelected(item);
|
Matomo.sendScreen(MainActivity.this, action, type);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -880,14 +731,21 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String acad = HelperInstance.getLiveInstance(MainActivity.this);
|
String acad = HelperInstance.getLiveInstance(MainActivity.this);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String item : academies) {
|
List<AcadInstances> acadInstances = AcadInstances.getInstances();
|
||||||
if (HelperInstance.getPeertubeUrl(item).compareTo(acad) == 0) {
|
String[] academiesKey = new String[acadInstances.size()];
|
||||||
break;
|
String[] academiesValue = new String[acadInstances.size()];
|
||||||
|
int position = 0;
|
||||||
|
for (AcadInstances ac : acadInstances) {
|
||||||
|
academiesKey[i] = ac.getName();
|
||||||
|
academiesValue[i] = ac.getUrl();
|
||||||
|
if (ac.getUrl().compareTo(acad) == 0) {
|
||||||
|
position = i;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
alt_bld.setSingleChoiceItems(academies, i, (dialog, item) -> {
|
|
||||||
String newInstance = academies[item];
|
alt_bld.setSingleChoiceItems(academiesKey, position, (dialog, item) -> {
|
||||||
|
String newInstance = academiesValue[item];
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.PREF_INSTANCE, newInstance);
|
editor.putString(Helper.PREF_INSTANCE, newInstance);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
|
@ -914,6 +772,13 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum TypeOfConnection {
|
||||||
|
UNKNOWN,
|
||||||
|
NORMAL,
|
||||||
|
SURFING,
|
||||||
|
REMOTE_ACCOUNT,
|
||||||
|
}
|
||||||
|
|
||||||
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
|
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
ScreenSlidePagerAdapter(FragmentManager fm) {
|
ScreenSlidePagerAdapter(FragmentManager fm) {
|
||||||
|
@ -926,28 +791,26 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 0:
|
case 0:
|
||||||
return overviewFragment;
|
return locaFragment;
|
||||||
case 1:
|
case 1:
|
||||||
return subscriptionFragment;
|
return recentFragment;
|
||||||
case 2:
|
case 2:
|
||||||
return trendingFragment;
|
return trendingFragment;
|
||||||
case 3:
|
case 3:
|
||||||
return recentFragment;
|
return overviewFragment;
|
||||||
case 4:
|
case 4:
|
||||||
return locaFragment;
|
return subscriptionFragment;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 0:
|
case 0:
|
||||||
return overviewFragment;
|
|
||||||
case 1:
|
|
||||||
return trendingFragment;
|
|
||||||
case 2:
|
|
||||||
return mostLikedFragment;
|
|
||||||
case 3:
|
|
||||||
return recentFragment;
|
|
||||||
case 4:
|
|
||||||
return locaFragment;
|
return locaFragment;
|
||||||
|
case 1:
|
||||||
|
return recentFragment;
|
||||||
|
case 2:
|
||||||
|
return trendingFragment;
|
||||||
|
case 3:
|
||||||
|
return overviewFragment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return overviewFragment;
|
return overviewFragment;
|
||||||
|
@ -955,13 +818,11 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
return 5;
|
return 5;
|
||||||
|
}else {
|
||||||
|
return 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TypeOfConnection {
|
|
||||||
UNKNOWN,
|
|
||||||
NORMAL,
|
|
||||||
SURFING
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.PICK_INSTANCE_SURF;
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.showRadioButtonDialogFullInstances;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -23,34 +26,35 @@ import android.os.Handler;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityManageInstancesBinding;
|
import app.fedilab.fedilabtube.databinding.ActivityManageInstancesBinding;
|
||||||
import app.fedilab.fedilabtube.drawer.AboutInstanceAdapter;
|
import app.fedilab.fedilabtube.drawer.AboutInstanceAdapter;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
|
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE_SURF;
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.showRadioButtonDialogFullInstances;
|
|
||||||
|
|
||||||
|
public class ManageInstancesActivity extends BaseActivity implements AboutInstanceAdapter.AllInstancesRemoved {
|
||||||
public class ManageInstancesActivity extends AppCompatActivity implements AboutInstanceAdapter.AllInstancesRemoved {
|
|
||||||
|
|
||||||
private ActivityManageInstancesBinding binding;
|
private ActivityManageInstancesBinding binding;
|
||||||
private List<InstanceData.AboutInstance> aboutInstances;
|
private List<InstanceData.AboutInstance> aboutInstances;
|
||||||
private AboutInstanceAdapter aboutInstanceAdapter;
|
private AboutInstanceAdapter aboutInstanceAdapter;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityManageInstancesBinding.inflate(getLayoutInflater());
|
binding = ActivityManageInstancesBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
View view = binding.getRoot();
|
|
@ -0,0 +1,195 @@
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
package app.fedilab.fedilabtube.activities;
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.webkit.CookieManager;
|
||||||
|
import android.webkit.CookieSyncManager;
|
||||||
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.Error;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
||||||
|
import app.fedilab.fedilabtube.client.entities.Token;
|
||||||
|
import app.fedilab.fedilabtube.client.mastodon.RetrofitMastodonAPI;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
public class MastodonWebviewConnectActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
|
private WebView webView;
|
||||||
|
private AlertDialog alert;
|
||||||
|
private String clientId, clientSecret;
|
||||||
|
private String instance, software;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static void clearCookies(Context context) {
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||||
|
CookieManager.getInstance().removeAllCookies(null);
|
||||||
|
CookieManager.getInstance().flush();
|
||||||
|
} else {
|
||||||
|
CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context);
|
||||||
|
cookieSyncMngr.startSync();
|
||||||
|
CookieManager cookieManager = CookieManager.getInstance();
|
||||||
|
cookieManager.removeAllCookie();
|
||||||
|
cookieManager.removeSessionCookie();
|
||||||
|
cookieSyncMngr.stopSync();
|
||||||
|
cookieSyncMngr.sync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String redirectUserToAuthorizeAndLogin(String clientId, String instance) {
|
||||||
|
String queryString = Helper.CLIENT_ID + "=" + clientId;
|
||||||
|
queryString += "&" + Helper.REDIRECT_URI + "=" + Uri.encode(Helper.REDIRECT_CONTENT_WEB);
|
||||||
|
queryString += "&response_type=code";
|
||||||
|
queryString += "&scope=read write follow";
|
||||||
|
return "https://" + instance + "/oauth/authorize?" + queryString;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_webview_connect);
|
||||||
|
Bundle b = getIntent().getExtras();
|
||||||
|
if (b != null) {
|
||||||
|
instance = b.getString("instance");
|
||||||
|
clientId = b.getString("client_id");
|
||||||
|
clientSecret = b.getString("client_secret");
|
||||||
|
software = b.getString("software");
|
||||||
|
}
|
||||||
|
if (instance == null)
|
||||||
|
finish();
|
||||||
|
if (getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
setTitle(R.string.login);
|
||||||
|
webView = findViewById(R.id.webviewConnect);
|
||||||
|
clearCookies(MastodonWebviewConnectActivity.this);
|
||||||
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
|
|
||||||
|
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
|
||||||
|
|
||||||
|
final ProgressBar pbar = findViewById(R.id.progress_bar);
|
||||||
|
webView.setWebChromeClient(new WebChromeClient() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(WebView view, int progress) {
|
||||||
|
if (progress < 100 && pbar.getVisibility() == ProgressBar.GONE) {
|
||||||
|
pbar.setVisibility(ProgressBar.VISIBLE);
|
||||||
|
}
|
||||||
|
pbar.setProgress(progress);
|
||||||
|
if (progress == 100) {
|
||||||
|
pbar.setVisibility(ProgressBar.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (instance == null) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
super.shouldOverrideUrlLoading(view, url);
|
||||||
|
if (url.contains(Helper.REDIRECT_CONTENT_WEB)) {
|
||||||
|
String[] val = url.split("code=");
|
||||||
|
if (val.length < 2) {
|
||||||
|
Toasty.error(MastodonWebviewConnectActivity.this, getString(R.string.toast_code_error), Toast.LENGTH_LONG).show();
|
||||||
|
Intent myIntent = new Intent(MastodonWebviewConnectActivity.this, LoginActivity.class);
|
||||||
|
startActivity(myIntent);
|
||||||
|
finish();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String code = val[1];
|
||||||
|
if (code.contains("&")) {
|
||||||
|
code = code.split("&")[0];
|
||||||
|
}
|
||||||
|
OauthParams oauthParams = new OauthParams();
|
||||||
|
oauthParams.setClient_id(clientId);
|
||||||
|
oauthParams.setClient_secret(clientSecret);
|
||||||
|
oauthParams.setGrant_type("authorization_code");
|
||||||
|
oauthParams.setCode(code);
|
||||||
|
oauthParams.setRedirect_uri(Helper.REDIRECT_CONTENT_WEB);
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
Token token = new RetrofitMastodonAPI(MastodonWebviewConnectActivity.this, instance, null).manageToken(oauthParams);
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token.getAccess_token());
|
||||||
|
editor.apply();
|
||||||
|
new RetrofitMastodonAPI(MastodonWebviewConnectActivity.this, instance, token.getAccess_token()).updateCredential(MastodonWebviewConnectActivity.this, clientId, clientSecret, token.getRefresh_token(), software);
|
||||||
|
} catch (Exception | Error ignored) {
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
webView.loadUrl(redirectUserToAuthorizeAndLogin(clientId, instance));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
if (itemId == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (webView != null && webView.canGoBack()) {
|
||||||
|
webView.goBack();
|
||||||
|
} else {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (alert != null) {
|
||||||
|
alert.dismiss();
|
||||||
|
alert = null;
|
||||||
|
}
|
||||||
|
if (webView != null) {
|
||||||
|
webView.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
||||||
|
import static app.fedilab.fedilabtube.worker.WorkHelper.NOTIFICATION_WORKER;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -31,7 +34,6 @@ import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
@ -45,6 +47,7 @@ import com.bumptech.glide.request.RequestOptions;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.entities.Error;
|
import app.fedilab.fedilabtube.client.entities.Error;
|
||||||
import app.fedilab.fedilabtube.client.entities.NotificationSettings;
|
import app.fedilab.fedilabtube.client.entities.NotificationSettings;
|
||||||
|
@ -52,13 +55,13 @@ import app.fedilab.fedilabtube.client.entities.UserMe;
|
||||||
import app.fedilab.fedilabtube.client.entities.UserSettings;
|
import app.fedilab.fedilabtube.client.entities.UserSettings;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityMyAccountSettingsBinding;
|
import app.fedilab.fedilabtube.databinding.ActivityMyAccountSettingsBinding;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.worker.WorkHelper;
|
import app.fedilab.fedilabtube.worker.WorkHelper;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
public class MyAccountActivity extends BaseActivity {
|
||||||
import static app.fedilab.fedilabtube.worker.WorkHelper.NOTIFICATION_WORKER;
|
|
||||||
|
|
||||||
public class MyAccountActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private static final int PICK_IMAGE = 466;
|
private static final int PICK_IMAGE = 466;
|
||||||
ActivityMyAccountSettingsBinding binding;
|
ActivityMyAccountSettingsBinding binding;
|
||||||
|
@ -66,8 +69,10 @@ public class MyAccountActivity extends AppCompatActivity {
|
||||||
private String fileName;
|
private String fileName;
|
||||||
private NotificationSettings notificationSettings;
|
private NotificationSettings notificationSettings;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityMyAccountSettingsBinding.inflate(getLayoutInflater());
|
binding = ActivityMyAccountSettingsBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
View view = binding.getRoot();
|
||||||
|
@ -94,8 +99,7 @@ public class MyAccountActivity extends AppCompatActivity {
|
||||||
initializeValues(notificationSettings.getNewCommentOnMyVideo(), binding.notifNewCommentApp, binding.notifNewCommentMail);
|
initializeValues(notificationSettings.getNewCommentOnMyVideo(), binding.notifNewCommentApp, binding.notifNewCommentMail);
|
||||||
initializeValues(notificationSettings.getNewVideoFromSubscription(), binding.notifNewVideoApp, binding.notifNewVideoMail);
|
initializeValues(notificationSettings.getNewVideoFromSubscription(), binding.notifNewVideoApp, binding.notifNewVideoMail);
|
||||||
|
|
||||||
Helper.loadGiF(MyAccountActivity.this, MainActivity.userMe.getAccount().getAvatar() != null ? MainActivity.userMe.getAccount().getAvatar().getPath() : null, binding.profilePicture);
|
Helper.loadAvatar(MyAccountActivity.this, MainActivity.userMe.getAccount(), binding.profilePicture);
|
||||||
|
|
||||||
String[] refresh_array = getResources().getStringArray(R.array.refresh_time);
|
String[] refresh_array = getResources().getStringArray(R.array.refresh_time);
|
||||||
ArrayAdapter<String> refreshArray = new ArrayAdapter<>(MyAccountActivity.this,
|
ArrayAdapter<String> refreshArray = new ArrayAdapter<>(MyAccountActivity.this,
|
||||||
android.R.layout.simple_spinner_dropdown_item, refresh_array);
|
android.R.layout.simple_spinner_dropdown_item, refresh_array);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.PEERTUBEDELETEVIDEO;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -30,7 +34,6 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
@ -45,6 +48,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
|
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
|
||||||
|
@ -55,18 +59,16 @@ import app.fedilab.fedilabtube.client.entities.ItemStr;
|
||||||
import app.fedilab.fedilabtube.client.entities.VideoParams;
|
import app.fedilab.fedilabtube.client.entities.VideoParams;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityPeertubeEditBinding;
|
import app.fedilab.fedilabtube.databinding.ActivityPeertubeEditBinding;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.MyVideoVM;
|
import app.fedilab.fedilabtube.viewmodel.MyVideoVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.PEERTUBEDELETEVIDEO;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
public class PeertubeEditUploadActivity extends BaseActivity {
|
||||||
public class PeertubeEditUploadActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
private final int PICK_IMAGE = 50378;
|
private final int PICK_IMAGE = 50378;
|
||||||
|
@ -82,8 +84,10 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
|
||||||
private ActivityPeertubeEditBinding binding;
|
private ActivityPeertubeEditBinding binding;
|
||||||
private Uri inputData;
|
private Uri inputData;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityPeertubeEditBinding.inflate(getLayoutInflater());
|
binding = ActivityPeertubeEditBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
View view = binding.getRoot();
|
||||||
|
@ -455,6 +459,10 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
|
||||||
videoParams.setChannelId(channelToSendId);
|
videoParams.setChannelId(channelToSendId);
|
||||||
videoParams.setPrivacy(finalPrivacyToSend.getId());
|
videoParams.setPrivacy(finalPrivacyToSend.getId());
|
||||||
List<String> tags = binding.pVideoTags.getTags();
|
List<String> tags = binding.pVideoTags.getTags();
|
||||||
|
if (tags.size() > 5) {
|
||||||
|
Toasty.error(PeertubeEditUploadActivity.this, getString(R.string.max_tag_size), Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
videoParams.setTags(tags);
|
videoParams.setTags(tags);
|
||||||
binding.setUploadSubmit.setEnabled(false);
|
binding.setUploadSubmit.setEnabled(false);
|
||||||
MyVideoVM myVideoVM = new ViewModelProvider(PeertubeEditUploadActivity.this).get(MyVideoVM.class);
|
MyVideoVM myVideoVM = new ViewModelProvider(PeertubeEditUploadActivity.this).get(MyVideoVM.class);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.PICK_INSTANCE;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -28,33 +30,34 @@ import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.entities.AccountCreation;
|
import app.fedilab.fedilabtube.client.entities.AccountCreation;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityRegisterPeertubeBinding;
|
import app.fedilab.fedilabtube.databinding.ActivityRegisterPeertubeBinding;
|
||||||
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE;
|
public class PeertubeRegisterActivity extends BaseActivity {
|
||||||
|
|
||||||
public class PeertubeRegisterActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
private String instance;
|
private String instance;
|
||||||
private ActivityRegisterPeertubeBinding binding;
|
private ActivityRegisterPeertubeBinding binding;
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
binding = ActivityRegisterPeertubeBinding.inflate(getLayoutInflater());
|
binding = ActivityRegisterPeertubeBinding.inflate(getLayoutInflater());
|
||||||
View mainView = binding.getRoot();
|
View mainView = binding.getRoot();
|
||||||
setContentView(mainView);
|
setContentView(mainView);
|
||||||
|
@ -71,9 +74,6 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
||||||
binding.titleLoginInstance.setVisibility(View.GONE);
|
binding.titleLoginInstance.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BuildConfig.FLAVOR.compareTo("queermotion") == 0) {
|
|
||||||
binding.loginInstance.setText("queermotion.org");
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.username.setOnFocusChangeListener((view, focused) -> {
|
binding.username.setOnFocusChangeListener((view, focused) -> {
|
||||||
if (!focused && binding.username.getText() != null) {
|
if (!focused && binding.username.getText() != null) {
|
||||||
|
@ -163,8 +163,7 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String host = emailArray[1];
|
instance = HelperInstance.getLiveInstance(PeertubeRegisterActivity.this);
|
||||||
instance = HelperInstance.getPeertubeUrl(host);
|
|
||||||
}
|
}
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
instance = instance.toLowerCase().trim();
|
instance = instance.toLowerCase().trim();
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.userMe;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
@ -31,13 +35,11 @@ import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.documentfile.provider.DocumentFile;
|
import androidx.documentfile.provider.DocumentFile;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
|
||||||
import net.gotev.uploadservice.data.UploadNotificationAction;
|
import net.gotev.uploadservice.data.UploadNotificationAction;
|
||||||
import net.gotev.uploadservice.data.UploadNotificationConfig;
|
import net.gotev.uploadservice.data.UploadNotificationConfig;
|
||||||
import net.gotev.uploadservice.data.UploadNotificationStatusConfig;
|
import net.gotev.uploadservice.data.UploadNotificationStatusConfig;
|
||||||
|
@ -53,6 +55,9 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.BaseFedilabTube;
|
||||||
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData;
|
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||||
|
@ -60,15 +65,12 @@ import app.fedilab.fedilabtube.client.entities.UserMe;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityPeertubeUploadBinding;
|
import app.fedilab.fedilabtube.databinding.ActivityPeertubeUploadBinding;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
public class PeertubeUploadActivity extends BaseActivity {
|
||||||
public class PeertubeUploadActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
public static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
public static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
||||||
|
@ -80,10 +82,11 @@ public class PeertubeUploadActivity extends AppCompatActivity {
|
||||||
private HashMap<String, String> channelToSend;
|
private HashMap<String, String> channelToSend;
|
||||||
private ActivityPeertubeUploadBinding binding;
|
private ActivityPeertubeUploadBinding binding;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -321,9 +324,7 @@ public class PeertubeUploadActivity extends AppCompatActivity {
|
||||||
filename = binding.videoTitle.getText().toString().trim();
|
filename = binding.videoTitle.getText().toString().trim();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
String token = Helper.getToken(PeertubeUploadActivity.this);
|
||||||
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
|
||||||
|
|
||||||
new MultipartUploadRequest(PeertubeUploadActivity.this, "https://" + HelperInstance.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
new MultipartUploadRequest(PeertubeUploadActivity.this, "https://" + HelperInstance.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
||||||
.setMethod("POST")
|
.setMethod("POST")
|
||||||
.setBearerAuth(token)
|
.setBearerAuth(token)
|
||||||
|
@ -414,6 +415,6 @@ public class PeertubeUploadActivity extends AppCompatActivity {
|
||||||
clearOnAction
|
clearOnAction
|
||||||
);
|
);
|
||||||
|
|
||||||
return new UploadNotificationConfig(FedilabTube.UPLOAD_CHANNEL_ID, ringToneEnabled, progress, success, error, cancelled);
|
return new UploadNotificationConfig(BaseFedilabTube.UPLOAD_CHANNEL_ID, ringToneEnabled, progress, success, error, cancelled);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -18,26 +18,28 @@ import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
|
import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
public class PlaylistsActivity extends AppCompatActivity {
|
public class PlaylistsActivity extends BaseActivity {
|
||||||
|
|
||||||
private final int PICK_IMPORT = 5556;
|
private final int PICK_IMPORT = 5556;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -19,7 +19,6 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
@ -30,13 +29,16 @@ import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivitySearchResultBinding;
|
import app.fedilab.fedilabtube.databinding.ActivitySearchResultBinding;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
public class SearchActivity extends AppCompatActivity {
|
public class SearchActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
private String search;
|
private String search;
|
||||||
|
@ -44,6 +46,7 @@ public class SearchActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivitySearchResultBinding.inflate(getLayoutInflater());
|
binding = ActivitySearchResultBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
View view = binding.getRoot();
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.activities.PeertubeActivity.hideKeyboard;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -22,7 +25,6 @@ import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
@ -37,26 +39,28 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivitySepiaSearchBinding;
|
import app.fedilab.fedilabtube.databinding.ActivitySepiaSearchBinding;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplaySepiaSearchFragment;
|
import app.fedilab.fedilabtube.fragment.DisplaySepiaSearchFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
||||||
import static app.fedilab.fedilabtube.PeertubeActivity.hideKeyboard;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
|
|
||||||
|
|
||||||
public class SepiaSearchActivity extends AppCompatActivity {
|
public class SepiaSearchActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
private SepiaSearch sepiaSearchVideo, sepiaSearchChannel;
|
private SepiaSearch sepiaSearchVideo, sepiaSearchChannel;
|
||||||
|
|
||||||
private ActivitySepiaSearchBinding binding;
|
private ActivitySepiaSearchBinding binding;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
binding = ActivitySepiaSearchBinding.inflate(getLayoutInflater());
|
binding = ActivitySepiaSearchBinding.inflate(getLayoutInflater());
|
||||||
View rootView = binding.getRoot();
|
View rootView = binding.getRoot();
|
||||||
setContentView(rootView);
|
setContentView(rootView);
|
|
@ -1,11 +1,11 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.fragment.SettingsFragment;
|
import app.fedilab.fedilabtube.fragment.SettingsFragment;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
|
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
|
@ -22,10 +22,12 @@ import app.fedilab.fedilabtube.fragment.SettingsFragment;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
public class SettingsActivity extends AppCompatActivity {
|
public class SettingsActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -31,7 +35,6 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
@ -43,23 +46,22 @@ import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.AccountsVM;
|
import app.fedilab.fedilabtube.viewmodel.AccountsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
|
||||||
|
|
||||||
|
public class ShowAccountActivity extends BaseActivity {
|
||||||
public class ShowAccountActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
private ViewPager mPager;
|
private ViewPager mPager;
|
||||||
|
@ -70,8 +72,10 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
private AccountData.Account account;
|
private AccountData.Account account;
|
||||||
private String accountAcct;
|
private String accountAcct;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_show_account);
|
setContentView(R.layout.activity_show_account);
|
||||||
setTitle("");
|
setTitle("");
|
||||||
|
@ -217,7 +221,7 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
account_dn.setText(account.getDisplayName());
|
account_dn.setText(account.getDisplayName());
|
||||||
|
|
||||||
manageNotes(account);
|
manageNotes(account);
|
||||||
Helper.loadGiF(ShowAccountActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, account_pp);
|
Helper.loadAvatar(ShowAccountActivity.this, account, account_pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,15 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
import static app.fedilab.fedilabtube.activities.MainActivity.TypeOfConnection.SURFING;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.CHANNEL;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
|
@ -28,15 +37,12 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -53,14 +59,18 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
|
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityShowChannelBinding;
|
||||||
import app.fedilab.fedilabtube.drawer.OwnAccountsAdapter;
|
import app.fedilab.fedilabtube.drawer.OwnAccountsAdapter;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
||||||
|
@ -69,44 +79,28 @@ import app.fedilab.fedilabtube.viewmodel.RelationshipVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
public class ShowChannelActivity extends BaseActivity {
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.CHANNEL;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
|
||||||
|
|
||||||
|
|
||||||
public class ShowChannelActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
|
|
||||||
private Button account_follow;
|
|
||||||
private ViewPager mPager;
|
|
||||||
private TabLayout tabLayout;
|
|
||||||
private TextView account_note, subscriber_count;
|
|
||||||
private Map<String, Boolean> relationship;
|
private Map<String, Boolean> relationship;
|
||||||
private ImageView account_pp;
|
|
||||||
private TextView account_dn;
|
|
||||||
private Channel channel;
|
private Channel channel;
|
||||||
private action doAction;
|
private action doAction;
|
||||||
private String channelAcct;
|
private String channelAcct;
|
||||||
private boolean sepiaSearch;
|
private boolean sepiaSearch;
|
||||||
private String peertubeInstance;
|
private String peertubeInstance;
|
||||||
|
private ActivityShowChannelBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_show_channel);
|
binding = ActivityShowChannelBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
setTitle("");
|
setTitle("");
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
account_follow = findViewById(R.id.account_follow);
|
binding.accountFollow.setEnabled(false);
|
||||||
subscriber_count = findViewById(R.id.subscriber_count);
|
binding.accountPp.setBackgroundResource(R.drawable.account_pp_border);
|
||||||
account_follow.setEnabled(false);
|
|
||||||
account_pp = findViewById(R.id.account_pp);
|
|
||||||
account_dn = findViewById(R.id.account_dn);
|
|
||||||
account_pp.setBackgroundResource(R.drawable.account_pp_border);
|
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
channel = b.getParcelable("channel");
|
channel = b.getParcelable("channel");
|
||||||
channelAcct = b.getString("channelId");
|
channelAcct = b.getString("channelId");
|
||||||
|
@ -121,55 +115,33 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabLayout = findViewById(R.id.account_tabLayout);
|
|
||||||
account_note = findViewById(R.id.account_note);
|
|
||||||
|
|
||||||
|
|
||||||
ChannelsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(ChannelsVM.class);
|
ChannelsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(ChannelsVM.class);
|
||||||
viewModel.get(sepiaSearch ? peertubeInstance : null, CHANNEL, channelAcct == null ? channel.getAcct() : channelAcct).observe(ShowChannelActivity.this, this::manageViewAccounts);
|
viewModel.get(sepiaSearch ? peertubeInstance : null, CHANNEL, channelAcct == null ? channel.getAcct() : channelAcct).observe(ShowChannelActivity.this, this::manageViewAccounts);
|
||||||
manageChannel();
|
manageChannel();
|
||||||
|
|
||||||
if (MainActivity.typeOfConnection == MainActivity.TypeOfConnection.SURFING) {
|
if (MainActivity.typeOfConnection == MainActivity.TypeOfConnection.SURFING) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
binding.accountFollow.setText(getString(R.string.action_follow));
|
||||||
int[][] states = new int[][]{
|
binding.accountFollow.setEnabled(true);
|
||||||
new int[]{android.R.attr.state_enabled}, // enabled
|
|
||||||
new int[]{-android.R.attr.state_enabled}, // disabled
|
|
||||||
new int[]{-android.R.attr.state_checked}, // unchecked
|
|
||||||
new int[]{android.R.attr.state_pressed} // pressed
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] colors = new int[]{
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent())
|
|
||||||
};
|
|
||||||
account_follow.setBackgroundTintList(new ColorStateList(states, colors));
|
|
||||||
}
|
|
||||||
account_follow.setText(getString(R.string.action_follow));
|
|
||||||
account_follow.setEnabled(true);
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<AccountData.Account> accounts = new AccountDAO(ShowChannelActivity.this, db).getAllAccount();
|
List<AccountData.Account> accounts = new AccountDAO(ShowChannelActivity.this, db).getAllAccount();
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
account_follow.setVisibility(View.VISIBLE);
|
binding.accountFollow.setVisibility(View.VISIBLE);
|
||||||
account_follow.setOnClickListener(v -> {
|
binding.accountFollow.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ShowChannelActivity.this);
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ShowChannelActivity.this);
|
||||||
builderSingle.setTitle(getString(R.string.list_of_accounts));
|
builderSingle.setTitle(getString(R.string.list_of_accounts));
|
||||||
if (accounts != null && accounts.size() > 0) {
|
if (accounts != null && accounts.size() > 0) {
|
||||||
if (accounts.size() > 1) {
|
if (accounts.size() > 1) {
|
||||||
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(ShowChannelActivity.this, accounts);
|
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(ShowChannelActivity.this, accounts);
|
||||||
builderSingle.setAdapter(accountsListAdapter, (dialog, which) -> {
|
builderSingle.setAdapter(accountsListAdapter, (dialog, which) -> new Thread(() -> {
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
try {
|
||||||
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(which).getHost(), accounts.get(which).getToken());
|
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(which).getHost(), accounts.get(which).getToken());
|
||||||
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}).start();
|
}).start());
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(0).getHost(), accounts.get(0).getToken());
|
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(0).getHost(), accounts.get(0).getToken());
|
||||||
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
||||||
|
@ -256,18 +228,16 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
|
|
||||||
setTitle(channel.getAcct());
|
setTitle(channel.getAcct());
|
||||||
|
|
||||||
|
binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.videos)));
|
||||||
mPager = findViewById(R.id.account_viewpager);
|
binding.accountViewpager.setOffscreenPageLimit(1);
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.videos)));
|
|
||||||
mPager.setOffscreenPageLimit(1);
|
|
||||||
|
|
||||||
|
|
||||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||||
mPager.setAdapter(mPagerAdapter);
|
binding.accountViewpager.setAdapter(mPagerAdapter);
|
||||||
ViewGroup.LayoutParams params = tabLayout.getLayoutParams();
|
ViewGroup.LayoutParams params = binding.accountTabLayout.getLayoutParams();
|
||||||
params.height = 0;
|
params.height = 0;
|
||||||
tabLayout.setLayoutParams(params);
|
binding.accountTabLayout.setLayoutParams(params);
|
||||||
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
binding.accountViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
|
@ -275,7 +245,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
TabLayout.Tab tab = tabLayout.getTabAt(position);
|
TabLayout.Tab tab = binding.accountTabLayout.getTabAt(position);
|
||||||
if (tab != null)
|
if (tab != null)
|
||||||
tab.select();
|
tab.select();
|
||||||
}
|
}
|
||||||
|
@ -286,10 +256,10 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
binding.accountTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTabSelected(TabLayout.Tab tab) {
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
mPager.setCurrentItem(tab.getPosition());
|
binding.accountViewpager.setCurrentItem(tab.getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -300,8 +270,8 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onTabReselected(TabLayout.Tab tab) {
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
Fragment fragment = null;
|
Fragment fragment = null;
|
||||||
if (mPager.getAdapter() != null)
|
if (binding.accountViewpager.getAdapter() != null)
|
||||||
fragment = (Fragment) mPager.getAdapter().instantiateItem(mPager, tab.getPosition());
|
fragment = (Fragment) binding.accountViewpager.getAdapter().instantiateItem(binding.accountViewpager, tab.getPosition());
|
||||||
switch (tab.getPosition()) {
|
switch (tab.getPosition()) {
|
||||||
case 0:
|
case 0:
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
|
@ -319,19 +289,19 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
account_dn.setText(channel.getDisplayName());
|
binding.accountDn.setText(channel.getDisplayName());
|
||||||
|
|
||||||
|
|
||||||
manageNotes(channel);
|
manageNotes(channel);
|
||||||
Helper.loadGiF(ShowChannelActivity.this, sepiaSearch ? peertubeInstance : null, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, account_pp);
|
Helper.loadAvatar(ShowChannelActivity.this, channel, binding.accountPp);
|
||||||
//Follow button
|
//Follow button
|
||||||
String target = channel.getAcct();
|
String target = channel.getAcct();
|
||||||
|
|
||||||
account_follow.setOnClickListener(v -> {
|
binding.accountFollow.setOnClickListener(v -> {
|
||||||
if (doAction == action.NOTHING) {
|
if (doAction == action.NOTHING) {
|
||||||
Toasty.info(ShowChannelActivity.this, getString(R.string.nothing_to_do), Toast.LENGTH_LONG).show();
|
Toasty.info(ShowChannelActivity.this, getString(R.string.nothing_to_do), Toast.LENGTH_LONG).show();
|
||||||
} else if (doAction == action.FOLLOW) {
|
} else if (doAction == action.FOLLOW) {
|
||||||
account_follow.setEnabled(false);
|
binding.accountFollow.setEnabled(false);
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(PostActionsVM.class);
|
PostActionsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(PostActionsVM.class);
|
||||||
viewModel.post(FOLLOW, target, null).observe(ShowChannelActivity.this, apiResponse -> manageVIewPostActions(FOLLOW, apiResponse));
|
viewModel.post(FOLLOW, target, null).observe(ShowChannelActivity.this, apiResponse -> manageVIewPostActions(FOLLOW, apiResponse));
|
||||||
} else if (doAction == action.UNFOLLOW) {
|
} else if (doAction == action.UNFOLLOW) {
|
||||||
|
@ -342,14 +312,14 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
unfollowConfirm.setMessage(channel.getAcct());
|
unfollowConfirm.setMessage(channel.getAcct());
|
||||||
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
unfollowConfirm.setPositiveButton(R.string.yes, (dialog, which) -> {
|
unfollowConfirm.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
account_follow.setEnabled(false);
|
binding.accountFollow.setEnabled(false);
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(PostActionsVM.class);
|
PostActionsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(PostActionsVM.class);
|
||||||
viewModel.post(UNFOLLOW, target, null).observe(ShowChannelActivity.this, apiResponse -> manageVIewPostActions(UNFOLLOW, apiResponse));
|
viewModel.post(UNFOLLOW, target, null).observe(ShowChannelActivity.this, apiResponse -> manageVIewPostActions(UNFOLLOW, apiResponse));
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
});
|
});
|
||||||
unfollowConfirm.show();
|
unfollowConfirm.show();
|
||||||
} else {
|
} else {
|
||||||
account_follow.setEnabled(false);
|
binding.accountFollow.setEnabled(false);
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(PostActionsVM.class);
|
PostActionsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(PostActionsVM.class);
|
||||||
viewModel.post(UNFOLLOW, target, null).observe(ShowChannelActivity.this, apiResponse -> manageVIewPostActions(UNFOLLOW, apiResponse));
|
viewModel.post(UNFOLLOW, target, null).observe(ShowChannelActivity.this, apiResponse -> manageVIewPostActions(UNFOLLOW, apiResponse));
|
||||||
}
|
}
|
||||||
|
@ -362,7 +332,11 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
public void manageVIewRelationship(APIResponse apiResponse) {
|
public void manageVIewRelationship(APIResponse apiResponse) {
|
||||||
|
|
||||||
if (apiResponse.getError() != null) {
|
if (apiResponse.getError() != null) {
|
||||||
|
if (apiResponse.getError().getError().length() > 500) {
|
||||||
|
Toasty.info(ShowChannelActivity.this, getString(R.string.remote_account), Toast.LENGTH_LONG).show();
|
||||||
|
} else {
|
||||||
Toasty.error(ShowChannelActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(ShowChannelActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.relationship = apiResponse.getRelationships();
|
this.relationship = apiResponse.getRelationships();
|
||||||
|
@ -374,39 +348,19 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
|
|
||||||
//Manages the visibility of the button
|
//Manages the visibility of the button
|
||||||
private void manageButtonVisibility() {
|
private void manageButtonVisibility() {
|
||||||
if (relationship == null || MainActivity.typeOfConnection == SURFING)
|
if (relationship == null || MainActivity.typeOfConnection == SURFING || channel == null)
|
||||||
return;
|
return;
|
||||||
|
binding.accountFollow.setEnabled(true);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
Boolean isFollowing = relationship.get(channel.getAcct());
|
||||||
int[][] states = new int[][]{
|
if (isFollowing != null && isFollowing) {
|
||||||
new int[]{android.R.attr.state_enabled}, // enabled
|
binding.accountFollow.setText(R.string.action_unfollow);
|
||||||
new int[]{-android.R.attr.state_enabled}, // disabled
|
binding.accountFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(ShowChannelActivity.this, R.color.red_1)));
|
||||||
new int[]{-android.R.attr.state_checked}, // unchecked
|
|
||||||
new int[]{android.R.attr.state_pressed} // pressed
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] colors = new int[]{
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent())
|
|
||||||
};
|
|
||||||
account_follow.setBackgroundTintList(new ColorStateList(states, colors));
|
|
||||||
}
|
|
||||||
account_follow.setEnabled(true);
|
|
||||||
|
|
||||||
boolean isFollowing = relationship.get(channel.getAcct());
|
|
||||||
if (isFollowing) {
|
|
||||||
account_follow.setText(R.string.action_unfollow);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
account_follow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(ShowChannelActivity.this, R.color.red_1)));
|
|
||||||
}
|
|
||||||
doAction = action.UNFOLLOW;
|
doAction = action.UNFOLLOW;
|
||||||
} else {
|
} else {
|
||||||
account_follow.setText(R.string.action_follow);
|
binding.accountFollow.setText(R.string.action_follow);
|
||||||
doAction = action.FOLLOW;
|
doAction = action.FOLLOW;
|
||||||
}
|
}
|
||||||
account_follow.setVisibility(View.VISIBLE);
|
binding.accountFollow.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -455,8 +409,8 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
if (channel.getOwnerAccount() != null) {
|
if (channel.getOwnerAccount() != null) {
|
||||||
this.channel.setOwnerAccount(channel.getOwnerAccount());
|
this.channel.setOwnerAccount(channel.getOwnerAccount());
|
||||||
}
|
}
|
||||||
subscriber_count.setText(getString(R.string.followers_count, Helper.withSuffix(channel.getFollowersCount())));
|
binding.subscriberCount.setText(getString(R.string.followers_count, Helper.withSuffix(channel.getFollowersCount())));
|
||||||
subscriber_count.setVisibility(View.VISIBLE);
|
binding.subscriberCount.setVisibility(View.VISIBLE);
|
||||||
manageNotes(channel);
|
manageNotes(channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,11 +423,11 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
else
|
else
|
||||||
spannableString = new SpannableString(Html.fromHtml(channel.getDescription()));
|
spannableString = new SpannableString(Html.fromHtml(channel.getDescription()));
|
||||||
|
|
||||||
account_note.setText(spannableString, TextView.BufferType.SPANNABLE);
|
binding.accountNote.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||||
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
account_note.setVisibility(View.VISIBLE);
|
binding.accountNote.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
account_note.setVisibility(View.GONE);
|
binding.accountNote.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,13 +14,14 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.HISTORY;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
@ -32,24 +33,26 @@ import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityVideosTimelineBinding;
|
import app.fedilab.fedilabtube.databinding.ActivityVideosTimelineBinding;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.HISTORY;
|
|
||||||
|
|
||||||
|
public class VideosTimelineActivity extends BaseActivity {
|
||||||
public class VideosTimelineActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private TimelineVM.TimelineType type;
|
private TimelineVM.TimelineType type;
|
||||||
private DisplayVideosFragment displayVideosFragment;
|
private DisplayVideosFragment displayVideosFragment;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
ActivityVideosTimelineBinding binding = ActivityVideosTimelineBinding.inflate(getLayoutInflater());
|
ActivityVideosTimelineBinding binding = ActivityVideosTimelineBinding.inflate(getLayoutInflater());
|
||||||
View mainView = binding.getRoot();
|
View mainView = binding.getRoot();
|
||||||
setContentView(mainView);
|
setContentView(mainView);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -29,20 +29,22 @@ import android.view.WindowManager;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import app.fedilab.fedilabtube.webview.CustomWebview;
|
import app.fedilab.fedilabtube.webview.CustomWebview;
|
||||||
import app.fedilab.fedilabtube.webview.MastalabWebChromeClient;
|
import app.fedilab.fedilabtube.webview.MastalabWebChromeClient;
|
||||||
import app.fedilab.fedilabtube.webview.MastalabWebViewClient;
|
import app.fedilab.fedilabtube.webview.MastalabWebViewClient;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
public class WebviewActivity extends AppCompatActivity {
|
public class WebviewActivity extends BaseActivity {
|
||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
private boolean peertubeLink;
|
private boolean peertubeLink;
|
||||||
|
@ -52,9 +54,8 @@ public class WebviewActivity extends AppCompatActivity {
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_webview);
|
setContentView(R.layout.activity_webview);
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
if (b != null) {
|
if (b != null) {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.fedilabtube;
|
package app.fedilab.fedilabtube.activities;
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,38 +14,44 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
import android.webkit.CookieSyncManager;
|
import android.webkit.CookieSyncManager;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.entities.Error;
|
import app.fedilab.fedilabtube.client.entities.Error;
|
||||||
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
||||||
import app.fedilab.fedilabtube.client.entities.Token;
|
import app.fedilab.fedilabtube.client.entities.Token;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.webview.CustomWebview;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
import app.fedilab.fedilabtube.helper.Theme;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
|
||||||
|
|
||||||
|
|
||||||
public class WebviewConnectActivity extends AppCompatActivity {
|
public class WebviewConnectActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
private CustomWebview webView;
|
private WebView webView;
|
||||||
private AlertDialog alert;
|
private AlertDialog alert;
|
||||||
private String clientId, clientSecret;
|
private String clientId, clientSecret;
|
||||||
private String url;
|
private String url;
|
||||||
|
@ -67,11 +73,13 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
Theme.setTheme(this, HelperInstance.getLiveInstance(this),false);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
WebView.setWebContentsDebuggingEnabled(true);
|
||||||
setContentView(R.layout.activity_webview_connect);
|
setContentView(R.layout.activity_webview_connect);
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
|
@ -86,12 +94,22 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
||||||
webView = findViewById(R.id.webviewConnect);
|
webView = findViewById(R.id.webviewConnect);
|
||||||
clearCookies(WebviewConnectActivity.this);
|
clearCookies(WebviewConnectActivity.this);
|
||||||
webView.getSettings().setJavaScriptEnabled(true);
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
|
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
|
||||||
} else {
|
webView.getSettings().setUseWideViewPort(true);
|
||||||
CookieManager.getInstance().setAcceptCookie(true);
|
webView.getSettings().setLoadWithOverviewMode(true);
|
||||||
}
|
webView.getSettings().setSupportZoom(true);
|
||||||
|
webView.getSettings().setDisplayZoomControls(false);
|
||||||
|
webView.getSettings().setBuiltInZoomControls(true);
|
||||||
|
webView.getSettings().setAllowContentAccess(true);
|
||||||
|
webView.getSettings().setLoadsImagesAutomatically(true);
|
||||||
|
webView.getSettings().setSupportMultipleWindows(false);
|
||||||
|
webView.getSettings().setAppCacheEnabled(true);
|
||||||
|
webView.getSettings().setDatabaseEnabled(true);
|
||||||
|
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
|
webView.getSettings().setMediaPlaybackRequiresUserGesture(true);
|
||||||
|
if (getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
setTitle(R.string.login);
|
||||||
|
|
||||||
final ProgressBar pbar = findViewById(R.id.progress_bar);
|
final ProgressBar pbar = findViewById(R.id.progress_bar);
|
||||||
webView.setWebChromeClient(new WebChromeClient() {
|
webView.setWebChromeClient(new WebChromeClient() {
|
||||||
|
@ -109,8 +127,63 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
||||||
|
|
||||||
webView.setWebViewClient(new WebViewClient() {
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
|
super.onPageStarted(view, url, favicon);
|
||||||
|
//Avoid to load first page for academic instances & openid
|
||||||
|
if (!BuildConfig.full_instances && url.contains("/client")) {
|
||||||
|
view.stopLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||||
|
if( request.getUrl() != null) {
|
||||||
|
String url = request.getUrl().toString();
|
||||||
|
Matcher matcher = Helper.redirectPattern.matcher(url);
|
||||||
|
if (matcher.find()) {
|
||||||
|
String externalAuthToken = matcher.group(1);
|
||||||
|
String username = matcher.group(2);
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
OauthParams oauthParams = new OauthParams();
|
||||||
|
oauthParams.setClient_id(sharedpreferences.getString(Helper.CLIENT_ID, null));
|
||||||
|
oauthParams.setClient_secret(sharedpreferences.getString(Helper.CLIENT_SECRET, null));
|
||||||
|
oauthParams.setGrant_type("password");
|
||||||
|
oauthParams.setScope("upload");
|
||||||
|
oauthParams.setResponse_type("code");
|
||||||
|
oauthParams.setUsername(username);
|
||||||
|
oauthParams.setExternalAuthToken(externalAuthToken);
|
||||||
|
oauthParams.setPassword(externalAuthToken);
|
||||||
|
String instance = new URL(url).getHost();
|
||||||
|
Token token = null;
|
||||||
|
try {
|
||||||
|
token = new RetrofitPeertubeAPI(WebviewConnectActivity.this, instance, null).manageToken(oauthParams);
|
||||||
|
} catch (Error error) {
|
||||||
|
error.printStackTrace();
|
||||||
|
Error.displayError(WebviewConnectActivity.this, error);
|
||||||
|
}
|
||||||
|
if (token != null) {
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token.getAccess_token());
|
||||||
|
editor.putString(Helper.PREF_SOFTWARE, null);
|
||||||
|
editor.putString(Helper.PREF_REMOTE_INSTANCE, null);
|
||||||
|
editor.putString(Helper.PREF_INSTANCE, instance);
|
||||||
|
editor.apply();
|
||||||
|
updateCredential(WebviewConnectActivity.this, token.getAccess_token(), clientId, clientSecret, token.getRefresh_token(), new URL(url).getHost(), null);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.shouldOverrideUrlLoading(view, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
public void onPageFinished(WebView view, String url) {
|
public void onPageFinished(WebView view, String url) {
|
||||||
Matcher matcher = Helper.redirectPattern.matcher(url);
|
Matcher matcher = Helper.redirectPattern.matcher(url);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
|
@ -122,21 +195,27 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
||||||
oauthParams.setClient_id(sharedpreferences.getString(Helper.CLIENT_ID, null));
|
oauthParams.setClient_id(sharedpreferences.getString(Helper.CLIENT_ID, null));
|
||||||
oauthParams.setClient_secret(sharedpreferences.getString(Helper.CLIENT_SECRET, null));
|
oauthParams.setClient_secret(sharedpreferences.getString(Helper.CLIENT_SECRET, null));
|
||||||
oauthParams.setGrant_type("password");
|
oauthParams.setGrant_type("password");
|
||||||
|
oauthParams.setScope("upload");
|
||||||
|
oauthParams.setResponse_type("code");
|
||||||
oauthParams.setUsername(username);
|
oauthParams.setUsername(username);
|
||||||
oauthParams.setExternalAuthToken(externalAuthToken);
|
oauthParams.setExternalAuthToken(externalAuthToken);
|
||||||
|
oauthParams.setPassword(externalAuthToken);
|
||||||
String instance = new URL(url).getHost();
|
String instance = new URL(url).getHost();
|
||||||
Token token = null;
|
Token token = null;
|
||||||
try {
|
try {
|
||||||
token = new RetrofitPeertubeAPI(WebviewConnectActivity.this, instance, null).manageToken(oauthParams);
|
token = new RetrofitPeertubeAPI(WebviewConnectActivity.this, instance, null).manageToken(oauthParams);
|
||||||
} catch (Error error) {
|
} catch (Error error) {
|
||||||
|
error.printStackTrace();
|
||||||
Error.displayError(WebviewConnectActivity.this, error);
|
Error.displayError(WebviewConnectActivity.this, error);
|
||||||
}
|
}
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token.getAccess_token());
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token.getAccess_token());
|
||||||
|
editor.putString(Helper.PREF_SOFTWARE, null);
|
||||||
|
editor.putString(Helper.PREF_REMOTE_INSTANCE, null);
|
||||||
editor.putString(Helper.PREF_INSTANCE, instance);
|
editor.putString(Helper.PREF_INSTANCE, instance);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
updateCredential(WebviewConnectActivity.this, token.getAccess_token(), clientId, clientSecret, token.getRefresh_token(), new URL(url).getHost());
|
updateCredential(WebviewConnectActivity.this, token.getAccess_token(), clientId, clientSecret, token.getRefresh_token(), new URL(url).getHost(), null);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -145,12 +224,23 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
super.onPageFinished(view, url);
|
super.onPageFinished(view, url);
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
webView.loadUrl(url);
|
webView.loadUrl(url);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
if (itemId == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (webView != null && webView.canGoBack()) {
|
if (webView != null && webView.canGoBack()) {
|
|
@ -25,6 +25,7 @@ import app.fedilab.fedilabtube.client.data.CommentData;
|
||||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.client.data.NotificationData;
|
import app.fedilab.fedilabtube.client.data.NotificationData;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
||||||
|
import app.fedilab.fedilabtube.client.data.PluginData;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
import app.fedilab.fedilabtube.client.entities.CaptionsParams;
|
import app.fedilab.fedilabtube.client.entities.CaptionsParams;
|
||||||
|
@ -70,6 +71,9 @@ public interface PeertubeService {
|
||||||
@GET(".well-known/nodeinfo")
|
@GET(".well-known/nodeinfo")
|
||||||
Call<WellKnownNodeinfo> getWellKnownNodeinfo();
|
Call<WellKnownNodeinfo> getWellKnownNodeinfo();
|
||||||
|
|
||||||
|
@GET("plugins/peertube-plugin-player-watermark/public-settings")
|
||||||
|
Call<PluginData.WaterMark> waterMark();
|
||||||
|
|
||||||
//Instance info
|
//Instance info
|
||||||
@GET("config/about")
|
@GET("config/about")
|
||||||
Call<InstanceData.InstanceInfo> configAbout();
|
Call<InstanceData.InstanceInfo> configAbout();
|
||||||
|
@ -103,6 +107,21 @@ public interface PeertubeService {
|
||||||
@GET("client/locales/{local}/server.json")
|
@GET("client/locales/{local}/server.json")
|
||||||
Call<Map<String, String>> getTranslations(@Path("local") String local);
|
Call<Map<String, String>> getTranslations(@Path("local") String local);
|
||||||
|
|
||||||
|
|
||||||
|
//TOKEN
|
||||||
|
//Refresh
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("users/token")
|
||||||
|
Call<Token> createOpenIdToken(
|
||||||
|
@Field("client_id") String client_id,
|
||||||
|
@Field("client_secret") String client_secret,
|
||||||
|
@Field("response_type") String response_type,
|
||||||
|
@Field("grant_type") String grant_type,
|
||||||
|
@Field("scope") String scope,
|
||||||
|
@Field("username") String username,
|
||||||
|
@Field("password") String password,
|
||||||
|
@Field("externalAuthToken") String externalAuthToken);
|
||||||
|
|
||||||
//TOKEN
|
//TOKEN
|
||||||
//Refresh
|
//Refresh
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
|
@ -169,27 +188,55 @@ public interface PeertubeService {
|
||||||
//Timelines Authenticated
|
//Timelines Authenticated
|
||||||
//Subscriber timeline
|
//Subscriber timeline
|
||||||
@GET("users/me/subscriptions/videos?sort=-publishedAt")
|
@GET("users/me/subscriptions/videos?sort=-publishedAt")
|
||||||
Call<VideoData> getSubscriptionVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
|
Call<VideoData> getSubscriptionVideos(
|
||||||
|
@Header("Authorization") String credentials,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String coun,
|
||||||
|
@Query("languageOneOf") List<String> languageOneOf);
|
||||||
|
|
||||||
//Overview videos
|
//Overview videos
|
||||||
@GET("overviews/videos")
|
@GET("overviews/videos")
|
||||||
Call<OverviewVideo> getOverviewVideos(@Header("Authorization") String credentials, @Query("page") String page, @Query("languageOneOf") List<String> languageOneOf);
|
Call<OverviewVideo> getOverviewVideos(
|
||||||
|
@Header("Authorization") String credentials,
|
||||||
|
@Query("page") String page,
|
||||||
|
@Query("nsfw") String nsfw,
|
||||||
|
@Query("languageOneOf") List<String> languageOneOf);
|
||||||
|
|
||||||
//Most liked videos
|
//Most liked videos
|
||||||
@GET("videos?sort=-likes")
|
@GET("videos?sort=-likes")
|
||||||
Call<VideoData> getMostLikedVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
|
Call<VideoData> getMostLikedVideos(
|
||||||
|
@Header("Authorization") String credentials,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw,
|
||||||
|
@Query("languageOneOf") List<String> languageOneOf);
|
||||||
|
|
||||||
//Trending videos
|
//Trending videos
|
||||||
@GET("videos?sort=-trending")
|
@GET("videos?sort=-trending")
|
||||||
Call<VideoData> getTrendingVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
|
Call<VideoData> getTrendingVideos(
|
||||||
|
@Header("Authorization") String credentials,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw,
|
||||||
|
@Query("languageOneOf") List<String> languageOneOf);
|
||||||
|
|
||||||
//Recently added videos
|
//Recently added videos
|
||||||
@GET("videos?sort=-publishedAt")
|
@GET("videos?sort=-publishedAt")
|
||||||
Call<VideoData> getRecentlyAddedVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
|
Call<VideoData> getRecentlyAddedVideos(
|
||||||
|
@Header("Authorization") String credentials,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw,
|
||||||
|
@Query("languageOneOf") List<String> languageOneOf);
|
||||||
|
|
||||||
//Local videos
|
//Local videos
|
||||||
@GET("videos?sort=-publishedAt&filter=local")
|
@GET("videos?sort=-publishedAt&filter=local")
|
||||||
Call<VideoData> getLocalVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
|
Call<VideoData> getLocalVideos(
|
||||||
|
@Header("Authorization") String credentials,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw,
|
||||||
|
@Query("languageOneOf") List<String> languageOneOf);
|
||||||
|
|
||||||
//History
|
//History
|
||||||
@GET("users/me/history/videos")
|
@GET("users/me/history/videos")
|
||||||
|
@ -197,6 +244,7 @@ public interface PeertubeService {
|
||||||
@Header("Authorization") String credentials,
|
@Header("Authorization") String credentials,
|
||||||
@Query("start") String maxId,
|
@Query("start") String maxId,
|
||||||
@Query("count") String count,
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw,
|
||||||
@Query("startDate") String startDate,
|
@Query("startDate") String startDate,
|
||||||
@Query("endDate") String endDate
|
@Query("endDate") String endDate
|
||||||
);
|
);
|
||||||
|
@ -211,7 +259,8 @@ public interface PeertubeService {
|
||||||
@Header("Authorization") String credentials,
|
@Header("Authorization") String credentials,
|
||||||
@Query("search") String search,
|
@Query("search") String search,
|
||||||
@Query("start") String maxId,
|
@Query("start") String maxId,
|
||||||
@Query("count") String count);
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw);
|
||||||
|
|
||||||
//Search channels
|
//Search channels
|
||||||
@GET("search/video-channels")
|
@GET("search/video-channels")
|
||||||
|
@ -228,12 +277,23 @@ public interface PeertubeService {
|
||||||
@Header("Authorization") String credentials,
|
@Header("Authorization") String credentials,
|
||||||
@Query("tagsOneOf") List<String> tagsOneOf,
|
@Query("tagsOneOf") List<String> tagsOneOf,
|
||||||
@Query("start") String maxId,
|
@Query("start") String maxId,
|
||||||
@Query("count") String count);
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw);
|
||||||
|
|
||||||
//Get notifications
|
//Get notifications
|
||||||
@GET("users/me/notifications")
|
@GET("users/me/notifications")
|
||||||
Call<NotificationData> getNotifications(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("since_id") String sinceId);
|
Call<NotificationData> getNotifications(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("since_id") String sinceId);
|
||||||
|
|
||||||
|
@GET("users/me/notifications?start=0&count=0&unread=true")
|
||||||
|
Call<NotificationData> countNotifications(@Header("Authorization") String credentials);
|
||||||
|
|
||||||
|
@POST("users/me/notifications/read-all")
|
||||||
|
Call<String> markAllAsRead(@Header("Authorization") String credentials);
|
||||||
|
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("users/me/notifications/read")
|
||||||
|
Call<String> markAsRead(@Header("Authorization") String credentials, @Field("ids[]") List<String> ids);
|
||||||
|
|
||||||
//Update Notification settings
|
//Update Notification settings
|
||||||
@PUT("users/me/notification-settings")
|
@PUT("users/me/notification-settings")
|
||||||
Call<String> updateNotifications(@Header("Authorization") String credentials, @Body NotificationSettings notificationSettings);
|
Call<String> updateNotifications(@Header("Authorization") String credentials, @Body NotificationSettings notificationSettings);
|
||||||
|
@ -254,9 +314,17 @@ public interface PeertubeService {
|
||||||
@GET("users/me/videos?sort=-publishedAt")
|
@GET("users/me/videos?sort=-publishedAt")
|
||||||
Call<VideoData> getMyVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count);
|
Call<VideoData> getMyVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count);
|
||||||
|
|
||||||
//Get my video
|
//Get user videos
|
||||||
@GET("accounts/{name}/videos?sort=-publishedAt")
|
@GET("accounts/{name}/videos?sort=-publishedAt")
|
||||||
Call<VideoData> getVideosForAccount(@Path("name") String name, @Query("start") String maxId, @Query("count") String count);
|
Call<VideoData> getVideosForAccount(
|
||||||
|
@Path("name") String name,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw
|
||||||
|
);
|
||||||
|
|
||||||
|
@POST("videos/{id}/views")
|
||||||
|
Call<String> postView(@Path("id") String id);
|
||||||
|
|
||||||
@Multipart
|
@Multipart
|
||||||
@PUT("videos/{id}")
|
@PUT("videos/{id}")
|
||||||
|
@ -303,7 +371,11 @@ public interface PeertubeService {
|
||||||
Call<ChannelData> getAllChannels();
|
Call<ChannelData> getAllChannels();
|
||||||
|
|
||||||
@GET("video-channels/{channelHandle}/videos")
|
@GET("video-channels/{channelHandle}/videos")
|
||||||
Call<VideoData> getChannelVideos(@Path("channelHandle") String channelHandle, @Query("start") String maxId, @Query("count") String count);
|
Call<VideoData> getChannelVideos(
|
||||||
|
@Path("channelHandle") String channelHandle,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String count,
|
||||||
|
@Query("nsfw") String nsfw);
|
||||||
|
|
||||||
@POST("video-channels")
|
@POST("video-channels")
|
||||||
Call<ChannelData.ChannelCreation> addChannel(@Header("Authorization") String credentials, @Body ChannelParams channelParams);
|
Call<ChannelData.ChannelCreation> addChannel(@Header("Authorization") String credentials, @Body ChannelParams channelParams);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.net.Uri;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
import android.webkit.URLUtil;
|
||||||
|
|
||||||
import androidx.documentfile.provider.DocumentFile;
|
import androidx.documentfile.provider.DocumentFile;
|
||||||
|
|
||||||
|
@ -37,14 +38,17 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.BuildConfig;
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
import app.fedilab.fedilabtube.MainActivity;
|
import app.fedilab.fedilabtube.activities.MainActivity;
|
||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.client.data.BlockData;
|
import app.fedilab.fedilabtube.client.data.BlockData;
|
||||||
|
@ -54,6 +58,7 @@ import app.fedilab.fedilabtube.client.data.CommentData;
|
||||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.client.data.NotificationData;
|
import app.fedilab.fedilabtube.client.data.NotificationData;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
||||||
|
import app.fedilab.fedilabtube.client.data.PluginData;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
import app.fedilab.fedilabtube.client.entities.AccountCreation;
|
import app.fedilab.fedilabtube.client.entities.AccountCreation;
|
||||||
|
@ -83,6 +88,7 @@ import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.MultipartBody;
|
import okhttp3.MultipartBody;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
@ -90,22 +96,36 @@ import retrofit2.Response;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression", "ConstantConditions"})
|
||||||
public class RetrofitPeertubeAPI {
|
public class RetrofitPeertubeAPI {
|
||||||
|
|
||||||
|
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||||
|
.readTimeout(60, TimeUnit.SECONDS)
|
||||||
|
.connectTimeout(60, TimeUnit.SECONDS)
|
||||||
|
.build();
|
||||||
private final String finalUrl;
|
private final String finalUrl;
|
||||||
private final Context _context;
|
private final Context _context;
|
||||||
private final String instance;
|
private final String instance;
|
||||||
private final String count;
|
private final String count;
|
||||||
|
private final String showNSFWVideos;
|
||||||
private String token;
|
private String token;
|
||||||
private Set<String> selection;
|
private Set<String> selection;
|
||||||
|
|
||||||
|
|
||||||
public RetrofitPeertubeAPI(Context context) {
|
public RetrofitPeertubeAPI(Context context) {
|
||||||
_context = context;
|
_context = context;
|
||||||
instance = HelperInstance.getLiveInstance(context);
|
instance = HelperInstance.getLiveInstance(context);
|
||||||
finalUrl = "https://" + HelperInstance.getLiveInstance(context) + "/api/v1/";
|
finalUrl = "https://" + HelperInstance.getLiveInstance(context) + "/api/v1/";
|
||||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
count = String.valueOf(sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE));
|
count = String.valueOf(sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE));
|
||||||
|
String currentSensitive = sharedpreferences.getString(_context.getString(R.string.set_video_sensitive_choice), Helper.BLUR);
|
||||||
|
if (currentSensitive.compareTo(Helper.DO_NOT_LIST) == 0) {
|
||||||
|
showNSFWVideos = "false";
|
||||||
|
} else if (currentSensitive.compareTo(Helper.BLUR) == 0) {
|
||||||
|
showNSFWVideos = "both";
|
||||||
|
} else {
|
||||||
|
showNSFWVideos = "true";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RetrofitPeertubeAPI(Context context, String instance, String token) {
|
public RetrofitPeertubeAPI(Context context, String instance, String token) {
|
||||||
|
@ -115,18 +135,21 @@ public class RetrofitPeertubeAPI {
|
||||||
finalUrl = "https://" + instance + "/api/v1/";
|
finalUrl = "https://" + instance + "/api/v1/";
|
||||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
count = String.valueOf(sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE));
|
count = String.valueOf(sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE));
|
||||||
|
String currentSensitive = sharedpreferences.getString(_context.getString(R.string.set_video_sensitive_choice), Helper.BLUR);
|
||||||
|
if (currentSensitive.compareTo(Helper.DO_NOT_LIST) == 0) {
|
||||||
|
showNSFWVideos = "false";
|
||||||
|
} else if (currentSensitive.compareTo(Helper.BLUR) == 0) {
|
||||||
|
showNSFWVideos = "both";
|
||||||
|
} else {
|
||||||
|
showNSFWVideos = "true";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void updateCredential(Activity activity, String token, String client_id, String client_secret, String refresh_token, String host) {
|
public static void updateCredential(Activity activity, String token, String client_id, String client_secret, String refresh_token, String host, String software) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
AccountData.Account account;
|
AccountData.Account account;
|
||||||
String instance;
|
String instance = host;
|
||||||
if (host.startsWith("tube") || BuildConfig.full_instances) {
|
|
||||||
instance = host;
|
|
||||||
} else {
|
|
||||||
instance = HelperInstance.getPeertubeUrl(host);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
UserMe userMe = new RetrofitPeertubeAPI(activity, instance, token).verifyCredentials();
|
UserMe userMe = new RetrofitPeertubeAPI(activity, instance, token).verifyCredentials();
|
||||||
account = userMe.getAccount();
|
account = userMe.getAccount();
|
||||||
|
@ -151,7 +174,8 @@ public class RetrofitPeertubeAPI {
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||||
editor.putString(Helper.PREF_KEY_NAME, account.getUsername());
|
editor.putString(Helper.PREF_KEY_NAME, account.getUsername());
|
||||||
if (!host.startsWith("tube")) {
|
boolean remote_account = software != null && software.toUpperCase().trim().compareTo("PEERTUBE") != 0;
|
||||||
|
if (!remote_account) {
|
||||||
editor.putString(Helper.PREF_INSTANCE, host);
|
editor.putString(Helper.PREF_INSTANCE, host);
|
||||||
}
|
}
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
@ -159,7 +183,7 @@ public class RetrofitPeertubeAPI {
|
||||||
new AccountDAO(activity, db).updateAccountCredential(account);
|
new AccountDAO(activity, db).updateAccountCredential(account);
|
||||||
else {
|
else {
|
||||||
if (account.getUsername() != null && account.getCreatedAt() != null)
|
if (account.getUsername() != null && account.getCreatedAt() != null)
|
||||||
new AccountDAO(activity, db).insertAccount(account);
|
new AccountDAO(activity, db).insertAccount(account, software);
|
||||||
}
|
}
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Runnable myRunnable = () -> {
|
Runnable myRunnable = () -> {
|
||||||
|
@ -184,19 +208,24 @@ public class RetrofitPeertubeAPI {
|
||||||
Retrofit retrofit = new Retrofit.Builder()
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
.baseUrl(finalUrl)
|
.baseUrl(finalUrl)
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.client(okHttpClient)
|
||||||
.build();
|
.build();
|
||||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
token = Helper.getToken(_context);
|
||||||
}
|
}
|
||||||
selection = sharedpreferences.getStringSet(_context.getString(R.string.set_video_language_choice), null);
|
selection = sharedpreferences.getStringSet(_context.getString(R.string.set_video_language_choice), null);
|
||||||
return retrofit.create(PeertubeService.class);
|
return retrofit.create(PeertubeService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PeertubeService initTranslation() {
|
private PeertubeService initTranslation() {
|
||||||
|
if (!URLUtil.isValidUrl("https://" + instance)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Retrofit retrofit = new Retrofit.Builder()
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
.baseUrl("https://" + instance)
|
.baseUrl("https://" + instance)
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.client(okHttpClient)
|
||||||
.build();
|
.build();
|
||||||
return retrofit.create(PeertubeService.class);
|
return retrofit.create(PeertubeService.class);
|
||||||
}
|
}
|
||||||
|
@ -208,7 +237,9 @@ public class RetrofitPeertubeAPI {
|
||||||
public Token manageToken(OauthParams oauthParams) throws Error {
|
public Token manageToken(OauthParams oauthParams) throws Error {
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
Call<Token> refreshTokenCall = null;
|
Call<Token> refreshTokenCall = null;
|
||||||
if (oauthParams.getGrant_type().compareTo("password") == 0) {
|
if (oauthParams.getExternalAuthToken() != null) {
|
||||||
|
refreshTokenCall = peertubeService.createOpenIdToken(oauthParams.getClient_id(), oauthParams.getClient_secret(), oauthParams.getResponse_type(), oauthParams.getGrant_type(), oauthParams.getScope(), oauthParams.getUsername(), oauthParams.getPassword(), oauthParams.getExternalAuthToken());
|
||||||
|
} else if (oauthParams.getGrant_type().compareTo("password") == 0) {
|
||||||
refreshTokenCall = peertubeService.createToken(oauthParams.getClient_id(), oauthParams.getClient_secret(), oauthParams.getGrant_type(), oauthParams.getUsername(), oauthParams.getPassword());
|
refreshTokenCall = peertubeService.createToken(oauthParams.getClient_id(), oauthParams.getClient_secret(), oauthParams.getGrant_type(), oauthParams.getUsername(), oauthParams.getPassword());
|
||||||
} else if (oauthParams.getGrant_type().compareTo("refresh_token") == 0) {
|
} else if (oauthParams.getGrant_type().compareTo("refresh_token") == 0) {
|
||||||
refreshTokenCall = peertubeService.refreshToken(oauthParams.getClient_id(), oauthParams.getClient_secret(), oauthParams.getRefresh_token(), oauthParams.getGrant_type());
|
refreshTokenCall = peertubeService.refreshToken(oauthParams.getClient_id(), oauthParams.getClient_secret(), oauthParams.getRefresh_token(), oauthParams.getGrant_type());
|
||||||
|
@ -222,6 +253,8 @@ public class RetrofitPeertubeAPI {
|
||||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, tokenReply.getAccess_token());
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, tokenReply.getAccess_token());
|
||||||
|
editor.putString(Helper.PREF_SOFTWARE, null);
|
||||||
|
editor.putString(Helper.PREF_REMOTE_INSTANCE, null);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(_context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(_context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new AccountDAO(_context, db).updateAccountToken(tokenReply);
|
new AccountDAO(_context, db).updateAccountToken(tokenReply);
|
||||||
|
@ -245,6 +278,66 @@ public class RetrofitPeertubeAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST a view count for a video
|
||||||
|
*/
|
||||||
|
public void postView(String videoUuid) {
|
||||||
|
if (videoUuid == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<String> postViewCall = peertubeService.postView(videoUuid);
|
||||||
|
try {
|
||||||
|
Response<String> dd = postViewCall.execute();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve notifications
|
||||||
|
*
|
||||||
|
* @return APIResponse
|
||||||
|
*/
|
||||||
|
public int unreadNotifications() {
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<NotificationData> notificationsCall = peertubeService.countNotifications("Bearer " + token);
|
||||||
|
try {
|
||||||
|
Response<NotificationData> response = notificationsCall.execute();
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
return response.body().total;
|
||||||
|
}
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark all notifications as read
|
||||||
|
*/
|
||||||
|
public void markAllAsRead() {
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<String> notificationsCall = peertubeService.markAllAsRead("Bearer " + token);
|
||||||
|
try {
|
||||||
|
Response<String> response = notificationsCall.execute();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark a notification as read
|
||||||
|
*/
|
||||||
|
public void markAsRead(String id) {
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
ArrayList<String> ids = new ArrayList<>();
|
||||||
|
ids.add(id);
|
||||||
|
Call<String> notificationsCall = peertubeService.markAsRead("Bearer " + token, ids);
|
||||||
|
try {
|
||||||
|
Response<String> response = notificationsCall.execute();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve notifications
|
* Retrieve notifications
|
||||||
*
|
*
|
||||||
|
@ -335,7 +428,7 @@ public class RetrofitPeertubeAPI {
|
||||||
public APIResponse getVideosForChannel(String channelId, String max_id) {
|
public APIResponse getVideosForChannel(String channelId, String max_id) {
|
||||||
APIResponse apiResponse = new APIResponse();
|
APIResponse apiResponse = new APIResponse();
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
Call<VideoData> videoCall = peertubeService.getChannelVideos(channelId, max_id, count);
|
Call<VideoData> videoCall = peertubeService.getChannelVideos(channelId, max_id, count, showNSFWVideos);
|
||||||
if (videoCall != null) {
|
if (videoCall != null) {
|
||||||
try {
|
try {
|
||||||
Response<VideoData> response = videoCall.execute();
|
Response<VideoData> response = videoCall.execute();
|
||||||
|
@ -380,7 +473,7 @@ public class RetrofitPeertubeAPI {
|
||||||
public APIResponse getHistory(String max_id, String startDate, String endDate) {
|
public APIResponse getHistory(String max_id, String startDate, String endDate) {
|
||||||
APIResponse apiResponse = new APIResponse();
|
APIResponse apiResponse = new APIResponse();
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
Call<VideoData> videoCall = peertubeService.getHistory(getToken(), max_id, count, startDate, endDate);
|
Call<VideoData> videoCall = peertubeService.getHistory(getToken(), max_id, count, showNSFWVideos, startDate, endDate);
|
||||||
if (videoCall != null) {
|
if (videoCall != null) {
|
||||||
try {
|
try {
|
||||||
Response<VideoData> response = videoCall.execute();
|
Response<VideoData> response = videoCall.execute();
|
||||||
|
@ -409,29 +502,29 @@ public class RetrofitPeertubeAPI {
|
||||||
videoCall = peertubeService.getMyVideos(getToken(), max_id, count);
|
videoCall = peertubeService.getMyVideos(getToken(), max_id, count);
|
||||||
break;
|
break;
|
||||||
case ACCOUNT_VIDEOS:
|
case ACCOUNT_VIDEOS:
|
||||||
videoCall = peertubeService.getVideosForAccount(forAccount, max_id, count);
|
videoCall = peertubeService.getVideosForAccount(forAccount, max_id, count, showNSFWVideos);
|
||||||
break;
|
break;
|
||||||
case SUBSCRIBTIONS:
|
case SUBSCRIBTIONS:
|
||||||
if (forAccount == null) {
|
if (forAccount == null) {
|
||||||
videoCall = peertubeService.getSubscriptionVideos(getToken(), max_id, count, filter);
|
videoCall = peertubeService.getSubscriptionVideos(getToken(), max_id, count, filter);
|
||||||
} else {
|
} else {
|
||||||
videoCall = peertubeService.getChannelVideos(forAccount, max_id, count);
|
videoCall = peertubeService.getChannelVideos(forAccount, max_id, count, showNSFWVideos);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MOST_LIKED:
|
case MOST_LIKED:
|
||||||
videoCall = peertubeService.getMostLikedVideos(getToken(), max_id, count, filter);
|
videoCall = peertubeService.getMostLikedVideos(getToken(), max_id, count, showNSFWVideos, filter);
|
||||||
break;
|
break;
|
||||||
case LOCAL:
|
case LOCAL:
|
||||||
videoCall = peertubeService.getLocalVideos(getToken(), max_id, count, filter);
|
videoCall = peertubeService.getLocalVideos(getToken(), max_id, count, showNSFWVideos, filter);
|
||||||
break;
|
break;
|
||||||
case TRENDING:
|
case TRENDING:
|
||||||
videoCall = peertubeService.getTrendingVideos(getToken(), max_id, count, filter);
|
videoCall = peertubeService.getTrendingVideos(getToken(), max_id, count, showNSFWVideos, filter);
|
||||||
break;
|
break;
|
||||||
case HISTORY:
|
case HISTORY:
|
||||||
videoCall = peertubeService.getHistory(getToken(), max_id, count, null, null);
|
videoCall = peertubeService.getHistory(getToken(), max_id, count, showNSFWVideos, null, null);
|
||||||
break;
|
break;
|
||||||
case RECENT:
|
case RECENT:
|
||||||
videoCall = peertubeService.getRecentlyAddedVideos(getToken(), max_id, count, filter);
|
videoCall = peertubeService.getRecentlyAddedVideos(getToken(), max_id, count, showNSFWVideos, filter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (videoCall != null) {
|
if (videoCall != null) {
|
||||||
|
@ -462,7 +555,7 @@ public class RetrofitPeertubeAPI {
|
||||||
APIResponse apiResponse = new APIResponse();
|
APIResponse apiResponse = new APIResponse();
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
ArrayList<String> filter = selection != null ? new ArrayList<>(selection) : null;
|
ArrayList<String> filter = selection != null ? new ArrayList<>(selection) : null;
|
||||||
Call<OverviewVideo> overviewVideoCall = peertubeService.getOverviewVideos(getToken(), page, filter);
|
Call<OverviewVideo> overviewVideoCall = peertubeService.getOverviewVideos(getToken(), page, showNSFWVideos, filter);
|
||||||
try {
|
try {
|
||||||
Response<OverviewVideo> response = overviewVideoCall.execute();
|
Response<OverviewVideo> response = overviewVideoCall.execute();
|
||||||
if (response.isSuccessful() && response.body() != null) {
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
@ -698,6 +791,26 @@ public class RetrofitPeertubeAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get watermark info
|
||||||
|
*
|
||||||
|
* @return PluginData.WaterMark
|
||||||
|
*/
|
||||||
|
public PluginData.WaterMark getWaterMark() {
|
||||||
|
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<PluginData.WaterMark> waterMarkCall = peertubeService.waterMark();
|
||||||
|
try {
|
||||||
|
Response<PluginData.WaterMark> response = waterMarkCall.execute();
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
return response.body();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get video quota
|
* Get video quota
|
||||||
*
|
*
|
||||||
|
@ -732,6 +845,21 @@ public class RetrofitPeertubeAPI {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
peertubeInformation.setCategories(response.body());
|
peertubeInformation.setCategories(response.body());
|
||||||
} else {
|
} else {
|
||||||
|
String categoriesStr = Helper.readFileFromAssets(_context, "categories.json");
|
||||||
|
try {
|
||||||
|
JSONObject obj = new JSONObject(categoriesStr);
|
||||||
|
Iterator<String> iter = obj.keys();
|
||||||
|
LinkedHashMap<Integer, String> data = new LinkedHashMap<>();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
String key = iter.next();
|
||||||
|
try {
|
||||||
|
String value = (String) obj.get(key);
|
||||||
|
data.put(Integer.valueOf(key), value);
|
||||||
|
} catch (JSONException ignored) {}
|
||||||
|
}
|
||||||
|
peertubeInformation.setCategories(data);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
Error error = new Error();
|
Error error = new Error();
|
||||||
error.setStatusCode(response.code());
|
error.setStatusCode(response.code());
|
||||||
if (response.errorBody() != null) {
|
if (response.errorBody() != null) {
|
||||||
|
@ -740,8 +868,25 @@ public class RetrofitPeertubeAPI {
|
||||||
error.setError(_context.getString(R.string.toast_error));
|
error.setError(_context.getString(R.string.toast_error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
String categoriesStr = Helper.readFileFromAssets(_context, "categories.json");
|
||||||
|
try {
|
||||||
|
JSONObject obj = new JSONObject(categoriesStr);
|
||||||
|
Iterator<String> iter = obj.keys();
|
||||||
|
LinkedHashMap<Integer, String> data = new LinkedHashMap<>();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
String key = iter.next();
|
||||||
|
try {
|
||||||
|
String value = (String) obj.get(key);
|
||||||
|
data.put(Integer.valueOf(key), value);
|
||||||
|
} catch (JSONException ignored) {}
|
||||||
|
}
|
||||||
|
peertubeInformation.setCategories(data);
|
||||||
|
} catch (JSONException e2) {
|
||||||
|
e2.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Call<Map<String, String>> languages = peertubeService.getLanguages();
|
Call<Map<String, String>> languages = peertubeService.getLanguages();
|
||||||
try {
|
try {
|
||||||
|
@ -749,6 +894,20 @@ public class RetrofitPeertubeAPI {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
peertubeInformation.setLanguages(response.body());
|
peertubeInformation.setLanguages(response.body());
|
||||||
} else {
|
} else {
|
||||||
|
String languageSrt = Helper.readFileFromAssets(_context, "languages.json");
|
||||||
|
try {
|
||||||
|
JSONObject obj = new JSONObject(languageSrt);
|
||||||
|
Iterator<String> iter = obj.keys();
|
||||||
|
LinkedHashMap<String, String> data = new LinkedHashMap<>();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
String key = iter.next();
|
||||||
|
try {
|
||||||
|
String value = (String) obj.get(key);
|
||||||
|
data.put(key, value);
|
||||||
|
} catch (JSONException ignored) {}
|
||||||
|
}
|
||||||
|
peertubeInformation.setLanguages(data);
|
||||||
|
} catch (JSONException e) {
|
||||||
Error error = new Error();
|
Error error = new Error();
|
||||||
error.setStatusCode(response.code());
|
error.setStatusCode(response.code());
|
||||||
if (response.errorBody() != null) {
|
if (response.errorBody() != null) {
|
||||||
|
@ -757,8 +916,24 @@ public class RetrofitPeertubeAPI {
|
||||||
error.setError(_context.getString(R.string.toast_error));
|
error.setError(_context.getString(R.string.toast_error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
String languageSrt = Helper.readFileFromAssets(_context, "languages.json");
|
||||||
|
try {
|
||||||
|
JSONObject obj = new JSONObject(languageSrt);
|
||||||
|
Iterator<String> iter = obj.keys();
|
||||||
|
LinkedHashMap<String, String> data = new LinkedHashMap<>();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
String key = iter.next();
|
||||||
|
try {
|
||||||
|
String value = (String) obj.get(key);
|
||||||
|
data.put(key, value);
|
||||||
|
} catch (JSONException ignored) {}
|
||||||
|
}
|
||||||
|
peertubeInformation.setLanguages(data);
|
||||||
|
} catch (JSONException e2) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Call<Map<Integer, String>> privacies = peertubeService.getPrivacies();
|
Call<Map<Integer, String>> privacies = peertubeService.getPrivacies();
|
||||||
try {
|
try {
|
||||||
|
@ -902,7 +1077,7 @@ public class RetrofitPeertubeAPI {
|
||||||
*/
|
*/
|
||||||
public APIResponse searchNextVideos(List<String> tags) {
|
public APIResponse searchNextVideos(List<String> tags) {
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
Call<VideoData> searchVideosCall = peertubeService.searchNextVideo(getToken(), tags, "0", "20");
|
Call<VideoData> searchVideosCall = peertubeService.searchNextVideo(getToken(), tags, "0", "20", showNSFWVideos);
|
||||||
APIResponse apiResponse = new APIResponse();
|
APIResponse apiResponse = new APIResponse();
|
||||||
try {
|
try {
|
||||||
Response<VideoData> response = searchVideosCall.execute();
|
Response<VideoData> response = searchVideosCall.execute();
|
||||||
|
@ -928,7 +1103,7 @@ public class RetrofitPeertubeAPI {
|
||||||
*/
|
*/
|
||||||
public APIResponse searchPeertube(String query, String max_id) {
|
public APIResponse searchPeertube(String query, String max_id) {
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
Call<VideoData> searchVideosCall = peertubeService.searchVideos(getToken(), query, max_id, count);
|
Call<VideoData> searchVideosCall = peertubeService.searchVideos(getToken(), query, max_id, count, showNSFWVideos);
|
||||||
APIResponse apiResponse = new APIResponse();
|
APIResponse apiResponse = new APIResponse();
|
||||||
try {
|
try {
|
||||||
Response<VideoData> response = searchVideosCall.execute();
|
Response<VideoData> response = searchVideosCall.execute();
|
||||||
|
@ -1467,7 +1642,10 @@ public class RetrofitPeertubeAPI {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
RequestBody displayName = RequestBody.create(playlistParams.getDisplayName(), MediaType.parse("text/plain"));
|
RequestBody displayName = RequestBody.create(playlistParams.getDisplayName(), MediaType.parse("text/plain"));
|
||||||
RequestBody description = RequestBody.create(playlistParams.getDescription(), MediaType.parse("text/plain"));
|
RequestBody description = null;
|
||||||
|
if (playlistParams.getDescription() != null) {
|
||||||
|
description = RequestBody.create(playlistParams.getDescription(), MediaType.parse("text/plain"));
|
||||||
|
}
|
||||||
RequestBody channelId = RequestBody.create(playlistParams.getVideoChannelId(), MediaType.parse("text/plain"));
|
RequestBody channelId = RequestBody.create(playlistParams.getVideoChannelId(), MediaType.parse("text/plain"));
|
||||||
if (apiAction == PlaylistsVM.action.CREATE_PLAYLIST) {
|
if (apiAction == PlaylistsVM.action.CREATE_PLAYLIST) {
|
||||||
Call<VideoPlaylistData.VideoPlaylistCreation> stringCall = peertubeService.addPlaylist(getToken(), displayName, description, playlistParams.getPrivacy(), channelId, bodyThumbnail);
|
Call<VideoPlaylistData.VideoPlaylistCreation> stringCall = peertubeService.addPlaylist(getToken(), displayName, description, playlistParams.getPrivacy(), channelId, bodyThumbnail);
|
||||||
|
@ -1588,6 +1766,9 @@ public class RetrofitPeertubeAPI {
|
||||||
error.setStatusCode(responseCode);
|
error.setStatusCode(responseCode);
|
||||||
error.setError(_context.getString(R.string.toast_error));
|
error.setError(_context.getString(R.string.toast_error));
|
||||||
}
|
}
|
||||||
|
if (responseCode == 404 || responseCode == 502) {
|
||||||
|
error.setError(_context.getString(R.string.instance_not_availabe));
|
||||||
|
}
|
||||||
apiResponse.setError(error);
|
apiResponse.setError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class AccountData {
|
||||||
private String client_id;
|
private String client_id;
|
||||||
private String client_secret;
|
private String client_secret;
|
||||||
private String refresh_token;
|
private String refresh_token;
|
||||||
|
private String software;
|
||||||
|
|
||||||
public Account() {
|
public Account() {
|
||||||
}
|
}
|
||||||
|
@ -241,6 +241,14 @@ public class AccountData {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSoftware() {
|
||||||
|
return software;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoftware(String software) {
|
||||||
|
this.software = software;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,4 +1,18 @@
|
||||||
package app.fedilab.fedilabtube.client.data;
|
package app.fedilab.fedilabtube.client.data;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
@ -366,6 +380,16 @@ public class InstanceData {
|
||||||
public static class InstanceConfig {
|
public static class InstanceConfig {
|
||||||
@SerializedName("user")
|
@SerializedName("user")
|
||||||
private User user;
|
private User user;
|
||||||
|
@SerializedName("plugin")
|
||||||
|
private PluginData.Plugin plugin;
|
||||||
|
|
||||||
|
public PluginData.Plugin getPlugin() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlugin(PluginData.Plugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
public User getUser() {
|
public User getUser() {
|
||||||
return user;
|
return user;
|
||||||
|
@ -376,6 +400,7 @@ public class InstanceData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class User {
|
public static class User {
|
||||||
@SerializedName("videoQuota")
|
@SerializedName("videoQuota")
|
||||||
private long videoQuota;
|
private long videoQuota;
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
package app.fedilab.fedilabtube.client.data;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
|
public class PluginData {
|
||||||
|
|
||||||
|
public static class Plugin {
|
||||||
|
@SerializedName("registered")
|
||||||
|
private List<PluginInfo> registered;
|
||||||
|
@SerializedName("registeredExternalAuths")
|
||||||
|
private List<PluginInfo> registeredExternalAuths;
|
||||||
|
@SerializedName("registeredIdAndPassAuths")
|
||||||
|
private List<PluginInfo> registeredIdAndPassAuths;
|
||||||
|
|
||||||
|
public List<PluginInfo> getRegistered() {
|
||||||
|
return registered;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegistered(List<PluginInfo> registered) {
|
||||||
|
this.registered = registered;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PluginInfo> getRegisteredExternalAuths() {
|
||||||
|
return registeredExternalAuths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegisteredExternalAuths(List<PluginInfo> registeredExternalAuths) {
|
||||||
|
this.registeredExternalAuths = registeredExternalAuths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PluginInfo> getRegisteredIdAndPassAuths() {
|
||||||
|
return registeredIdAndPassAuths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegisteredIdAndPassAuths(List<PluginInfo> registeredIdAndPassAuths) {
|
||||||
|
this.registeredIdAndPassAuths = registeredIdAndPassAuths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class WaterMark {
|
||||||
|
@SerializedName("publicSettings")
|
||||||
|
private PublicSettings description;
|
||||||
|
|
||||||
|
public PublicSettings getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(PublicSettings description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PublicSettings {
|
||||||
|
@SerializedName("watermark-image-url")
|
||||||
|
private String watermarkImageUrl;
|
||||||
|
@SerializedName("watermark-target-url")
|
||||||
|
private String watermarkTargetUrl;
|
||||||
|
|
||||||
|
public String getWatermarkImageUrl() {
|
||||||
|
return watermarkImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWatermarkImageUrl(String watermarkImageUrl) {
|
||||||
|
this.watermarkImageUrl = watermarkImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWatermarkTargetUrl() {
|
||||||
|
return watermarkTargetUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWatermarkTargetUrl(String watermarkTargetUrl) {
|
||||||
|
this.watermarkTargetUrl = watermarkTargetUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PluginInfo {
|
||||||
|
@SerializedName("description")
|
||||||
|
private String description;
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("version")
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|