Compare commits
198 Commits
Author | SHA1 | Date |
---|---|---|
|
e19526dbf6 | |
|
f6192881d3 | |
|
309c6aa890 | |
|
9f6ac90074 | |
|
8d4418bf2b | |
|
3d85e74957 | |
|
fda17ee8fe | |
|
5696809c1d | |
|
e03147c6da | |
|
7c695f5f82 | |
|
1c6f7858ca | |
|
1ef0389997 | |
|
1c54d44a22 | |
|
724b43ca4d | |
|
ed3d978b03 | |
|
af53071b08 | |
|
bd8e2a50d9 | |
|
e5c918af51 | |
|
4077c5bc55 | |
|
2b43f32772 | |
|
1e0eafef9b | |
|
45b35d0718 | |
|
a9286ab150 | |
|
fcb1974e78 | |
|
2456e8f782 | |
|
ce4913452b | |
|
e605dd8417 | |
|
8434f9ee00 | |
|
61bb7d962d | |
|
35aec32070 | |
|
274bcc8be7 | |
|
ce70df5137 | |
|
d9dca3ef23 | |
|
e3635c3f01 | |
|
2cdabbcb70 | |
|
d5ad9b181b | |
|
540fb3e2dc | |
|
edbe65593b | |
|
d5f394dfea | |
|
d5a5fdf52e | |
|
a7f9256947 | |
|
d769729901 | |
|
b2026c8784 | |
|
b29de141ef | |
|
6d4772da75 | |
|
2344fe0942 | |
|
7c309b68b8 | |
|
c8c5e56a17 | |
|
cef227ba42 | |
|
02296b038a | |
|
b76a4cfcf5 | |
|
f168f101bc | |
|
2e8a86fe20 | |
|
fe0d2fe726 | |
|
9b322cc922 | |
|
346656e53d | |
|
6e6187175a | |
|
5e832fa046 | |
|
34007d4507 | |
|
fd400f025e | |
|
f3f474ee13 | |
|
d971032d52 | |
|
961c77103e | |
|
b22b21c47a | |
|
6d70bd758a | |
|
087ac92f15 | |
|
99fe789f30 | |
|
10892f92f1 | |
|
0a919c85ab | |
|
761abc013f | |
|
327f6f0e8d | |
|
d6f1a360d2 | |
|
24ec69d7f7 | |
|
c80692bd34 | |
|
b5e9f70be6 | |
|
d446081331 | |
|
8178cff72c | |
|
950d99b5de | |
|
b7855cb1a2 | |
|
b298fbfa3e | |
|
d83929f80a | |
|
b932ed2c13 | |
|
36073d340d | |
|
0e14540b69 | |
|
57327a8ad0 | |
|
bbfa278d6b | |
|
439decf6a9 | |
|
2277cc5f05 | |
|
4204ffccee | |
|
31407e709d | |
|
44d26bb1cf | |
|
8a8a433023 | |
|
5c27292543 | |
|
e475348d39 | |
|
9f8358e471 | |
|
4fd8d42d85 | |
|
498990c48a | |
|
1cddf26c9a | |
|
325a239b86 | |
|
2c4ef9c3ce | |
|
4dbd191c4f | |
|
01e489da10 | |
|
53a7062c6d | |
|
3425e1e593 | |
|
9970635ff8 | |
|
c1f174a5b8 | |
|
3587e7c524 | |
|
3911ad15a6 | |
|
d40b35da59 | |
|
ccb6e184cc | |
|
74e45b1820 | |
|
0a1336f0e0 | |
|
d5a0dcb980 | |
|
83e7c41ca0 | |
|
1d1b0c11a9 | |
|
3b2c4e2ac6 | |
|
2d77fe580f | |
|
7ae20f43f8 | |
|
f03c1b206b | |
|
d99a58f2cf | |
|
5aeaf7f34b | |
|
af0b484d16 | |
|
0a6791b752 | |
|
e73e306d05 | |
|
52189abbff | |
|
d721f12d74 | |
|
69f28bb647 | |
|
2b2295d831 | |
|
179586b8c4 | |
|
1afad9e06a | |
|
59c73fd864 | |
|
6820344750 | |
|
680504791c | |
|
41e500a8f8 | |
|
448af1ef9a | |
|
041e8c0bd6 | |
|
0b7300e93a | |
|
94c5f5a705 | |
|
fa2f8a7b05 | |
|
aeb288142e | |
|
635c43f458 | |
|
d36138431b | |
|
9cdf857730 | |
|
52a6152af6 | |
|
9d3312c081 | |
|
1146236f46 | |
|
ec19ee1e55 | |
|
cc37e40158 | |
|
bdd12de34d | |
|
e64692d0d3 | |
|
7da8c0f664 | |
|
fc41c077dc | |
|
50800da4b9 | |
|
a9219e8a91 | |
|
5eedadef47 | |
|
14cde8e625 | |
|
1f2ecd591d | |
|
9a2eb6cd49 | |
|
aa38514bcb | |
|
f2fddfb16c | |
|
05300682c1 | |
|
a3714a4ecf | |
|
500584b9ef | |
|
33ac822957 | |
|
1f6107e238 | |
|
2b7639599c | |
|
dedf7b0163 | |
|
88b5a83fb1 | |
|
efd6b0088f | |
|
ccb5cd20b1 | |
|
668e41bc9b | |
|
46123fa7d6 | |
|
b079965de8 | |
|
842ab914a4 | |
|
fcb93b7dc6 | |
|
f1420fe29e | |
|
23f8674adc | |
|
76a4aa5ae6 | |
|
85ffb4064b | |
|
73c9e639b6 | |
|
5172695784 | |
|
fcc10f97b5 | |
|
0a12020fd8 | |
|
e9c10b17e0 | |
|
f4698f1312 | |
|
1690507a18 | |
|
fbeb87e29e | |
|
de14e95e90 | |
|
35c5713b0a | |
|
413792087e | |
|
21c53d2b4d | |
|
5757a8b1d8 | |
|
680bdf7bd2 | |
|
6911fbd124 | |
|
9fdffc9709 | |
|
0b722a5ecc | |
|
d3ffc32d9b | |
|
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:
|
||||||
|
|
||||||
|
|
139
app/build.gradle
|
@ -1,18 +1,17 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
apply plugin: "androidx.navigation.safeargs"
|
apply plugin: "androidx.navigation.safeargs"
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 30
|
|
||||||
buildToolsVersion "30.0.2"
|
|
||||||
|
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode 29
|
versionCode 45
|
||||||
versionName "1.9.0"
|
versionName "1.15.0"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -32,7 +31,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding true
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
|
@ -40,45 +39,88 @@ 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"
|
||||||
|
resValue "string", "app_name", "TubeAcad"
|
||||||
|
resValue "string", "app_id", "app.fedilab.fedilabtube"
|
||||||
buildConfigField "String", "version", "\"fdroid_acad\""
|
buildConfigField "String", "version", "\"fdroid_acad\""
|
||||||
buildConfigField "boolean", "full_instances", "false"
|
buildConfigField "boolean", "full_instances", "false"
|
||||||
buildConfigField "boolean", "google_restriction", "false"
|
buildConfigField "boolean", "google_restriction", "false"
|
||||||
|
buildConfigField "boolean", "surfing_mode", "false"
|
||||||
|
buildConfigField "boolean", "sepia_search", "false"
|
||||||
|
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"
|
||||||
|
resValue "string", "app_name", "TubeAcad"
|
||||||
|
resValue "string", "app_id", "app.fedilab.fedilabtube"
|
||||||
buildConfigField "String", "version", "\"google_acad\""
|
buildConfigField "String", "version", "\"google_acad\""
|
||||||
buildConfigField "boolean", "full_instances", "false"
|
buildConfigField "boolean", "full_instances", "false"
|
||||||
buildConfigField "boolean", "google_restriction", "true"
|
buildConfigField "boolean", "google_restriction", "true"
|
||||||
|
buildConfigField "boolean", "surfing_mode", "false"
|
||||||
|
buildConfigField "boolean", "sepia_search", "false"
|
||||||
|
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"
|
||||||
|
resValue "string", "app_name", "TubeLab"
|
||||||
|
resValue "string", "app_id", "app.fedilab.tubelab"
|
||||||
buildConfigField "String", "version", "\"fdroid_full\""
|
buildConfigField "String", "version", "\"fdroid_full\""
|
||||||
buildConfigField "boolean", "full_instances", "true"
|
buildConfigField "boolean", "full_instances", "true"
|
||||||
buildConfigField "boolean", "google_restriction", "false"
|
buildConfigField "boolean", "google_restriction", "false"
|
||||||
|
buildConfigField "boolean", "surfing_mode", "true"
|
||||||
|
buildConfigField "boolean", "sepia_search", "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"
|
||||||
|
resValue "string", "app_name", "TubeLab"
|
||||||
|
resValue "string", "app_id", "app.fedilab.tubelab"
|
||||||
buildConfigField "String", "version", "\"google_full\""
|
buildConfigField "String", "version", "\"google_full\""
|
||||||
buildConfigField "boolean", "full_instances", "true"
|
buildConfigField "boolean", "full_instances", "true"
|
||||||
buildConfigField "boolean", "google_restriction", "true"
|
buildConfigField "boolean", "google_restriction", "true"
|
||||||
|
buildConfigField "boolean", "surfing_mode", "true"
|
||||||
|
buildConfigField "boolean", "sepia_search", "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"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,46 +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.1'
|
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.1'
|
implementation 'androidx.navigation:navigation-ui:2.4.2'
|
||||||
implementation ("androidx.navigation:navigation-dynamic-features-fragment:2.3.1")
|
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.2.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'
|
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.0'
|
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"
|
|
||||||
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
|
||||||
|
//************ 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 720 B |
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 937 B After Width: | Height: | Size: 937 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
@ -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>
|
|
@ -1,375 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<string name="app_name" translatable="false">TubeAcad</string>
|
|
||||||
<string name="app_id" translatable="false">app.fedilab.fedilabtube</string>
|
|
||||||
<string name="set_video_mode_choice" translatable="false">set_video_mode_choice</string>
|
|
||||||
<string name="set_video_minimize_choice" translatable="false">set_video_minimize_choice</string>
|
|
||||||
<string name="set_video_language_choice" translatable="false">set_video_language_choice</string>
|
|
||||||
<string name="set_video_quality_choice" translatable="false">set_video_quality_choice</string>
|
|
||||||
<string name="set_video_cache_choice" translatable="false">set_video_cache_choice</string>
|
|
||||||
<string name="set_autoplay_choice" translatable="false">set_autoplay_choice</string>
|
|
||||||
<string name="set_theme_choice" translatable="false">set_theme_choice</string>
|
|
||||||
<string name="set_fullscreen_choice" translatable="false">set_fullscreen_choice</string>
|
|
||||||
<string name="set_autoplay_next_video_choice" translatable="false">set_autoplay_next_video_choice</string>
|
|
||||||
<string name="set_store_in_history" translatable="false">set_store_in_history</string>
|
|
||||||
<string name="set_play_screen_lock_choice" translatable="false">set_play_screen_lock_choice</string>
|
|
||||||
<string name="set_video_in_list_choice" translatable="false">set_video_in_list_choice</string>
|
|
||||||
<string name="set_video_sensitive_choice" translatable="false">set_video_sensitive_choice</string>
|
|
||||||
<string name="set_video_in_list">Vidéos dans une liste</string>
|
|
||||||
<string name="set_video_in_list_description">Change la mise en page pour afficher les vidéos dans une liste</string>
|
|
||||||
|
|
||||||
<string name="_retry">Réessayer</string>
|
|
||||||
<string name="refresh_token_failed">Échec de rafraîchissement du jeton d\'accès</string>
|
|
||||||
<string name="refresh_token_failed_message">Vous pouvez réessayer de le rafraîchir ou simplement déconnecter le compte</string>
|
|
||||||
<string name="export_list">Exporter</string>
|
|
||||||
<string name="import_list">Importer</string>
|
|
||||||
<string name="originally_published">Date de publication</string>
|
|
||||||
|
|
||||||
<string name="delete_history">Supprimer l\'historique de vidéos</string>
|
|
||||||
<string name="delete_history_confirm">Êtes vous sur de vouloir supprimer toutes les vidéos de votre historique ?</string>
|
|
||||||
<string name="export_notification_title">Exportation réussie !</string>
|
|
||||||
<string name="export_notification_content">Cliquer ici pour envoyer l\'exportation par mèl.</string>
|
|
||||||
<string name="export_notification_subjet">Nouvelle liste de lecture</string>
|
|
||||||
<string name="export_notification_body">Ouvrez la pièce jointe avec l\'application TubeAcad</string>
|
|
||||||
|
|
||||||
<string name="show_more">Montrer plus</string>
|
|
||||||
<string name="show_less">Montrer moins</string>
|
|
||||||
<string name="no_instances">Aucune instance !</string>
|
|
||||||
<string name="set_play_screen_lock">Verrouillage d\'écran</string>
|
|
||||||
<string name="set_play_screen_lock_description">Continuer à lire des vidéos lorsque l\'écran est verrouillé</string>
|
|
||||||
|
|
||||||
|
|
||||||
<string name="change_profile_picture">Modifier la photo de profil</string>
|
|
||||||
<string name="account_updated">Le compte a été mis à jour !</string>
|
|
||||||
|
|
||||||
|
|
||||||
<string name="new_video">Nouvelle vidéo</string>
|
|
||||||
<string name="new_blacklist">New blacklist info</string>
|
|
||||||
<string name="new_my_video_published">Your video is published</string>
|
|
||||||
<string name="new_my_video_error">Error when publishing your video</string>
|
|
||||||
<string name="new_comment">New comment</string>
|
|
||||||
<string name="new_follow">New follow</string>
|
|
||||||
|
|
||||||
<string name="notif_new_video">Nouvelle vidéo depuis vos souscriptions</string>
|
|
||||||
<string name="notif_new_comment">Nouveau commentaire sur votre vidéo</string>
|
|
||||||
<string name="notif_blocked">Une de vos vidéos est bloquée/débloquée</string>
|
|
||||||
<string name="notif_video_published">Vidéo publiée (après transcodage / mise à jour programmée)</string>
|
|
||||||
<string name="notif_video_imported">Import de vidéo terminé</string>
|
|
||||||
<string name="notif_new_followers">Vous ou votre chaîne avez/a un·e nouvel·le abonné·e</string>
|
|
||||||
<string name="notif_video_mention">Quelqu\'un vous a mentionné dans les commentaires d\'une vidéo</string>
|
|
||||||
<string name="notif_abuse_received">Un signalement d\'abus a reçu un nouveau message</string>
|
|
||||||
<string name="notif_abuse_accepted">Un de vos rapports d\'abus a été accepté ou rejeté par les modérateurs</string>
|
|
||||||
|
|
||||||
<string name="save">Enregistrer</string>
|
|
||||||
<string name="set_autoplay_next_video">Lire automatiquement la vidéo suivante</string>
|
|
||||||
<string name="set_autoplay_next_video_description">Quand une vidéo est terminée, lire la prochaine vidéo suggérée.</string>
|
|
||||||
|
|
||||||
<string name="enable_history">Activer l\'historique</string>
|
|
||||||
<string name="set_autoplay">Lecture automatique</string>
|
|
||||||
<string name="set_autoplay_description">Si activé, les vidéos seront lues automatiquement</string>
|
|
||||||
|
|
||||||
<string name="set_fullscreen">Plein écran</string>
|
|
||||||
<string name="set_fullscreen_description">Ouvre automatiquement les vidéos en plein écran</string>
|
|
||||||
|
|
||||||
<string name="delete_account_comment">Supprimer tous les commentaires</string>
|
|
||||||
<string name="delete_account_comment_confirm">Etes-vous sûr de vouloir supprimer tous les commentaires de ce compte pour vos vidéos ?</string>
|
|
||||||
<string-array name="settings_theme">
|
|
||||||
<item>Clair</item>
|
|
||||||
<item>Sombre</item>
|
|
||||||
<item>Automatique</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string name="refresh_every">Mettre à jour toutes les :</string>
|
|
||||||
<string-array name="refresh_time">
|
|
||||||
<item>Jamais</item>
|
|
||||||
<item>15 minutes</item>
|
|
||||||
<item>30 minutes</item>
|
|
||||||
<item>1 heure</item>
|
|
||||||
<item>2 heures</item>
|
|
||||||
<item>6 heures</item>
|
|
||||||
<item>12 heures</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<plurals name="number_of_replies">
|
|
||||||
<item quantity="zero">%d réponse</item>
|
|
||||||
<item quantity="one">%d réponse</item>
|
|
||||||
<item quantity="other">%d réponses</item>
|
|
||||||
</plurals>
|
|
||||||
|
|
||||||
<string name="set_theme">Thème</string>
|
|
||||||
<string name="set_theme_description">Permet de changer le thème de l\'application</string>
|
|
||||||
<string name="federation_issue">La vidéo ne peut pas être fédérée !</string>
|
|
||||||
<string name="title_home">Locale</string>
|
|
||||||
<string name="title_local">Locale</string>
|
|
||||||
<string name="title_discover">Découvrir</string>
|
|
||||||
<string name="title_notifications">Notifications</string>
|
|
||||||
<string name="title_recently_added">Nouveautés</string>
|
|
||||||
<string name="title_trending">Tendances</string>
|
|
||||||
<string name="title_most_liked">Plus aimées</string>
|
|
||||||
<string name="toast_error">Une erreur s\'est produite !</string>
|
|
||||||
<string name="title_muted">Sourdine</string>
|
|
||||||
<string name="title_channel">Chaînes</string>
|
|
||||||
<string name="do_not_list">Ne pas lister</string>
|
|
||||||
<string name="blur">Estomper</string>
|
|
||||||
<string name="display">Afficher</string>
|
|
||||||
<string name="no_opinion">Pas d\'opinion</string>
|
|
||||||
<string name="instance_choice">Choisissez une instance</string>
|
|
||||||
<string name="not_valide_instance">Cette instance ne semble pas être valide !</string>
|
|
||||||
<string name="no_videos">Aucune vidéo !</string>
|
|
||||||
<string name="no_notifications">Aucune notification !</string>
|
|
||||||
<string name="favicon">Favicon</string>
|
|
||||||
<string name="open_with">Ouvrir avec</string>
|
|
||||||
<string name="action_playlist_edit">Modifier une liste de lecture</string>
|
|
||||||
<string name="close">Fermer</string>
|
|
||||||
<string name="upload_video">Téléverser</string>
|
|
||||||
<string name="image_preview">Aperçu de l\'image</string>
|
|
||||||
<string name="file_to_upload">Sélectionnez un fichier à transférer</string>
|
|
||||||
<string name="channel">Chaîne</string>
|
|
||||||
<string name="videos">Vidéos</string>
|
|
||||||
<string name="channels">Chaînes</string>
|
|
||||||
<string name="yes">Oui</string>
|
|
||||||
<string name="no">Non</string>
|
|
||||||
<string name="cancel">Annuler</string>
|
|
||||||
<string name="download">Télécharger</string>
|
|
||||||
<string name="profile_picture">Photo du profil</string>
|
|
||||||
<string name="update_video">Mettre à jour la vidéo</string>
|
|
||||||
<string name="remove_from_playlist">Supprimer de la liste de lecture</string>
|
|
||||||
<string name="date_seconds">%d s</string>
|
|
||||||
<string name="date_minutes">%d min</string>
|
|
||||||
<string name="date_hours">%d h</string>
|
|
||||||
<string name="date_day">%d j</string>
|
|
||||||
<string name="number_view_video">%s vues</string>
|
|
||||||
<string name="title_instance_login">Domaine de l\'instance</string>
|
|
||||||
<string name="uploading">Transfert en cours, veuillez patienter …</string>
|
|
||||||
<string name="upload_video_success">La vidéo a été transférée !</string>
|
|
||||||
<string name="toast_cancelled">Transfert annulé !</string>
|
|
||||||
<string name="video_uploaded_action">Cliquez ici pour éditer les données de la vidéo.</string>
|
|
||||||
<string name="toot_select_image_error">Une erreur s’est produite lors de la sélection du média !</string>
|
|
||||||
<string name="download_file">Télécharger %1$s</string>
|
|
||||||
<string name="action_privacy">Confidentialité</string>
|
|
||||||
<string name="action_logout">Déconnexion</string>
|
|
||||||
<string name="login">Connexion</string>
|
|
||||||
<string name="password">Mot de passe</string>
|
|
||||||
<string name="email">Courriel</string>
|
|
||||||
<string name="tags">Étiquettes</string>
|
|
||||||
<string name="validate">Valider</string>
|
|
||||||
<string name="share_with">Partager avec</string>
|
|
||||||
<string name="shared_via">Partagé via TubeLab</string>
|
|
||||||
<string name="username">Nom d’utilisateur</string>
|
|
||||||
<string name="settings">Paramètres</string>
|
|
||||||
<string name="logout_account_confirmation">Voulez-vous vraiment déconnecter le compte @%1$s@%2$s ?</string>
|
|
||||||
<string name="following">Suit</string>
|
|
||||||
<string name="followers">Abonné·e·s</string>
|
|
||||||
<string name="client_error">Impossible d’obtenir l’id du client !</string>
|
|
||||||
<string name="toast_error_loading_account">Une erreur s’est produite pendant le chargement du compte !</string>
|
|
||||||
<string name="toast_error_search">Une erreur s’est produite lors de la recherche !</string>
|
|
||||||
<string name="nothing_to_do">Aucune action ne peut être réalisée</string>
|
|
||||||
<string name="action_follow">S\'abonner</string>
|
|
||||||
<string name="action_mute">Mettre en sourdine</string>
|
|
||||||
<string name="search">Chercher</string>
|
|
||||||
<string name="delete">Supprimer</string>
|
|
||||||
<string name="action_lists_confirm_delete">Êtes-vous sûr de vouloir supprimer définitivement cette liste de lecture ?</string>
|
|
||||||
<string name="action_lists_delete">Supprimer la liste de lecture</string>
|
|
||||||
<string name="no_comments">Soyez le·a premier·ère à laisser un commentaire sur cette vidéo en utilisant le bouton supérieur droit !</string>
|
|
||||||
<string name="comment_no_allowed_peertube">Les commentaires sur cette vidéos ont été désactivés !</string>
|
|
||||||
<string name="pickup_resolution">Choisissez une résolution</string>
|
|
||||||
<string name="bookmark_add_peertube">La vidéo est rajoutée aux favoris !</string>
|
|
||||||
<string name="bookmark_remove_peertube">La vidéo a été retirée de vos favoris !</string>
|
|
||||||
<string name="information" tools:ignore="UnusedResources">Information</string>
|
|
||||||
<string name="app_logo">Logo de l’application</string>
|
|
||||||
<!-- languages not translated -->
|
|
||||||
<string name="subscriptions">Abonnements</string>
|
|
||||||
<string name="delete_instance">Supprimer l\'instance</string>
|
|
||||||
<string name="delete_instance_confirm">Etes-vous sûr de vouloir supprimer cette instance ?</string>
|
|
||||||
|
|
||||||
<string name="delete_comment">Supprimer le commentaire</string>
|
|
||||||
<string name="delete_comment_confirm">Etes-vous sûr de vouloir supprimer ce commentaire ?</string>
|
|
||||||
|
|
||||||
<string name="set_video_mode">Mode pour les vidéos</string>
|
|
||||||
<string name="filter">Filtrer</string>
|
|
||||||
<string name="sepia_search">Recherche sépia</string>
|
|
||||||
<string name="sepia_element_nsfw">Afficher le contenu sensible</string>
|
|
||||||
<string name="sepia_element_published_date">Date de publication</string>
|
|
||||||
<string name="any">Toutes</string>
|
|
||||||
<string name="today">Aujourd\'hui</string>
|
|
||||||
<string name="last_7_days">Les 7 derniers jours</string>
|
|
||||||
<string name="last_30_days">Les 30 derniers jours</string>
|
|
||||||
<string name="last_365_days">Les 365 derniers jours</string>
|
|
||||||
<string name="sepia_element_duration">Durée</string>
|
|
||||||
<string name="duration_short"><![CDATA[Courte (<4 min)]]></string>
|
|
||||||
<string name="duration_medium"><![CDATA[Moyenne (4-10 min)]]></string>
|
|
||||||
<string name="duration_long"><![CDATA[Longue (> 10 min)]]></string>
|
|
||||||
<string name="display_all_categories">Afficher toutes les catégories</string>
|
|
||||||
<string name="display_all_licenses">Afficher toutes les licences</string>
|
|
||||||
<string name="display_all_languages">Afficher toutes les langues</string>
|
|
||||||
<string name="all_of_these_tags">Tous ces labels</string>
|
|
||||||
<string name="one_of_these_tags">Un de ces labels</string>
|
|
||||||
<string name="apply_filter">Appliquer le filtre</string>
|
|
||||||
|
|
||||||
<string name="playback_speed">Vitesse du lecteur</string>
|
|
||||||
<string name="normal">Normal</string>
|
|
||||||
<string-array name="sort_by_array">
|
|
||||||
<item>Meilleurs résultats</item>
|
|
||||||
<item>Les plus récentes</item>
|
|
||||||
<item>Les moins récentes</item>
|
|
||||||
</string-array>
|
|
||||||
<string name="sort_by">Trier par</string>
|
|
||||||
<string name="sepia_search_hint">Mot-clé, chaîne, vidéo, etc.</string>
|
|
||||||
<string name="sepia_indication">La recherche Sepia affiche les vidéos et les chaînes qui correspondent à votre recherche mais qui n\'est pas l\'éditeur, ni le propriétaire. Si vous remarquez des problèmes avec une vidéo, signalez-la aux administrateurs sur le site Web de PeerTube où la vidéo est publiée.</string>
|
|
||||||
<string name="my_videos">Mes vidéos</string>
|
|
||||||
<string name="title">Titre</string>
|
|
||||||
<string name="license">Licence</string>
|
|
||||||
<string name="category">Catégorie</string>
|
|
||||||
<string name="language">Langue</string>
|
|
||||||
<string name="peertube_nsfw">Cette vidéo contient du contenu pour adultes</string>
|
|
||||||
<string name="peertube_enable_comments">Activer les commentaires</string>
|
|
||||||
<string name="description">Libellé</string>
|
|
||||||
<string name="toast_peertube_video_updated">La vidéo a été mise à jour !</string>
|
|
||||||
<string name="register_account">Créer un compte</string>
|
|
||||||
<string name="email_address">Adresse mèl</string>
|
|
||||||
<string name="preview">Aperçu</string>
|
|
||||||
<string name="change_preview">Modifier l\'aperçu</string>
|
|
||||||
<string name="name">Nom</string>
|
|
||||||
<string name="display_more">Afficher plus</string>
|
|
||||||
<string name="no_channels">Aucune chaîne !</string>
|
|
||||||
<string name="report_helper">Quelques explications concernant votre signalement…</string>
|
|
||||||
<string name="report_video">Signaler la vidéo</string>
|
|
||||||
<string name="report">Signaler</string>
|
|
||||||
<string name="change_instance">Changer d\'instance</string>
|
|
||||||
<string name="my_history">Historique</string>
|
|
||||||
<string name="edit">Modifier</string>
|
|
||||||
<string name="video_settings">Réglages des vidéos</string>
|
|
||||||
<string name="app_interface">Interface</string>
|
|
||||||
<string name="set_cache_mode">Cache</string>
|
|
||||||
<string name="set_video_cache_description">Définir le cache pour les vidéos (par défaut 100Mo)</string>
|
|
||||||
<string name="set_video_quality_description">Définir une qualité par défaut pour les vidéos</string>
|
|
||||||
<string name="set_quality_mode">Résolution pour les vidéos</string>
|
|
||||||
<string name="video_cache_value">Cache vidéo : %d Mo</string>
|
|
||||||
<string name="captions">Légendes</string>
|
|
||||||
<string name="pickup_captions">Options d\'envoi</string>
|
|
||||||
<string name="none">Aucune</string>
|
|
||||||
<string name="set_video_mode_description">Permet de changer le mode de lecture pour les vidéos (normal, streaming ou via un navigateur).</string>
|
|
||||||
<string name="delete_video">Supprimer la vidéo</string>
|
|
||||||
<string name="delete_video_confirmation">Êtes-vous sûr de vouloir supprimer cette vidéo ?</string>
|
|
||||||
<string name="no_video_to_display">Aucune vidéo n’est disponible !</string>
|
|
||||||
<string name="share">Partager</string>
|
|
||||||
<string name="peertube_comment_on_video"><![CDATA[<b>%1$s</b> a commenté votre vidéo <b>%2$s</b>]]></string>
|
|
||||||
<string name="peertube_follow_channel"><![CDATA[<b>%1$s</b> suit votre chaîne <b>%2$s</b>]]></string>
|
|
||||||
<string name="peertube_follow_account"><![CDATA[<b>%1$s</b> suit votre compte]]></string>
|
|
||||||
<string name="peertube_video_published"><![CDATA[Votre vidéo <b>%1$s</b> a été publiée]]></string>
|
|
||||||
<string name="peertube_video_import_success"><![CDATA[L’importation de votre vidéo <b>%1$s</b> a réussi]]></string>
|
|
||||||
<string name="peertube_video_import_error"><![CDATA[Échec lors de l’importation de votre vidéo <b>%1$s</b>]]></string>
|
|
||||||
<string name="peertube_video_from_subscription"><![CDATA[<b>%1$s</b> a publié une nouvelle vidéo : <b>%2$s</b>]]></string>
|
|
||||||
<string name="peertube_video_blacklist"><![CDATA[Votre vidéo <b>%1$s</b> a été blacklisté]]></string>
|
|
||||||
<string name="peertube_video_unblacklist"><![CDATA[Votre vidéo <b>%1$s</b> n’est plus blacklisté]]></string>
|
|
||||||
<string name="peertube_video_abuse"><![CDATA[Nouveau signalement pour la vidéo : <b>%1$s</b>]]></string>
|
|
||||||
<string name="add_public_comment">Ajouter un commentaire public</string>
|
|
||||||
<string name="add_public_reply">Répondre publiquement</string>
|
|
||||||
<string name="send_comment">Envoyer un commentaire</string>
|
|
||||||
<string name="all">Tout</string>
|
|
||||||
<string name="activity">Activité</string>
|
|
||||||
<string name="app">App</string>
|
|
||||||
<string name="fetch_notification_channel_name">Mise à jour des notifications</string>
|
|
||||||
<string name="peertube_video_report_success"><![CDATA[ Votre signalement <b>%1$s</b> a été accepté]]></string>
|
|
||||||
<string name="reply">Répondre</string>
|
|
||||||
<!-- end languages -->
|
|
||||||
<string name="playlists">Listes de lecture</string>
|
|
||||||
<string name="display_name">Nom d\'affichage</string>
|
|
||||||
<string name="action_playlist_add">Vous n\'avez aucune liste de lecture. Cliquez sur l\'icône « + » pour en ajouter une</string>
|
|
||||||
<string name="error_display_name">Vous devez fournir un nom d\'affichage !</string>
|
|
||||||
<string name="error_channel_mandatory">Une chaîne est requise lorsque la liste de lecture est publique.</string>
|
|
||||||
<string name="action_playlist_create">Créer une liste de lecture</string>
|
|
||||||
<string name="action_playlist_empty_content">Cette liste de lecture est vide.</string>
|
|
||||||
<string name="password_confirm">Confirmer le mot de passe</string>
|
|
||||||
<string name="agreement_check">J\'accepte les %1$s et les %2$s</string>
|
|
||||||
<string name="server_rules">règles du serveur</string>
|
|
||||||
<string name="tos">conditions de service</string>
|
|
||||||
<string name="sign_up">S’inscrire</string>
|
|
||||||
<string name="all_field_filled">Veuillez remplir tous les champs !</string>
|
|
||||||
<string name="password_error">Les mots de passe ne sont pas identiques !</string>
|
|
||||||
<string name="email_error">L\'e-mail ne semble pas être valide !</string>
|
|
||||||
<string name="email_indicator">Vous recevrez un e-mail de confirmation</string>
|
|
||||||
<string name="password_indicator">Utilisez au moins 8 caractères</string>
|
|
||||||
<string name="password_too_short">Le mot de passe doit contenir au moins 8 caractères</string>
|
|
||||||
<string name="username_error">Le nom d\'utilisateur·rice doit être en minuscule, contenir uniquement des lettres, des chiffres, des points et des caractères de soulignement</string>
|
|
||||||
<string name="account_created">Compte créé !</string>
|
|
||||||
<string name="account_created_message">Votre compte est créé !\n\nVous allez recevoir un email de confirmation à l\'adresse <b>%1$s</b>.\n\nCliquez sur le lien présent dans le mail pour valider votre compte.</string>
|
|
||||||
<string name="account">Compte</string>
|
|
||||||
<string name="report_account">Signaler le compte</string>
|
|
||||||
<string-array name="settings_video_mode">
|
|
||||||
<item>Normal</item>
|
|
||||||
<item>Navigateur</item>
|
|
||||||
<item>Magnet</item>
|
|
||||||
<item>Torrent</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="settings_video_quality">
|
|
||||||
<item>Élevée</item>
|
|
||||||
<item>Moyenne</item>
|
|
||||||
<item>Faible</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string name="unlimited">Illimité</string>
|
|
||||||
<string name="mb">Mo</string>
|
|
||||||
<string name="gb">Go</string>
|
|
||||||
<string name="total_video_quota">Total du quota vidéo</string>
|
|
||||||
<string name="daily_video_quota">Quota vidéo journalier</string>
|
|
||||||
<string name="nsfw_title_warning">Contenu explicite ou sensible</string>
|
|
||||||
<string name="nsfw_message_warning">Cette vidéo contient du contenu sensible. Êtes-vous sûr·e de vouloir la regarder ?</string>
|
|
||||||
<string name="set_autoplay_next_video_settings">Lecture automatique</string>
|
|
||||||
<string name="unfollow_confirm">Voulez-vous vous désabonner de ce compte ?</string>
|
|
||||||
<string name="no_playlist">Aucune liste de lecture !</string>
|
|
||||||
<string name="title_video_peertube">Titre de la vidéo</string>
|
|
||||||
<string name="join_peertube">Rejoignez Peertube</string>
|
|
||||||
<string name="agreement_check_peertube">J\'ai au moins 16 ans et je suis d\'accord avec les %1$s de cette instance</string>
|
|
||||||
<string name="edit_profile">Éditer le profil</string>
|
|
||||||
<string name="make_an_action">Faire une action</string>
|
|
||||||
<string name="action_unfollow">Se désabonner</string>
|
|
||||||
<string name="display_nsfw_videos">Afficher les vidéos sensibles</string>
|
|
||||||
<string name="fullscreen">Vidéo plein écran</string>
|
|
||||||
<string name="bookmark_peertube_empty">Il n’y a aucune vidéo Peertube dans vos favoris !</string>
|
|
||||||
<string name="delete_channel">Supprimer la chaîne</string>
|
|
||||||
<string name="action_channel_confirm_delete">Êtes-vous sûr de vouloir supprimer définitivement cette chaîne ?</string>
|
|
||||||
<string name="modify_playlists">Vidéo dans les listes de lecture</string>
|
|
||||||
<string name="no_muted">Aucun compte en sourdine !</string>
|
|
||||||
<string name="error_display_name_channel">Vous devez fournir un nom d\'affichage et un nom pour la chaîne!</string>
|
|
||||||
<string name="action_channel_create">Créer une chaîne</string>
|
|
||||||
<string name="action_channel_edit">Modifier une chaîne</string>
|
|
||||||
<string name="email_error_domain">Les adresses mails %1$s ne sont pas autorisées !</string>
|
|
||||||
<string name="report_comment_size">Veuillez préciser les raisons.</string>
|
|
||||||
<string name="not_logged_in">Vous devez être connecté.e pour effectuer cette action !</string>
|
|
||||||
<string name="successful_report">Le compte a été signalé !</string>
|
|
||||||
<string name="successful_report_comment">Le commentaire a été signalé !</string>
|
|
||||||
<string name="successful_video_report">La vidéo a été signalée !</string>
|
|
||||||
<string name="password_length_error">Le mot de passe doit contenir 6 caractères !</string>
|
|
||||||
<string name="muted_done">Le compte a été mis en sourdine !</string>
|
|
||||||
<string name="edit_video">Modifier une vidéo</string>
|
|
||||||
<string name="create_an_account">Créer un compte</string>
|
|
||||||
<string name="followers_count">%1$s Abonné·e·s</string>
|
|
||||||
<string name="developer">Développeur</string>
|
|
||||||
<string name="about_vesrion">Version %1$s</string>
|
|
||||||
<string name="about_the_app">À propos de l’application</string>
|
|
||||||
<string name="Donate">Faire un don</string>
|
|
||||||
<string name="source_code">Code source</string>
|
|
||||||
<string name="issue_tracker">Suivi des tickets</string>
|
|
||||||
<string name="action_instance_empty_content">Aucune instance ne correspond à ces critères</string>
|
|
||||||
<string name="instances_picker">Sélecteur d\'instances</string>
|
|
||||||
<string name="pickup_instance">Choisissez une instance</string>
|
|
||||||
<string name="sensitive_video"> Vidéos sensibles</string>
|
|
||||||
<string name="sensitive_content">Contenu sensible : %1$s</string>
|
|
||||||
<string name="followers_instance">%1$s instances suiveuses</string>
|
|
||||||
<string name="help">Aide</string>
|
|
||||||
<string name="pickup_categories">Sélection des catégories</string>
|
|
||||||
<string name="pickup_languages">Sélection des langues</string>
|
|
||||||
<string name="notification_channel_name">Mise à jour des informations</string>
|
|
||||||
<string name="add_account">Ajouter un compte</string>
|
|
||||||
<string name="list_of_accounts">Liste des comptes</string>
|
|
||||||
<string name="pause">Pause</string>
|
|
||||||
<string name="play">Jouer</string>
|
|
||||||
<string name="minimize">Minimiser</string>
|
|
||||||
<string name="fast_rewind">Rembobinage rapide</string>
|
|
||||||
<string name="fast_forward">Avance rapide</string>
|
|
||||||
<string name="set_video_minimize">Minimiser la taille des vidéos</string>
|
|
||||||
<string name="set_video_minimize_description">Minimiser la taille des vidéos lorsque l\'application est en arrière-plan (Android N+)</string>
|
|
||||||
<string name="set_video_language">Filtre de langue</string>
|
|
||||||
<string name="set_video_language_description">Filtrer les vidéos avec différentes langues</string>
|
|
||||||
</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>
|
|
@ -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" />
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
https://fedilab.app
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,5 +0,0 @@
|
||||||
- Nouvelles options :
|
|
||||||
- Mode plein écran automatique
|
|
||||||
- Désactiver la lecture automatique des vidéos
|
|
||||||
|
|
||||||
- Quelques corrections de bugs
|
|
|
@ -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" />
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
https://fedilab.app
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1 +0,0 @@
|
||||||
TubeLab est une application Peertube pour les instances académiques.
|
|
|
@ -1,22 +0,0 @@
|
||||||
*Not authenticated mode*
|
|
||||||
|
|
||||||
It's a limited mode where you can do some actions:
|
|
||||||
|
|
||||||
- Switch instance,
|
|
||||||
- Share videos,
|
|
||||||
- Download videos.
|
|
||||||
|
|
||||||
|
|
||||||
*Authenticated mode*
|
|
||||||
|
|
||||||
Many features are available with this mode:
|
|
||||||
|
|
||||||
- Write/delete comments
|
|
||||||
- Upload/remove/edit videos
|
|
||||||
- Manage (create/edit/remove) channels and playlists
|
|
||||||
- Follow/unfollow channels
|
|
||||||
- Thumbs-up/down
|
|
||||||
- Check notifications
|
|
||||||
- Mute/unmute channels
|
|
||||||
- Report videos/accounts
|
|
||||||
- Check your history
|
|
|
@ -1,15 +0,0 @@
|
||||||
Added:
|
|
||||||
- Allow to search channels
|
|
||||||
- Show storage quota
|
|
||||||
- Warning on Playing NSFW videos
|
|
||||||
- Swipe to change timelines
|
|
||||||
|
|
||||||
Changed:
|
|
||||||
- Improve comment threads
|
|
||||||
- Comment composer in full-screen
|
|
||||||
- Swipe to change timeline
|
|
||||||
|
|
||||||
Fixed:
|
|
||||||
- Status bar for fullscreen not removed
|
|
||||||
- Filter for subscriptions not working with remote accounts
|
|
||||||
- Some crashes
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="#FFFFFF"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<group
|
||||||
|
android:scaleX="1.104"
|
||||||
|
android:scaleY="1.104"
|
||||||
|
android:translateX="-1.248"
|
||||||
|
android:translateY="-1.248">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
After Width: | Height: | Size: 720 B |
After Width: | Height: | Size: 491 B |
After Width: | Height: | Size: 937 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
|
@ -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,287 +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 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;
|
|
||||||
|
|
||||||
@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 = 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) {
|
|
||||||
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.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(Helper.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(Helper.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 = Helper.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(Helper.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://" + Helper.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,21 +94,13 @@ 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) {
|
||||||
donation_container.setVisibility(View.GONE);
|
donation_container.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Developer donation
|
//Developer donation
|
||||||
Button donatePaypal = findViewById(R.id.donate_paypal);
|
Button donatePaypal = findViewById(R.id.donate_paypal);
|
||||||
donatePaypal.setOnClickListener(v -> {
|
donatePaypal.setOnClickListener(v -> {
|
||||||
|
@ -123,14 +109,16 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
Button donateLiberapay = findViewById(R.id.donate_liberapay);
|
Button donateLiberapay = findViewById(R.id.donate_liberapay);
|
||||||
donateLiberapay.setOnClickListener(v -> {
|
donateLiberapay.setOnClickListener(v -> {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79"));
|
Intent browserIntent;
|
||||||
|
browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79"));
|
||||||
|
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
|
@ -197,7 +200,7 @@ public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistA
|
||||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||||
startActivityForResult(intent, PICK_AVATAR);
|
startActivityForResult(intent, PICK_AVATAR);
|
||||||
});
|
});
|
||||||
Helper.loadGiF(AllPlaylistsActivity.this, playlistParam.getThumbnailPath(), bindingDialog.profilePicture);
|
Helper.loadGiF(AllPlaylistsActivity.this, playlistParam != null ? playlistParam.getThumbnailPath() : null, bindingDialog.profilePicture);
|
||||||
alertDialog.setOnShowListener(dialogInterface -> {
|
alertDialog.setOnShowListener(dialogInterface -> {
|
||||||
|
|
||||||
Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
|
@ -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,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.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.Context;
|
import android.content.Context;
|
||||||
|
@ -28,15 +32,15 @@ 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.ImageView;
|
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;
|
||||||
|
@ -48,6 +52,7 @@ import com.kobakei.ratethisapp.RateThisApp;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -55,9 +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.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;
|
||||||
|
@ -69,8 +80,11 @@ 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.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;
|
||||||
|
@ -78,12 +92,8 @@ 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 static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.NORMAL;
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.academies;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends BaseMainActivity {
|
||||||
|
|
||||||
|
|
||||||
public static int PICK_INSTANCE = 5641;
|
public static int PICK_INSTANCE = 5641;
|
||||||
|
@ -91,16 +101,48 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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 final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
|
= item -> {
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
@SuppressLint("ApplySharedPref")
|
||||||
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
||||||
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(activity);
|
AlertDialog.Builder alt_bld = new AlertDialog.Builder(activity);
|
||||||
alt_bld.setTitle(R.string.instance_choice);
|
alt_bld.setTitle(R.string.instance_choice);
|
||||||
String instance = Helper.getLiveInstance(activity);
|
String instance = HelperInstance.getLiveInstance(activity);
|
||||||
final EditText input = new EditText(activity);
|
final EditText input = new EditText(activity);
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
@ -112,6 +154,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
(dialog, which) -> new Thread(() -> {
|
(dialog, which) -> new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
String newInstance = input.getText().toString().trim();
|
String newInstance = input.getText().toString().trim();
|
||||||
|
if (!newInstance.startsWith("http")) {
|
||||||
|
newInstance = "http://" + newInstance;
|
||||||
|
}
|
||||||
|
URL url = new URL(newInstance);
|
||||||
|
newInstance = url.getHost();
|
||||||
|
|
||||||
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
|
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
|
||||||
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
|
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
@ -162,50 +210,28 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
|
||||||
= item -> {
|
@Override
|
||||||
int itemId = item.getItemId();
|
public void onDestroy() {
|
||||||
if (itemId == R.id.navigation_discover) {
|
super.onDestroy();
|
||||||
setTitleCustom(R.string.title_discover);
|
binding = null;
|
||||||
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
|
@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);
|
|
||||||
|
|
||||||
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);
|
||||||
|
@ -241,8 +267,19 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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();
|
||||||
}
|
}
|
||||||
binding.viewpager.setOffscreenPageLimit(5);
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
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() {
|
||||||
|
@ -265,6 +302,9 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
toolbar.setOnClickListener(v -> {
|
toolbar.setOnClickListener(v -> {
|
||||||
|
if (binding.viewpager.getAdapter() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof DisplayVideosFragment) {
|
if (binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof DisplayVideosFragment) {
|
||||||
((DisplayVideosFragment) binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem())).scrollToTop();
|
((DisplayVideosFragment) binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem())).scrollToTop();
|
||||||
} else if (binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof DisplayOverviewFragment) {
|
} else if (binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof DisplayOverviewFragment) {
|
||||||
|
@ -275,12 +315,11 @@ public class MainActivity extends AppCompatActivity {
|
||||||
setTitleCustom(R.string.title_discover);
|
setTitleCustom(R.string.title_discover);
|
||||||
|
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
binding.navView.inflateMenu(R.menu.bottom_nav_menu_connected);
|
||||||
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<>());
|
||||||
|
@ -298,6 +337,20 @@ public class MainActivity extends AppCompatActivity {
|
||||||
if (!BuildConfig.full_instances) {
|
if (!BuildConfig.full_instances) {
|
||||||
PlaylistExportHelper.manageIntentUrl(MainActivity.this, getIntent());
|
PlaylistExportHelper.manageIntentUrl(MainActivity.this, getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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) {
|
||||||
|
super.discoverCast();
|
||||||
|
}
|
||||||
|
//Instance
|
||||||
|
if(HelperInstance.getLiveInstance(MainActivity.this) == null) {
|
||||||
|
Intent intent = new Intent(MainActivity.this, InstancePickerActivity.class);
|
||||||
|
startActivityForResult(intent, PICK_INSTANCE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisplayVideosFragment getSubscriptionFragment() {
|
public DisplayVideosFragment getSubscriptionFragment() {
|
||||||
|
@ -313,11 +366,17 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 = Helper.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);
|
||||||
String userIdShar = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userIdShar = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
@ -335,25 +394,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
oauthParams.setAccess_token(account.getToken());
|
oauthParams.setAccess_token(account.getToken());
|
||||||
try {
|
try {
|
||||||
Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams);
|
Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams);
|
||||||
if (token == null && Helper.instanceOnline(instance)) {
|
if (token == null) {
|
||||||
runOnUiThread(() -> {
|
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
|
|
||||||
alt_bld.setTitle(R.string.refresh_token_failed);
|
|
||||||
alt_bld.setMessage(R.string.refresh_token_failed_message);
|
|
||||||
alt_bld.setNegativeButton(R.string.action_logout, (dialog, id) -> {
|
|
||||||
dialog.dismiss();
|
|
||||||
Helper.logoutCurrentUser(MainActivity.this, finalAccount);
|
|
||||||
});
|
|
||||||
alt_bld.setPositiveButton(R.string._retry, (dialog, id) -> {
|
|
||||||
dialog.dismiss();
|
|
||||||
refreshToken();
|
|
||||||
});
|
|
||||||
AlertDialog alert = alt_bld.create();
|
|
||||||
alert.show();
|
|
||||||
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
} else if (token == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
|
@ -391,7 +432,22 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
instanceConfig = new RetrofitPeertubeAPI(MainActivity.this).getConfigInstance();
|
instanceConfig = new RetrofitPeertubeAPI(MainActivity.this).getConfigInstance();
|
||||||
} catch (Error error) {
|
} catch (Error error) {
|
||||||
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
runOnUiThread(() -> {
|
||||||
|
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
|
||||||
|
alt_bld.setTitle(R.string.refresh_token_failed);
|
||||||
|
alt_bld.setMessage(R.string.refresh_token_failed_message);
|
||||||
|
alt_bld.setNegativeButton(R.string.action_logout, (dialog, id) -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
Helper.logoutCurrentUser(MainActivity.this, finalAccount);
|
||||||
|
});
|
||||||
|
alt_bld.setPositiveButton(R.string._retry, (dialog, id) -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
refreshToken();
|
||||||
|
});
|
||||||
|
AlertDialog alert = alt_bld.create();
|
||||||
|
alert.show();
|
||||||
|
|
||||||
|
});
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +463,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextSubmit(String query) {
|
public boolean onQueryTextSubmit(String query) {
|
||||||
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$");
|
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})(\\?start=(\\d+[hH])?(\\d+[mM])?(\\d+[sS])?)?$");
|
||||||
Matcher matcherLink = link.matcher(query.trim());
|
Matcher matcherLink = link.matcher(query.trim());
|
||||||
if (matcherLink.find()) {
|
if (matcherLink.find()) {
|
||||||
Intent intent = new Intent(MainActivity.this, PeertubeActivity.class);
|
Intent intent = new Intent(MainActivity.this, PeertubeActivity.class);
|
||||||
|
@ -443,25 +499,31 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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);
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
FrameLayout rootView = (FrameLayout) accountItem.getActionView();
|
||||||
ImageView instances = toolbar.findViewById(R.id.instances);
|
|
||||||
if (BuildConfig.full_instances && ((Helper.isLoggedIn(MainActivity.this) && typeOfConnection == NORMAL) || typeOfConnection == SURFING)) {
|
FrameLayout redCircle = rootView.findViewById(R.id.view_alert_red_circle);
|
||||||
instances.setVisibility(View.VISIBLE);
|
TextView countTextView = rootView.findViewById(R.id.view_alert_count_textview);
|
||||||
instances.setOnClickListener(null);
|
//change counter for notifications
|
||||||
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 {
|
||||||
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);
|
||||||
|
@ -471,10 +533,13 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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);
|
||||||
|
@ -486,18 +551,16 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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);
|
||||||
|
@ -510,17 +573,18 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!BuildConfig.full_instances) {
|
if (!BuildConfig.sepia_search) {
|
||||||
sepiaSearchItem.setVisible(false);
|
sepiaSearchItem.setVisible(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkIfConnectedUsers() {
|
private void checkIfConnectedUsers() {
|
||||||
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) {
|
||||||
|
@ -536,15 +600,29 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}).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);
|
||||||
|
@ -553,39 +631,40 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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)) {
|
||||||
|
@ -594,15 +673,15 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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);
|
||||||
|
@ -621,8 +700,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}).start();
|
}).start();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (type != null) {
|
||||||
return super.onOptionsItemSelected(item);
|
Matomo.sendScreen(MainActivity.this, action, type);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -648,16 +729,23 @@ public class MainActivity extends AppCompatActivity {
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
|
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
|
||||||
alt_bld.setTitle(R.string.instance_choice);
|
alt_bld.setTitle(R.string.instance_choice);
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String acad = Helper.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 (Helper.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();
|
||||||
|
@ -679,11 +767,18 @@ public class MainActivity extends AppCompatActivity {
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.PREF_INSTANCE, String.valueOf(data.getData()));
|
editor.putString(Helper.PREF_INSTANCE, String.valueOf(data.getData()));
|
||||||
editor.commit();
|
editor.commit();
|
||||||
finish();
|
recreate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum TypeOfConnection {
|
||||||
|
UNKNOWN,
|
||||||
|
NORMAL,
|
||||||
|
SURFING,
|
||||||
|
REMOTE_ACCOUNT,
|
||||||
|
}
|
||||||
|
|
||||||
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
|
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
ScreenSlidePagerAdapter(FragmentManager fm) {
|
ScreenSlidePagerAdapter(FragmentManager fm) {
|
||||||
|
@ -696,42 +791,38 @@ public class MainActivity extends AppCompatActivity {
|
||||||
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 null;
|
return overviewFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return 5;
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|