forked from mirrors/Fedilab
Compare commits
330 commits
Author | SHA1 | Date | |
---|---|---|---|
a06fb1657d | |||
|
97ba87aba7 | ||
|
7603db8ce0 | ||
|
663e33466d | ||
|
cbed3f1ae1 | ||
|
8bdaf8d410 | ||
|
6595af849e | ||
|
4111d00025 | ||
|
f75d8258f4 | ||
|
7a11e156a5 | ||
|
8977990fea | ||
|
bc44a9be15 | ||
|
88d9bf4629 | ||
|
65706e727c | ||
|
b64fd393e9 | ||
|
2b300ceae4 | ||
|
6e4bb95dda | ||
|
440ad039be | ||
|
4c89a855c6 | ||
|
0ca53b75d2 | ||
|
91eb579e2c | ||
|
1aad4f07df | ||
|
335842c8a2 | ||
|
c10d078add | ||
|
67cdceb90e | ||
|
ddbd3f8684 | ||
|
4ae8011eff | ||
|
d61dbb0315 | ||
|
3c13bf7199 | ||
|
b19cd7c0c9 | ||
|
17438f6f5c | ||
|
f05ab805ff | ||
|
212cd9d54e | ||
|
f4437b6955 | ||
|
e8950f03ae | ||
|
0e16cb1730 | ||
|
67cfa9cf01 | ||
|
7bdf2aa1ad | ||
|
44676707f0 | ||
|
d9e92b13b6 | ||
|
833ea5d0c3 | ||
|
04c5f32c53 | ||
|
93d5995ec1 | ||
|
d679d1fb73 | ||
|
f8b0ed7f18 | ||
|
d83f787956 | ||
|
b958e24dc9 | ||
|
e61de6eb1d | ||
|
b89212a4f6 | ||
|
c37d8ab34f | ||
|
ca5b37edfe | ||
|
408e51c0a6 | ||
|
9fd834eb44 | ||
|
58f3d01c87 | ||
|
de46b38991 | ||
|
926caf2f3f | ||
|
8bbe897483 | ||
|
59ba9134e7 | ||
|
83e68742be | ||
|
9a38da9475 | ||
|
c8d0931d8e | ||
|
4d643ae28f | ||
|
33b8dd36e4 | ||
|
25d3803e69 | ||
|
7b08bf77bf | ||
|
3f1af73b0e | ||
|
a22dd088a5 | ||
|
e88c53d950 | ||
|
a160d3e212 | ||
|
dacfba7043 | ||
|
9683fee1e6 | ||
|
575329586f | ||
|
a866f5524a | ||
|
654f7850de | ||
|
b52ab37aed | ||
|
554335aa6e | ||
|
96abece6da | ||
|
8103bf4a16 | ||
|
e4affdc9d7 | ||
|
90a6a6ceaa | ||
|
a97448438a | ||
|
557e973fca | ||
|
98385aa706 | ||
|
7119c12467 | ||
|
3d1d9534be | ||
|
b94c08d029 | ||
|
42cf16b545 | ||
|
bebe315b08 | ||
|
6a359bbbf8 | ||
|
42bdcaf6b6 | ||
|
27641128c3 | ||
|
be0a85cb3a | ||
|
f11c0e3d58 | ||
|
58e7346f71 | ||
|
fc34de1da4 | ||
|
bf8543bc77 | ||
|
8b26deb064 | ||
|
6ef2683e5e | ||
|
e0b12ab0e2 | ||
|
5ce553f8cf | ||
|
44ff9225bc | ||
|
206d5c7e74 | ||
|
50698f7325 | ||
|
6e8381396f | ||
|
e87a347354 | ||
|
7b071eb9eb | ||
|
77fbebf4a7 | ||
|
c09a7a3c2b | ||
|
1b429a31a2 | ||
|
82a5bfebb4 | ||
|
4c5232039a | ||
|
74afdc0a7a | ||
|
1de94be096 | ||
|
5c6745dacc | ||
|
66161f4eb3 | ||
|
d77dd2c349 | ||
|
e9571221be | ||
|
a33ddf3e51 | ||
|
84073c8df4 | ||
|
1e9b701f58 | ||
|
b48d7adaed | ||
|
b6a4fb03fc | ||
|
05dfc73d94 | ||
|
850805b562 | ||
|
bf5e092f7d | ||
|
f2799e939c | ||
|
ff6244883a | ||
|
13fa111394 | ||
|
f8e22c4a9d | ||
|
fdec78fd61 | ||
|
2e262e3156 | ||
|
3d11a064bd | ||
|
688ff330db | ||
|
4ded712634 | ||
|
a7a8cb6c90 | ||
|
c2d270696d | ||
|
47c66185a3 | ||
|
b83ffa4dcf | ||
|
c994ccca0c | ||
|
d3bb4a285b | ||
|
5b4f7d70b6 | ||
|
e50c0fa9fe | ||
|
0da6ff2c0c | ||
|
f72e9cb26f | ||
|
60bafb2d32 | ||
|
d103844496 | ||
|
e134d23594 | ||
|
7bc983d345 | ||
|
255eeac0a5 | ||
|
3b30708954 | ||
|
e0e2f7789b | ||
|
ef5a211f57 | ||
|
939023b71e | ||
|
89c30f16f0 | ||
|
f8641a953a | ||
|
a1f97d7cfa | ||
|
21abe0e297 | ||
|
d5c51e6dca | ||
|
25ad71080e | ||
|
4584630883 | ||
|
5733eed8bc | ||
|
e0deba141a | ||
|
1a66bd5d89 | ||
|
72a79766b8 | ||
|
7751646d50 | ||
|
97e15dd37f | ||
|
ce9d4c2cd3 | ||
|
3ab25e3333 | ||
|
80f6fb2382 | ||
|
1768a85cbd | ||
|
eaecabe7b7 | ||
|
ae7394888d | ||
|
27423a6ab5 | ||
|
a5d1e8efe0 | ||
|
3a8f037be5 | ||
|
f5b0eacfab | ||
|
0740f6399b | ||
|
8dfd55fe10 | ||
|
3046a8a391 | ||
|
ef8bf95c28 | ||
|
7e1a8c1af3 | ||
|
7c9b67584d | ||
|
fda91e7d3d | ||
|
dcbaa32aa2 | ||
|
71c7d0a1fa | ||
|
b1d9d3016f | ||
|
447ad45fc6 | ||
|
d3f721f7cc | ||
|
107ac13e15 | ||
|
d70c285bea | ||
|
bb2b66ce6a | ||
|
849967fe97 | ||
|
bb68512502 | ||
|
ae31abaa3b | ||
|
80927bfa9c | ||
|
1ef01af199 | ||
|
d5a5f08727 | ||
|
e03c02cc35 | ||
|
c37f4bb643 | ||
|
098e2d87ec | ||
|
fd6d487060 | ||
|
af10d647b9 | ||
|
31025af9ab | ||
|
8162e3f171 | ||
|
316e750004 | ||
|
edc4f1357e | ||
|
ac503cdf0c | ||
|
bc8dfec325 | ||
|
39f248e0a6 | ||
|
f966874550 | ||
|
7704e15e31 | ||
|
b0e01e5bf1 | ||
|
4ec8496124 | ||
|
b54c36627c | ||
|
884e8d35de | ||
|
8154c3425e | ||
|
7e76d68466 | ||
|
a01ffab237 | ||
|
d97a78362c | ||
|
4ccd299fda | ||
|
1fe0701342 | ||
|
902d5176ff | ||
|
0a2effe591 | ||
|
e6139c129f | ||
|
fafb7dc301 | ||
|
8c98b9e46d | ||
|
1a8108d5e0 | ||
|
466da9a0b3 | ||
|
da122028c9 | ||
|
000552c090 | ||
|
47e43193b8 | ||
|
4057a04302 | ||
|
6df271c319 | ||
|
32f9264558 | ||
|
3ea4559f69 | ||
|
cd4df2d29a | ||
|
e23d2caf00 | ||
|
566b50d394 | ||
|
d77f1fc9f6 | ||
|
c052e376e2 | ||
|
7e1d9b8910 | ||
|
17d6152af3 | ||
|
caa14ecaa9 | ||
|
56b82461b5 | ||
|
1e807725e1 | ||
|
8fe26abec7 | ||
|
9e701f82ba | ||
|
97e3d7ed19 | ||
|
1c650b56f1 | ||
|
31bdafe5fd | ||
|
ca85e500a5 | ||
|
229262d478 | ||
|
12611a116b | ||
|
9d6a2057ab | ||
|
785257cc6c | ||
|
4e9af2abb2 | ||
|
b45a007797 | ||
|
e726b6a540 | ||
|
f6eedc3eb5 | ||
|
db8d57b18d | ||
|
f3391b1ac6 | ||
|
d6a5d2a1c7 | ||
|
f7205fbbbb | ||
|
090fbce96a | ||
|
10ce384282 | ||
|
9dbf8ccdc0 | ||
|
ba4456f305 | ||
|
299df2cd59 | ||
|
a78a3580b3 | ||
|
886f066071 | ||
|
f140b2883a | ||
|
5480ff91d2 | ||
|
3210530975 | ||
|
807530f8d6 | ||
|
a81f27faff | ||
|
2ebbc27c0a | ||
|
1edd554fde | ||
|
580024e1b9 | ||
|
d9f477a57f | ||
|
aea0f8ca83 | ||
|
df5354ec1e | ||
|
66acb1b8d8 | ||
|
537bb3f622 | ||
|
da2ce8bce4 | ||
|
508f3c6253 | ||
|
64e50bd8b5 | ||
|
ccdbc2f45a | ||
|
6a98b4db48 | ||
|
0ec4e0c51b | ||
|
0d1107ec15 | ||
|
cbc5eddc9c | ||
|
61798a7ce1 | ||
|
7303e7faa8 | ||
|
95f4059509 | ||
|
c590ab48f5 | ||
|
8fb7e4dc71 | ||
|
a6f25737f7 | ||
|
f4748cef95 | ||
|
e450589f76 | ||
|
ec9e0dbbda | ||
|
56e372a2f6 | ||
|
f976b6dd72 | ||
|
f81ba544a3 | ||
|
818f32ffb5 | ||
|
112701dd86 | ||
|
c3006080ba | ||
|
12fae6059a | ||
|
90b9291dab | ||
|
b1c22713b1 | ||
|
a859f3cbef | ||
|
31929850c3 | ||
|
e5c4efb4e9 | ||
|
7b84049014 | ||
|
2164c2fe91 | ||
|
4d5be03db6 | ||
|
1defbdad83 | ||
|
9466a76071 | ||
|
d55baa92af | ||
|
23cd690f33 | ||
|
cfcab79cf8 | ||
|
6ff29f3514 | ||
|
3a87f65b33 | ||
|
f1940f5f24 | ||
|
4b1897921a | ||
|
7fc812073e | ||
|
bbf1f20a67 | ||
|
4e12d3fcdd | ||
|
8cc8e01614 | ||
|
b91f249efc | ||
|
51fc16f4a2 |
1443 changed files with 55433 additions and 7975 deletions
|
@ -13,8 +13,8 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 456
|
versionCode 477
|
||||||
versionName "3.13.2"
|
versionName "3.17.0"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
|
@ -63,6 +63,21 @@ android {
|
||||||
java.srcDirs = ['src/main/java', 'src/fdroid/java']
|
java.srcDirs = ['src/main/java', 'src/fdroid/java']
|
||||||
res.srcDirs = ['src/main/res', 'src/fdroid/res']
|
res.srcDirs = ['src/main/res', 'src/fdroid/res']
|
||||||
}
|
}
|
||||||
|
main {
|
||||||
|
res.srcDirs = [
|
||||||
|
'src/main/res/layouts/mastodon',
|
||||||
|
'src/main/res/layouts/peertube',
|
||||||
|
'src/main/res/layouts',
|
||||||
|
'src/main/layout',
|
||||||
|
'src/main/res/drawables/mastodon',
|
||||||
|
'src/main/res/drawables/peertube',
|
||||||
|
'src/main/res/drawables',
|
||||||
|
'src/main/res/menus/mastodon',
|
||||||
|
'src/main/res/menus/peertube',
|
||||||
|
'src/main/res/menus',
|
||||||
|
'src/main/res'
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
configurations {
|
configurations {
|
||||||
all {
|
all {
|
||||||
|
@ -78,7 +93,7 @@ allprojects {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':autoimageslider')
|
implementation project(':autoimageslider')
|
||||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
implementation 'androidx.appcompat:appcompat:1.6.0'
|
||||||
|
|
||||||
implementation 'com.google.android.material:material:1.7.0'
|
implementation 'com.google.android.material:material:1.7.0'
|
||||||
|
|
||||||
|
@ -94,19 +109,23 @@ dependencies {
|
||||||
implementation "org.conscrypt:conscrypt-android:2.5.2"
|
implementation "org.conscrypt:conscrypt-android:2.5.2"
|
||||||
implementation 'com.vanniktech:emoji-one:0.6.0'
|
implementation 'com.vanniktech:emoji-one:0.6.0'
|
||||||
implementation 'com.github.GrenderG:Toasty:1.5.2'
|
implementation 'com.github.GrenderG:Toasty:1.5.2'
|
||||||
implementation 'org.framagit.tom79:SparkButton:1.0.13'
|
|
||||||
implementation "com.github.bumptech.glide:glide:4.14.2"
|
implementation "com.github.bumptech.glide:glide:4.14.2"
|
||||||
implementation "com.github.bumptech.glide:okhttp3-integration:4.14.2"
|
implementation "com.github.bumptech.glide:okhttp3-integration:4.14.2"
|
||||||
|
implementation("com.github.bumptech.glide:recyclerview-integration:4.14.2") {
|
||||||
|
// Excludes the support library because it's already included by Glide.
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
|
||||||
implementation "org.jsoup:jsoup:1.15.1"
|
implementation "org.jsoup:jsoup:1.15.1"
|
||||||
|
|
||||||
implementation 'com.github.mergehez:ArgPlayer:v3.1'
|
implementation 'com.github.mergehez:ArgPlayer:v3.1'
|
||||||
implementation project(path: ':mytransl')
|
implementation project(path: ':mytransl')
|
||||||
implementation project(path: ':ratethisapp')
|
implementation project(path: ':ratethisapp')
|
||||||
|
implementation project(path: ':sparkbutton')
|
||||||
|
|
||||||
implementation 'com.burhanrashid52:photoeditor:1.5.1'
|
implementation 'com.burhanrashid52:photoeditor:1.5.1'
|
||||||
implementation("com.vanniktech:android-image-cropper:4.3.3")
|
implementation("com.vanniktech:android-image-cropper:4.3.3")
|
||||||
|
implementation project(path: ':mathjaxandroid')
|
||||||
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
|
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
|
||||||
implementation 'jp.wasabeef:glide-transformations:4.3.0'
|
implementation 'jp.wasabeef:glide-transformations:4.3.0'
|
||||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.23.0'
|
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.23.0'
|
||||||
|
@ -139,8 +158,50 @@ dependencies {
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
|
||||||
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
|
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
|
||||||
|
implementation 'com.r0adkll:slidableactivity:2.1.0'
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
|
||||||
|
|
||||||
|
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||||
|
implementation "androidx.fragment:fragment:1.5.5"
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
|
implementation 'androidx.browser:browser:1.4.0'
|
||||||
|
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||||
|
implementation 'com.github.amoskorir:avatarimagegenerator:1.5.0'
|
||||||
|
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
|
||||||
|
implementation 'com.google.android.exoplayer:extension-mediasession:2.18.1'
|
||||||
|
implementation "com.github.mabbas007:TagsEditText:1.0.5"
|
||||||
|
implementation "net.gotev:uploadservice:4.7.0"
|
||||||
|
implementation "net.gotev:uploadservice-okhttp:4.7.0"
|
||||||
|
implementation 'androidx.media:media:1.6.0'
|
||||||
|
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
|
||||||
|
|
||||||
|
implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.0'
|
||||||
|
|
||||||
|
|
||||||
|
//************ CAST **************///
|
||||||
|
|
||||||
|
//---> Google libs (google_full)
|
||||||
|
playstoreImplementation "com.google.android.gms:play-services-cast-tv:19.0.1"
|
||||||
|
playstoreImplementation "com.google.android.gms:play-services-cast:21.0.1"
|
||||||
|
playstoreImplementation "androidx.mediarouter:mediarouter:1.3.0"
|
||||||
|
playstoreImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1'
|
||||||
|
|
||||||
|
playstoreImplementation "com.google.android.gms:play-services-cast-tv:19.0.1"
|
||||||
|
playstoreImplementation "com.google.android.gms:play-services-cast:21.0.1"
|
||||||
|
playstoreImplementation "androidx.mediarouter:mediarouter:1.3.0"
|
||||||
|
playstoreImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1'
|
||||||
|
|
||||||
|
//----> Other flavors
|
||||||
|
fdroidImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||||
|
fdroidImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||||
|
fdroidImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||||
|
fdroidImplementation 'com.github.evozi:Cyanea:1.0.7'
|
||||||
|
|
||||||
|
fdroidImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||||
|
fdroidImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||||
|
fdroidImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||||
|
|
||||||
}
|
}
|
||||||
def getCurrentFlavor() {
|
def getCurrentFlavor() {
|
||||||
Gradle gradle = getGradle()
|
Gradle gradle = getGradle()
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package app.fedilab.android;
|
package app.fedilab.android;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instrumented test, which will execute on an Android device.
|
* Instrumented test, which will execute on an Android device.
|
||||||
*
|
*
|
||||||
|
|
19
app/src/debug/res/xml/compose_shortcuts.xml
Normal file
19
app/src/debug/res/xml/compose_shortcuts.xml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="compose"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@drawable/ic_baseline_add_comment_24"
|
||||||
|
android:shortcutShortLabel="@string/compose_shortcut_short_label1"
|
||||||
|
tools:targetApi="n_mr1">
|
||||||
|
<intent
|
||||||
|
android:action="app.fedilab.android.shorcut.compose"
|
||||||
|
android:targetClass="app.fedilab.android.activities.MainActivity"
|
||||||
|
android:targetPackage="fr.gouv.etalab.mastodon.debug" />
|
||||||
|
|
||||||
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
<capability-binding android:key="actions.intent.CREATE_MESSAGE" />
|
||||||
|
</shortcut>
|
||||||
|
|
||||||
|
|
||||||
|
</shortcuts>
|
|
@ -0,0 +1,211 @@
|
||||||
|
package app.fedilab.android.activities;
|
||||||
|
/* Copyright 2023 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Fedilab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Fedilab 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 Fedilab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import static app.fedilab.android.peertube.helper.Helper.CAST_ID;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.ExoPlayer;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.GeneralSecurityException;
|
||||||
|
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.databinding.ActivityPeertubeBinding;
|
||||||
|
import app.fedilab.android.mastodon.activities.BaseBarActivity;
|
||||||
|
import app.fedilab.android.peertube.client.data.VideoData;
|
||||||
|
import app.fedilab.android.peertube.helper.Helper;
|
||||||
|
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||||
|
import su.litvak.chromecast.api.v2.MediaStatus;
|
||||||
|
import su.litvak.chromecast.api.v2.Status;
|
||||||
|
|
||||||
|
|
||||||
|
public class BasePeertubeActivity extends BaseBarActivity {
|
||||||
|
|
||||||
|
protected ActivityPeertubeBinding binding;
|
||||||
|
protected VideoData.Video peertube;
|
||||||
|
protected ExoPlayer player;
|
||||||
|
protected String videoURL;
|
||||||
|
protected String subtitlesStr;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
|
||||||
|
|
||||||
|
binding.minController.castPlay.setOnClickListener(v -> {
|
||||||
|
binding.minController.castLoader.setVisibility(View.VISIBLE);
|
||||||
|
if (PeertubeBaseMainActivity.chromeCast != null) {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
int icon = -1;
|
||||||
|
if (PeertubeBaseMainActivity.chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
||||||
|
PeertubeBaseMainActivity.chromeCast.pause();
|
||||||
|
icon = R.drawable.ic_baseline_play_arrow_32;
|
||||||
|
} else if (PeertubeBaseMainActivity.chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PAUSED) {
|
||||||
|
PeertubeBaseMainActivity.chromeCast.play();
|
||||||
|
icon = R.drawable.ic_baseline_pause_32;
|
||||||
|
}
|
||||||
|
if (icon != -1) {
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
int finalIcon = icon;
|
||||||
|
Runnable myRunnable = () -> binding.minController.castPlay.setImageResource(finalIcon);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
}
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> binding.minController.castLoader.setVisibility(View.GONE);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == R.id.action_cast) {
|
||||||
|
if (PeertubeBaseMainActivity.chromeCasts != null && PeertubeBaseMainActivity.chromeCasts.size() > 0) {
|
||||||
|
String[] chromecast_choice = new String[PeertubeBaseMainActivity.chromeCasts.size()];
|
||||||
|
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(this);
|
||||||
|
alt_bld.setTitle(R.string.chromecast_choice);
|
||||||
|
int i = 0;
|
||||||
|
for (ChromeCast cc : PeertubeBaseMainActivity.chromeCasts) {
|
||||||
|
chromecast_choice[i] = cc.getTitle();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
for (ChromeCast cc : PeertubeBaseMainActivity.chromeCasts) {
|
||||||
|
if (PeertubeBaseMainActivity.chromecastActivated && cc.isConnected()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
alt_bld.setSingleChoiceItems(chromecast_choice, i, (dialog, position) -> {
|
||||||
|
PeertubeBaseMainActivity.chromeCast = PeertubeBaseMainActivity.chromeCasts.get(position);
|
||||||
|
new Thread(() -> {
|
||||||
|
if (PeertubeBaseMainActivity.chromeCast != null) {
|
||||||
|
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
if (PeertubeBaseMainActivity.chromecastActivated) {
|
||||||
|
b.putInt("displayed", 0);
|
||||||
|
intentBC.putExtras(b);
|
||||||
|
LocalBroadcastManager.getInstance(BasePeertubeActivity.this).sendBroadcast(intentBC);
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> {
|
||||||
|
binding.doubleTapPlayerView.setVisibility(View.VISIBLE);
|
||||||
|
binding.minController.castMiniController.setVisibility(View.GONE);
|
||||||
|
};
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
b.putInt("displayed", 1);
|
||||||
|
b.putSerializable("castedTube", peertube);
|
||||||
|
intentBC.putExtras(b);
|
||||||
|
LocalBroadcastManager.getInstance(BasePeertubeActivity.this).sendBroadcast(intentBC);
|
||||||
|
try {
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> {
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
binding.minController.castLoader.setVisibility(View.VISIBLE);
|
||||||
|
player.setPlayWhenReady(false);
|
||||||
|
binding.doubleTapPlayerView.setVisibility(View.GONE);
|
||||||
|
binding.minController.castMiniController.setVisibility(View.VISIBLE);
|
||||||
|
dialog.dismiss();
|
||||||
|
if (videoURL != null) {
|
||||||
|
if (player != null && player.getCurrentPosition() > 0) {
|
||||||
|
videoURL += "?start=" + (player.getCurrentPosition() / 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
if (!PeertubeBaseMainActivity.chromeCast.isConnected()) {
|
||||||
|
PeertubeBaseMainActivity.chromeCast.connect();
|
||||||
|
}
|
||||||
|
myRunnable = this::invalidateOptionsMenu;
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
Status status = PeertubeBaseMainActivity.chromeCast.getStatus();
|
||||||
|
if (PeertubeBaseMainActivity.chromeCast.isAppAvailable(CAST_ID) && !status.isAppRunning(CAST_ID)) {
|
||||||
|
PeertubeBaseMainActivity.chromeCast.launchApp(CAST_ID);
|
||||||
|
}
|
||||||
|
if (videoURL != null) {
|
||||||
|
String mime = MimeTypeMap.getFileExtensionFromUrl(videoURL);
|
||||||
|
PeertubeBaseMainActivity.chromeCast.setRequestTimeout(60000);
|
||||||
|
PeertubeBaseMainActivity.chromeCast.load(peertube.getTitle(), null, videoURL, mime);
|
||||||
|
PeertubeBaseMainActivity.chromeCast.play();
|
||||||
|
binding.minController.castPlay.setImageResource(R.drawable.ic_baseline_pause_32);
|
||||||
|
}
|
||||||
|
myRunnable = () -> binding.minController.castLoader.setVisibility(View.GONE);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (IOException | GeneralSecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> {
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
dialog.dismiss();
|
||||||
|
};
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
});
|
||||||
|
alt_bld.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
|
||||||
|
AlertDialog alert = alt_bld.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.video_menu, menu);
|
||||||
|
MenuItem castItem = menu.findItem(R.id.action_cast);
|
||||||
|
if (PeertubeBaseMainActivity.chromeCasts != null && PeertubeBaseMainActivity.chromeCasts.size() > 0) {
|
||||||
|
castItem.setVisible(true);
|
||||||
|
if (PeertubeBaseMainActivity.chromeCast != null && PeertubeBaseMainActivity.chromeCast.isConnected()) {
|
||||||
|
castItem.setIcon(R.drawable.ic_baseline_cast_connected_24);
|
||||||
|
} else {
|
||||||
|
castItem.setIcon(R.drawable.ic_baseline_cast_24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,263 @@
|
||||||
|
package app.fedilab.android.activities;
|
||||||
|
/* Copyright 2023 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Fedilab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Fedilab 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 Fedilab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.databinding.ActivityMainPeertubeBinding;
|
||||||
|
import app.fedilab.android.mastodon.activities.BaseActivity;
|
||||||
|
import app.fedilab.android.peertube.client.data.VideoData;
|
||||||
|
import app.fedilab.android.peertube.helper.Helper;
|
||||||
|
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||||
|
import su.litvak.chromecast.api.v2.ChromeCasts;
|
||||||
|
import su.litvak.chromecast.api.v2.ChromeCastsListener;
|
||||||
|
import su.litvak.chromecast.api.v2.MediaStatus;
|
||||||
|
|
||||||
|
public abstract class PeertubeBaseMainActivity extends BaseActivity implements ChromeCastsListener {
|
||||||
|
|
||||||
|
public static List<ChromeCast> chromeCasts;
|
||||||
|
public static ChromeCast chromeCast;
|
||||||
|
public static boolean chromecastActivated = false;
|
||||||
|
protected ActivityMainPeertubeBinding binding;
|
||||||
|
private BroadcastReceiver manage_chromecast;
|
||||||
|
private VideoData.Video castedTube;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityMainPeertubeBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
ChromeCastsListener chromeCastsListener = this;
|
||||||
|
ChromeCasts.registerListener(chromeCastsListener);
|
||||||
|
|
||||||
|
|
||||||
|
binding.castClose.setOnClickListener(v -> {
|
||||||
|
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putInt("displayed", 0);
|
||||||
|
intentBC.putExtras(b);
|
||||||
|
LocalBroadcastManager.getInstance(PeertubeBaseMainActivity.this).sendBroadcast(intentBC);
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.castTogglePlay.setOnClickListener(v -> {
|
||||||
|
if (chromeCast != null) {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> binding.castTogglePlay.setVisibility(View.GONE);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
int icon = -1;
|
||||||
|
if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
||||||
|
chromeCast.pause();
|
||||||
|
icon = R.drawable.ic_baseline_play_arrow_32;
|
||||||
|
} else if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PAUSED) {
|
||||||
|
chromeCast.play();
|
||||||
|
icon = R.drawable.ic_baseline_pause_32;
|
||||||
|
}
|
||||||
|
if (icon != -1) {
|
||||||
|
int finalIcon = icon;
|
||||||
|
myRunnable = () -> binding.castTogglePlay.setImageResource(finalIcon);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
}
|
||||||
|
myRunnable = () -> binding.castTogglePlay.setVisibility(View.VISIBLE);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
manage_chromecast = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Bundle b = intent.getExtras();
|
||||||
|
assert b != null;
|
||||||
|
int state = b.getInt("state_asked", -1);
|
||||||
|
int displayed = b.getInt("displayed", -1);
|
||||||
|
castedTube = (VideoData.Video) b.getSerializable("castedTube");
|
||||||
|
|
||||||
|
if (state == 1) {
|
||||||
|
discoverCast();
|
||||||
|
} else if (state == 0) {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
if (chromeCast != null) {
|
||||||
|
chromeCast.stopApp();
|
||||||
|
chromeCast.disconnect();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
if (displayed == 1) {
|
||||||
|
chromecastActivated = true;
|
||||||
|
if (castedTube != null) {
|
||||||
|
binding.castInfo.setVisibility(View.VISIBLE);
|
||||||
|
Helper.loadGiF(PeertubeBaseMainActivity.this, castedTube.getThumbnailPath(), binding.castView);
|
||||||
|
binding.castTitle.setText(castedTube.getTitle());
|
||||||
|
binding.castDescription.setText(castedTube.getDescription());
|
||||||
|
}
|
||||||
|
} else if (displayed == 0) {
|
||||||
|
chromecastActivated = false;
|
||||||
|
binding.castInfo.setVisibility(View.GONE);
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
if (chromeCast != null) {
|
||||||
|
chromeCast.stopApp();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
LocalBroadcastManager.getInstance(PeertubeBaseMainActivity.this).registerReceiver(manage_chromecast, new IntentFilter(Helper.RECEIVE_CAST_SETTINGS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void newChromeCastDiscovered(ChromeCast chromeCast) {
|
||||||
|
if (chromeCasts == null) {
|
||||||
|
chromeCasts = new ArrayList<>();
|
||||||
|
chromeCasts.add(chromeCast);
|
||||||
|
} else {
|
||||||
|
boolean canBeAdded = true;
|
||||||
|
for (ChromeCast cast : chromeCasts) {
|
||||||
|
if (cast.getName().compareTo(chromeCast.getName()) == 0) {
|
||||||
|
canBeAdded = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canBeAdded) {
|
||||||
|
chromeCasts.add(chromeCast);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (chromeCast.isAppRunning(Helper.CAST_ID) && chromeCast.getMediaStatus() != null && chromeCast.getMediaStatus().playerState != null) {
|
||||||
|
if (binding.castInfo.getVisibility() == View.GONE) {
|
||||||
|
binding.castInfo.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void chromeCastRemoved(ChromeCast chromeCast) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
ChromeCasts.unregisterListener(this);
|
||||||
|
if (manage_chromecast != null) {
|
||||||
|
LocalBroadcastManager.getInstance(PeertubeBaseMainActivity.this).unregisterReceiver(manage_chromecast);
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
if (chromeCasts != null && chromeCasts.size() > 0) {
|
||||||
|
for (ChromeCast cast : chromeCasts) {
|
||||||
|
try {
|
||||||
|
cast.stopApp();
|
||||||
|
cast.disconnect();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
if (chromeCasts != null) {
|
||||||
|
chromeCasts = null;
|
||||||
|
}
|
||||||
|
if (chromeCast != null) {
|
||||||
|
chromeCast = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Method for discovering cast devices
|
||||||
|
public void discoverCast() {
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
if (chromeCasts != null) {
|
||||||
|
for (ChromeCast cast : chromeCasts) {
|
||||||
|
try {
|
||||||
|
cast.disconnect();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chromeCasts = null;
|
||||||
|
}
|
||||||
|
chromeCasts = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
List<NetworkInterface> interfaces;
|
||||||
|
interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
||||||
|
for (NetworkInterface ni : interfaces) {
|
||||||
|
if ((!ni.isLoopback()) && ni.isUp() && (ni.getName().equals("wlan0"))) {
|
||||||
|
Enumeration<InetAddress> inetAddressEnumeration = ni.getInetAddresses();
|
||||||
|
while (inetAddressEnumeration.hasMoreElements()) {
|
||||||
|
InetAddress inetAddress = inetAddressEnumeration.nextElement();
|
||||||
|
ChromeCasts.restartDiscovery(inetAddress);
|
||||||
|
int tryFind = 0;
|
||||||
|
while (ChromeCasts.get().isEmpty() && tryFind < 5) {
|
||||||
|
try {
|
||||||
|
//noinspection BusyWait
|
||||||
|
Thread.sleep(1000);
|
||||||
|
tryFind++;
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChromeCasts.stopDiscovery();
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = this::invalidateOptionsMenu;
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
52
app/src/fdroid/res/layout/min_controller.xml
Normal file
52
app/src/fdroid/res/layout/min_controller.xml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/cast_play"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/play"
|
||||||
|
android:src="@drawable/ic_baseline_play_arrow_32"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cast_loader"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/cast_loader_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/please_wait"
|
||||||
|
android:textColor="?colorAccent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/cast_loader_small"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/cast_loader_small"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="18dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/cast_loader_text"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
10
app/src/fdroid/res/menu/video_menu.xml
Normal file
10
app/src/fdroid/res/menu/video_menu.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?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/action_cast"
|
||||||
|
android:icon="@drawable/ic_baseline_cast_24"
|
||||||
|
android:title="@string/cast"
|
||||||
|
android:visible="false"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
</menu>
|
19
app/src/fdroid/res/xml/compose_shortcuts.xml
Normal file
19
app/src/fdroid/res/xml/compose_shortcuts.xml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="compose"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@drawable/ic_baseline_add_comment_24"
|
||||||
|
android:shortcutShortLabel="@string/compose_shortcut_short_label1"
|
||||||
|
tools:targetApi="n_mr1">
|
||||||
|
<intent
|
||||||
|
android:action="app.fedilab.android.shorcut.compose"
|
||||||
|
android:targetClass="app.fedilab.android.activities.MainActivity"
|
||||||
|
android:targetPackage="fr.gouv.etalab.mastodon" />
|
||||||
|
|
||||||
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
<capability-binding android:key="actions.intent.CREATE_MESSAGE" />
|
||||||
|
</shortcut>
|
||||||
|
|
||||||
|
|
||||||
|
</shortcuts>
|
|
@ -28,9 +28,9 @@
|
||||||
android:icon="@mipmap/ic_launcher_bubbles"
|
android:icon="@mipmap/ic_launcher_bubbles"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:roundIcon="@mipmap/ic_launcher_bubbles_round"
|
android:roundIcon="@mipmap/ic_launcher_bubbles_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:requestLegacyExternalStorage="true"
|
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
@ -80,9 +80,13 @@
|
||||||
android:roundIcon="@mipmap/ic_launcher_bubbles_round"
|
android:roundIcon="@mipmap/ic_launcher_bubbles_round"
|
||||||
android:targetActivity=".activities.MainActivity">
|
android:targetActivity=".activities.MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/compose_shortcuts" />
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
|
@ -96,6 +100,9 @@
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/compose_shortcuts" />
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
|
@ -109,6 +116,9 @@
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/compose_shortcuts" />
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
|
@ -122,6 +132,9 @@
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/compose_shortcuts" />
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
|
@ -135,6 +148,9 @@
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/compose_shortcuts" />
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
|
@ -148,6 +164,9 @@
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/compose_shortcuts" />
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,50 +186,52 @@
|
||||||
android:scheme="fedilab" />
|
android:scheme="fedilab" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.StatusHistoryActivity"
|
android:name=".mastodon.activities.StatusHistoryActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/status_history"
|
android:label="@string/status_history"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.ContextActivity"
|
android:name=".mastodon.activities.ContextActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.DraftActivity"
|
android:name=".mastodon.activities.DraftActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".imageeditor.EditImageActivity"
|
android:name=".mastodon.imageeditor.EditImageActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.ComposeActivity"
|
android:name=".mastodon.activities.ComposeActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/compose" />
|
android:label="@string/compose" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.StatusInfoActivity"
|
android:name=".mastodon.activities.StatusInfoActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.FollowRequestActivity"
|
android:name=".mastodon.activities.FollowRequestActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.ProfileActivity"
|
android:name=".mastodon.activities.ProfileActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/account" />
|
android:label="@string/account" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.admin.AdminAccountActivity"
|
android:name=".mastodon.activities.admin.AdminAccountActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/account" />
|
android:label="@string/account" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.AccountReportActivity"
|
android:name=".mastodon.activities.AccountReportActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/account"
|
android:label="@string/account"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.admin.AdminReportActivity"
|
android:name=".mastodon.activities.admin.AdminReportActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/report"
|
android:label="@string/report"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.ScheduledActivity"
|
android:name=".mastodon.activities.ScheduledActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/scheduled" />
|
android:label="@string/scheduled" />
|
||||||
<activity
|
<activity
|
||||||
|
@ -219,17 +240,17 @@
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.SearchResultTabActivity"
|
android:name=".mastodon.activities.SearchResultTabActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/search"
|
android:label="@string/search"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.TrendsActivity"
|
android:name=".mastodon.activities.TrendsActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/trending"
|
android:label="@string/trending"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.ReorderTimelinesActivity"
|
android:name=".mastodon.activities.ReorderTimelinesActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/reorder_timelines"
|
android:label="@string/reorder_timelines"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
|
@ -240,97 +261,84 @@
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.admin.AdminDomainBlockActivity"
|
android:name=".mastodon.activities.admin.AdminDomainBlockActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/blocked_domains"
|
android:label="@string/blocked_domains"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.SuggestionActivity"
|
android:name=".mastodon.activities.SuggestionActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/Suggestions"
|
android:label="@string/Suggestions"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.PartnerShipActivity"
|
android:name=".mastodon.activities.DirectoryActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:label="@string/Directory"
|
||||||
|
android:theme="@style/AppThemeBar" />
|
||||||
|
<activity
|
||||||
|
android:name=".mastodon.activities.PartnerShipActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/action_about"
|
android:label="@string/action_about"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.ActionActivity"
|
android:name=".mastodon.activities.ActionActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/interactions"
|
android:label="@string/interactions"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.admin.AdminActionActivity"
|
android:name=".mastodon.activities.admin.AdminActionActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/administration"
|
android:label="@string/administration"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.MastodonListActivity"
|
android:name=".mastodon.activities.MastodonListActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/action_lists"
|
android:label="@string/action_lists"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.FollowedTagActivity"
|
android:name=".mastodon.activities.FollowedTagActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/followed_tags"
|
android:label="@string/followed_tags"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.SettingsActivity"
|
android:name=".mastodon.activities.SettingsActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/settings"
|
android:label="@string/settings"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.InstanceActivity"
|
android:name=".mastodon.activities.HashTagActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
android:label="@string/action_about_instance"
|
|
||||||
android:theme="@style/AppThemeAlertDialog" />
|
|
||||||
<activity
|
|
||||||
android:name=".activities.InstanceProfileActivity"
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:theme="@style/AppThemeAlertDialog" />
|
|
||||||
<activity
|
|
||||||
android:name=".activities.ProxyActivity"
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:theme="@style/AppThemeAlertDialog" />
|
|
||||||
<activity
|
|
||||||
android:name=".activities.HashTagActivity"
|
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.AnnouncementActivity"
|
android:name=".mastodon.activities.AnnouncementActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.MediaActivity"
|
android:name=".mastodon.activities.MediaActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:theme="@style/Transparent" />
|
android:theme="@style/Transparent" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.InstanceHealthActivity"
|
android:name=".mastodon.activities.ReportActivity"
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:theme="@style/AppThemeAlertDialog" />
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activities.ReportActivity"
|
|
||||||
android:theme="@style/AppThemeBar"
|
android:theme="@style/AppThemeBar"
|
||||||
android:windowSoftInputMode="stateVisible" />
|
android:windowSoftInputMode="stateVisible" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.CustomSharingActivity"
|
android:name=".mastodon.activities.CustomSharingActivity"
|
||||||
android:label="@string/settings_title_custom_sharing"
|
android:label="@string/settings_title_custom_sharing"
|
||||||
android:theme="@style/AppThemeBar"
|
android:theme="@style/AppThemeBar"
|
||||||
android:windowSoftInputMode="stateVisible" />
|
android:windowSoftInputMode="stateVisible" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.FilterActivity"
|
android:name=".mastodon.activities.FilterActivity"
|
||||||
android:label="@string/filters"
|
android:label="@string/filters"
|
||||||
android:theme="@style/AppThemeBar"
|
android:theme="@style/AppThemeBar"
|
||||||
android:windowSoftInputMode="stateVisible" />
|
android:windowSoftInputMode="stateVisible" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.EditProfileActivity"
|
android:name=".mastodon.activities.EditProfileActivity"
|
||||||
android:label="@string/edit_profile"
|
android:label="@string/edit_profile"
|
||||||
android:theme="@style/AppThemeBar"
|
android:theme="@style/AppThemeBar"
|
||||||
android:windowSoftInputMode="stateVisible" />
|
android:windowSoftInputMode="stateVisible" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.CacheActivity"
|
android:name=".mastodon.activities.CacheActivity"
|
||||||
android:label="@string/action_cache"
|
android:label="@string/action_cache"
|
||||||
android:theme="@style/AppThemeBar" />
|
android:theme="@style/AppThemeBar" />
|
||||||
|
|
||||||
|
@ -345,7 +353,7 @@
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".broadcastreceiver.ToastMessage"
|
android:name=".mastodon.broadcastreceiver.ToastMessage"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="RECEIVE_TOAST_MESSAGE" />
|
<action android:name="RECEIVE_TOAST_MESSAGE" />
|
||||||
|
@ -353,7 +361,7 @@
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".services.CustomReceiver"
|
android:name=".mastodon.services.CustomReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -364,5 +372,105 @@
|
||||||
<action android:name="org.unifiedpush.android.connector.REGISTRATION_REFUSED" />
|
<action android:name="org.unifiedpush.android.connector.REGISTRATION_REFUSED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.PeertubeMainActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.PeertubeActivity"
|
||||||
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:resizeableActivity="true"
|
||||||
|
android:supportsPictureInPicture="true"
|
||||||
|
tools:targetApi="n" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.PeertubeEditUploadActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:exported="false"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.ShowChannelActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.ShowAccountActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.AccountActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.MyAccountActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.SearchActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.AllPlaylistsActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.AllLocalPlaylistsActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.PlaylistsActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.VideosTimelineActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.SepiaSearchActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/sepia_search"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.ManageInstancesActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/instances_picker"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.WebviewActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.LoginActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:exported="true"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden">
|
||||||
|
<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
|
||||||
|
android:name=".peertube.activities.SettingsActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/settings"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".peertube.activities.PeertubeUploadActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/upload_video"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".peertube.services.RetrieveInfoService"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
20
app/src/main/assets/categories.json
Normal file
20
app/src/main/assets/categories.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
199
app/src/main/assets/languages.json
Normal file
199
app/src/main/assets/languages.json
Normal file
|
@ -0,0 +1,199 @@
|
||||||
|
{
|
||||||
|
"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,4 +1,109 @@
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "3.17.0",
|
||||||
|
"code": "477",
|
||||||
|
"note": "Added:\n- Peertube 2FA support\n- Cache home in background (default disabled -> New settings category and per account) / change frequency\n- Auto-fetch missing messages for the Home (default disabled -> in Settings - Timelines)\n- Automatically switch between tabs when searching\n- More deep links detection\n- Allow to group mentions at the top (default: disabled)\n\n\nFixed:\n- Dynamic color for Android 12+\n- Missing media description for previews\n- Fix a crash when replying\n- Fix button size not changed\n- Forward tags in replies\n- Media cannot be downloaded or shared with Android 10\n- Some crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.16.4",
|
||||||
|
"code": "476",
|
||||||
|
"note": "Added:\n- Cache home in background (default disabled -> New settings category and per account) / change frequency\n- Auto-fetch missing messages for the Home (default disabled -> in Settings - Timelines)\n- Automatically switch between tabs when searching\n\nFixed:\n- Some crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.16.3",
|
||||||
|
"code": "475",
|
||||||
|
"note": "Added:\n- Peertube 2FA support\n\nFixed:\n- Dynamic color for Android 12+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.16.2",
|
||||||
|
"code": "474",
|
||||||
|
"note": "Added:\n- Peertube support\n- Compose shortcut (long press launcher)\n- Long press compose button to write with another account\n- Edit description and focus for media (for the next Mastodon release)\n\nChanged:\n- Cross actions with two accounts display a dialog\n- Order & compact og values when sharing > title - url - content\n- Tap on top message (user info) open threads\n\nFixed:\n- Text cleared when adding a media\n- Fix Maths not working with quotes\n- Fix crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.16.1",
|
||||||
|
"code": "473",
|
||||||
|
"note": "Changed:\n- Edit description and focus for media (for the next Mastodon release)\n\nChanged:\n- Peertube: remove role support to avoid crashes with older instances\n\nFixed:\n- Fix some crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.16.0",
|
||||||
|
"code": "472",
|
||||||
|
"note": "Changed:\n- Peertube support\n- Compose shortcut\n- Long press compose button to write with another account\n\nChanged:\n- Cross actions with two accounts display a dialog\n- Order & compact og values when sharing > title - url - content\n\nFixed:\n- Text cleared when adding a media\n- Fix crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.15.2",
|
||||||
|
"code": "471",
|
||||||
|
"note": "Changed:\n- Add instance name when sharing\n\nFixed:\n- Fix a crash when removing media\n- Other minor fixes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.15.1",
|
||||||
|
"code": "470",
|
||||||
|
"note": "Changed:\n- Material dialogs\n\nFixed:\n- Light theme issues"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.15.0",
|
||||||
|
"code": "469",
|
||||||
|
"note": "Added:\n- Maths support (view and compose)\n- Filter DMs in HOME (long press on the tab)\n- Filter languages for users in home timeline (from their profile)\n- Add several targeted languages for translator\n\nChanged:\n- Hide single media with preview is now a setting (default: disabled)\n- Group items in menu of messages\n\nFixed:\n- Cross-actions didn't display account instances"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.14.6",
|
||||||
|
"code": "468",
|
||||||
|
"note": "Added:\n- Maths support (view and compose)\n\nChanged:\n- Hide single media with preview is now a setting (default: disabled)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.14.5",
|
||||||
|
"code": "467",
|
||||||
|
"note": "Changed:\n- Allow to swipe media for profiles\n\nFixed:\n- Fix crashes with pinch zoom\n- Copy/Paste in threads\n- Fix crash when checking redirection on http links\n- Display menu in media viewer resets pinch-zoom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.14.4",
|
||||||
|
"code": "466",
|
||||||
|
"note": "Changed:\n- Media viewer (pinch zoom)\n\nFixed:\n- Cross account actions (long press)\n- Boost color\n- Buttons not visible with custom themes.\n- Fix some bad behaviors with media viewer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.14.3",
|
||||||
|
"code": "465",
|
||||||
|
"note": "Added:\n- Display date of the message instead of the boost (default: disabled)\n- Allow to disable release notes popup in Settings\n\nFixed:\n- Fix timelines slow down and stuttering after some scrolls\n- Fix color issues with follow buttons\n- Fix import from settings (import from login was OK)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.14.2",
|
||||||
|
"code": "464",
|
||||||
|
"note": "Added:\n- Display familiar followers on profiles\n- Display and filter Instance directory\n\nChanged:\n- Bot and reply icon indicators more visible\n- Single media are hidden with link previews\n\nFixed:\n- Fix a crash with Art timelines\n- Friendica: media cannot be downloaded/shared\n- Fix a crash with pinned timelines"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.14.1",
|
||||||
|
"code": "463",
|
||||||
|
"note": "Added:\n- Search bar: display suggestions when starting by \"@\" or \"#\"\n\nChanged:\n- Preload media in timelines to avoid jumps\n- Search: Automatically switch to account tab if no results for tags\n\nFixed:\n- Fix jumps with the fetch more feature\n- Fix videos cannot be saved\n- Tags cannot be pinned when there are no custom tabs\n- PixelFed view: NSFW not honored\n- Fix crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.14.0",
|
||||||
|
"code": "462",
|
||||||
|
"note": "Added:\n\n- Add Bubble timeline support in extra-features with filters\n- Allow to display public profiles by default to get all messages (Settings > Interface)\n- Glitch: Allow to post messages locally (Can be turned off in Settings)\n- Pixelfed: Custom layout to display Media fully (Also works for other software when there are media)\n- Allow to align left action buttons in messages\n\nChanged:\n- Full rework on links in messages (also mentions and tags)\n- Add pinned tag in \"any\" to avoid to lose it when renaming timeline\n\nFixed:\n- Links to messages not handled by the app\n- CW when editing a message\n- Fix push notifications with several accounts\n- New messages or edition notifications not pushed\n- Fix quotes with tags/mentions\n- Fix notifications\n- Fix sending multiple media\n- Fix crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.13.7",
|
||||||
|
"code": "461",
|
||||||
|
"note": "Added:\n- Pixelfed: Custom layout to display Media fully \n*(Settings > Timelines > Pixelfed Presentation) - Also works for other softwares when there are media\n\nChanged:\n- Add pinned tag in \"any\" to avoid to lose it when renaming timeline\n\nFixed:\n- Fix push notifications with several accounts\n- Fix quotes with tags/mentions\n- Fix notifications\n- Fix sending multiple media\n- Some crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.13.6",
|
||||||
|
"code": "460",
|
||||||
|
"note": "Fixed:\n- Cross-compose: Wrong instance emojis\n- Custom emojis not displayed in notifications\n- Fav/Boost markers with shared messages\n- Empty notifications\n- Fix cw removed when replying\n- Fix expand media with fit preview images when sensitive\n- Fix an issue with fetch more displayed too often (cache clear will help or wait new messages)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.13.5",
|
||||||
|
"code": "459",
|
||||||
|
"note": "Added:\n- Glitch: Allow to post messages locally (Can be turned off in Settings)\n\nFixed:\n- Crashes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.13.4",
|
||||||
|
"code": "458",
|
||||||
|
"note": "Added:\n- Add Bubble timeline support in extra-features with filters\n- Allow to display public profiles by default to get all messages (Settings > Interface)\n\nChanged:\n- Full rework on links in messages (also mentions and tags)\n\nFixed:\n- Spoiler text when editing\n- Fix watermarks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "3.13.3",
|
||||||
|
"code": "457",
|
||||||
|
"note": "Added:\n- Allow to enable extra features in Settings\n- Customizable settings for extra features\n- Support quotes, reactions with messages\n- Support text format (html, markdown, etc.) when composing\n\nFixed:\n- CW not working with media\n- Media not displayed for older instances\n- Some crashes\n"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "3.13.2",
|
"version": "3.13.2",
|
||||||
"code": "456",
|
"code": "456",
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,15 +15,20 @@ package app.fedilab.android;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.NotificationChannel;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import androidx.multidex.MultiDex;
|
import androidx.multidex.MultiDex;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.google.android.material.color.DynamicColors;
|
import net.gotev.uploadservice.UploadServiceConfig;
|
||||||
|
import net.gotev.uploadservice.observer.request.GlobalRequestObserver;
|
||||||
|
|
||||||
import org.acra.ACRA;
|
import org.acra.ACRA;
|
||||||
import org.acra.ReportField;
|
import org.acra.ReportField;
|
||||||
|
@ -32,35 +37,42 @@ import org.acra.config.DialogConfigurationBuilder;
|
||||||
import org.acra.config.MailSenderConfigurationBuilder;
|
import org.acra.config.MailSenderConfigurationBuilder;
|
||||||
import org.acra.data.StringFormat;
|
import org.acra.data.StringFormat;
|
||||||
|
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
import app.fedilab.android.peertube.services.GlobalUploadObserver;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
public class MainApplication extends MultiDexApplication {
|
public class MainApplication extends MultiDexApplication {
|
||||||
|
|
||||||
|
public static String UPLOAD_CHANNEL_ID = "upload_info_peertube";
|
||||||
private static MainApplication app;
|
private WebView webView;
|
||||||
|
|
||||||
public static MainApplication getApp() {
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
app = this;
|
try {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(MainApplication.this);
|
webView = new WebView(this);
|
||||||
|
} catch (Exception ignored) {
|
||||||
boolean dynamicColor = sharedpreferences.getBoolean(getString(R.string.SET_DYNAMICCOLOR), false);
|
|
||||||
if (dynamicColor) {
|
|
||||||
DynamicColors.applyToActivitiesIfAvailable(this);
|
|
||||||
}
|
}
|
||||||
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
|
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
|
||||||
StrictMode.setVmPolicy(builder.build());
|
StrictMode.setVmPolicy(builder.build());
|
||||||
Toasty.Config.getInstance().apply();
|
Toasty.Config.getInstance().apply();
|
||||||
|
if (webView != null) {
|
||||||
|
try {
|
||||||
|
webView.destroy();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
createNotificationChannel();
|
||||||
|
UploadServiceConfig.initialize(MainApplication.this, UPLOAD_CHANNEL_ID, true);
|
||||||
|
|
||||||
|
new GlobalRequestObserver(this, new GlobalUploadObserver());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
|
@ -100,4 +112,15 @@ public class MainApplication extends MultiDexApplication {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void createNotificationChannel() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
NotificationChannel channel = new NotificationChannel(UPLOAD_CHANNEL_ID,
|
||||||
|
getString(R.string.notification_channel_name),
|
||||||
|
NotificationManager.IMPORTANCE_LOW);
|
||||||
|
channel.setSound(null, null);
|
||||||
|
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,15 @@ import java.util.List;
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.BuildConfig;
|
import app.fedilab.android.BuildConfig;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.databinding.ActivityAboutBinding;
|
import app.fedilab.android.databinding.ActivityAboutBinding;
|
||||||
import app.fedilab.android.helper.CrossActionHelper;
|
import app.fedilab.android.mastodon.activities.BaseBarActivity;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.activities.ProfileActivity;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
|
import app.fedilab.android.mastodon.helper.CrossActionHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
|
||||||
|
|
||||||
public class AboutActivity extends BaseBarActivity {
|
public class AboutActivity extends BaseBarActivity {
|
||||||
|
@ -113,7 +115,7 @@ public class AboutActivity extends BaseBarActivity {
|
||||||
if (relationShips != null && relationShips.size() > 0) {
|
if (relationShips != null && relationShips.size() > 0) {
|
||||||
if (!relationShips.get(0).following) {
|
if (!relationShips.get(0).following) {
|
||||||
binding.accountFollow.setVisibility(View.VISIBLE);
|
binding.accountFollow.setVisibility(View.VISIBLE);
|
||||||
binding.accountFollow.setOnClickListener(v -> accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false)
|
binding.accountFollow.setOnClickListener(v -> accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false, null)
|
||||||
.observe(AboutActivity.this, relationShip -> binding.accountFollow.setVisibility(View.GONE)));
|
.observe(AboutActivity.this, relationShip -> binding.accountFollow.setVisibility(View.GONE)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,139 +0,0 @@
|
||||||
package app.fedilab.android.activities;
|
|
||||||
/* Copyright 2021 Thomas Schneider
|
|
||||||
*
|
|
||||||
* This file is a part of Fedilab
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Fedilab 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 Fedilab; if not,
|
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
|
||||||
import androidx.preference.PreferenceManager;
|
|
||||||
|
|
||||||
import com.vanniktech.emoji.EmojiManager;
|
|
||||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
|
||||||
import app.fedilab.android.helper.Helper;
|
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("Registered")
|
|
||||||
public class BaseAlertDialogActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
static {
|
|
||||||
Helper.installProvider();
|
|
||||||
EmojiManager.install(new EmojiOneProvider());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME));
|
|
||||||
//Default automatic switch
|
|
||||||
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
|
||||||
|
|
||||||
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
||||||
switch (currentNightMode) {
|
|
||||||
case Configuration.UI_MODE_NIGHT_NO:
|
|
||||||
String defaultLight = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_LIGHT), "LIGHT");
|
|
||||||
switch (defaultLight) {
|
|
||||||
case "LIGHT":
|
|
||||||
setTheme(R.style.AppThemeAlertDialog);
|
|
||||||
break;
|
|
||||||
case "SOLARIZED_LIGHT":
|
|
||||||
setTheme(R.style.SolarizedAlertDialog);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Configuration.UI_MODE_NIGHT_YES:
|
|
||||||
String defaultDark = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_DARK), "DARK");
|
|
||||||
switch (defaultDark) {
|
|
||||||
case "DARK":
|
|
||||||
setTheme(R.style.AppThemeAlertDialog);
|
|
||||||
break;
|
|
||||||
case "SOLARIZED_DARK":
|
|
||||||
setTheme(R.style.SolarizedAlertDialog);
|
|
||||||
break;
|
|
||||||
case "BLACK":
|
|
||||||
Window window = getWindow();
|
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
||||||
window.setStatusBarColor(Color.BLACK);
|
|
||||||
setTheme(R.style.BlackAlertDialog);
|
|
||||||
break;
|
|
||||||
case "DRACULA":
|
|
||||||
setTheme(R.style.DraculaAlertDialog);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (currentTheme) {
|
|
||||||
case "LIGHT":
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
|
||||||
setTheme(R.style.AppThemeAlertDialog);
|
|
||||||
break;
|
|
||||||
case "DARK":
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
|
||||||
setTheme(R.style.AppThemeAlertDialog);
|
|
||||||
break;
|
|
||||||
case "SOLARIZED_LIGHT":
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
|
||||||
setTheme(R.style.SolarizedAlertDialog);
|
|
||||||
break;
|
|
||||||
case "SOLARIZED_DARK":
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
|
||||||
setTheme(R.style.SolarizedAlertDialog);
|
|
||||||
break;
|
|
||||||
case "BLACK":
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
|
||||||
Window window = getWindow();
|
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
||||||
window.setStatusBarColor(Color.BLACK);
|
|
||||||
setTheme(R.style.BlackAlertDialog);
|
|
||||||
break;
|
|
||||||
case "DRACULA":
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
|
||||||
setTheme(R.style.DraculaAlertDialog);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) {
|
|
||||||
ThemeHelper.adjustFontScale(this, getResources().getConfiguration());
|
|
||||||
}
|
|
||||||
Helper.setLocale(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context newBase) {
|
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
|
|
||||||
final Configuration override = new Configuration(newBase.getResources().getConfiguration());
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(newBase);
|
|
||||||
override.fontScale = prefs.getFloat(newBase.getString(R.string.SET_FONT_SCALE), 1.1f);
|
|
||||||
applyOverrideConfiguration(override);
|
|
||||||
}
|
|
||||||
super.attachBaseContext(newBase);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,173 +0,0 @@
|
||||||
package app.fedilab.android.activities;
|
|
||||||
/* Copyright 2022 Thomas Schneider
|
|
||||||
*
|
|
||||||
* This file is a part of Fedilab
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Fedilab 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 Fedilab; if not,
|
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
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.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
import androidx.preference.PreferenceManager;
|
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
|
||||||
import app.fedilab.android.R;
|
|
||||||
import app.fedilab.android.client.entities.api.Instance;
|
|
||||||
import app.fedilab.android.databinding.ActivityInstanceBinding;
|
|
||||||
import app.fedilab.android.helper.Helper;
|
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
|
||||||
import app.fedilab.android.viewmodel.mastodon.InstancesVM;
|
|
||||||
|
|
||||||
|
|
||||||
public class InstanceActivity extends BaseAlertDialogActivity {
|
|
||||||
|
|
||||||
|
|
||||||
ActivityInstanceBinding binding;
|
|
||||||
private boolean applyMaxChar = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
binding = ActivityInstanceBinding.inflate(getLayoutInflater());
|
|
||||||
|
|
||||||
setContentView(binding.getRoot());
|
|
||||||
|
|
||||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
if (getSupportActionBar() != null)
|
|
||||||
getSupportActionBar().hide();
|
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(InstanceActivity.this);
|
|
||||||
|
|
||||||
|
|
||||||
final SpannableString contentAbout = new SpannableString(getString(R.string.action_about_instance));
|
|
||||||
contentAbout.setSpan(new UnderlineSpan(), 0, contentAbout.length(), 0);
|
|
||||||
contentAbout.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(this, R.attr.colorPrimary)), 0, contentAbout.length(),
|
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
binding.tos.setText(contentAbout);
|
|
||||||
|
|
||||||
final SpannableString contentPrivacy = new SpannableString(getString(R.string.action_privacy_policy));
|
|
||||||
contentPrivacy.setSpan(new UnderlineSpan(), 0, contentPrivacy.length(), 0);
|
|
||||||
contentPrivacy.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(this, R.attr.colorPrimary)), 0, contentPrivacy.length(),
|
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
binding.privacy.setText(contentPrivacy);
|
|
||||||
|
|
||||||
binding.tos.setOnClickListener(v -> Helper.openBrowser(InstanceActivity.this, "https://" + MainActivity.currentInstance + "/about"));
|
|
||||||
binding.privacy.setOnClickListener(v -> Helper.openBrowser(InstanceActivity.this, "https://" + MainActivity.currentInstance + "/privacy-policy"));
|
|
||||||
binding.close.setOnClickListener(
|
|
||||||
|
|
||||||
view -> {
|
|
||||||
if (applyMaxChar) {
|
|
||||||
String max_char = binding.maxChar.getText().toString();
|
|
||||||
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
if (!max_char.isEmpty()) {
|
|
||||||
try {
|
|
||||||
editor.putInt(getString(R.string.SET_MAX_INSTANCE_CHAR) + MainActivity.currentInstance, Integer.parseInt(max_char));
|
|
||||||
editor.apply();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
if (getSupportActionBar() != null) {
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
InstancesVM instancesVM = new ViewModelProvider(InstanceActivity.this).get(InstancesVM.class);
|
|
||||||
instancesVM.getInstance(BaseMainActivity.currentInstance).observe(InstanceActivity.this, instanceInfo -> {
|
|
||||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
|
||||||
binding.loader.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
if (instanceInfo == null || instanceInfo.info == null || instanceInfo.info.description == null) {
|
|
||||||
binding.maxCharContainer.setVisibility(View.VISIBLE);
|
|
||||||
binding.instanceContainer.setVisibility(View.GONE);
|
|
||||||
binding.instanceContact.setVisibility(View.GONE);
|
|
||||||
int val = sharedpreferences.getInt(getString(R.string.SET_MAX_INSTANCE_CHAR) + MainActivity.currentInstance, -1);
|
|
||||||
if (val != -1) {
|
|
||||||
binding.maxChar.setText(String.valueOf(val));
|
|
||||||
}
|
|
||||||
applyMaxChar = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Instance instance = instanceInfo.info;
|
|
||||||
binding.instanceTitle.setText(instance.title);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
binding.instanceDescription.setText(Html.fromHtml(instance.description, Html.FROM_HTML_MODE_LEGACY));
|
|
||||||
else
|
|
||||||
binding.instanceDescription.setText(Html.fromHtml(instance.description));
|
|
||||||
if (instance.description == null || instance.description.trim().length() == 0)
|
|
||||||
binding.instanceDescription.setText(getString(R.string.instance_no_description));
|
|
||||||
binding.instanceVersion.setText(instance.version);
|
|
||||||
binding.instanceUri.setText(instance.uri);
|
|
||||||
if (instance.email == null) {
|
|
||||||
binding.instanceContact.hide();
|
|
||||||
}
|
|
||||||
Glide.with(InstanceActivity.this)
|
|
||||||
.asDrawable()
|
|
||||||
.load(instance.thumbnail)
|
|
||||||
.into(new CustomTarget<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
|
||||||
binding.background.setAlpha(0.2f);
|
|
||||||
binding.background.setBackground(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
binding.instanceContact.setOnClickListener(v -> {
|
|
||||||
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", instance.email, null));
|
|
||||||
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "[Mastodon] - " + instance.uri);
|
|
||||||
startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == android.R.id.home) {
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,118 +0,0 @@
|
||||||
package app.fedilab.android.activities;
|
|
||||||
/* Copyright 2022 Thomas Schneider
|
|
||||||
*
|
|
||||||
* This file is a part of Fedilab
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Fedilab 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 Fedilab; if not,
|
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.style.UnderlineSpan;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
|
||||||
import app.fedilab.android.R;
|
|
||||||
import app.fedilab.android.client.entities.app.InstanceSocial;
|
|
||||||
import app.fedilab.android.databinding.ActivityInstanceSocialBinding;
|
|
||||||
import app.fedilab.android.helper.Helper;
|
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
|
||||||
import app.fedilab.android.viewmodel.mastodon.InstanceSocialVM;
|
|
||||||
|
|
||||||
|
|
||||||
public class InstanceHealthActivity extends BaseAlertDialogActivity {
|
|
||||||
|
|
||||||
private ActivityInstanceSocialBinding binding;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
binding = ActivityInstanceSocialBinding.inflate(getLayoutInflater());
|
|
||||||
|
|
||||||
setContentView(binding.getRoot());
|
|
||||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
if (getSupportActionBar() != null)
|
|
||||||
getSupportActionBar().hide();
|
|
||||||
|
|
||||||
binding.close.setOnClickListener(view -> finish());
|
|
||||||
|
|
||||||
SpannableString content = new SpannableString(binding.refInstance.getText().toString());
|
|
||||||
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
|
||||||
binding.refInstance.setText(content);
|
|
||||||
binding.refInstance.setOnClickListener(view -> {
|
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://instances.social"));
|
|
||||||
startActivity(browserIntent);
|
|
||||||
});
|
|
||||||
|
|
||||||
checkInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == android.R.id.home) {
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void checkInstance() {
|
|
||||||
|
|
||||||
|
|
||||||
InstanceSocialVM instanceSocialVM = new ViewModelProvider(InstanceHealthActivity.this).get(InstanceSocialVM.class);
|
|
||||||
instanceSocialVM.getInstances(BaseMainActivity.currentInstance.trim()).observe(InstanceHealthActivity.this, instanceSocialList -> {
|
|
||||||
if (instanceSocialList != null && instanceSocialList.instances.size() > 0) {
|
|
||||||
InstanceSocial.Instance instanceSocial = instanceSocialList.instances.get(0);
|
|
||||||
for (InstanceSocial.Instance instance : instanceSocialList.instances) {
|
|
||||||
if (instance.name.equalsIgnoreCase(BaseMainActivity.currentInstance.trim())) {
|
|
||||||
instanceSocial = instance;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (instanceSocial.thumbnail != null && !instanceSocial.thumbnail.equals("null"))
|
|
||||||
Glide.with(InstanceHealthActivity.this)
|
|
||||||
.asBitmap()
|
|
||||||
.load(instanceSocial.thumbnail)
|
|
||||||
.into(binding.backGroundImage);
|
|
||||||
binding.name.setText(instanceSocial.name);
|
|
||||||
if (instanceSocial.up) {
|
|
||||||
binding.up.setText(R.string.is_up);
|
|
||||||
binding.up.setTextColor(ThemeHelper.getAttColor(this, R.attr.colorPrimary));
|
|
||||||
} else {
|
|
||||||
binding.up.setText(R.string.is_down);
|
|
||||||
binding.up.setTextColor(ThemeHelper.getAttColor(this, R.attr.colorError));
|
|
||||||
}
|
|
||||||
binding.uptime.setText(getString(R.string.instance_health_uptime, (instanceSocial.uptime * 100)));
|
|
||||||
if (instanceSocial.checked_at != null)
|
|
||||||
binding.checkedAt.setText(getString(R.string.instance_health_checkedat, Helper.dateToString(instanceSocial.checked_at)));
|
|
||||||
binding.values.setText(getString(R.string.instance_health_indication, instanceSocial.version, Helper.withSuffix(instanceSocial.active_users), Helper.withSuffix(instanceSocial.statuses)));
|
|
||||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
|
||||||
binding.mainContainer.setVisibility(View.GONE);
|
|
||||||
binding.noInstance.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
binding.loader.setVisibility(View.GONE);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -15,8 +15,7 @@ package app.fedilab.android.activities;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import static app.fedilab.android.helper.Helper.PREF_USER_TOKEN;
|
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE;
|
||||||
import static app.fedilab.android.helper.MastodonHelper.REDIRECT_CONTENT_WEB;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -39,13 +38,16 @@ import java.util.regex.Matcher;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.app.Account;
|
import app.fedilab.android.mastodon.activities.BaseActivity;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.activities.ProxyActivity;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.app.Account;
|
||||||
import app.fedilab.android.ui.fragment.login.FragmentLoginMain;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AdminVM;
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.OauthVM;
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AdminVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.OauthVM;
|
||||||
|
import app.fedilab.android.ui.fragment.FragmentLoginMain;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +71,8 @@ public class LoginActivity extends BaseActivity {
|
||||||
BaseMainActivity.api = Account.API.MASTODON;
|
BaseMainActivity.api = Account.API.MASTODON;
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(PREF_USER_TOKEN, account.token);
|
editor.putString(Helper.PREF_USER_TOKEN, account.token);
|
||||||
|
editor.putString(PREF_USER_SOFTWARE, BaseMainActivity.api.name());
|
||||||
editor.commit();
|
editor.commit();
|
||||||
//The user is now authenticated, it will be redirected to MainActivity
|
//The user is now authenticated, it will be redirected to MainActivity
|
||||||
Runnable myRunnable = () -> {
|
Runnable myRunnable = () -> {
|
||||||
|
@ -86,7 +89,7 @@ public class LoginActivity extends BaseActivity {
|
||||||
|
|
||||||
private void manageItent(Intent intent) {
|
private void manageItent(Intent intent) {
|
||||||
|
|
||||||
if (intent != null && intent.getData() != null && intent.getData().toString().contains(REDIRECT_CONTENT_WEB + "?code=")) {
|
if (intent != null && intent.getData() != null && intent.getData().toString().contains(MastodonHelper.REDIRECT_CONTENT_WEB + "?code=")) {
|
||||||
String url = intent.getData().toString();
|
String url = intent.getData().toString();
|
||||||
Matcher matcher = Helper.codePattern.matcher(url);
|
Matcher matcher = Helper.codePattern.matcher(url);
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
|
@ -179,8 +182,7 @@ public class LoginActivity extends BaseActivity {
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_proxy) {
|
if (id == R.id.action_proxy) {
|
||||||
Intent intent = new Intent(LoginActivity.this, ProxyActivity.class);
|
(new ProxyActivity()).show(getSupportFragmentManager(), null);
|
||||||
startActivity(intent);
|
|
||||||
} else if (id == R.id.action_request_admin) {
|
} else if (id == R.id.action_request_admin) {
|
||||||
item.setChecked(!item.isChecked());
|
item.setChecked(!item.isChecked());
|
||||||
requestedAdmin = item.isChecked();
|
requestedAdmin = item.isChecked();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,93 +0,0 @@
|
||||||
package app.fedilab.android.helper;
|
|
||||||
/* Copyright 2022 Thomas Schneider
|
|
||||||
*
|
|
||||||
* This file is a part of Fedilab
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Fedilab 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 Fedilab; if not,
|
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.text.Html;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.preference.PreferenceManager;
|
|
||||||
|
|
||||||
import com.github.stom79.mytransl.MyTransL;
|
|
||||||
import com.github.stom79.mytransl.client.HttpsConnectionException;
|
|
||||||
import com.github.stom79.mytransl.client.Results;
|
|
||||||
import com.github.stom79.mytransl.translate.Params;
|
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
|
||||||
import es.dmoral.toasty.Toasty;
|
|
||||||
|
|
||||||
public class TranslateHelper {
|
|
||||||
|
|
||||||
public static void translate(Context context, String toTranslate, Translate callback) {
|
|
||||||
String statusToTranslate;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
statusToTranslate = Html.fromHtml(toTranslate, Html.FROM_HTML_MODE_LEGACY).toString();
|
|
||||||
else
|
|
||||||
statusToTranslate = Html.fromHtml(toTranslate).toString();
|
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
String translator = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR), "FEDILAB");
|
|
||||||
MyTransL.translatorEngine et;
|
|
||||||
if (translator.compareToIgnoreCase("FEDILAB") == 0) {
|
|
||||||
et = MyTransL.translatorEngine.LIBRETRANSLATE;
|
|
||||||
} else {
|
|
||||||
et = MyTransL.translatorEngine.DEEPL;
|
|
||||||
}
|
|
||||||
final MyTransL myTransL = MyTransL.getInstance(et);
|
|
||||||
myTransL.setObfuscation(true);
|
|
||||||
Params params = new Params();
|
|
||||||
params.setSplit_sentences(false);
|
|
||||||
params.setFormat(Params.fType.TEXT);
|
|
||||||
params.setSource_lang("auto");
|
|
||||||
if (translator.compareToIgnoreCase("FEDILAB") == 0) {
|
|
||||||
myTransL.setLibretranslateDomain("translate.fedilab.app");
|
|
||||||
} else {
|
|
||||||
String translatorVersion = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_VERSION), "PRO");
|
|
||||||
params.setPro(translatorVersion.equals("PRO"));
|
|
||||||
String apikey = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_API_KEY), null);
|
|
||||||
if (apikey != null) {
|
|
||||||
myTransL.setDeeplAPIKey(apikey.trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String translate = sharedpreferences.getString(context.getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale());
|
|
||||||
if (translate.equalsIgnoreCase("default")) {
|
|
||||||
translate = MyTransL.getLocale();
|
|
||||||
}
|
|
||||||
|
|
||||||
myTransL.translate(statusToTranslate, translate, params, new Results() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(com.github.stom79.mytransl.translate.Translate translate) {
|
|
||||||
if (translate.getTranslatedContent() != null) {
|
|
||||||
callback.onTranslate(translate.getTranslatedContent());
|
|
||||||
} else {
|
|
||||||
callback.onTranslate("");
|
|
||||||
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFail(HttpsConnectionException httpsConnectionException) {
|
|
||||||
callback.onTranslate("");
|
|
||||||
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface Translate {
|
|
||||||
void onTranslate(String translated);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -29,14 +29,15 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminAccount;
|
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminReport;
|
|
||||||
import app.fedilab.android.databinding.ActivityAdminReportBinding;
|
import app.fedilab.android.databinding.ActivityAdminReportBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
|
||||||
import app.fedilab.android.ui.drawer.StatusReportAdapter;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminReport;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AdminVM;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.StatusReportAdapter;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AdminVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class AccountReportActivity extends BaseBarActivity {
|
public class AccountReportActivity extends BaseBarActivity {
|
||||||
|
@ -320,6 +321,7 @@ public class AccountReportActivity extends BaseBarActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -22,13 +22,13 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.databinding.ActivityActionsBinding;
|
import app.fedilab.android.databinding.ActivityActionsBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonAccount;
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonDomainBlock;
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonAccount;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonDomainBlock;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
|
||||||
public class ActionActivity extends BaseBarActivity {
|
public class ActionActivity extends BaseBarActivity {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -27,11 +27,11 @@ import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.EmojiInstance;
|
|
||||||
import app.fedilab.android.databinding.ActivityAnnouncementBinding;
|
import app.fedilab.android.databinding.ActivityAnnouncementBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.api.EmojiInstance;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonAnnouncement;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonAnnouncement;
|
||||||
|
|
||||||
|
|
||||||
public class AnnouncementActivity extends BaseActivity {
|
public class AnnouncementActivity extends BaseActivity {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -30,12 +30,17 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.google.android.material.color.DynamicColors;
|
||||||
import com.vanniktech.emoji.EmojiManager;
|
import com.vanniktech.emoji.EmojiManager;
|
||||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
import com.vanniktech.emoji.one.EmojiOneProvider;
|
||||||
|
|
||||||
|
import org.conscrypt.Conscrypt;
|
||||||
|
|
||||||
|
import java.security.Security;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("Registered")
|
@SuppressLint("Registered")
|
||||||
|
@ -44,14 +49,25 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
public static int currentThemeId;
|
public static int currentThemeId;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Helper.installProvider();
|
|
||||||
EmojiManager.install(new EmojiOneProvider());
|
EmojiManager.install(new EmojiOneProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
boolean patch_provider = true;
|
||||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
try {
|
||||||
|
patch_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
if (patch_provider) {
|
||||||
|
try {
|
||||||
|
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME));
|
String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME));
|
||||||
//Default automatic switch
|
//Default automatic switch
|
||||||
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
||||||
|
@ -128,6 +144,10 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
boolean dynamicColor = sharedpreferences.getBoolean(getString(R.string.SET_DYNAMICCOLOR), false);
|
||||||
|
if (dynamicColor) {
|
||||||
|
DynamicColors.applyToActivityIfAvailable(this);
|
||||||
|
}
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) {
|
||||||
ThemeHelper.adjustFontScale(this, getResources().getConfiguration());
|
ThemeHelper.adjustFontScale(this, getResources().getConfiguration());
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -30,25 +30,40 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.google.android.material.color.DynamicColors;
|
||||||
import com.vanniktech.emoji.EmojiManager;
|
import com.vanniktech.emoji.EmojiManager;
|
||||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
import com.vanniktech.emoji.one.EmojiOneProvider;
|
||||||
|
|
||||||
|
import org.conscrypt.Conscrypt;
|
||||||
|
|
||||||
|
import java.security.Security;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("Registered")
|
@SuppressLint("Registered")
|
||||||
public class BaseBarActivity extends AppCompatActivity {
|
public class BaseBarActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Helper.installProvider();
|
|
||||||
EmojiManager.install(new EmojiOneProvider());
|
EmojiManager.install(new EmojiOneProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
boolean patch_provider = true;
|
||||||
|
try {
|
||||||
|
patch_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
if (patch_provider) {
|
||||||
|
try {
|
||||||
|
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME));
|
String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME));
|
||||||
//Default automatic switch
|
//Default automatic switch
|
||||||
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
||||||
|
@ -114,6 +129,10 @@ public class BaseBarActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
boolean dynamicColor = sharedpreferences.getBoolean(getString(R.string.SET_DYNAMICCOLOR), false);
|
||||||
|
if (dynamicColor) {
|
||||||
|
DynamicColors.applyToActivityIfAvailable(this);
|
||||||
|
}
|
||||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -30,25 +30,40 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.google.android.material.color.DynamicColors;
|
||||||
import com.vanniktech.emoji.EmojiManager;
|
import com.vanniktech.emoji.EmojiManager;
|
||||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
import com.vanniktech.emoji.one.EmojiOneProvider;
|
||||||
|
|
||||||
|
import org.conscrypt.Conscrypt;
|
||||||
|
|
||||||
|
import java.security.Security;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("Registered")
|
@SuppressLint("Registered")
|
||||||
public class BaseTransparentActivity extends AppCompatActivity {
|
public class BaseTransparentActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Helper.installProvider();
|
|
||||||
EmojiManager.install(new EmojiOneProvider());
|
EmojiManager.install(new EmojiOneProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
boolean patch_provider = true;
|
||||||
|
try {
|
||||||
|
patch_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
if (patch_provider) {
|
||||||
|
try {
|
||||||
|
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME));
|
String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME));
|
||||||
//Default automatic switch
|
//Default automatic switch
|
||||||
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
||||||
|
@ -114,6 +129,10 @@ public class BaseTransparentActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
boolean dynamicColor = sharedpreferences.getBoolean(getString(R.string.SET_DYNAMICCOLOR), false);
|
||||||
|
if (dynamicColor) {
|
||||||
|
DynamicColors.applyToActivityIfAvailable(this);
|
||||||
|
}
|
||||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -26,21 +26,23 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.app.Account;
|
|
||||||
import app.fedilab.android.client.entities.app.BaseAccount;
|
|
||||||
import app.fedilab.android.client.entities.app.CacheAccount;
|
|
||||||
import app.fedilab.android.client.entities.app.StatusCache;
|
|
||||||
import app.fedilab.android.client.entities.app.StatusDraft;
|
|
||||||
import app.fedilab.android.databinding.ActivityCacheBinding;
|
import app.fedilab.android.databinding.ActivityCacheBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.app.Account;
|
||||||
import app.fedilab.android.helper.CacheHelper;
|
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.app.CacheAccount;
|
||||||
import app.fedilab.android.ui.drawer.CacheAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
|
||||||
|
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
|
||||||
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
|
import app.fedilab.android.mastodon.helper.CacheHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.CacheAdapter;
|
||||||
|
|
||||||
public class CacheActivity extends BaseBarActivity {
|
public class CacheActivity extends BaseBarActivity {
|
||||||
|
|
||||||
|
@ -119,7 +121,7 @@ public class CacheActivity extends BaseBarActivity {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_clear) {
|
} else if (item.getItemId() == R.id.action_clear) {
|
||||||
AlertDialog.Builder deleteConfirm = new AlertDialog.Builder(CacheActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder deleteConfirm = new MaterialAlertDialogBuilder(CacheActivity.this);
|
||||||
deleteConfirm.setTitle(getString(R.string.delete_cache));
|
deleteConfirm.setTitle(getString(R.string.delete_cache));
|
||||||
deleteConfirm.setMessage(getString(R.string.delete_cache_message));
|
deleteConfirm.setMessage(getString(R.string.delete_cache_message));
|
||||||
deleteConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
deleteConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
@ -129,7 +131,7 @@ public class CacheActivity extends BaseBarActivity {
|
||||||
size = size / 1000000.0f;
|
size = size / 1000000.0f;
|
||||||
}
|
}
|
||||||
binding.fileCacheSize.setText(String.format("%s %s", String.format(Locale.getDefault(), "%.2f", size), getString(R.string.cache_units)));
|
binding.fileCacheSize.setText(String.format("%s %s", String.format(Locale.getDefault(), "%.2f", size), getString(R.string.cache_units)));
|
||||||
AlertDialog.Builder restartBuilder = new AlertDialog.Builder(CacheActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder restartBuilder = new MaterialAlertDialogBuilder(CacheActivity.this);
|
||||||
restartBuilder.setMessage(getString(R.string.restart_the_app));
|
restartBuilder.setMessage(getString(R.string.restart_the_app));
|
||||||
restartBuilder.setNegativeButton(R.string.no, (dialogRestart, whichRestart) -> {
|
restartBuilder.setNegativeButton(R.string.no, (dialogRestart, whichRestart) -> {
|
||||||
recreate();
|
recreate();
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -18,7 +18,6 @@ package app.fedilab.android.activities;
|
||||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
import static app.fedilab.android.BaseMainActivity.currentInstance;
|
import static app.fedilab.android.BaseMainActivity.currentInstance;
|
||||||
import static app.fedilab.android.BaseMainActivity.emojis;
|
import static app.fedilab.android.BaseMainActivity.emojis;
|
||||||
import static app.fedilab.android.ui.drawer.ComposeAdapter.prepareDraft;
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
@ -56,6 +55,8 @@ import androidx.work.OneTimeWorkRequest;
|
||||||
import androidx.work.OutOfQuotaPolicy;
|
import androidx.work.OutOfQuotaPolicy;
|
||||||
import androidx.work.WorkManager;
|
import androidx.work.WorkManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -63,36 +64,39 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.api.Context;
|
|
||||||
import app.fedilab.android.client.entities.api.EmojiInstance;
|
|
||||||
import app.fedilab.android.client.entities.api.Instance;
|
|
||||||
import app.fedilab.android.client.entities.api.Mention;
|
|
||||||
import app.fedilab.android.client.entities.api.ScheduledStatus;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.client.entities.app.BaseAccount;
|
|
||||||
import app.fedilab.android.client.entities.app.StatusDraft;
|
|
||||||
import app.fedilab.android.databinding.ActivityPaginationBinding;
|
import app.fedilab.android.databinding.ActivityPaginationBinding;
|
||||||
import app.fedilab.android.databinding.PopupContactBinding;
|
import app.fedilab.android.databinding.PopupContactBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.helper.DividerDecorationSimple;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Context;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.client.entities.api.EmojiInstance;
|
||||||
import app.fedilab.android.helper.MediaHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Instance;
|
||||||
import app.fedilab.android.interfaces.OnDownloadInterface;
|
import app.fedilab.android.mastodon.client.entities.api.Mention;
|
||||||
import app.fedilab.android.jobs.ComposeWorker;
|
import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus;
|
||||||
import app.fedilab.android.jobs.ScheduleThreadWorker;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.services.ThreadMessageService;
|
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
|
||||||
import app.fedilab.android.ui.drawer.AccountsReplyAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
|
||||||
import app.fedilab.android.ui.drawer.ComposeAdapter;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.helper.DividerDecorationSimple;
|
||||||
import app.fedilab.android.viewmodel.mastodon.StatusesVM;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MediaHelper;
|
||||||
|
import app.fedilab.android.mastodon.interfaces.OnDownloadInterface;
|
||||||
|
import app.fedilab.android.mastodon.jobs.ComposeWorker;
|
||||||
|
import app.fedilab.android.mastodon.jobs.ScheduleThreadWorker;
|
||||||
|
import app.fedilab.android.mastodon.services.ThreadMessageService;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.AccountsReplyAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.ComposeAdapter;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.StatusesVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class ComposeActivity extends BaseActivity implements ComposeAdapter.ManageDrafts, AccountsReplyAdapter.ActionDone, ComposeAdapter.promptDraftListener {
|
public class ComposeActivity extends BaseActivity implements ComposeAdapter.ManageDrafts, AccountsReplyAdapter.ActionDone, ComposeAdapter.promptDraftListener {
|
||||||
|
@ -104,14 +108,9 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
public static final int TAKE_PHOTO = 5600;
|
public static final int TAKE_PHOTO = 5600;
|
||||||
private final Timer timer = new Timer();
|
private final Timer timer = new Timer();
|
||||||
private List<Status> statusList;
|
private List<Status> statusList;
|
||||||
private Status statusReply, statusMention;
|
private Status statusReply, statusMention, statusQuoted;
|
||||||
private StatusDraft statusDraft;
|
private StatusDraft statusDraft;
|
||||||
private ComposeAdapter composeAdapter;
|
private ComposeAdapter composeAdapter;
|
||||||
private boolean promptSaveDraft;
|
|
||||||
private boolean restoredDraft;
|
|
||||||
private List<Attachment> sharedAttachments;
|
|
||||||
|
|
||||||
|
|
||||||
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(android.content.Context context, Intent intent) {
|
public void onReceive(android.content.Context context, Intent intent) {
|
||||||
|
@ -138,16 +137,18 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private boolean promptSaveDraft;
|
||||||
|
private boolean restoredDraft;
|
||||||
|
private List<Attachment> sharedAttachments;
|
||||||
private ActivityPaginationBinding binding;
|
private ActivityPaginationBinding binding;
|
||||||
private BaseAccount account;
|
private BaseAccount account;
|
||||||
private String instance, token;
|
private String instance, token;
|
||||||
private Uri photoFileUri;
|
private Uri photoFileUri;
|
||||||
private ScheduledStatus scheduledStatus;
|
private ScheduledStatus scheduledStatus;
|
||||||
private String visibility;
|
private String visibility;
|
||||||
private app.fedilab.android.client.entities.api.Account accountMention;
|
private Account accountMention;
|
||||||
private String statusReplyId;
|
private String statusReplyId;
|
||||||
private app.fedilab.android.client.entities.api.Account mentionBooster;
|
private Account mentionBooster;
|
||||||
private String sharedSubject, sharedContent, sharedTitle, sharedDescription, shareURL, sharedUrlMedia;
|
private String sharedSubject, sharedContent, sharedTitle, sharedDescription, shareURL, sharedUrlMedia;
|
||||||
private String editMessageId;
|
private String editMessageId;
|
||||||
|
|
||||||
|
@ -210,11 +211,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
|
|
||||||
private void storeDraftWarning() {
|
private void storeDraftWarning() {
|
||||||
if (statusDraft == null) {
|
if (statusDraft == null) {
|
||||||
statusDraft = prepareDraft(statusList, composeAdapter, account.instance, account.user_id);
|
statusDraft = ComposeAdapter.prepareDraft(statusList, composeAdapter, account.instance, account.user_id);
|
||||||
}
|
}
|
||||||
if (canBeSent(statusDraft)) {
|
if (canBeSent(statusDraft)) {
|
||||||
if (promptSaveDraft) {
|
if (promptSaveDraft) {
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(ComposeActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(ComposeActivity.this);
|
||||||
alt_bld.setMessage(R.string.save_draft);
|
alt_bld.setMessage(R.string.save_draft);
|
||||||
alt_bld.setPositiveButton(R.string.save, (dialog, id) -> {
|
alt_bld.setPositiveButton(R.string.save, (dialog, id) -> {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
@ -315,7 +316,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
} else if (item.getItemId() == R.id.action_photo_camera) {
|
} else if (item.getItemId() == R.id.action_photo_camera) {
|
||||||
photoFileUri = MediaHelper.dispatchTakePictureIntent(ComposeActivity.this);
|
photoFileUri = MediaHelper.dispatchTakePictureIntent(ComposeActivity.this);
|
||||||
} else if (item.getItemId() == R.id.action_contacts) {
|
} else if (item.getItemId() == R.id.action_contacts) {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ComposeActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builderSingle = new MaterialAlertDialogBuilder(ComposeActivity.this);
|
||||||
|
|
||||||
builderSingle.setTitle(getString(R.string.select_accounts));
|
builderSingle.setTitle(getString(R.string.select_accounts));
|
||||||
PopupContactBinding popupContactBinding = PopupContactBinding.inflate(getLayoutInflater(), new LinearLayout(ComposeActivity.this), false);
|
PopupContactBinding popupContactBinding = PopupContactBinding.inflate(getLayoutInflater(), new LinearLayout(ComposeActivity.this), false);
|
||||||
|
@ -391,7 +392,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
}
|
}
|
||||||
} else if (item.getItemId() == R.id.action_schedule) {
|
} else if (item.getItemId() == R.id.action_schedule) {
|
||||||
if (statusDraft == null) {
|
if (statusDraft == null) {
|
||||||
statusDraft = prepareDraft(statusList, composeAdapter, account.instance, account.user_id);
|
statusDraft = ComposeAdapter.prepareDraft(statusList, composeAdapter, account.instance, account.user_id);
|
||||||
}
|
}
|
||||||
if (canBeSent(statusDraft)) {
|
if (canBeSent(statusDraft)) {
|
||||||
MediaHelper.scheduleMessage(ComposeActivity.this, date -> storeDraft(true, date));
|
MediaHelper.scheduleMessage(ComposeActivity.this, date -> storeDraft(true, date));
|
||||||
|
@ -402,14 +403,14 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRetrieveContact(PopupContactBinding popupContactBinding, List<app.fedilab.android.client.entities.api.Account> accounts) {
|
private void onRetrieveContact(PopupContactBinding popupContactBinding, List<Account> accounts) {
|
||||||
popupContactBinding.loader.setVisibility(View.GONE);
|
popupContactBinding.loader.setVisibility(View.GONE);
|
||||||
if (accounts == null) {
|
if (accounts == null) {
|
||||||
accounts = new ArrayList<>();
|
accounts = new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<Boolean> checkedValues = new ArrayList<>();
|
List<Boolean> checkedValues = new ArrayList<>();
|
||||||
List<app.fedilab.android.client.entities.api.Account> contacts = new ArrayList<>(accounts);
|
List<Account> contacts = new ArrayList<>(accounts);
|
||||||
for (app.fedilab.android.client.entities.api.Account account : contacts) {
|
for (Account account : contacts) {
|
||||||
checkedValues.add(composeAdapter.getLastComposeContent().contains("@" + account.acct));
|
checkedValues.add(composeAdapter.getLastComposeContent().contains("@" + account.acct));
|
||||||
}
|
}
|
||||||
AccountsReplyAdapter contactAdapter = new AccountsReplyAdapter(contacts, checkedValues);
|
AccountsReplyAdapter contactAdapter = new AccountsReplyAdapter(contacts, checkedValues);
|
||||||
|
@ -465,6 +466,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY);
|
statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY);
|
||||||
|
statusQuoted = (Status) b.getSerializable(Helper.ARG_QUOTED_MESSAGE);
|
||||||
statusDraft = (StatusDraft) b.getSerializable(Helper.ARG_STATUS_DRAFT);
|
statusDraft = (StatusDraft) b.getSerializable(Helper.ARG_STATUS_DRAFT);
|
||||||
scheduledStatus = (ScheduledStatus) b.getSerializable(Helper.ARG_STATUS_SCHEDULED);
|
scheduledStatus = (ScheduledStatus) b.getSerializable(Helper.ARG_STATUS_SCHEDULED);
|
||||||
statusReplyId = b.getString(Helper.ARG_STATUS_REPLY_ID);
|
statusReplyId = b.getString(Helper.ARG_STATUS_REPLY_ID);
|
||||||
|
@ -479,8 +481,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
} else if (visibility == null && currentAccount != null && currentAccount.mastodon_account != null && currentAccount.mastodon_account.source != null) {
|
} else if (visibility == null && currentAccount != null && currentAccount.mastodon_account != null && currentAccount.mastodon_account.source != null) {
|
||||||
visibility = currentAccount.mastodon_account.source.privacy;
|
visibility = currentAccount.mastodon_account.source.privacy;
|
||||||
}
|
}
|
||||||
mentionBooster = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
|
mentionBooster = (Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
|
||||||
accountMention = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
|
accountMention = (Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
|
||||||
//Shared elements
|
//Shared elements
|
||||||
sharedAttachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ATTACHMENTS);
|
sharedAttachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ATTACHMENTS);
|
||||||
sharedUrlMedia = b.getString(Helper.ARG_SHARE_URL_MEDIA);
|
sharedUrlMedia = b.getString(Helper.ARG_SHARE_URL_MEDIA);
|
||||||
|
@ -536,10 +538,10 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
token = account.token;
|
token = account.token;
|
||||||
}
|
}
|
||||||
if (emojis == null || !emojis.containsKey(currentInstance)) {
|
if (emojis == null || !emojis.containsKey(instance)) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
emojis.put(currentInstance, new EmojiInstance(ComposeActivity.this).getEmojiList(currentInstance));
|
emojis.put(instance, new EmojiInstance(ComposeActivity.this).getEmojiList(instance));
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -557,6 +559,9 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
List<Status> statusDraftList = new ArrayList<>();
|
List<Status> statusDraftList = new ArrayList<>();
|
||||||
Status status = new Status();
|
Status status = new Status();
|
||||||
status.id = Helper.generateIdString();
|
status.id = Helper.generateIdString();
|
||||||
|
if (statusQuoted != null) {
|
||||||
|
status.quote_id = statusQuoted.id;
|
||||||
|
}
|
||||||
statusDraftList.add(status);
|
statusDraftList.add(status);
|
||||||
|
|
||||||
if (statusReplyId != null && statusDraft != null) {//Delete and redraft
|
if (statusReplyId != null && statusDraft != null) {//Delete and redraft
|
||||||
|
@ -633,9 +638,25 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
}
|
}
|
||||||
if (statusReply.spoiler_text != null) {
|
if (statusReply.spoiler_text != null) {
|
||||||
statusDraftList.get(0).spoiler_text = statusReply.spoiler_text;
|
statusDraftList.get(0).spoiler_text = statusReply.spoiler_text;
|
||||||
|
if (statusReply.spoiler_text.trim().length() > 0) {
|
||||||
|
statusDraftList.get(0).spoilerChecked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (statusReply.language != null && !statusReply.language.isEmpty()) {
|
if (statusReply.language != null && !statusReply.language.isEmpty()) {
|
||||||
statusDraftList.get(0).language = statusReply.language;
|
Set<String> storedLanguages = sharedpreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null);
|
||||||
|
if (storedLanguages == null || storedLanguages.size() == 0) {
|
||||||
|
statusDraftList.get(0).language = statusReply.language;
|
||||||
|
} else {
|
||||||
|
if (storedLanguages.contains(statusReply.language)) {
|
||||||
|
statusDraftList.get(0).language = statusReply.language;
|
||||||
|
} else {
|
||||||
|
String currentCode = sharedpreferences.getString(getString(R.string.SET_COMPOSE_LANGUAGE) + account.user_id + account.instance, Locale.getDefault().getLanguage());
|
||||||
|
if (currentCode.isEmpty()) {
|
||||||
|
currentCode = "EN";
|
||||||
|
}
|
||||||
|
statusDraftList.get(0).language = currentCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//StatusDraftList at this point should only have one element
|
//StatusDraftList at this point should only have one element
|
||||||
statusList.addAll(statusDraftList);
|
statusList.addAll(statusDraftList);
|
||||||
|
@ -647,6 +668,18 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
binding.recyclerView.setAdapter(composeAdapter);
|
binding.recyclerView.setAdapter(composeAdapter);
|
||||||
statusesVM.getContext(currentInstance, BaseMainActivity.currentToken, statusReply.id)
|
statusesVM.getContext(currentInstance, BaseMainActivity.currentToken, statusReply.id)
|
||||||
.observe(ComposeActivity.this, this::initializeContextView);
|
.observe(ComposeActivity.this, this::initializeContextView);
|
||||||
|
} else if (statusQuoted != null) {
|
||||||
|
statusList.add(statusQuoted);
|
||||||
|
int statusCount = statusList.size();
|
||||||
|
statusDraftList.get(0).quote_id = statusQuoted.id;
|
||||||
|
//StatusDraftList at this point should only have one element
|
||||||
|
statusList.addAll(statusDraftList);
|
||||||
|
composeAdapter = new ComposeAdapter(statusList, statusCount, account, accountMention, visibility, editMessageId);
|
||||||
|
composeAdapter.manageDrafts = this;
|
||||||
|
composeAdapter.promptDraftListener = this;
|
||||||
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(ComposeActivity.this);
|
||||||
|
binding.recyclerView.setLayoutManager(mLayoutManager);
|
||||||
|
binding.recyclerView.setAdapter(composeAdapter);
|
||||||
} else {
|
} else {
|
||||||
//Compose without replying
|
//Compose without replying
|
||||||
statusList.addAll(statusDraftList);
|
statusList.addAll(statusDraftList);
|
||||||
|
@ -715,18 +748,20 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
Status status = new Status();
|
Status status = new Status();
|
||||||
|
|
||||||
status.id = Helper.generateIdString();
|
status.id = Helper.generateIdString();
|
||||||
status.mentions = statusList.get(position).mentions;
|
status.mentions = statusList.get(position - 1).mentions;
|
||||||
status.visibility = statusList.get(position).visibility;
|
status.visibility = statusList.get(position - 1).visibility;
|
||||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this);
|
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this);
|
||||||
boolean unlistedReplies = sharedpreferences.getBoolean(getString(R.string.SET_UNLISTED_REPLIES), true);
|
boolean unlistedReplies = sharedpreferences.getBoolean(getString(R.string.SET_UNLISTED_REPLIES), true);
|
||||||
if (status.visibility.equalsIgnoreCase("public") && unlistedReplies) {
|
if (status.visibility.equalsIgnoreCase("public") && unlistedReplies) {
|
||||||
status.visibility = "unlisted";
|
status.visibility = "unlisted";
|
||||||
}
|
}
|
||||||
status.spoiler_text = statusList.get(position).spoiler_text;
|
status.spoiler_text = statusList.get(position - 1).spoiler_text;
|
||||||
status.sensitive = statusList.get(position).sensitive;
|
status.sensitive = statusList.get(position - 1).sensitive;
|
||||||
statusList.add(status);
|
statusList.add(status);
|
||||||
composeAdapter.notifyItemInserted(position + 1);
|
composeAdapter.notifyItemInserted(position);
|
||||||
binding.recyclerView.smoothScrollToPosition(position + 1);
|
composeAdapter.notifyItemRangeChanged(0, statusList.size());
|
||||||
|
binding.recyclerView.smoothScrollToPosition(statusList.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -830,6 +865,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
WorkManager.getInstance(ComposeActivity.this).enqueue(oneTimeWorkRequest);
|
WorkManager.getInstance(ComposeActivity.this).enqueue(oneTimeWorkRequest);
|
||||||
statusDraft.workerUuid = oneTimeWorkRequest.getId();
|
statusDraft.workerUuid = oneTimeWorkRequest.getId();
|
||||||
statusDraft.scheduled_at = date;
|
statusDraft.scheduled_at = date;
|
||||||
|
try {
|
||||||
|
new StatusDraft(ComposeActivity.this).updateStatusDraft(statusDraft);
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Runnable myRunnable = () -> {
|
Runnable myRunnable = () -> {
|
||||||
Toasty.info(ComposeActivity.this, getString(R.string.toot_scheduled), Toasty.LENGTH_LONG).show();
|
Toasty.info(ComposeActivity.this, getString(R.string.toot_scheduled), Toasty.LENGTH_LONG).show();
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -16,7 +16,6 @@ package app.fedilab.android.activities;
|
||||||
|
|
||||||
|
|
||||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
import static app.fedilab.android.ui.drawer.StatusAdapter.sendAction;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -41,14 +40,16 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.app.StatusCache;
|
|
||||||
import app.fedilab.android.databinding.ActivityConversationBinding;
|
import app.fedilab.android.databinding.ActivityConversationBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonContext;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.StatusesVM;
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.StatusAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonContext;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.StatusesVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class ContextActivity extends BaseActivity implements FragmentMastodonContext.FirstMessage {
|
public class ContextActivity extends BaseActivity implements FragmentMastodonContext.FirstMessage {
|
||||||
|
@ -114,7 +115,7 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
|
||||||
new StatusCache(getApplication()).updateIfExists(statusCache);
|
new StatusCache(getApplication()).updateIfExists(statusCache);
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
//Update UI
|
//Update UI
|
||||||
Runnable myRunnable = () -> sendAction(ContextActivity.this, Helper.ARG_STATUS_ACTION, status, null);
|
Runnable myRunnable = () -> StatusAdapter.sendAction(ContextActivity.this, Helper.ARG_STATUS_ACTION, status, null);
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -31,15 +31,15 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
|
||||||
import app.fedilab.android.client.entities.api.Emoji;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.client.entities.api.Tag;
|
|
||||||
import app.fedilab.android.databinding.ActivityCustomSharingBinding;
|
import app.fedilab.android.databinding.ActivityCustomSharingBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.helper.customsharing.CustomSharingAsyncTask;
|
import app.fedilab.android.mastodon.client.entities.api.Emoji;
|
||||||
import app.fedilab.android.helper.customsharing.CustomSharingResponse;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.helper.customsharing.OnCustomSharingInterface;
|
import app.fedilab.android.mastodon.client.entities.api.Tag;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.customsharing.CustomSharingAsyncTask;
|
||||||
|
import app.fedilab.android.mastodon.helper.customsharing.CustomSharingResponse;
|
||||||
|
import app.fedilab.android.mastodon.helper.customsharing.OnCustomSharingInterface;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
package app.fedilab.android.mastodon.activities;
|
||||||
|
/* Copyright 2022 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Fedilab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Fedilab 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 Fedilab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.android.mastodon.client.entities.app.Timeline.TimeLineEnum.ACCOUNT_DIRECTORY;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.databinding.ActivityDirectoryBinding;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonAccount;
|
||||||
|
|
||||||
|
|
||||||
|
public class DirectoryActivity extends BaseBarActivity {
|
||||||
|
|
||||||
|
private static boolean local = false;
|
||||||
|
private static String order = "active";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
ActivityDirectoryBinding binding = ActivityDirectoryBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
if (getSupportActionBar() != null) {
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putBoolean(Helper.ARG_DIRECTORY_LOCAL, local);
|
||||||
|
bundle.putString(Helper.ARG_DIRECTORY_ORDER, order);
|
||||||
|
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, ACCOUNT_DIRECTORY);
|
||||||
|
Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_directory, new FragmentMastodonAccount(), bundle, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.menu_directory, menu);
|
||||||
|
if (order.equals("active")) {
|
||||||
|
menu.findItem(R.id.order_active).setChecked(true);
|
||||||
|
} else {
|
||||||
|
menu.findItem(R.id.order_new).setChecked(true);
|
||||||
|
}
|
||||||
|
menu.findItem(R.id.action_local).setChecked(local);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(@NotNull MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.action_local) {
|
||||||
|
item.setChecked(!item.isChecked());
|
||||||
|
local = item.isChecked();
|
||||||
|
} else if (item.getItemId() == R.id.order_active) {
|
||||||
|
order = "active";
|
||||||
|
} else if (item.getItemId() == R.id.order_new) {
|
||||||
|
order = "new";
|
||||||
|
}
|
||||||
|
recreate();
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -33,19 +33,20 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.client.entities.app.StatusDraft;
|
|
||||||
import app.fedilab.android.databinding.ActivityDraftsBinding;
|
import app.fedilab.android.databinding.ActivityDraftsBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.ui.drawer.StatusDraftAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
|
||||||
import app.fedilab.android.viewmodel.mastodon.TimelinesVM;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.StatusDraftAdapter;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.TimelinesVM;
|
||||||
|
|
||||||
public class DraftActivity extends BaseActivity implements StatusDraftAdapter.DraftActions {
|
public class DraftActivity extends BaseActivity implements StatusDraftAdapter.DraftActions {
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ public class DraftActivity extends BaseActivity implements StatusDraftAdapter.Dr
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_delete) {
|
} else if (item.getItemId() == R.id.action_delete) {
|
||||||
AlertDialog.Builder unfollowConfirm = new AlertDialog.Builder(DraftActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(DraftActivity.this);
|
||||||
unfollowConfirm.setTitle(getString(R.string.delete_all));
|
unfollowConfirm.setTitle(getString(R.string.delete_all));
|
||||||
unfollowConfirm.setMessage(getString(R.string.remove_draft));
|
unfollowConfirm.setMessage(getString(R.string.remove_draft));
|
||||||
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -34,6 +34,7 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.textfield.TextInputEditText;
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
@ -42,14 +43,14 @@ import java.util.Locale;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.Field;
|
|
||||||
import app.fedilab.android.databinding.AccountFieldItemBinding;
|
import app.fedilab.android.databinding.AccountFieldItemBinding;
|
||||||
import app.fedilab.android.databinding.ActivityEditProfileBinding;
|
import app.fedilab.android.databinding.ActivityEditProfileBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Field;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class EditProfileActivity extends BaseBarActivity {
|
public class EditProfileActivity extends BaseBarActivity {
|
||||||
|
@ -135,7 +136,7 @@ public class EditProfileActivity extends BaseBarActivity {
|
||||||
value = Html.fromHtml(field.value).toString();
|
value = Html.fromHtml(field.value).toString();
|
||||||
fieldItemBinding.value.setText(value);
|
fieldItemBinding.value.setText(value);
|
||||||
fieldItemBinding.remove.setOnClickListener(v -> {
|
fieldItemBinding.remove.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder deleteConfirm = new AlertDialog.Builder(EditProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder deleteConfirm = new MaterialAlertDialogBuilder(EditProfileActivity.this);
|
||||||
deleteConfirm.setTitle(getString(R.string.delete_field));
|
deleteConfirm.setTitle(getString(R.string.delete_field));
|
||||||
deleteConfirm.setMessage(getString(R.string.delete_field_confirm));
|
deleteConfirm.setMessage(getString(R.string.delete_field_confirm));
|
||||||
deleteConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
deleteConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
@ -157,7 +158,7 @@ public class EditProfileActivity extends BaseBarActivity {
|
||||||
binding.addField.setOnClickListener(view -> {
|
binding.addField.setOnClickListener(view -> {
|
||||||
AccountFieldItemBinding fieldItemBinding = AccountFieldItemBinding.inflate(getLayoutInflater());
|
AccountFieldItemBinding fieldItemBinding = AccountFieldItemBinding.inflate(getLayoutInflater());
|
||||||
fieldItemBinding.remove.setOnClickListener(v -> {
|
fieldItemBinding.remove.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder deleteConfirm = new AlertDialog.Builder(EditProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder deleteConfirm = new MaterialAlertDialogBuilder(EditProfileActivity.this);
|
||||||
deleteConfirm.setTitle(getString(R.string.delete_field));
|
deleteConfirm.setTitle(getString(R.string.delete_field));
|
||||||
deleteConfirm.setMessage(getString(R.string.delete_field_confirm));
|
deleteConfirm.setMessage(getString(R.string.delete_field_confirm));
|
||||||
deleteConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
deleteConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
@ -207,7 +208,7 @@ public class EditProfileActivity extends BaseBarActivity {
|
||||||
Helper.recreateMainActivity(EditProfileActivity.this);
|
Helper.recreateMainActivity(EditProfileActivity.this);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(currentAccount);
|
new app.fedilab.android.mastodon.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(currentAccount);
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -234,7 +235,7 @@ public class EditProfileActivity extends BaseBarActivity {
|
||||||
currentAccount.mastodon_account = account;
|
currentAccount.mastodon_account = account;
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(currentAccount);
|
new app.fedilab.android.mastodon.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(currentAccount);
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -328,7 +329,7 @@ public class EditProfileActivity extends BaseBarActivity {
|
||||||
currentAccount.mastodon_account = account;
|
currentAccount.mastodon_account = account;
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(currentAccount);
|
new app.fedilab.android.mastodon.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(currentAccount);
|
||||||
sendBroadCast(account);
|
sendBroadCast(account);
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -32,19 +32,21 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.lifecycle.ViewModelStoreOwner;
|
import androidx.lifecycle.ViewModelStoreOwner;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Filter;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.databinding.ActivityFiltersBinding;
|
import app.fedilab.android.databinding.ActivityFiltersBinding;
|
||||||
import app.fedilab.android.databinding.PopupAddFilterBinding;
|
import app.fedilab.android.databinding.PopupAddFilterBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Filter;
|
||||||
import app.fedilab.android.ui.drawer.FilterAdapter;
|
import app.fedilab.android.mastodon.ui.drawer.FilterAdapter;
|
||||||
import app.fedilab.android.ui.drawer.KeywordAdapter;
|
import app.fedilab.android.mastodon.ui.drawer.KeywordAdapter;
|
||||||
import app.fedilab.android.viewmodel.mastodon.FiltersVM;
|
import app.fedilab.android.mastodon.viewmodel.mastodon.FiltersVM;
|
||||||
|
|
||||||
public class FilterActivity extends BaseBarActivity implements FilterAdapter.Delete {
|
public class FilterActivity extends BaseBarActivity implements FilterAdapter.Delete {
|
||||||
|
|
||||||
|
@ -60,7 +62,7 @@ public class FilterActivity extends BaseBarActivity implements FilterAdapter.Del
|
||||||
* @param listener - {@link FilterAdapter.FilterAction}
|
* @param listener - {@link FilterAdapter.FilterAction}
|
||||||
*/
|
*/
|
||||||
public static void addEditFilter(Context context, Filter filter, FilterAdapter.FilterAction listener) {
|
public static void addEditFilter(Context context, Filter filter, FilterAdapter.FilterAction listener) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(context);
|
||||||
PopupAddFilterBinding popupAddFilterBinding = PopupAddFilterBinding.inflate(LayoutInflater.from(context));
|
PopupAddFilterBinding popupAddFilterBinding = PopupAddFilterBinding.inflate(LayoutInflater.from(context));
|
||||||
FiltersVM filtersVM = new ViewModelProvider((ViewModelStoreOwner) context).get(FiltersVM.class);
|
FiltersVM filtersVM = new ViewModelProvider((ViewModelStoreOwner) context).get(FiltersVM.class);
|
||||||
dialogBuilder.setView(popupAddFilterBinding.getRoot());
|
dialogBuilder.setView(popupAddFilterBinding.getRoot());
|
||||||
|
@ -234,7 +236,7 @@ public class FilterActivity extends BaseBarActivity implements FilterAdapter.Del
|
||||||
alertDialog.setTitle(context.getString(R.string.action_update_filter));
|
alertDialog.setTitle(context.getString(R.string.action_update_filter));
|
||||||
alertDialog.setOnDismissListener(dialogInterface -> {
|
alertDialog.setOnDismissListener(dialogInterface -> {
|
||||||
//Hide keyboard
|
//Hide keyboard
|
||||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) context.getSystemService(INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(popupAddFilterBinding.addTitle.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(popupAddFilterBinding.addTitle.getWindowToken(), 0);
|
||||||
});
|
});
|
||||||
if (alertDialog.getWindow() != null) {
|
if (alertDialog.getWindow() != null) {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -29,12 +29,12 @@ import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.Accounts;
|
|
||||||
import app.fedilab.android.databinding.ActivityStatusInfoBinding;
|
import app.fedilab.android.databinding.ActivityStatusInfoBinding;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.ui.drawer.AccountFollowRequestAdapter;
|
import app.fedilab.android.mastodon.client.entities.api.Accounts;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.AccountFollowRequestAdapter;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
|
||||||
|
|
||||||
public class FollowRequestActivity extends BaseActivity {
|
public class FollowRequestActivity extends BaseActivity {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -28,19 +28,21 @@ import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Tag;
|
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.databinding.ActivityFollowedTagsBinding;
|
import app.fedilab.android.databinding.ActivityFollowedTagsBinding;
|
||||||
import app.fedilab.android.databinding.PopupAddFollowedTagtBinding;
|
import app.fedilab.android.databinding.PopupAddFollowedTagtBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Tag;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
import app.fedilab.android.ui.drawer.FollowedTagAdapter;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.TagVM;
|
import app.fedilab.android.mastodon.ui.drawer.FollowedTagAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.TagVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +90,7 @@ public class FollowedTagActivity extends BaseBarActivity implements FollowedTagA
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_unfollow && tag != null) {
|
} else if (item.getItemId() == R.id.action_unfollow && tag != null) {
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(FollowedTagActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(FollowedTagActivity.this);
|
||||||
alt_bld.setTitle(R.string.action_unfollow_tag);
|
alt_bld.setTitle(R.string.action_unfollow_tag);
|
||||||
alt_bld.setMessage(R.string.action_unfollow_tag_confirm);
|
alt_bld.setMessage(R.string.action_unfollow_tag_confirm);
|
||||||
alt_bld.setPositiveButton(R.string.unfollow, (dialog, id) -> {
|
alt_bld.setPositiveButton(R.string.unfollow, (dialog, id) -> {
|
||||||
|
@ -120,7 +122,7 @@ public class FollowedTagActivity extends BaseBarActivity implements FollowedTagA
|
||||||
AlertDialog alert = alt_bld.create();
|
AlertDialog alert = alt_bld.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
} else if (item.getItemId() == R.id.action_follow_tag) {
|
} else if (item.getItemId() == R.id.action_follow_tag) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(FollowedTagActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(FollowedTagActivity.this);
|
||||||
PopupAddFollowedTagtBinding popupAddFollowedTagtBinding = PopupAddFollowedTagtBinding.inflate(getLayoutInflater());
|
PopupAddFollowedTagtBinding popupAddFollowedTagtBinding = PopupAddFollowedTagtBinding.inflate(getLayoutInflater());
|
||||||
dialogBuilder.setView(popupAddFollowedTagtBinding.getRoot());
|
dialogBuilder.setView(popupAddFollowedTagtBinding.getRoot());
|
||||||
popupAddFollowedTagtBinding.addTag.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)});
|
popupAddFollowedTagtBinding.addTag.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)});
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -30,25 +30,28 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Filter;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.client.entities.app.Pinned;
|
|
||||||
import app.fedilab.android.client.entities.app.PinnedTimeline;
|
|
||||||
import app.fedilab.android.client.entities.app.StatusDraft;
|
|
||||||
import app.fedilab.android.client.entities.app.TagTimeline;
|
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.databinding.ActivityHashtagBinding;
|
import app.fedilab.android.databinding.ActivityHashtagBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.api.Filter;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
import app.fedilab.android.mastodon.client.entities.app.Pinned;
|
||||||
import app.fedilab.android.viewmodel.mastodon.FiltersVM;
|
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
|
||||||
import app.fedilab.android.viewmodel.mastodon.ReorderVM;
|
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
|
||||||
import app.fedilab.android.viewmodel.mastodon.TagVM;
|
import app.fedilab.android.mastodon.client.entities.app.TagTimeline;
|
||||||
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.FiltersVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.ReorderVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.TagVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,21 +108,23 @@ public class HashTagActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
ReorderVM reorderVM = new ViewModelProvider(HashTagActivity.this).get(ReorderVM.class);
|
ReorderVM reorderVM = new ViewModelProvider(HashTagActivity.this).get(ReorderVM.class);
|
||||||
reorderVM.getAllPinned().observe(HashTagActivity.this, pinned -> {
|
reorderVM.getAllPinned().observe(HashTagActivity.this, pinned -> {
|
||||||
if (pinned != null) {
|
if (pinned == null) {
|
||||||
this.pinned = pinned;
|
pinned = new Pinned();
|
||||||
pinnedTag = false;
|
pinned.pinnedTimelines = new ArrayList<>();
|
||||||
if (pinned.pinnedTimelines != null) {
|
}
|
||||||
for (PinnedTimeline pinnedTimeline : pinned.pinnedTimelines) {
|
this.pinned = pinned;
|
||||||
if (pinnedTimeline.tagTimeline != null) {
|
pinnedTag = false;
|
||||||
if (pinnedTimeline.tagTimeline.name.equalsIgnoreCase(stripTag)) {
|
if (pinned.pinnedTimelines != null) {
|
||||||
this.pinnedTimeline = pinnedTimeline;
|
for (PinnedTimeline pinnedTimeline : pinned.pinnedTimelines) {
|
||||||
pinnedTag = true;
|
if (pinnedTimeline.tagTimeline != null) {
|
||||||
break;
|
if (pinnedTimeline.tagTimeline.name.equalsIgnoreCase(stripTag)) {
|
||||||
}
|
this.pinnedTimeline = pinnedTimeline;
|
||||||
|
pinnedTag = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invalidateOptionsMenu();
|
|
||||||
}
|
}
|
||||||
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (MainActivity.filterFetched && MainActivity.mainFilters != null) {
|
if (MainActivity.filterFetched && MainActivity.mainFilters != null) {
|
||||||
|
@ -168,10 +173,13 @@ public class HashTagActivity extends BaseActivity {
|
||||||
} else if (item.getItemId() == R.id.action_add_timeline) {
|
} else if (item.getItemId() == R.id.action_add_timeline) {
|
||||||
|
|
||||||
if (pinnedTag) {
|
if (pinnedTag) {
|
||||||
AlertDialog.Builder unpinConfirm = new AlertDialog.Builder(HashTagActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder unpinConfirm = new MaterialAlertDialogBuilder(HashTagActivity.this);
|
||||||
unpinConfirm.setMessage(getString(R.string.unpin_timeline_description));
|
unpinConfirm.setMessage(getString(R.string.unpin_timeline_description));
|
||||||
unpinConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
unpinConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
unpinConfirm.setPositiveButton(R.string.yes, (dialog, which) -> {
|
unpinConfirm.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
|
if (pinned == null || pinned.pinnedTimelines == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
pinned.pinnedTimelines.remove(pinnedTimeline);
|
pinned.pinnedTimelines.remove(pinnedTimeline);
|
||||||
try {
|
try {
|
||||||
new Pinned(HashTagActivity.this).updatePinned(pinned);
|
new Pinned(HashTagActivity.this).updatePinned(pinned);
|
||||||
|
@ -221,8 +229,14 @@ public class HashTagActivity extends BaseActivity {
|
||||||
tagTimeline.name = stripTag.trim();
|
tagTimeline.name = stripTag.trim();
|
||||||
tagTimeline.isNSFW = false;
|
tagTimeline.isNSFW = false;
|
||||||
tagTimeline.isART = false;
|
tagTimeline.isART = false;
|
||||||
|
tagTimeline.any = new ArrayList<>();
|
||||||
|
tagTimeline.any.add(stripTag.trim());
|
||||||
pinnedTimeline.tagTimeline = tagTimeline;
|
pinnedTimeline.tagTimeline = tagTimeline;
|
||||||
pinned.pinnedTimelines.add(pinnedTimeline);
|
pinned.pinnedTimelines.add(pinnedTimeline);
|
||||||
|
if (pinned.instance == null || pinned.user_id == null) {
|
||||||
|
pinned.instance = MainActivity.currentInstance;
|
||||||
|
pinned.user_id = MainActivity.currentUserID;
|
||||||
|
}
|
||||||
if (update) {
|
if (update) {
|
||||||
new Pinned(HashTagActivity.this).updatePinned(pinned);
|
new Pinned(HashTagActivity.this).updatePinned(pinned);
|
||||||
} else {
|
} else {
|
|
@ -0,0 +1,158 @@
|
||||||
|
package app.fedilab.android.mastodon.activities;
|
||||||
|
/* Copyright 2022 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Fedilab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Fedilab 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 Fedilab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
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.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
import app.fedilab.android.BaseMainActivity;
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.activities.MainActivity;
|
||||||
|
import app.fedilab.android.databinding.ActivityInstanceBinding;
|
||||||
|
import app.fedilab.android.mastodon.client.entities.api.Instance;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.InstancesVM;
|
||||||
|
|
||||||
|
|
||||||
|
public class InstanceActivity extends DialogFragment {
|
||||||
|
|
||||||
|
ActivityInstanceBinding binding;
|
||||||
|
private boolean applyMaxChar = false;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
binding = ActivityInstanceBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
|
MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(requireContext());
|
||||||
|
materialAlertDialogBuilder.setView(binding.getRoot());
|
||||||
|
|
||||||
|
Dialog dialog = materialAlertDialogBuilder.create();
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
|
|
||||||
|
final SpannableString contentAbout = new SpannableString(getString(R.string.action_about_instance));
|
||||||
|
contentAbout.setSpan(new UnderlineSpan(), 0, contentAbout.length(), 0);
|
||||||
|
contentAbout.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(requireContext(), R.attr.colorPrimary)), 0, contentAbout.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
binding.about.setText(contentAbout);
|
||||||
|
|
||||||
|
final SpannableString contentPrivacy = new SpannableString(getString(R.string.action_privacy_policy));
|
||||||
|
contentPrivacy.setSpan(new UnderlineSpan(), 0, contentPrivacy.length(), 0);
|
||||||
|
contentPrivacy.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(requireContext(), R.attr.colorPrimary)), 0, contentPrivacy.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
binding.privacy.setText(contentPrivacy);
|
||||||
|
|
||||||
|
binding.about.setOnClickListener(v -> Helper.openBrowser(requireActivity(), "https://" + MainActivity.currentInstance + "/about"));
|
||||||
|
binding.privacy.setOnClickListener(v -> Helper.openBrowser(requireActivity(), "https://" + MainActivity.currentInstance + "/privacy-policy"));
|
||||||
|
binding.close.setOnClickListener(view -> {
|
||||||
|
if (applyMaxChar) {
|
||||||
|
String max_char = binding.maxChar.getText().toString();
|
||||||
|
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
if (!max_char.isEmpty()) {
|
||||||
|
try {
|
||||||
|
editor.putInt(getString(R.string.SET_MAX_INSTANCE_CHAR) + MainActivity.currentInstance, Integer.parseInt(max_char));
|
||||||
|
editor.apply();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requireDialog().dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
InstancesVM instancesVM = new ViewModelProvider(InstanceActivity.this).get(InstancesVM.class);
|
||||||
|
instancesVM.getInstance(BaseMainActivity.currentInstance).observe(InstanceActivity.this, instanceInfo -> {
|
||||||
|
binding.loader.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if (instanceInfo == null || instanceInfo.info == null || instanceInfo.info.description == null) {
|
||||||
|
binding.instanceData.setVisibility(View.GONE);
|
||||||
|
binding.contact.setVisibility(View.GONE);
|
||||||
|
int val = sharedpreferences.getInt(getString(R.string.SET_MAX_INSTANCE_CHAR) + MainActivity.currentInstance, -1);
|
||||||
|
if (val != -1) {
|
||||||
|
binding.maxChar.setText(String.valueOf(val));
|
||||||
|
}
|
||||||
|
applyMaxChar = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Instance instance = instanceInfo.info;
|
||||||
|
|
||||||
|
Glide.with(InstanceActivity.this)
|
||||||
|
.asDrawable()
|
||||||
|
.placeholder(R.drawable.default_banner)
|
||||||
|
.load(instance.thumbnail)
|
||||||
|
.into(binding.backgroundImage);
|
||||||
|
|
||||||
|
binding.name.setText(instance.title);
|
||||||
|
|
||||||
|
if (instance.description == null || instance.description.trim().length() == 0)
|
||||||
|
binding.description.setText(getString(R.string.instance_no_description));
|
||||||
|
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
binding.description.setText(Html.fromHtml(instance.description, Html.FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
binding.description.setText(Html.fromHtml(instance.description));
|
||||||
|
|
||||||
|
binding.version.setText(instance.version);
|
||||||
|
|
||||||
|
binding.uri.setText(instance.uri);
|
||||||
|
|
||||||
|
if (instance.email == null) {
|
||||||
|
binding.contact.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
binding.contact.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.contact.setOnClickListener(v -> {
|
||||||
|
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", instance.email, null));
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "[Mastodon] - " + instance.uri);
|
||||||
|
startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email)));
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.instanceData.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
package app.fedilab.android.mastodon.activities
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.SpannableString
|
||||||
|
import android.text.style.UnderlineSpan
|
||||||
|
import android.view.Window
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.fragment.app.DialogFragment
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import app.fedilab.android.BaseMainActivity
|
||||||
|
import app.fedilab.android.R
|
||||||
|
import app.fedilab.android.databinding.ActivityInstanceSocialBinding
|
||||||
|
import app.fedilab.android.mastodon.client.entities.app.InstanceSocial
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper
|
||||||
|
import app.fedilab.android.mastodon.helper.ThemeHelper
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.InstanceSocialVM
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
|
||||||
|
/* Copyright 2022 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Fedilab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Fedilab 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 Fedilab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
class InstanceHealthActivity : DialogFragment() {
|
||||||
|
private var _binding: ActivityInstanceSocialBinding? = null
|
||||||
|
private val binding: ActivityInstanceSocialBinding get() = _binding!!
|
||||||
|
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
_binding = ActivityInstanceSocialBinding.inflate(layoutInflater)
|
||||||
|
binding.close.setOnClickListener { dialog?.dismiss() }
|
||||||
|
val content = SpannableString(binding.refInstance.text.toString())
|
||||||
|
content.setSpan(UnderlineSpan(), 0, content.length, 0)
|
||||||
|
binding.refInstance.text = content
|
||||||
|
binding.refInstance.setOnClickListener {
|
||||||
|
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://instances.social")))
|
||||||
|
}
|
||||||
|
|
||||||
|
val materialAlertDialogBuilder = MaterialAlertDialogBuilder(requireContext())
|
||||||
|
materialAlertDialogBuilder.setView(binding.root)
|
||||||
|
|
||||||
|
val dialog = materialAlertDialogBuilder.create()
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
|
dialog.setOnShowListener { checkInstance() }
|
||||||
|
|
||||||
|
return dialog
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkInstance() {
|
||||||
|
val instanceSocialVM =
|
||||||
|
ViewModelProvider(this@InstanceHealthActivity)[InstanceSocialVM::class.java]
|
||||||
|
instanceSocialVM.getInstances(BaseMainActivity.currentInstance.trim { it <= ' ' })
|
||||||
|
.observe(this@InstanceHealthActivity) { instanceSocialList: InstanceSocial? ->
|
||||||
|
val instance = instanceSocialList?.instances?.firstOrNull { instance ->
|
||||||
|
instance.name.equals(
|
||||||
|
BaseMainActivity.currentInstance.trim { it <= ' ' },
|
||||||
|
ignoreCase = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (instance != null) {
|
||||||
|
instance.thumbnail?.takeIf { it != "null" }?.let { thumbnail ->
|
||||||
|
Glide.with(this@InstanceHealthActivity)
|
||||||
|
.asBitmap()
|
||||||
|
.placeholder(R.drawable.default_banner)
|
||||||
|
.load(thumbnail)
|
||||||
|
.into(binding.backgroundImage)
|
||||||
|
}
|
||||||
|
binding.name.text = instance.name
|
||||||
|
if (instance.up) {
|
||||||
|
binding.up.setText(app.fedilab.android.R.string.is_up)
|
||||||
|
binding.up.setTextColor(
|
||||||
|
ThemeHelper.getAttColor(
|
||||||
|
requireContext(),
|
||||||
|
app.fedilab.android.R.attr.colorPrimary
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
binding.up.setText(app.fedilab.android.R.string.is_down)
|
||||||
|
binding.up.setTextColor(
|
||||||
|
ThemeHelper.getAttColor(
|
||||||
|
requireContext(),
|
||||||
|
app.fedilab.android.R.attr.colorError
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
binding.uptime.text = getString(
|
||||||
|
app.fedilab.android.R.string.instance_health_uptime,
|
||||||
|
instance.uptime * 100
|
||||||
|
)
|
||||||
|
if (instance.checked_at != null)
|
||||||
|
binding.checkedAt.text =
|
||||||
|
getString(
|
||||||
|
app.fedilab.android.R.string.instance_health_checkedat,
|
||||||
|
Helper.dateToString(instance.checked_at)
|
||||||
|
)
|
||||||
|
binding.values.text = getString(
|
||||||
|
app.fedilab.android.R.string.instance_health_indication,
|
||||||
|
instance.version,
|
||||||
|
Helper.withSuffix(instance.active_users.toLong()),
|
||||||
|
Helper.withSuffix(instance.statuses.toLong())
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
binding.instanceData.isVisible = false
|
||||||
|
binding.noInstance.isVisible = true
|
||||||
|
}
|
||||||
|
binding.loader.isVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
_binding = null
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,72 +15,64 @@ package app.fedilab.android.activities;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.databinding.ActivityInstanceProfileBinding;
|
import app.fedilab.android.databinding.ActivityInstanceProfileBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.NodeInfoVM;
|
import app.fedilab.android.mastodon.viewmodel.mastodon.NodeInfoVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class InstanceProfileActivity extends BaseAlertDialogActivity {
|
public class InstanceProfileActivity extends DialogFragment {
|
||||||
|
|
||||||
|
|
||||||
private String instance;
|
private String instance;
|
||||||
private ActivityInstanceProfileBinding binding;
|
private ActivityInstanceProfileBinding binding;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
binding = ActivityInstanceProfileBinding.inflate(getLayoutInflater());
|
binding = ActivityInstanceProfileBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
|
||||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(requireContext());
|
||||||
Bundle b = getIntent().getExtras();
|
materialAlertDialogBuilder.setView(binding.getRoot());
|
||||||
if (getSupportActionBar() != null)
|
|
||||||
getSupportActionBar().hide();
|
Dialog dialog = materialAlertDialogBuilder.create();
|
||||||
|
|
||||||
|
Bundle b = getArguments();
|
||||||
if (b != null)
|
if (b != null)
|
||||||
instance = b.getString(Helper.ARG_INSTANCE, null);
|
instance = b.getString(Helper.ARG_INSTANCE, null);
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
finish();
|
requireDialog().dismiss();
|
||||||
}
|
}
|
||||||
Button close = findViewById(R.id.close);
|
|
||||||
close.setOnClickListener(view -> finish());
|
binding.close.setOnClickListener(v -> requireDialog().dismiss());
|
||||||
|
|
||||||
NodeInfoVM nodeInfoVM = new ViewModelProvider(InstanceProfileActivity.this).get(NodeInfoVM.class);
|
NodeInfoVM nodeInfoVM = new ViewModelProvider(InstanceProfileActivity.this).get(NodeInfoVM.class);
|
||||||
nodeInfoVM.getNodeInfo(instance).observe(InstanceProfileActivity.this, nodeInfo -> {
|
nodeInfoVM.getNodeInfo(instance).observe(InstanceProfileActivity.this, nodeInfo -> {
|
||||||
if (nodeInfo == null) {
|
if (nodeInfo == null) {
|
||||||
Toasty.error(InstanceProfileActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
Toasty.error(requireContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
finish();
|
requireDialog().dismiss();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
binding.name.setText(instance);
|
binding.name.setText(instance);
|
||||||
SpannableString descriptionSpan;
|
|
||||||
binding.userCount.setText(Helper.withSuffix((nodeInfo.usage.users.total)));
|
binding.userCount.setText(Helper.withSuffix((nodeInfo.usage.users.total)));
|
||||||
binding.statusCount.setText(Helper.withSuffix(((nodeInfo.usage.localPosts))));
|
binding.statusCount.setText(Helper.withSuffix(((nodeInfo.usage.localPosts))));
|
||||||
String softwareStr = nodeInfo.software.name + " - ";
|
String softwareStr = nodeInfo.software.name + " - ";
|
||||||
binding.software.setText(softwareStr);
|
binding.software.setText(softwareStr);
|
||||||
binding.version.setText(nodeInfo.software.version);
|
binding.version.setText(nodeInfo.software.version);
|
||||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
|
||||||
binding.loader.setVisibility(View.GONE);
|
binding.loader.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == android.R.id.home) {
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -34,29 +34,32 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.api.MastodonList;
|
|
||||||
import app.fedilab.android.client.entities.app.Pinned;
|
|
||||||
import app.fedilab.android.client.entities.app.PinnedTimeline;
|
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.databinding.ActivityListBinding;
|
import app.fedilab.android.databinding.ActivityListBinding;
|
||||||
import app.fedilab.android.databinding.PopupAddListBinding;
|
import app.fedilab.android.databinding.PopupAddListBinding;
|
||||||
import app.fedilab.android.databinding.PopupManageAccountsListBinding;
|
import app.fedilab.android.databinding.PopupManageAccountsListBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.client.entities.app.Pinned;
|
||||||
import app.fedilab.android.ui.drawer.AccountListAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
|
||||||
import app.fedilab.android.ui.drawer.MastodonListAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.ReorderVM;
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.TimelinesVM;
|
import app.fedilab.android.mastodon.ui.drawer.AccountListAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.MastodonListAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.ReorderVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.TimelinesVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,7 +147,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_user_mute_home) {
|
} else if (item.getItemId() == R.id.action_user_mute_home) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(MastodonListActivity.this);
|
||||||
dialogBuilder.setTitle(R.string.put_all_accounts_in_home_muted);
|
dialogBuilder.setTitle(R.string.put_all_accounts_in_home_muted);
|
||||||
dialogBuilder.setPositiveButton(R.string.mute_them_all, (dialog, id) -> {
|
dialogBuilder.setPositiveButton(R.string.mute_them_all, (dialog, id) -> {
|
||||||
timelinesVM.getAccountsInList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mastodonList.id, null, null, 0)
|
timelinesVM.getAccountsInList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mastodonList.id, null, null, 0)
|
||||||
|
@ -158,7 +161,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
|
||||||
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||||
dialogBuilder.show();
|
dialogBuilder.show();
|
||||||
} else if (item.getItemId() == R.id.action_manage_users) {
|
} else if (item.getItemId() == R.id.action_manage_users) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(MastodonListActivity.this);
|
||||||
PopupManageAccountsListBinding popupManageAccountsListBinding = PopupManageAccountsListBinding.inflate(getLayoutInflater());
|
PopupManageAccountsListBinding popupManageAccountsListBinding = PopupManageAccountsListBinding.inflate(getLayoutInflater());
|
||||||
dialogBuilder.setView(popupManageAccountsListBinding.getRoot());
|
dialogBuilder.setView(popupManageAccountsListBinding.getRoot());
|
||||||
popupManageAccountsListBinding.loader.setVisibility(View.VISIBLE);
|
popupManageAccountsListBinding.loader.setVisibility(View.VISIBLE);
|
||||||
|
@ -255,7 +258,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
|
||||||
dialogBuilder.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
|
dialogBuilder.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
|
||||||
dialogBuilder.create().show();
|
dialogBuilder.create().show();
|
||||||
} else if (item.getItemId() == R.id.action_delete && mastodonList != null) {
|
} else if (item.getItemId() == R.id.action_delete && mastodonList != null) {
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(MastodonListActivity.this);
|
||||||
alt_bld.setTitle(R.string.action_lists_delete);
|
alt_bld.setTitle(R.string.action_lists_delete);
|
||||||
alt_bld.setMessage(R.string.action_lists_confirm_delete);
|
alt_bld.setMessage(R.string.action_lists_confirm_delete);
|
||||||
alt_bld.setPositiveButton(R.string.delete, (dialog, id) -> {
|
alt_bld.setPositiveButton(R.string.delete, (dialog, id) -> {
|
||||||
|
@ -293,7 +296,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
|
||||||
AlertDialog alert = alt_bld.create();
|
AlertDialog alert = alt_bld.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
} else if (item.getItemId() == R.id.action_add_list) {
|
} else if (item.getItemId() == R.id.action_add_list) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(MastodonListActivity.this);
|
||||||
PopupAddListBinding popupAddListBinding = PopupAddListBinding.inflate(getLayoutInflater());
|
PopupAddListBinding popupAddListBinding = PopupAddListBinding.inflate(getLayoutInflater());
|
||||||
dialogBuilder.setView(popupAddListBinding.getRoot());
|
dialogBuilder.setView(popupAddListBinding.getRoot());
|
||||||
popupAddListBinding.addList.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)});
|
popupAddListBinding.addList.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)});
|
||||||
|
@ -333,7 +336,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
|
||||||
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||||
dialogBuilder.create().show();
|
dialogBuilder.create().show();
|
||||||
} else if (item.getItemId() == R.id.action_edit) {
|
} else if (item.getItemId() == R.id.action_edit) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(MastodonListActivity.this);
|
||||||
PopupAddListBinding popupAddListBinding = PopupAddListBinding.inflate(getLayoutInflater());
|
PopupAddListBinding popupAddListBinding = PopupAddListBinding.inflate(getLayoutInflater());
|
||||||
dialogBuilder.setView(popupAddListBinding.getRoot());
|
dialogBuilder.setView(popupAddListBinding.getRoot());
|
||||||
popupAddListBinding.addList.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)});
|
popupAddListBinding.addList.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)});
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -22,12 +22,10 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Point;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.Display;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
@ -49,14 +47,15 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.databinding.ActivityMediaPagerBinding;
|
import app.fedilab.android.databinding.ActivityMediaPagerBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.helper.MediaHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.helper.TranslateHelper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnDownloadInterface;
|
import app.fedilab.android.mastodon.helper.MediaHelper;
|
||||||
import app.fedilab.android.ui.fragment.media.FragmentMedia;
|
import app.fedilab.android.mastodon.helper.TranslateHelper;
|
||||||
|
import app.fedilab.android.mastodon.interfaces.OnDownloadInterface;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.media.FragmentMedia;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.media.FragmentMediaProfile;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
|
long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
|
||||||
if (downloadID == id) {
|
if (downloadID == id) {
|
||||||
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
DownloadManager manager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
|
||||||
assert manager != null;
|
assert manager != null;
|
||||||
Uri uri = manager.getUriForDownloadedFile(downloadID);
|
Uri uri = manager.getUriForDownloadedFile(downloadID);
|
||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
@ -94,12 +93,10 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
};
|
};
|
||||||
private boolean fullscreen;
|
private boolean fullscreen;
|
||||||
private Handler handler;
|
private Handler handler;
|
||||||
private int minTouch, maxTouch;
|
|
||||||
private float startX;
|
|
||||||
private float startY;
|
|
||||||
private ActivityMediaPagerBinding binding;
|
private ActivityMediaPagerBinding binding;
|
||||||
private FragmentMedia mCurrentFragment;
|
private FragmentMedia mCurrentFragment;
|
||||||
private Status status;
|
private Status status;
|
||||||
|
private boolean mediaFromProfile;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -117,8 +114,13 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
mediaPosition = b.getInt(Helper.ARG_MEDIA_POSITION, 1);
|
mediaPosition = b.getInt(Helper.ARG_MEDIA_POSITION, 1);
|
||||||
attachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ARRAY);
|
attachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ARRAY);
|
||||||
|
mediaFromProfile = b.getBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, false);
|
||||||
status = (Status) b.getSerializable(Helper.ARG_STATUS);
|
status = (Status) b.getSerializable(Helper.ARG_STATUS);
|
||||||
}
|
}
|
||||||
|
if (mediaFromProfile && FragmentMediaProfile.mediaAttachmentProfile != null) {
|
||||||
|
attachments = new ArrayList<>();
|
||||||
|
attachments.addAll(FragmentMediaProfile.mediaAttachmentProfile);
|
||||||
|
}
|
||||||
if (getSupportActionBar() != null) {
|
if (getSupportActionBar() != null) {
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
|
@ -133,14 +135,13 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
binding.mediaViewpager.setAdapter(mPagerAdapter);
|
binding.mediaViewpager.setAdapter(mPagerAdapter);
|
||||||
binding.mediaViewpager.setSaveEnabled(false);
|
binding.mediaViewpager.setSaveEnabled(false);
|
||||||
binding.mediaViewpager.setCurrentItem(mediaPosition - 1);
|
binding.mediaViewpager.setCurrentItem(mediaPosition - 1);
|
||||||
binding.haulerView.setOnDragDismissedListener(dragDirection -> ActivityCompat.finishAfterTransition(MediaActivity.this));
|
|
||||||
registerReceiver(onDownloadComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
registerReceiver(onDownloadComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
||||||
String description = attachments.get(mediaPosition - 1).description;
|
String description = attachments.get(mediaPosition - 1).description;
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
if (status != null) {
|
if (attachments.get(mediaPosition - 1).status != null) {
|
||||||
binding.originalMessage.setOnClickListener(v -> {
|
binding.originalMessage.setOnClickListener(v -> {
|
||||||
Intent intentContext = new Intent(MediaActivity.this, ContextActivity.class);
|
Intent intentContext = new Intent(MediaActivity.this, ContextActivity.class);
|
||||||
intentContext.putExtra(Helper.ARG_STATUS, status);
|
intentContext.putExtra(Helper.ARG_STATUS, attachments.get(mediaPosition - 1).status);
|
||||||
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(intentContext);
|
startActivity(intentContext);
|
||||||
});
|
});
|
||||||
|
@ -178,6 +179,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
|
mediaPosition = position;
|
||||||
String description = attachments.get(position).description;
|
String description = attachments.get(position).description;
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler.removeCallbacksAndMessages(null);
|
handler.removeCallbacksAndMessages(null);
|
||||||
|
@ -214,18 +216,23 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
setFullscreen(true);
|
setFullscreen(true);
|
||||||
Display display = getWindowManager().getDefaultDisplay();
|
|
||||||
Point size = new Point();
|
|
||||||
display.getSize(size);
|
|
||||||
int screenHeight = size.y;
|
|
||||||
minTouch = (int) (screenHeight * 0.1);
|
|
||||||
maxTouch = (int) (screenHeight * 0.9);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
try {
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toogleFullScreen() {
|
||||||
|
fullscreen = !fullscreen;
|
||||||
|
setFullscreen(fullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
||||||
|
@ -243,7 +250,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
int position = binding.mediaViewpager.getCurrentItem();
|
int position = binding.mediaViewpager.getCurrentItem();
|
||||||
Attachment attachment = attachments.get(position);
|
Attachment attachment = attachments.get(position);
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
||||||
if (ContextCompat.checkSelfPermission(MediaActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(MediaActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(MediaActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(MediaActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
ActivityCompat.requestPermissions(MediaActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Helper.EXTERNAL_STORAGE_REQUEST_CODE_MEDIA_SAVE);
|
ActivityCompat.requestPermissions(MediaActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Helper.EXTERNAL_STORAGE_REQUEST_CODE_MEDIA_SAVE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -315,71 +322,38 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void toggleScreenContain(boolean fullscreen) {
|
||||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
if (!fullscreen) {
|
||||||
|
String description = attachments.get(binding.mediaViewpager.getCurrentItem()).description;
|
||||||
switch (event.getAction()) {
|
if (description != null && description.trim().length() > 0 && description.trim().compareTo("null") != 0) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
binding.mediaDescription.setText(description);
|
||||||
startX = event.getX();
|
if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) {
|
||||||
startY = event.getY();
|
binding.mediaDescription.setVisibility(View.GONE);
|
||||||
break;
|
binding.mediaDescriptionTranslated.setText(attachments.get(binding.mediaViewpager.getCurrentItem()).translation);
|
||||||
case MotionEvent.ACTION_UP:
|
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
|
||||||
float endX = event.getX();
|
} else {
|
||||||
float endY = event.getY();
|
binding.mediaDescription.setVisibility(View.VISIBLE);
|
||||||
if (endY > minTouch && endY < maxTouch && isAClick(startX, endX, startY, endY)) {
|
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||||
setFullscreen(!fullscreen);
|
|
||||||
if (!fullscreen) {
|
|
||||||
String description = attachments.get(binding.mediaViewpager.getCurrentItem()).description;
|
|
||||||
if (handler != null) {
|
|
||||||
handler.removeCallbacksAndMessages(null);
|
|
||||||
}
|
|
||||||
handler = new Handler();
|
|
||||||
if (description != null && description.trim().length() > 0 && description.trim().compareTo("null") != 0) {
|
|
||||||
binding.mediaDescription.setText(description);
|
|
||||||
if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) {
|
|
||||||
binding.mediaDescription.setVisibility(View.GONE);
|
|
||||||
binding.mediaDescriptionTranslated.setText(attachments.get(binding.mediaViewpager.getCurrentItem()).translation);
|
|
||||||
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
binding.mediaDescription.setVisibility(View.VISIBLE);
|
|
||||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
binding.translate.setVisibility(View.GONE);
|
|
||||||
if (status != null) {
|
|
||||||
binding.originalMessage.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
binding.originalMessage.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
|
||||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
|
||||||
binding.mediaDescription.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
binding.originalMessage.setVisibility(View.INVISIBLE);
|
|
||||||
binding.translate.setVisibility(View.GONE);
|
|
||||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
|
||||||
binding.mediaDescription.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
|
binding.translate.setVisibility(View.GONE);
|
||||||
|
if (status != null) {
|
||||||
|
binding.originalMessage.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
binding.originalMessage.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||||
|
binding.mediaDescription.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.originalMessage.setVisibility(View.INVISIBLE);
|
||||||
|
binding.translate.setVisibility(View.GONE);
|
||||||
|
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||||
|
binding.mediaDescription.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
return super.dispatchTouchEvent(event);
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isAClick(float startX, float endX, float startY, float endY) {
|
|
||||||
float differenceX = Math.abs(startX - endX);
|
|
||||||
float differenceY = Math.abs(startY - endY);
|
|
||||||
int CLICK_ACTION_THRESHOLD = 200;
|
|
||||||
return !(differenceX > CLICK_ACTION_THRESHOLD/* =5 */ || differenceY > CLICK_ACTION_THRESHOLD);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
unregisterReceiver(onDownloadComplete);
|
unregisterReceiver(onDownloadComplete);
|
||||||
|
@ -401,6 +375,15 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
super.onPostResume();
|
super.onPostResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shows the system bars by removing all the flags
|
||||||
|
// except for the ones that make the content appear under the system bars.
|
||||||
|
private void showSystemUI() {
|
||||||
|
View decorView = getWindow().getDecorView();
|
||||||
|
decorView.setSystemUiVisibility(flags |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getFullScreen() {
|
public boolean getFullScreen() {
|
||||||
return this.fullscreen;
|
return this.fullscreen;
|
||||||
|
@ -412,15 +395,16 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
showSystemUI();
|
showSystemUI();
|
||||||
binding.mediaDescription.setVisibility(View.VISIBLE);
|
binding.mediaDescription.setVisibility(View.VISIBLE);
|
||||||
binding.translate.setVisibility(View.VISIBLE);
|
binding.translate.setVisibility(View.VISIBLE);
|
||||||
if (status != null) {
|
if (mediaFromProfile) {
|
||||||
binding.originalMessage.setVisibility(View.VISIBLE);
|
binding.originalMessage.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
hideSystemUI();
|
||||||
binding.mediaDescription.setVisibility(View.GONE);
|
binding.mediaDescription.setVisibility(View.GONE);
|
||||||
binding.translate.setVisibility(View.GONE);
|
binding.translate.setVisibility(View.GONE);
|
||||||
binding.originalMessage.setVisibility(View.INVISIBLE);
|
binding.originalMessage.setVisibility(View.INVISIBLE);
|
||||||
hideSystemUI();
|
|
||||||
}
|
}
|
||||||
|
toggleScreenContain(fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideSystemUI() {
|
private void hideSystemUI() {
|
||||||
|
@ -440,16 +424,6 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN);
|
| View.SYSTEM_UI_FLAG_FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shows the system bars by removing all the flags
|
|
||||||
// except for the ones that make the content appear under the system bars.
|
|
||||||
private void showSystemUI() {
|
|
||||||
View decorView = getWindow().getDecorView();
|
|
||||||
decorView.setSystemUiVisibility(flags |
|
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FragmentMedia getCurrentFragment() {
|
public FragmentMedia getCurrentFragment() {
|
||||||
return mCurrentFragment;
|
return mCurrentFragment;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -31,13 +31,13 @@ import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.databinding.ActivityPartnershipBinding;
|
import app.fedilab.android.databinding.ActivityPartnershipBinding;
|
||||||
import app.fedilab.android.helper.CrossActionHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.helper.CrossActionHelper;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
|
||||||
|
|
||||||
public class PartnerShipActivity extends BaseBarActivity {
|
public class PartnerShipActivity extends BaseBarActivity {
|
||||||
|
@ -93,7 +93,7 @@ public class PartnerShipActivity extends BaseBarActivity {
|
||||||
if (relationShips != null && relationShips.size() > 0) {
|
if (relationShips != null && relationShips.size() > 0) {
|
||||||
if (!relationShips.get(0).following) {
|
if (!relationShips.get(0).following) {
|
||||||
binding.accountFollow.setVisibility(View.VISIBLE);
|
binding.accountFollow.setVisibility(View.VISIBLE);
|
||||||
binding.accountFollow.setOnClickListener(v -> accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false)
|
binding.accountFollow.setOnClickListener(v -> accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false, null)
|
||||||
.observe(PartnerShipActivity.this, relationShip -> binding.accountFollow.setVisibility(View.GONE)));
|
.observe(PartnerShipActivity.this, relationShip -> binding.accountFollow.setVisibility(View.GONE)));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -34,6 +34,7 @@ import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.text.style.UnderlineSpan;
|
import android.text.style.UnderlineSpan;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -60,6 +61,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
@ -74,31 +76,35 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
|
||||||
import app.fedilab.android.client.entities.api.Field;
|
|
||||||
import app.fedilab.android.client.entities.api.IdentityProof;
|
|
||||||
import app.fedilab.android.client.entities.api.MastodonList;
|
|
||||||
import app.fedilab.android.client.entities.api.RelationShip;
|
|
||||||
import app.fedilab.android.client.entities.app.Pinned;
|
|
||||||
import app.fedilab.android.client.entities.app.PinnedTimeline;
|
|
||||||
import app.fedilab.android.client.entities.app.RemoteInstance;
|
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.client.entities.app.WellKnownNodeinfo;
|
|
||||||
import app.fedilab.android.databinding.ActivityProfileBinding;
|
import app.fedilab.android.databinding.ActivityProfileBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.databinding.NotificationsRelatedAccountsBinding;
|
||||||
import app.fedilab.android.helper.CrossActionHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.client.entities.api.FamiliarFollowers;
|
||||||
import app.fedilab.android.helper.SpannableHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Field;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.client.entities.api.IdentityProof;
|
||||||
import app.fedilab.android.ui.drawer.FieldAdapter;
|
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
|
||||||
import app.fedilab.android.ui.drawer.IdentityProofsAdapter;
|
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
|
||||||
import app.fedilab.android.ui.pageadapter.FedilabProfileTLPageAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.Languages;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.client.entities.app.Pinned;
|
||||||
import app.fedilab.android.viewmodel.mastodon.NodeInfoVM;
|
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
|
||||||
import app.fedilab.android.viewmodel.mastodon.ReorderVM;
|
import app.fedilab.android.mastodon.client.entities.app.RemoteInstance;
|
||||||
import app.fedilab.android.viewmodel.mastodon.TimelinesVM;
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
|
import app.fedilab.android.mastodon.client.entities.app.WellKnownNodeinfo;
|
||||||
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
|
import app.fedilab.android.mastodon.helper.CrossActionHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.FieldAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.IdentityProofsAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.pageadapter.FedilabProfileTLPageAdapter;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.NodeInfoVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.ReorderVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.TimelinesVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,6 +112,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
private RelationShip relationship;
|
private RelationShip relationship;
|
||||||
|
private FamiliarFollowers familiarFollowers;
|
||||||
private Account account;
|
private Account account;
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
private action doAction;
|
private action doAction;
|
||||||
|
@ -117,8 +124,6 @@ public class ProfileActivity extends BaseActivity {
|
||||||
private String mention_str;
|
private String mention_str;
|
||||||
private WellKnownNodeinfo.NodeInfo nodeInfo;
|
private WellKnownNodeinfo.NodeInfo nodeInfo;
|
||||||
private boolean checkRemotely;
|
private boolean checkRemotely;
|
||||||
private boolean homeMuted;
|
|
||||||
|
|
||||||
private final BroadcastReceiver broadcast_data = new BroadcastReceiver() {
|
private final BroadcastReceiver broadcast_data = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
@ -133,6 +138,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private boolean homeMuted;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -145,6 +151,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
binding.accountFollow.setEnabled(false);
|
binding.accountFollow.setEnabled(false);
|
||||||
checkRemotely = false;
|
checkRemotely = false;
|
||||||
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
homeMuted = false;
|
homeMuted = false;
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
account = (Account) b.getSerializable(Helper.ARG_ACCOUNT);
|
account = (Account) b.getSerializable(Helper.ARG_ACCOUNT);
|
||||||
|
@ -152,6 +159,9 @@ public class ProfileActivity extends BaseActivity {
|
||||||
mention_str = b.getString(Helper.ARG_MENTION, null);
|
mention_str = b.getString(Helper.ARG_MENTION, null);
|
||||||
checkRemotely = b.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
|
checkRemotely = b.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
|
||||||
}
|
}
|
||||||
|
if (!checkRemotely) {
|
||||||
|
checkRemotely = sharedpreferences.getBoolean(getString(R.string.SET_PROFILE_REMOTELY), false);
|
||||||
|
}
|
||||||
ActivityCompat.postponeEnterTransition(ProfileActivity.this);
|
ActivityCompat.postponeEnterTransition(ProfileActivity.this);
|
||||||
//Remove title
|
//Remove title
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
|
@ -162,7 +172,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
}
|
}
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
|
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
|
||||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
|
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
|
||||||
accountsVM = new ViewModelProvider(ProfileActivity.this).get(AccountsVM.class);
|
accountsVM = new ViewModelProvider(ProfileActivity.this).get(AccountsVM.class);
|
||||||
|
@ -252,6 +262,13 @@ public class ProfileActivity extends BaseActivity {
|
||||||
updateAccount();
|
updateAccount();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
accountsVM.getFamiliarFollowers(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountListToCheck).observe(ProfileActivity.this, familiarFollowersList -> {
|
||||||
|
if (familiarFollowersList != null && familiarFollowersList.size() > 0) {
|
||||||
|
this.familiarFollowers = familiarFollowersList.get(0);
|
||||||
|
updateAccount();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//Retrieve identity proofs
|
//Retrieve identity proofs
|
||||||
accountsVM.getIdentityProofs(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id).observe(ProfileActivity.this, identityProofs -> {
|
accountsVM.getIdentityProofs(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id).observe(ProfileActivity.this, identityProofs -> {
|
||||||
this.identityProofList = identityProofs;
|
this.identityProofList = identityProofs;
|
||||||
|
@ -452,7 +469,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
Toasty.info(ProfileActivity.this, getString(R.string.nothing_to_do), Toast.LENGTH_LONG).show();
|
Toasty.info(ProfileActivity.this, getString(R.string.nothing_to_do), Toast.LENGTH_LONG).show();
|
||||||
} else if (doAction == action.FOLLOW) {
|
} else if (doAction == action.FOLLOW) {
|
||||||
binding.accountFollow.setEnabled(false);
|
binding.accountFollow.setEnabled(false);
|
||||||
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false)
|
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false, null)
|
||||||
.observe(ProfileActivity.this, relationShip -> {
|
.observe(ProfileActivity.this, relationShip -> {
|
||||||
this.relationship = relationShip;
|
this.relationship = relationShip;
|
||||||
updateAccount();
|
updateAccount();
|
||||||
|
@ -460,7 +477,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
} else if (doAction == action.UNFOLLOW) {
|
} else if (doAction == action.UNFOLLOW) {
|
||||||
boolean confirm_unfollow = sharedpreferences.getBoolean(getString(R.string.SET_UNFOLLOW_VALIDATION), true);
|
boolean confirm_unfollow = sharedpreferences.getBoolean(getString(R.string.SET_UNFOLLOW_VALIDATION), true);
|
||||||
if (confirm_unfollow) {
|
if (confirm_unfollow) {
|
||||||
AlertDialog.Builder unfollowConfirm = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
unfollowConfirm.setTitle(getString(R.string.unfollow_confirm));
|
unfollowConfirm.setTitle(getString(R.string.unfollow_confirm));
|
||||||
unfollowConfirm.setMessage(account.acct);
|
unfollowConfirm.setMessage(account.acct);
|
||||||
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
@ -516,12 +533,11 @@ public class ProfileActivity extends BaseActivity {
|
||||||
binding.instanceInfo.setVisibility(View.VISIBLE);
|
binding.instanceInfo.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
binding.instanceInfo.setOnClickListener(v -> {
|
binding.instanceInfo.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(ProfileActivity.this, InstanceProfileActivity.class);
|
InstanceProfileActivity instanceProfileActivity = new InstanceProfileActivity();
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
||||||
intent.putExtras(b);
|
instanceProfileActivity.setArguments(b);
|
||||||
startActivity(intent);
|
instanceProfileActivity.show(getSupportFragmentManager(), null);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -549,7 +565,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
//Recyclerview for identity proof has not been inflated yet
|
//Recyclerview for identity proof has not been inflated yet
|
||||||
if (identityProofsRecycler == null) {
|
if (identityProofsRecycler == null) {
|
||||||
identity_proofs_indicator.setOnClickListener(v -> {
|
identity_proofs_indicator.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
identityProofsRecycler = new RecyclerView(ProfileActivity.this);
|
identityProofsRecycler = new RecyclerView(ProfileActivity.this);
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(ProfileActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(ProfileActivity.this);
|
||||||
identityProofsRecycler.setLayoutManager(mLayoutManager);
|
identityProofsRecycler.setLayoutManager(mLayoutManager);
|
||||||
|
@ -564,6 +580,27 @@ public class ProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (familiarFollowers != null && familiarFollowers.accounts != null && familiarFollowers.accounts.size() > 0) {
|
||||||
|
binding.relatedAccounts.removeAllViews();
|
||||||
|
for (Account account : familiarFollowers.accounts) {
|
||||||
|
NotificationsRelatedAccountsBinding notificationsRelatedAccountsBinding = NotificationsRelatedAccountsBinding.inflate(LayoutInflater.from(ProfileActivity.this));
|
||||||
|
MastodonHelper.loadProfileMediaMastodonRound(ProfileActivity.this, notificationsRelatedAccountsBinding.profilePicture, account);
|
||||||
|
notificationsRelatedAccountsBinding.acc.setText(account.username);
|
||||||
|
notificationsRelatedAccountsBinding.relatedAccountContainer.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(ProfileActivity.this, ProfileActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putSerializable(Helper.ARG_ACCOUNT, account);
|
||||||
|
intent.putExtras(b);
|
||||||
|
ActivityOptionsCompat options = ActivityOptionsCompat
|
||||||
|
.makeSceneTransitionAnimation(ProfileActivity.this, notificationsRelatedAccountsBinding.profilePicture, getString(R.string.activity_porfile_pp));
|
||||||
|
// start the new activity
|
||||||
|
startActivity(intent, options.toBundle());
|
||||||
|
});
|
||||||
|
binding.relatedAccounts.addView(notificationsRelatedAccountsBinding.getRoot());
|
||||||
|
}
|
||||||
|
binding.familiarFollowers.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
binding.accountFollow.setEnabled(true);
|
binding.accountFollow.setEnabled(true);
|
||||||
//Visibility depending of the relationship
|
//Visibility depending of the relationship
|
||||||
if (relationship != null) {
|
if (relationship != null) {
|
||||||
|
@ -624,7 +661,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
binding.accountNotification.setOnClickListener(v -> {
|
binding.accountNotification.setOnClickListener(v -> {
|
||||||
if (relationship != null && relationship.following) {
|
if (relationship != null && relationship.following) {
|
||||||
relationship.notifying = !relationship.notifying;
|
relationship.notifying = !relationship.notifying;
|
||||||
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, relationship.showing_reblogs, relationship.notifying)
|
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, relationship.showing_reblogs, relationship.notifying, relationship.languages)
|
||||||
.observe(ProfileActivity.this, relationShip -> {
|
.observe(ProfileActivity.this, relationShip -> {
|
||||||
this.relationship = relationShip;
|
this.relationship = relationShip;
|
||||||
updateAccount();
|
updateAccount();
|
||||||
|
@ -638,7 +675,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
binding.personalNote.setText(relationship.note);
|
binding.personalNote.setText(relationship.note);
|
||||||
}
|
}
|
||||||
binding.personalNote.setOnClickListener(view -> {
|
binding.personalNote.setOnClickListener(view -> {
|
||||||
AlertDialog.Builder builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
builderInner.setTitle(R.string.note_for_account);
|
builderInner.setTitle(R.string.note_for_account);
|
||||||
EditText input = new EditText(ProfileActivity.this);
|
EditText input = new EditText(ProfileActivity.this);
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||||
|
@ -690,6 +727,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
menu.findItem(R.id.action_direct_message).setVisible(false);
|
menu.findItem(R.id.action_direct_message).setVisible(false);
|
||||||
menu.findItem(R.id.action_add_to_list).setVisible(false);
|
menu.findItem(R.id.action_add_to_list).setVisible(false);
|
||||||
menu.findItem(R.id.action_mute_home).setVisible(false);
|
menu.findItem(R.id.action_mute_home).setVisible(false);
|
||||||
|
menu.findItem(R.id.action_subscribed_language).setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
menu.findItem(R.id.action_block).setVisible(true);
|
menu.findItem(R.id.action_block).setVisible(true);
|
||||||
menu.findItem(R.id.action_mute).setVisible(true);
|
menu.findItem(R.id.action_mute).setVisible(true);
|
||||||
|
@ -703,6 +741,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
menu.findItem(R.id.action_hide_boost).setVisible(false);
|
menu.findItem(R.id.action_hide_boost).setVisible(false);
|
||||||
menu.findItem(R.id.action_endorse).setVisible(false);
|
menu.findItem(R.id.action_endorse).setVisible(false);
|
||||||
menu.findItem(R.id.action_mute_home).setVisible(false);
|
menu.findItem(R.id.action_mute_home).setVisible(false);
|
||||||
|
menu.findItem(R.id.action_subscribed_language).setVisible(false);
|
||||||
}
|
}
|
||||||
if (relationship.blocking) {
|
if (relationship.blocking) {
|
||||||
menu.findItem(R.id.action_block).setTitle(R.string.action_unblock);
|
menu.findItem(R.id.action_block).setTitle(R.string.action_unblock);
|
||||||
|
@ -797,6 +836,10 @@ public class ProfileActivity extends BaseActivity {
|
||||||
pinnedTimeline.type = Timeline.TimeLineEnum.REMOTE;
|
pinnedTimeline.type = Timeline.TimeLineEnum.REMOTE;
|
||||||
pinnedTimeline.position = pinned.pinnedTimelines.size();
|
pinnedTimeline.position = pinned.pinnedTimelines.size();
|
||||||
pinned.pinnedTimelines.add(pinnedTimeline);
|
pinned.pinnedTimelines.add(pinnedTimeline);
|
||||||
|
if (pinned.instance == null || pinned.user_id == null) {
|
||||||
|
pinned.instance = MainActivity.currentInstance;
|
||||||
|
pinned.user_id = MainActivity.currentUserID;
|
||||||
|
}
|
||||||
Pinned finalPinned = pinned;
|
Pinned finalPinned = pinned;
|
||||||
boolean finalPresent = present;
|
boolean finalPresent = present;
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
@ -821,7 +864,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_filter) {
|
} else if (itemId == R.id.action_filter) {
|
||||||
AlertDialog.Builder filterTagDialog = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder filterTagDialog = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
Set<String> featuredTagsSet = sharedpreferences.getStringSet(getString(R.string.SET_FEATURED_TAGS), null);
|
Set<String> featuredTagsSet = sharedpreferences.getStringSet(getString(R.string.SET_FEATURED_TAGS), null);
|
||||||
List<String> tags = new ArrayList<>();
|
List<String> tags = new ArrayList<>();
|
||||||
if (featuredTagsSet != null) {
|
if (featuredTagsSet != null) {
|
||||||
|
@ -862,13 +905,70 @@ public class ProfileActivity extends BaseActivity {
|
||||||
.observe(ProfileActivity.this, relationShip -> this.relationship = relationShip);
|
.observe(ProfileActivity.this, relationShip -> this.relationship = relationShip);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (itemId == R.id.action_subscribed_language) {
|
||||||
|
if (relationship != null) {
|
||||||
|
List<String> subscribedLanguages = relationship.languages;
|
||||||
|
Set<String> storedLanguages = sharedpreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null);
|
||||||
|
List<Languages.Language> languages = Languages.get(ProfileActivity.this);
|
||||||
|
if (languages == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String[] codesArr;
|
||||||
|
String[] languagesArr;
|
||||||
|
boolean[] presentArr;
|
||||||
|
if (storedLanguages != null && storedLanguages.size() > 0) {
|
||||||
|
int i = 0;
|
||||||
|
codesArr = new String[storedLanguages.size()];
|
||||||
|
languagesArr = new String[storedLanguages.size()];
|
||||||
|
presentArr = new boolean[storedLanguages.size()];
|
||||||
|
for (String code : storedLanguages) {
|
||||||
|
for (Languages.Language language : languages) {
|
||||||
|
if (language.code.equalsIgnoreCase(code)) {
|
||||||
|
languagesArr[i] = language.language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
codesArr[i] = code;
|
||||||
|
presentArr[i] = subscribedLanguages != null && subscribedLanguages.contains(code);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
codesArr = new String[languages.size()];
|
||||||
|
presentArr = new boolean[languages.size()];
|
||||||
|
languagesArr = new String[languages.size()];
|
||||||
|
int i = 0;
|
||||||
|
for (Languages.Language language : languages) {
|
||||||
|
codesArr[i] = language.code;
|
||||||
|
languagesArr[i] = language.language;
|
||||||
|
if (subscribedLanguages != null && subscribedLanguages.contains(language.code)) {
|
||||||
|
presentArr[i] = true;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
|
builder.setTitle(getString(R.string.filter_languages));
|
||||||
|
builder.setMultiChoiceItems(languagesArr, presentArr, (dialog, which, isChecked) -> {
|
||||||
|
List<String> languagesFilter = new ArrayList<>();
|
||||||
|
for (int i = 0; i < codesArr.length; i++) {
|
||||||
|
if (presentArr[i]) {
|
||||||
|
languagesFilter.add(codesArr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, relationship.showing_reblogs, relationship.notifying, languagesFilter)
|
||||||
|
.observe(ProfileActivity.this, relationShip -> this.relationship = relationShip);
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(R.string.close, (dialog, which) -> dialog.dismiss());
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
} else if (itemId == R.id.action_hide_boost) {
|
} else if (itemId == R.id.action_hide_boost) {
|
||||||
if (relationship != null)
|
if (relationship != null)
|
||||||
if (relationship.showing_reblogs) {
|
if (relationship.showing_reblogs) {
|
||||||
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, false, relationship.notifying)
|
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, false, relationship.notifying, relationship.languages)
|
||||||
.observe(ProfileActivity.this, relationShip -> this.relationship = relationShip);
|
.observe(ProfileActivity.this, relationShip -> this.relationship = relationShip);
|
||||||
} else {
|
} else {
|
||||||
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, relationship.notifying)
|
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, relationship.notifying, relationship.languages)
|
||||||
.observe(ProfileActivity.this, relationShip -> this.relationship = relationShip);
|
.observe(ProfileActivity.this, relationShip -> this.relationship = relationShip);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -890,7 +990,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
accountsVM.getListContainingAccount(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
|
accountsVM.getListContainingAccount(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
|
||||||
.observe(ProfileActivity.this, mastodonListUserIs -> {
|
.observe(ProfileActivity.this, mastodonListUserIs -> {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builderSingle = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
builderSingle.setTitle(getString(R.string.action_lists_add_to));
|
builderSingle.setTitle(getString(R.string.action_lists_add_to));
|
||||||
builderSingle.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss());
|
builderSingle.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss());
|
||||||
String[] listsId = new String[mastodonLists.size()];
|
String[] listsId = new String[mastodonLists.size()];
|
||||||
|
@ -913,7 +1013,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
builderSingle.setMultiChoiceItems(listsArray, presentArray, (dialog, which, isChecked) -> {
|
builderSingle.setMultiChoiceItems(listsArray, presentArray, (dialog, which, isChecked) -> {
|
||||||
if (relationship == null || !relationship.following) {
|
if (relationship == null || !relationship.following) {
|
||||||
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false)
|
accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false, null)
|
||||||
.observe(ProfileActivity.this, newRelationShip -> {
|
.observe(ProfileActivity.this, newRelationShip -> {
|
||||||
if (newRelationShip != null) {
|
if (newRelationShip != null) {
|
||||||
relationship = newRelationShip;
|
relationship = newRelationShip;
|
||||||
|
@ -982,7 +1082,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
builderInner.setTitle(stringArrayConf[0]);
|
builderInner.setTitle(stringArrayConf[0]);
|
||||||
|
|
||||||
builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
@ -1002,7 +1102,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
builderInner.show();
|
builderInner.show();
|
||||||
}
|
}
|
||||||
} else if (itemId == R.id.action_mute_home) {
|
} else if (itemId == R.id.action_mute_home) {
|
||||||
AlertDialog.Builder builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
builderInner.setMessage(account.acct);
|
builderInner.setMessage(account.acct);
|
||||||
builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
if (homeMuted) {
|
if (homeMuted) {
|
||||||
|
@ -1030,7 +1130,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_report) {
|
} else if (itemId == R.id.action_report) {
|
||||||
AlertDialog.Builder builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
builderInner.setTitle(R.string.report_account);
|
builderInner.setTitle(R.string.report_account);
|
||||||
//Text for report
|
//Text for report
|
||||||
EditText input = new EditText(ProfileActivity.this);
|
EditText input = new EditText(ProfileActivity.this);
|
||||||
|
@ -1050,7 +1150,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
builderInner.show();
|
builderInner.show();
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_block) {
|
} else if (itemId == R.id.action_block) {
|
||||||
AlertDialog.Builder builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
if (relationship != null) {
|
if (relationship != null) {
|
||||||
if (relationship.blocking) {
|
if (relationship.blocking) {
|
||||||
builderInner.setTitle(stringArrayConf[5]);
|
builderInner.setTitle(stringArrayConf[5]);
|
||||||
|
@ -1090,7 +1190,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
builderInner.show();
|
builderInner.show();
|
||||||
} else if (itemId == R.id.action_block_instance) {
|
} else if (itemId == R.id.action_block_instance) {
|
||||||
AlertDialog.Builder builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
String domain = account.acct.split("@")[1];
|
String domain = account.acct.split("@")[1];
|
||||||
builderInner.setMessage(getString(R.string.block_domain_confirm_message, domain));
|
builderInner.setMessage(getString(R.string.block_domain_confirm_message, domain));
|
||||||
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,39 +15,44 @@ package app.fedilab.android.activities;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.view.Window;
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.databinding.ActivityProxyBinding;
|
import app.fedilab.android.databinding.ActivityProxyBinding;
|
||||||
|
|
||||||
|
|
||||||
public class ProxyActivity extends BaseAlertDialogActivity {
|
public class ProxyActivity extends DialogFragment {
|
||||||
|
|
||||||
private ActivityProxyBinding binding;
|
private ActivityProxyBinding binding;
|
||||||
private int position;
|
private int position;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ProxyActivity.this);
|
|
||||||
binding = ActivityProxyBinding.inflate(getLayoutInflater());
|
binding = ActivityProxyBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
|
||||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(requireContext());
|
||||||
if (getSupportActionBar() != null)
|
materialAlertDialogBuilder.setView(binding.getRoot());
|
||||||
getSupportActionBar().hide();
|
|
||||||
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
|
|
||||||
//Enable proxy
|
//Enable proxy
|
||||||
boolean enable_proxy = sharedpreferences.getBoolean(getString(R.string.SET_PROXY_ENABLED), false);
|
boolean enable_proxy = sharedpreferences.getBoolean(getString(R.string.SET_PROXY_ENABLED), false);
|
||||||
binding.enableProxy.setChecked(enable_proxy);
|
binding.enableProxy.setChecked(enable_proxy);
|
||||||
position = 0;
|
position = sharedpreferences.getInt(getString(R.string.SET_PROXY_TYPE), 0);
|
||||||
String hostVal = sharedpreferences.getString(getString(R.string.SET_PROXY_HOST), "127.0.0.1");
|
String hostVal = sharedpreferences.getString(getString(R.string.SET_PROXY_HOST), "127.0.0.1");
|
||||||
int portVal = sharedpreferences.getInt(getString(R.string.SET_PROXY_PORT), 8118);
|
int portVal = sharedpreferences.getInt(getString(R.string.SET_PROXY_PORT), 8118);
|
||||||
final String login = sharedpreferences.getString(getString(R.string.SET_PROXY_LOGIN), null);
|
final String login = sharedpreferences.getString(getString(R.string.SET_PROXY_LOGIN), null);
|
||||||
|
@ -62,22 +67,17 @@ public class ProxyActivity extends BaseAlertDialogActivity {
|
||||||
if (pwd != null && binding.proxyPassword.length() > 0) {
|
if (pwd != null && binding.proxyPassword.length() > 0) {
|
||||||
binding.proxyPassword.setText(pwd);
|
binding.proxyPassword.setText(pwd);
|
||||||
}
|
}
|
||||||
ArrayAdapter<CharSequence> adapterTrans = ArrayAdapter.createFromResource(ProxyActivity.this,
|
if (position == 1) binding.protocol.check(R.id.protocol_socks);
|
||||||
R.array.proxy_type_choice, android.R.layout.simple_spinner_dropdown_item);
|
binding.protocol.addOnButtonCheckedListener((group, checkedId, isChecked) -> {
|
||||||
binding.type.setAdapter(adapterTrans);
|
if (isChecked) {
|
||||||
binding.type.setSelection(sharedpreferences.getInt(getString(R.string.SET_PROXY_TYPE), 0), false);
|
if (checkedId == R.id.protocol_http)
|
||||||
binding.type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
position = 0;
|
||||||
@Override
|
else
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int p, long id) {
|
position = 1;
|
||||||
position = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
binding.setProxySave.setOnClickListener(view -> {
|
|
||||||
|
materialAlertDialogBuilder.setPositiveButton(R.string.save, (dialog1, which) -> {
|
||||||
String hostVal1 = binding.host.getText().toString().trim();
|
String hostVal1 = binding.host.getText().toString().trim();
|
||||||
String portVal1 = binding.port.getText().toString().trim();
|
String portVal1 = binding.port.getText().toString().trim();
|
||||||
String proxy_loginVal = binding.proxyLogin.getText().toString().trim();
|
String proxy_loginVal = binding.proxyLogin.getText().toString().trim();
|
||||||
|
@ -91,18 +91,24 @@ public class ProxyActivity extends BaseAlertDialogActivity {
|
||||||
editor.putString(getString(R.string.SET_PROXY_LOGIN), proxy_loginVal);
|
editor.putString(getString(R.string.SET_PROXY_LOGIN), proxy_loginVal);
|
||||||
editor.putString(getString(R.string.SET_PROXY_PASSWORD), proxy_passwordVal);
|
editor.putString(getString(R.string.SET_PROXY_PASSWORD), proxy_passwordVal);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
finish();
|
|
||||||
});
|
});
|
||||||
|
materialAlertDialogBuilder.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
Dialog dialog = materialAlertDialogBuilder.create();
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public void onDestroyView() {
|
||||||
if (item.getItemId() == android.R.id.home) {
|
super.onDestroyView();
|
||||||
finish();
|
binding = null;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,9 +15,6 @@ package app.fedilab.android.activities;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import static app.fedilab.android.helper.PinnedTimelineHelper.sortMenuItem;
|
|
||||||
import static app.fedilab.android.helper.PinnedTimelineHelper.sortPositionAsc;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -40,27 +37,31 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.app.BottomMenu;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.app.InstanceSocial;
|
|
||||||
import app.fedilab.android.client.entities.app.Pinned;
|
|
||||||
import app.fedilab.android.client.entities.app.PinnedTimeline;
|
|
||||||
import app.fedilab.android.client.entities.app.RemoteInstance;
|
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.databinding.ActivityReorderTabsBinding;
|
import app.fedilab.android.databinding.ActivityReorderTabsBinding;
|
||||||
import app.fedilab.android.databinding.PopupSearchInstanceBinding;
|
import app.fedilab.android.databinding.PopupSearchInstanceBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.client.entities.app.BottomMenu;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.app.InstanceSocial;
|
||||||
import app.fedilab.android.helper.itemtouchhelper.OnStartDragListener;
|
import app.fedilab.android.mastodon.client.entities.app.Pinned;
|
||||||
import app.fedilab.android.helper.itemtouchhelper.SimpleItemTouchHelperCallback;
|
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
|
||||||
import app.fedilab.android.ui.drawer.ReorderBottomMenuAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.RemoteInstance;
|
||||||
import app.fedilab.android.ui.drawer.ReorderTabAdapter;
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
import app.fedilab.android.viewmodel.mastodon.InstanceSocialVM;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.viewmodel.mastodon.ReorderVM;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.PinnedTimelineHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.itemtouchhelper.OnStartDragListener;
|
||||||
|
import app.fedilab.android.mastodon.helper.itemtouchhelper.SimpleItemTouchHelperCallback;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.ReorderBottomMenuAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.ReorderTabAdapter;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.InstanceSocialVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.ReorderVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import okhttp3.Callback;
|
import okhttp3.Callback;
|
||||||
|
@ -123,7 +124,7 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
|
||||||
this.pinned.pinnedTimelines = new ArrayList<>();
|
this.pinned.pinnedTimelines = new ArrayList<>();
|
||||||
update = false;
|
update = false;
|
||||||
}
|
}
|
||||||
sortPositionAsc(this.pinned.pinnedTimelines);
|
PinnedTimelineHelper.sortPositionAsc(this.pinned.pinnedTimelines);
|
||||||
reorderTabAdapter = new ReorderTabAdapter(this.pinned, ReorderTimelinesActivity.this);
|
reorderTabAdapter = new ReorderTabAdapter(this.pinned, ReorderTimelinesActivity.this);
|
||||||
ItemTouchHelper.Callback callback =
|
ItemTouchHelper.Callback callback =
|
||||||
new SimpleItemTouchHelperCallback(reorderTabAdapter);
|
new SimpleItemTouchHelperCallback(reorderTabAdapter);
|
||||||
|
@ -139,7 +140,7 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
|
||||||
this.bottomMenu = new BottomMenu(getApplicationContext()).defaultBottomMenu();
|
this.bottomMenu = new BottomMenu(getApplicationContext()).defaultBottomMenu();
|
||||||
this.bottomMenu.bottom_menu = new ArrayList<>();
|
this.bottomMenu.bottom_menu = new ArrayList<>();
|
||||||
}
|
}
|
||||||
sortMenuItem(this.bottomMenu.bottom_menu);
|
PinnedTimelineHelper.sortMenuItem(this.bottomMenu.bottom_menu);
|
||||||
reorderBottomMenuAdapter = new ReorderBottomMenuAdapter(this.bottomMenu, ReorderTimelinesActivity.this);
|
reorderBottomMenuAdapter = new ReorderBottomMenuAdapter(this.bottomMenu, ReorderTimelinesActivity.this);
|
||||||
ItemTouchHelper.Callback callback =
|
ItemTouchHelper.Callback callback =
|
||||||
new SimpleItemTouchHelperCallback(reorderBottomMenuAdapter);
|
new SimpleItemTouchHelperCallback(reorderBottomMenuAdapter);
|
||||||
|
@ -170,7 +171,7 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInstance() {
|
private void addInstance() {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ReorderTimelinesActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(ReorderTimelinesActivity.this);
|
||||||
PopupSearchInstanceBinding popupSearchInstanceBinding = PopupSearchInstanceBinding.inflate(getLayoutInflater());
|
PopupSearchInstanceBinding popupSearchInstanceBinding = PopupSearchInstanceBinding.inflate(getLayoutInflater());
|
||||||
dialogBuilder.setView(popupSearchInstanceBinding.getRoot());
|
dialogBuilder.setView(popupSearchInstanceBinding.getRoot());
|
||||||
TextWatcher textWatcher = autoComplete(popupSearchInstanceBinding);
|
TextWatcher textWatcher = autoComplete(popupSearchInstanceBinding);
|
||||||
|
@ -261,7 +262,10 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
|
||||||
pinnedTimeline.type = Timeline.TimeLineEnum.REMOTE;
|
pinnedTimeline.type = Timeline.TimeLineEnum.REMOTE;
|
||||||
pinnedTimeline.position = pinned.pinnedTimelines.size();
|
pinnedTimeline.position = pinned.pinnedTimelines.size();
|
||||||
pinned.pinnedTimelines.add(pinnedTimeline);
|
pinned.pinnedTimelines.add(pinnedTimeline);
|
||||||
|
if (pinned.user_id == null || pinned.instance == null) {
|
||||||
|
pinned.user_id = MainActivity.currentUserID;
|
||||||
|
pinned.instance = MainActivity.currentInstance;
|
||||||
|
}
|
||||||
if (update) {
|
if (update) {
|
||||||
try {
|
try {
|
||||||
new Pinned(ReorderTimelinesActivity.this).updatePinned(pinned);
|
new Pinned(ReorderTimelinesActivity.this).updatePinned(pinned);
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -31,15 +31,15 @@ import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.RelationShip;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.databinding.ActivityReportBinding;
|
import app.fedilab.android.databinding.ActivityReportBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.ui.drawer.RulesAdapter;
|
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.RulesAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -29,8 +29,8 @@ import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.databinding.ActivityScheduledBinding;
|
import app.fedilab.android.databinding.ActivityScheduledBinding;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
import app.fedilab.android.ui.pageadapter.FedilabScheduledPageAdapter;
|
import app.fedilab.android.mastodon.ui.pageadapter.FedilabScheduledPageAdapter;
|
||||||
|
|
||||||
public class ScheduledActivity extends BaseActivity {
|
public class ScheduledActivity extends BaseActivity {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -16,7 +16,9 @@ package app.fedilab.android.activities;
|
||||||
|
|
||||||
import android.app.SearchManager;
|
import android.app.SearchManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.database.MatrixCursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.BaseColumns;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -26,22 +28,39 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
|
import androidx.cursoradapter.widget.CursorAdapter;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.viewpager.widget.PagerAdapter;
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.FutureTarget;
|
||||||
|
import com.bumptech.glide.request.target.Target;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.databinding.ActivitySearchResultTabsBinding;
|
import app.fedilab.android.databinding.ActivitySearchResultTabsBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonAccount;
|
import app.fedilab.android.mastodon.client.entities.api.Tag;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTag;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
import app.fedilab.android.mastodon.ui.drawer.AccountsSearchTopBarAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.TagSearchTopBarAdapter;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonAccount;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTag;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.SearchVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +70,7 @@ public class SearchResultTabActivity extends BaseBarActivity {
|
||||||
private String search;
|
private String search;
|
||||||
private ActivitySearchResultTabsBinding binding;
|
private ActivitySearchResultTabsBinding binding;
|
||||||
private TabLayout.Tab initial;
|
private TabLayout.Tab initial;
|
||||||
|
public Boolean tagEmpty, accountEmpty;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -140,6 +160,75 @@ public class SearchResultTabActivity extends BaseBarActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextChange(String newText) {
|
public boolean onQueryTextChange(String newText) {
|
||||||
|
String pattern = "^(@[\\w_-]+@[a-z0-9.\\-]+|@[\\w_-]+)";
|
||||||
|
final Pattern mentionPattern = Pattern.compile(pattern);
|
||||||
|
String patternTag = "^#([\\w-]{2,})$";
|
||||||
|
final Pattern tagPattern = Pattern.compile(patternTag);
|
||||||
|
Matcher matcherMention, matcherTag;
|
||||||
|
matcherMention = mentionPattern.matcher(newText);
|
||||||
|
matcherTag = tagPattern.matcher(newText);
|
||||||
|
if (newText.trim().isEmpty()) {
|
||||||
|
searchView.setSuggestionsAdapter(null);
|
||||||
|
}
|
||||||
|
if (matcherMention.matches()) {
|
||||||
|
String[] from = new String[]{SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_TEXT_1};
|
||||||
|
int[] to = new int[]{R.id.account_pp, R.id.account_un};
|
||||||
|
String searchGroup = matcherMention.group();
|
||||||
|
AccountsVM accountsVM = new ViewModelProvider(SearchResultTabActivity.this).get(AccountsVM.class);
|
||||||
|
MatrixCursor cursor = new MatrixCursor(new String[]{BaseColumns._ID,
|
||||||
|
SearchManager.SUGGEST_COLUMN_ICON_1,
|
||||||
|
SearchManager.SUGGEST_COLUMN_TEXT_1});
|
||||||
|
accountsVM.searchAccounts(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, searchGroup, 5, false, false)
|
||||||
|
.observe(SearchResultTabActivity.this, accounts -> {
|
||||||
|
if (accounts == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AccountsSearchTopBarAdapter cursorAdapter = new AccountsSearchTopBarAdapter(SearchResultTabActivity.this, accounts, R.layout.drawer_account_search, null, from, to, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
|
||||||
|
searchView.setSuggestionsAdapter(cursorAdapter);
|
||||||
|
new Thread(() -> {
|
||||||
|
int i = 0;
|
||||||
|
for (Account account : accounts) {
|
||||||
|
FutureTarget<File> futureTarget = Glide
|
||||||
|
.with(SearchResultTabActivity.this.getApplicationContext())
|
||||||
|
.load(account.avatar_static)
|
||||||
|
.downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
|
||||||
|
File cacheFile;
|
||||||
|
try {
|
||||||
|
cacheFile = futureTarget.get();
|
||||||
|
cursor.addRow(new String[]{String.valueOf(i), cacheFile.getAbsolutePath(), "@" + account.acct});
|
||||||
|
i++;
|
||||||
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runOnUiThread(() -> cursorAdapter.changeCursor(cursor));
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
});
|
||||||
|
} else if (matcherTag.matches()) {
|
||||||
|
SearchVM searchVM = new ViewModelProvider(SearchResultTabActivity.this).get(SearchVM.class);
|
||||||
|
String[] from = new String[]{SearchManager.SUGGEST_COLUMN_TEXT_1};
|
||||||
|
int[] to = new int[]{R.id.tag_name};
|
||||||
|
String searchGroup = matcherTag.group();
|
||||||
|
MatrixCursor cursor = new MatrixCursor(new String[]{BaseColumns._ID,
|
||||||
|
SearchManager.SUGGEST_COLUMN_TEXT_1});
|
||||||
|
searchVM.search(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, searchGroup, null,
|
||||||
|
"hashtags", false, true, false, 0,
|
||||||
|
null, null, 10).observe(SearchResultTabActivity.this,
|
||||||
|
results -> {
|
||||||
|
if (results == null || results.hashtags == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TagSearchTopBarAdapter cursorAdapter = new TagSearchTopBarAdapter(SearchResultTabActivity.this, results.hashtags, R.layout.drawer_tag_search, null, from, to, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
|
||||||
|
searchView.setSuggestionsAdapter(cursorAdapter);
|
||||||
|
int i = 0;
|
||||||
|
for (Tag tag : results.hashtags) {
|
||||||
|
cursor.addRow(new String[]{String.valueOf(i), "#" + tag.name});
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
runOnUiThread(() -> cursorAdapter.changeCursor(cursor));
|
||||||
|
});
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -188,6 +277,18 @@ public class SearchResultTabActivity extends BaseBarActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void moveToAccount() {
|
||||||
|
tagEmpty = null;
|
||||||
|
accountEmpty = null;
|
||||||
|
binding.searchViewpager.setCurrentItem(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveToMessage() {
|
||||||
|
tagEmpty = null;
|
||||||
|
accountEmpty = null;
|
||||||
|
binding.searchViewpager.setCurrentItem(2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pager adapter for the 4 fragments
|
* Pager adapter for the 4 fragments
|
||||||
*/
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -23,10 +23,11 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.databinding.ActivityStatusHistoryBinding;
|
import app.fedilab.android.databinding.ActivityStatusHistoryBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.ui.drawer.StatusHistoryAdapter;
|
import app.fedilab.android.mastodon.ui.drawer.StatusHistoryAdapter;
|
||||||
import app.fedilab.android.viewmodel.mastodon.StatusesVM;
|
import app.fedilab.android.mastodon.viewmodel.mastodon.StatusesVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -29,15 +29,15 @@ import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.Accounts;
|
|
||||||
import app.fedilab.android.client.entities.api.RelationShip;
|
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
|
||||||
import app.fedilab.android.databinding.ActivityStatusInfoBinding;
|
import app.fedilab.android.databinding.ActivityStatusInfoBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.ui.drawer.AccountAdapter;
|
import app.fedilab.android.mastodon.client.entities.api.Accounts;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
|
||||||
import app.fedilab.android.viewmodel.mastodon.StatusesVM;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.ui.drawer.AccountAdapter;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.StatusesVM;
|
||||||
|
|
||||||
|
|
||||||
public class StatusInfoActivity extends BaseActivity {
|
public class StatusInfoActivity extends BaseActivity {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -21,8 +21,8 @@ import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.databinding.ActivitySuggestionsBinding;
|
import app.fedilab.android.databinding.ActivitySuggestionsBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonSuggestion;
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonSuggestion;
|
||||||
|
|
||||||
|
|
||||||
public class SuggestionActivity extends BaseBarActivity {
|
public class SuggestionActivity extends BaseBarActivity {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.activities;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -30,11 +30,11 @@ import com.google.android.material.tabs.TabLayout;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
|
||||||
import app.fedilab.android.databinding.ActivityTrendsBinding;
|
import app.fedilab.android.databinding.ActivityTrendsBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.client.entities.app.Timeline;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTag;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTag;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
|
||||||
|
|
||||||
public class TrendsActivity extends BaseBarActivity {
|
public class TrendsActivity extends BaseBarActivity {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities.admin;
|
package app.fedilab.android.mastodon.activities.admin;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -53,20 +53,20 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.BaseActivity;
|
|
||||||
import app.fedilab.android.activities.InstanceProfileActivity;
|
|
||||||
import app.fedilab.android.activities.MainActivity;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.activities.MediaActivity;
|
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminAccount;
|
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminIp;
|
|
||||||
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
|
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.activities.BaseActivity;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.activities.InstanceProfileActivity;
|
||||||
import app.fedilab.android.helper.SpannableHelper;
|
import app.fedilab.android.mastodon.activities.MediaActivity;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AdminVM;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
|
||||||
import app.fedilab.android.viewmodel.mastodon.NodeInfoVM;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminIp;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AdminVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.NodeInfoVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -365,12 +365,11 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
binding.instanceInfo.setVisibility(View.VISIBLE);
|
binding.instanceInfo.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
binding.instanceInfo.setOnClickListener(v -> {
|
binding.instanceInfo.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(AdminAccountActivity.this, InstanceProfileActivity.class);
|
InstanceProfileActivity instanceProfileActivity = new InstanceProfileActivity();
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
||||||
intent.putExtras(b);
|
instanceProfileActivity.setArguments(b);
|
||||||
startActivity(intent);
|
instanceProfileActivity.show(getSupportFragmentManager(), null);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities.admin;
|
package app.fedilab.android.mastodon.activities.admin;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -14,9 +14,9 @@ package app.fedilab.android.activities.admin;
|
||||||
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import static app.fedilab.android.activities.admin.AdminActionActivity.AdminEnum.ACCOUNT;
|
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.ACCOUNT;
|
||||||
import static app.fedilab.android.activities.admin.AdminActionActivity.AdminEnum.DOMAIN;
|
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.DOMAIN;
|
||||||
import static app.fedilab.android.activities.admin.AdminActionActivity.AdminEnum.REPORT;
|
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.REPORT;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -33,19 +33,20 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.BaseBarActivity;
|
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminDomainBlock;
|
|
||||||
import app.fedilab.android.databinding.ActivityAdminActionsBinding;
|
import app.fedilab.android.databinding.ActivityAdminActionsBinding;
|
||||||
import app.fedilab.android.databinding.PopupAdminFilterAccountsBinding;
|
import app.fedilab.android.databinding.PopupAdminFilterAccountsBinding;
|
||||||
import app.fedilab.android.databinding.PopupAdminFilterReportsBinding;
|
import app.fedilab.android.databinding.PopupAdminFilterReportsBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.activities.BaseBarActivity;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminDomainBlock;
|
||||||
import app.fedilab.android.ui.fragment.admin.FragmentAdminAccount;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.ui.fragment.admin.FragmentAdminDomain;
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
import app.fedilab.android.ui.fragment.admin.FragmentAdminReport;
|
import app.fedilab.android.mastodon.ui.fragment.admin.FragmentAdminAccount;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.admin.FragmentAdminDomain;
|
||||||
|
import app.fedilab.android.mastodon.ui.fragment.admin.FragmentAdminReport;
|
||||||
|
|
||||||
public class AdminActionActivity extends BaseBarActivity {
|
public class AdminActionActivity extends BaseBarActivity {
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ public class AdminActionActivity extends BaseBarActivity {
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_filter) {
|
} else if (item.getItemId() == R.id.action_filter) {
|
||||||
if (getTitle().toString().equalsIgnoreCase(getString(R.string.accounts))) {
|
if (getTitle().toString().equalsIgnoreCase(getString(R.string.accounts))) {
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(AdminActionActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(AdminActionActivity.this);
|
||||||
PopupAdminFilterAccountsBinding binding = PopupAdminFilterAccountsBinding.inflate(getLayoutInflater());
|
PopupAdminFilterAccountsBinding binding = PopupAdminFilterAccountsBinding.inflate(getLayoutInflater());
|
||||||
alertDialogBuilder.setView(binding.getRoot());
|
alertDialogBuilder.setView(binding.getRoot());
|
||||||
if (local != null && remote == null) {
|
if (local != null && remote == null) {
|
||||||
|
@ -258,7 +259,7 @@ public class AdminActionActivity extends BaseBarActivity {
|
||||||
AlertDialog alert = alertDialogBuilder.create();
|
AlertDialog alert = alertDialogBuilder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(AdminActionActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(AdminActionActivity.this);
|
||||||
PopupAdminFilterReportsBinding binding = PopupAdminFilterReportsBinding.inflate(getLayoutInflater());
|
PopupAdminFilterReportsBinding binding = PopupAdminFilterReportsBinding.inflate(getLayoutInflater());
|
||||||
alertDialogBuilder.setView(binding.getRoot());
|
alertDialogBuilder.setView(binding.getRoot());
|
||||||
if (resolved == null) {
|
if (resolved == null) {
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities.admin;
|
package app.fedilab.android.mastodon.activities.admin;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,8 +15,6 @@ package app.fedilab.android.activities.admin;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import static app.fedilab.android.helper.Helper.BROADCAST_DATA;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -30,13 +28,15 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.BaseBarActivity;
|
|
||||||
import app.fedilab.android.activities.MainActivity;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminDomainBlock;
|
|
||||||
import app.fedilab.android.databinding.ActivityAdminDomainblockBinding;
|
import app.fedilab.android.databinding.ActivityAdminDomainblockBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.activities.BaseBarActivity;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AdminVM;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminDomainBlock;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AdminVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class AdminDomainBlockActivity extends BaseBarActivity {
|
public class AdminDomainBlockActivity extends BaseBarActivity {
|
||||||
|
@ -107,7 +107,7 @@ public class AdminDomainBlockActivity extends BaseBarActivity {
|
||||||
} else {
|
} else {
|
||||||
Toasty.error(AdminDomainBlockActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
Toasty.error(AdminDomainBlockActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK, adminDomainBlockResult);
|
Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK, adminDomainBlockResult);
|
||||||
LocalBroadcastManager.getInstance(AdminDomainBlockActivity.this).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(AdminDomainBlockActivity.this).sendBroadcast(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@ -129,13 +129,13 @@ public class AdminDomainBlockActivity extends BaseBarActivity {
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_delete) {
|
} else if (itemId == R.id.action_delete) {
|
||||||
if (adminDomainBlock.id != null) {
|
if (adminDomainBlock.id != null) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(AdminDomainBlockActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(AdminDomainBlockActivity.this);
|
||||||
builder.setMessage(getString(R.string.unblock_domain_confirm, adminDomainBlock.domain));
|
builder.setMessage(getString(R.string.unblock_domain_confirm, adminDomainBlock.domain));
|
||||||
builder
|
builder
|
||||||
.setPositiveButton(R.string.unblock_domain, (dialog, which) -> {
|
.setPositiveButton(R.string.unblock_domain, (dialog, which) -> {
|
||||||
adminVM.deleteDomain(MainActivity.currentInstance, MainActivity.currentToken, adminDomainBlock.id)
|
adminVM.deleteDomain(MainActivity.currentInstance, MainActivity.currentToken, adminDomainBlock.id)
|
||||||
.observe(AdminDomainBlockActivity.this, adminDomainBlockResult -> {
|
.observe(AdminDomainBlockActivity.this, adminDomainBlockResult -> {
|
||||||
Intent intent = new Intent(BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE, adminDomainBlock);
|
Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE, adminDomainBlock);
|
||||||
LocalBroadcastManager.getInstance(AdminDomainBlockActivity.this).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(AdminDomainBlockActivity.this).sendBroadcast(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities.admin;
|
package app.fedilab.android.mastodon.activities.admin;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -54,20 +54,20 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.BaseBarActivity;
|
|
||||||
import app.fedilab.android.activities.InstanceProfileActivity;
|
|
||||||
import app.fedilab.android.activities.MediaActivity;
|
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminAccount;
|
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminIp;
|
|
||||||
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
|
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.activities.BaseBarActivity;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.mastodon.activities.InstanceProfileActivity;
|
||||||
import app.fedilab.android.helper.SpannableHelper;
|
import app.fedilab.android.mastodon.activities.MediaActivity;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.viewmodel.mastodon.AdminVM;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.viewmodel.mastodon.NodeInfoVM;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
|
||||||
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminIp;
|
||||||
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
|
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||||
|
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.AdminVM;
|
||||||
|
import app.fedilab.android.mastodon.viewmodel.mastodon.NodeInfoVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,12 +383,11 @@ public class AdminReportActivity extends BaseBarActivity {
|
||||||
binding.instanceInfo.setVisibility(View.VISIBLE);
|
binding.instanceInfo.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
binding.instanceInfo.setOnClickListener(v -> {
|
binding.instanceInfo.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(AdminReportActivity.this, InstanceProfileActivity.class);
|
InstanceProfileActivity instanceProfileActivity = new InstanceProfileActivity();
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
||||||
intent.putExtras(b);
|
instanceProfileActivity.setArguments(b);
|
||||||
startActivity(intent);
|
instanceProfileActivity.show(getSupportFragmentManager(), null);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.broadcastreceiver;
|
package app.fedilab.android.mastodon.broadcastreceiver;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.broadcastreceiver;
|
package app.fedilab.android.mastodon.broadcastreceiver;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -14,15 +14,12 @@ package app.fedilab.android.broadcastreceiver;
|
||||||
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import static app.fedilab.android.helper.Helper.RECEIVE_TOAST_CONTENT;
|
|
||||||
import static app.fedilab.android.helper.Helper.RECEIVE_TOAST_TYPE;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class ToastMessage extends BroadcastReceiver {
|
public class ToastMessage extends BroadcastReceiver {
|
||||||
|
@ -30,8 +27,8 @@ public class ToastMessage extends BroadcastReceiver {
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Bundle b = intent.getExtras();
|
Bundle b = intent.getExtras();
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
String type = b.getString(RECEIVE_TOAST_TYPE, null);
|
String type = b.getString(Helper.RECEIVE_TOAST_TYPE, null);
|
||||||
String content = b.getString(RECEIVE_TOAST_CONTENT, null);
|
String content = b.getString(Helper.RECEIVE_TOAST_CONTENT, null);
|
||||||
if (type != null && content != null) {
|
if (type != null && content != null) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Helper.RECEIVE_TOAST_TYPE_ERROR:
|
case Helper.RECEIVE_TOAST_TYPE_ERROR:
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client;
|
package app.fedilab.android.mastodon.client;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,7 +15,7 @@ package app.fedilab.android.client;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.app.WellKnownNodeinfo;
|
import app.fedilab.android.mastodon.client.entities.app.WellKnownNodeinfo;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Path;
|
import retrofit2.http.Path;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,7 +17,7 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.JoinMastodonInstance;
|
import app.fedilab.android.mastodon.client.entities.api.JoinMastodonInstance;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,17 +17,18 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.client.entities.api.FeaturedTag;
|
import app.fedilab.android.mastodon.client.entities.api.FamiliarFollowers;
|
||||||
import app.fedilab.android.client.entities.api.IdentityProof;
|
import app.fedilab.android.mastodon.client.entities.api.FeaturedTag;
|
||||||
import app.fedilab.android.client.entities.api.MastodonList;
|
import app.fedilab.android.mastodon.client.entities.api.IdentityProof;
|
||||||
import app.fedilab.android.client.entities.api.Preferences;
|
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
|
||||||
import app.fedilab.android.client.entities.api.RelationShip;
|
import app.fedilab.android.mastodon.client.entities.api.Preferences;
|
||||||
import app.fedilab.android.client.entities.api.Report;
|
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
import app.fedilab.android.mastodon.client.entities.api.Report;
|
||||||
import app.fedilab.android.client.entities.api.Suggestion;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.client.entities.api.Tag;
|
import app.fedilab.android.mastodon.client.entities.api.Suggestion;
|
||||||
import app.fedilab.android.client.entities.api.Token;
|
import app.fedilab.android.mastodon.client.entities.api.Tag;
|
||||||
|
import app.fedilab.android.mastodon.client.entities.api.Token;
|
||||||
import okhttp3.MultipartBody;
|
import okhttp3.MultipartBody;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
|
@ -95,7 +96,7 @@ public interface MastodonAccountsService {
|
||||||
@Field("source[privacy]") String privacy,
|
@Field("source[privacy]") String privacy,
|
||||||
@Field("source[sensitive]") Boolean sensitive,
|
@Field("source[sensitive]") Boolean sensitive,
|
||||||
@Field("source[language]") String language,
|
@Field("source[language]") String language,
|
||||||
@Field("fields_attributes") List<app.fedilab.android.client.entities.api.Field.FieldParams> fields
|
@Field("fields_attributes") List<app.fedilab.android.mastodon.client.entities.api.Field.FieldParams> fields
|
||||||
);
|
);
|
||||||
|
|
||||||
//Get Account
|
//Get Account
|
||||||
|
@ -173,7 +174,8 @@ public interface MastodonAccountsService {
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("id") String id,
|
@Path("id") String id,
|
||||||
@Field("reblogs") boolean reblogs,
|
@Field("reblogs") boolean reblogs,
|
||||||
@Field("notify") boolean notify
|
@Field("notify") boolean notify,
|
||||||
|
@Field("languages[]") List<String> languages
|
||||||
);
|
);
|
||||||
|
|
||||||
//Follow account
|
//Follow account
|
||||||
|
@ -253,6 +255,13 @@ public interface MastodonAccountsService {
|
||||||
@Query("id[]") List<String> ids
|
@Query("id[]") List<String> ids
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//Get familiar followers
|
||||||
|
@GET("accounts/familiar_followers ")
|
||||||
|
Call<List<FamiliarFollowers>> getFamiliarFollowers(
|
||||||
|
@Header("Authorization") String token,
|
||||||
|
@Query("id[]") List<String> ids
|
||||||
|
);
|
||||||
|
|
||||||
//Get search
|
//Get search
|
||||||
@GET("accounts/search")
|
@GET("accounts/search")
|
||||||
Call<List<Account>> searchAccounts(
|
Call<List<Account>> searchAccounts(
|
||||||
|
@ -409,4 +418,15 @@ public interface MastodonAccountsService {
|
||||||
@Header("Authorization") String token,
|
@Header("Authorization") String token,
|
||||||
@Path("account_id") String account_id
|
@Path("account_id") String account_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//Get user suggestions
|
||||||
|
@GET("directory")
|
||||||
|
Call<List<Account>> getDirectory(
|
||||||
|
@Header("Authorization") String token,
|
||||||
|
@Query("offset") Integer offset,
|
||||||
|
@Query("limit") Integer limit,
|
||||||
|
@Query("order") String order,
|
||||||
|
@Query("local") Boolean local
|
||||||
|
);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,9 +17,9 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminAccount;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminDomainBlock;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminDomainBlock;
|
||||||
import app.fedilab.android.client.entities.api.admin.AdminReport;
|
import app.fedilab.android.mastodon.client.entities.api.admin.AdminReport;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.DELETE;
|
import retrofit2.http.DELETE;
|
||||||
import retrofit2.http.Field;
|
import retrofit2.http.Field;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,7 +17,7 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Announcement;
|
import app.fedilab.android.mastodon.client.entities.api.Announcement;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.DELETE;
|
import retrofit2.http.DELETE;
|
||||||
import retrofit2.http.FormUrlEncoded;
|
import retrofit2.http.FormUrlEncoded;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,8 +15,8 @@ package app.fedilab.android.client.endpoints;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.App;
|
import app.fedilab.android.mastodon.client.entities.api.App;
|
||||||
import app.fedilab.android.client.entities.api.Token;
|
import app.fedilab.android.mastodon.client.entities.api.Token;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Field;
|
import retrofit2.http.Field;
|
||||||
import retrofit2.http.FormUrlEncoded;
|
import retrofit2.http.FormUrlEncoded;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,7 +17,7 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Filter;
|
import app.fedilab.android.mastodon.client.entities.api.Filter;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.DELETE;
|
import retrofit2.http.DELETE;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,11 +17,11 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.client.entities.api.Activity;
|
import app.fedilab.android.mastodon.client.entities.api.Activity;
|
||||||
import app.fedilab.android.client.entities.api.Emoji;
|
import app.fedilab.android.mastodon.client.entities.api.Emoji;
|
||||||
import app.fedilab.android.client.entities.api.Instance;
|
import app.fedilab.android.mastodon.client.entities.api.Instance;
|
||||||
import app.fedilab.android.client.entities.api.Tag;
|
import app.fedilab.android.mastodon.client.entities.api.Tag;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -16,8 +16,8 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Notification;
|
import app.fedilab.android.mastodon.client.entities.api.Notification;
|
||||||
import app.fedilab.android.client.entities.api.PushSubscription;
|
import app.fedilab.android.mastodon.client.entities.api.PushSubscription;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.DELETE;
|
import retrofit2.http.DELETE;
|
||||||
import retrofit2.http.Field;
|
import retrofit2.http.Field;
|
||||||
|
@ -71,7 +71,12 @@ public interface MastodonNotificationsService {
|
||||||
@Field("data[alerts][favourite]") boolean favourite,
|
@Field("data[alerts][favourite]") boolean favourite,
|
||||||
@Field("data[alerts][reblog]") boolean reblog,
|
@Field("data[alerts][reblog]") boolean reblog,
|
||||||
@Field("data[alerts][mention]") boolean mention,
|
@Field("data[alerts][mention]") boolean mention,
|
||||||
@Field("data[alerts][poll]") boolean poll
|
@Field("data[alerts][poll]") boolean poll,
|
||||||
|
@Field("data[alerts][status]") boolean status,
|
||||||
|
@Field("data[alerts][update]") boolean update,
|
||||||
|
@Field("data[alerts][admin.sign_up]") boolean admin_sign_up,
|
||||||
|
@Field("data[alerts][admin.report]") boolean admin_report
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@GET("push/subscription")
|
@GET("push/subscription")
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,7 +15,7 @@ package app.fedilab.android.client.endpoints;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Oembed;
|
import app.fedilab.android.mastodon.client.entities.api.Oembed;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -15,7 +15,7 @@ package app.fedilab.android.client.endpoints;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Results;
|
import app.fedilab.android.mastodon.client.entities.api.Results;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Header;
|
import retrofit2.http.Header;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,14 +17,14 @@ package app.fedilab.android.client.endpoints;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
import app.fedilab.android.mastodon.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.client.entities.api.Card;
|
import app.fedilab.android.mastodon.client.entities.api.Card;
|
||||||
import app.fedilab.android.client.entities.api.Context;
|
import app.fedilab.android.mastodon.client.entities.api.Context;
|
||||||
import app.fedilab.android.client.entities.api.Poll;
|
import app.fedilab.android.mastodon.client.entities.api.Poll;
|
||||||
import app.fedilab.android.client.entities.api.ScheduledStatus;
|
import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.client.entities.api.StatusSource;
|
import app.fedilab.android.mastodon.client.entities.api.StatusSource;
|
||||||
import okhttp3.MultipartBody;
|
import okhttp3.MultipartBody;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
@ -59,7 +59,9 @@ public interface MastodonStatusesService {
|
||||||
@Field("sensitive") Boolean sensitive,
|
@Field("sensitive") Boolean sensitive,
|
||||||
@Field("spoiler_text") String spoiler_text,
|
@Field("spoiler_text") String spoiler_text,
|
||||||
@Field("visibility") String visibility,
|
@Field("visibility") String visibility,
|
||||||
@Field("language") String language
|
@Field("language") String language,
|
||||||
|
@Field("quote_id") String quote_id,
|
||||||
|
@Field("content_type") String content_type
|
||||||
);
|
);
|
||||||
|
|
||||||
@GET("statuses/{id}/source")
|
@GET("statuses/{id}/source")
|
||||||
|
@ -89,10 +91,12 @@ public interface MastodonStatusesService {
|
||||||
@Field("sensitive") Boolean sensitive,
|
@Field("sensitive") Boolean sensitive,
|
||||||
@Field("spoiler_text") String spoiler_text,
|
@Field("spoiler_text") String spoiler_text,
|
||||||
@Field("visibility") String visibility,
|
@Field("visibility") String visibility,
|
||||||
@Field("language") String language
|
@Field("language") String language,
|
||||||
|
@Field("media_attributes[id][]") List<String> media_id,
|
||||||
|
@Field("media_attributes[description][]") List<String> media_description,
|
||||||
|
@Field("media_attributes[focus][]") List<String> focus
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//Post a scheduled status
|
//Post a scheduled status
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("statuses")
|
@POST("statuses")
|
||||||
|
@ -314,4 +318,18 @@ public interface MastodonStatusesService {
|
||||||
@Header("Authorization") String token,
|
@Header("Authorization") String token,
|
||||||
@Path("id") String id
|
@Path("id") String id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@POST("statuses/{id}/react/{name}")
|
||||||
|
Call<Void> addReaction(
|
||||||
|
@Header("Authorization") String app_token,
|
||||||
|
@Path("id") String id,
|
||||||
|
@Path("name") String name
|
||||||
|
);
|
||||||
|
|
||||||
|
@POST("statuses/{id}/unreact/{name}")
|
||||||
|
Call<Void> removeReaction(
|
||||||
|
@Header("Authorization") String app_token,
|
||||||
|
@Path("id") String id,
|
||||||
|
@Path("name") String name
|
||||||
|
);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -17,7 +17,7 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Tag;
|
import app.fedilab.android.mastodon.client.entities.api.Tag;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Header;
|
import retrofit2.http.Header;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -16,15 +16,15 @@ package app.fedilab.android.client.endpoints;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
||||||
import app.fedilab.android.client.entities.api.Conversation;
|
import app.fedilab.android.mastodon.client.entities.api.Conversation;
|
||||||
import app.fedilab.android.client.entities.api.Marker;
|
import app.fedilab.android.mastodon.client.entities.api.Marker;
|
||||||
import app.fedilab.android.client.entities.api.MastodonList;
|
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.client.entities.api.Tag;
|
import app.fedilab.android.mastodon.client.entities.api.Tag;
|
||||||
import app.fedilab.android.client.entities.misskey.MisskeyNote;
|
import app.fedilab.android.mastodon.client.entities.misskey.MisskeyNote;
|
||||||
import app.fedilab.android.client.entities.nitter.Nitter;
|
import app.fedilab.android.mastodon.client.entities.nitter.Nitter;
|
||||||
import app.fedilab.android.client.entities.peertube.PeertubeVideo;
|
import app.fedilab.android.mastodon.client.entities.peertube.PeertubeVideo;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.DELETE;
|
import retrofit2.http.DELETE;
|
||||||
|
@ -53,6 +53,19 @@ public interface MastodonTimelinesService {
|
||||||
@Query("limit") Integer limit
|
@Query("limit") Integer limit
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@GET("timelines/bubble")
|
||||||
|
Call<List<Status>> getBubble(
|
||||||
|
@Header("Authorization") String token,
|
||||||
|
@Query("only_media") Boolean only_media,
|
||||||
|
@Query("remote") Boolean remote,
|
||||||
|
@Query("with_muted") Boolean with_muted,
|
||||||
|
@Query("exclude_visibilities") List<String> exclude_visibilities,
|
||||||
|
@Query("reply_visibility") String reply_visibility,
|
||||||
|
@Query("max_id") String max_id,
|
||||||
|
@Query("since_id") String since_id,
|
||||||
|
@Query("min_id") String min_id,
|
||||||
|
@Query("limit") Integer limit
|
||||||
|
);
|
||||||
|
|
||||||
@GET("trends/statuses")
|
@GET("trends/statuses")
|
||||||
Call<List<Status>> getStatusTrends(
|
Call<List<Status>> getStatusTrends(
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.endpoints;
|
package app.fedilab.android.mastodon.client.endpoints;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -29,7 +29,7 @@ import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.helper.SpannableHelper;
|
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||||
|
|
||||||
public class Account implements Serializable {
|
public class Account implements Serializable {
|
||||||
|
|
||||||
|
@ -87,7 +87,38 @@ public class Account implements Serializable {
|
||||||
public Account moved;
|
public Account moved;
|
||||||
@SerializedName("role")
|
@SerializedName("role")
|
||||||
public Role role;
|
public Role role;
|
||||||
|
public transient RelationShip relationShip;
|
||||||
|
|
||||||
|
public synchronized Spannable getSpanDisplayName(Context context, WeakReference<View> viewWeakReference) {
|
||||||
|
if (display_name == null || display_name.isEmpty()) {
|
||||||
|
display_name = username;
|
||||||
|
}
|
||||||
|
return SpannableHelper.convert(context, display_name, null, this, null, viewWeakReference);
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized Spannable getSpanDisplayName(Activity activity, WeakReference<View> viewWeakReference) {
|
||||||
|
if (display_name == null || display_name.isEmpty()) {
|
||||||
|
display_name = username;
|
||||||
|
}
|
||||||
|
return SpannableHelper.convertEmoji(activity, display_name, this, viewWeakReference);
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized Spannable getSpanDisplayNameTitle(Context context, WeakReference<View> viewWeakReference, String title) {
|
||||||
|
return SpannableHelper.convert(context, title, null, this, null, viewWeakReference);
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference) {
|
||||||
|
return SpannableHelper.convert(context, note, null, this, null, viewWeakReference);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
boolean same = false;
|
||||||
|
if (obj instanceof Account) {
|
||||||
|
same = this.id.equals(((Account) obj).id);
|
||||||
|
}
|
||||||
|
return same;
|
||||||
|
}
|
||||||
|
|
||||||
public static class Role implements Serializable {
|
public static class Role implements Serializable {
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
|
@ -108,31 +139,6 @@ public class Account implements Serializable {
|
||||||
public Date updated_at;
|
public Date updated_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public transient RelationShip relationShip;
|
|
||||||
|
|
||||||
public synchronized Spannable getSpanDisplayName(Context context, WeakReference<View> viewWeakReference) {
|
|
||||||
if (display_name == null || display_name.isEmpty()) {
|
|
||||||
display_name = username;
|
|
||||||
}
|
|
||||||
return SpannableHelper.convert(context, display_name, null, this, null, false, false, viewWeakReference);
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized Spannable getSpanDisplayName(Activity activity, WeakReference<View> viewWeakReference) {
|
|
||||||
if (display_name == null || display_name.isEmpty()) {
|
|
||||||
display_name = username;
|
|
||||||
}
|
|
||||||
return SpannableHelper.convertEmoji(activity, display_name, this, viewWeakReference);
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized Spannable getSpanDisplayNameTitle(Context context, WeakReference<View> viewWeakReference, String title) {
|
|
||||||
return SpannableHelper.convert(context, title, null, this, null, false, false, viewWeakReference);
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference) {
|
|
||||||
return SpannableHelper.convert(context, note, null, this, null, true, true, viewWeakReference);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class AccountParams implements Serializable {
|
public static class AccountParams implements Serializable {
|
||||||
@SerializedName("discoverable")
|
@SerializedName("discoverable")
|
||||||
public boolean discoverable;
|
public boolean discoverable;
|
||||||
|
@ -150,14 +156,4 @@ public class Account implements Serializable {
|
||||||
public LinkedHashMap<Integer, Field.FieldParams> fields;
|
public LinkedHashMap<Integer, Field.FieldParams> fields;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(@Nullable Object obj) {
|
|
||||||
boolean same = false;
|
|
||||||
if (obj instanceof Account) {
|
|
||||||
same = this.id.equals(((Account) obj).id);
|
|
||||||
}
|
|
||||||
return same;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -24,7 +24,7 @@ import java.lang.ref.WeakReference;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.helper.SpannableHelper;
|
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||||
|
|
||||||
public class Announcement {
|
public class Announcement {
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
|
@ -56,7 +56,7 @@ public class Announcement {
|
||||||
|
|
||||||
|
|
||||||
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference) {
|
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference) {
|
||||||
return SpannableHelper.convert(context, content, null, null, this, true, false, viewWeakReference);
|
return SpannableHelper.convert(context, content, null, null, this, viewWeakReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.android.client.entities.api;
|
||||||
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -45,13 +47,24 @@ public class Attachment implements Serializable {
|
||||||
public String local_path;
|
public String local_path;
|
||||||
@SerializedName("meta")
|
@SerializedName("meta")
|
||||||
public Meta meta;
|
public Meta meta;
|
||||||
|
@SerializedName("sensitive")
|
||||||
|
public boolean sensitive = false;
|
||||||
|
|
||||||
public String peertubeHost = null;
|
public String peertubeHost = null;
|
||||||
public String peertubeId = null;
|
public String peertubeId = null;
|
||||||
public String focus = null;
|
public String focus = null;
|
||||||
public String translation = null;
|
public String translation = null;
|
||||||
|
public transient Status status = null;
|
||||||
|
|
||||||
public float measuredWidth = -1.f;
|
@Override
|
||||||
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
boolean same = false;
|
||||||
|
if (obj instanceof Attachment && ((Attachment) obj).id != null && this.id != null) {
|
||||||
|
same = this.id.equals(((Attachment) obj).id);
|
||||||
|
return same;
|
||||||
|
} else return super.equals(obj);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static class Meta implements Serializable {
|
public static class Meta implements Serializable {
|
||||||
@SerializedName("focus")
|
@SerializedName("focus")
|
||||||
|
@ -79,4 +92,5 @@ public class Attachment implements Serializable {
|
||||||
@SerializedName("aspect")
|
@SerializedName("aspect")
|
||||||
public float aspect;
|
public float aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -27,7 +27,7 @@ import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.sqlite.Sqlite;
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2022 Thomas Schneider
|
/* Copyright 2022 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -14,24 +14,15 @@ package app.fedilab.android.activities;
|
||||||
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
import com.vanniktech.emoji.EmojiManager;
|
|
||||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
|
||||||
|
|
||||||
import app.fedilab.android.helper.Helper;
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("Registered")
|
|
||||||
public class BaseFragmentActivity extends FragmentActivity {
|
|
||||||
|
|
||||||
|
|
||||||
static {
|
|
||||||
Helper.installProvider();
|
|
||||||
EmojiManager.install(new EmojiOneProvider());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class FamiliarFollowers implements Serializable {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
public String id;
|
||||||
|
@SerializedName("accounts")
|
||||||
|
public List<Account> accounts;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -28,7 +28,7 @@ import java.lang.ref.WeakReference;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.helper.SpannableHelper;
|
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||||
|
|
||||||
public class Field implements Serializable {
|
public class Field implements Serializable {
|
||||||
@SerializedName("name")
|
@SerializedName("name")
|
||||||
|
@ -47,7 +47,7 @@ public class Field implements Serializable {
|
||||||
if (verified_at != null && value != null) {
|
if (verified_at != null && value != null) {
|
||||||
value_span = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.verified_text));
|
value_span = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.verified_text));
|
||||||
}
|
}
|
||||||
Spannable spannable = SpannableHelper.convert(context, value, null, account, null, true, true, viewWeakReference);
|
Spannable spannable = SpannableHelper.convert(context, value, null, account, null, viewWeakReference);
|
||||||
if (value_span != null && spannable != null) {
|
if (value_span != null && spannable != null) {
|
||||||
spannable.setSpan(value_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
spannable.setSpan(value_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class Field implements Serializable {
|
||||||
|
|
||||||
public synchronized Spannable getLabelSpan(Context context, Account account, WeakReference<View> viewWeakReference) {
|
public synchronized Spannable getLabelSpan(Context context, Account account, WeakReference<View> viewWeakReference) {
|
||||||
|
|
||||||
Spannable spannable = SpannableHelper.convert(context, name, null, account, null, true, true, viewWeakReference);
|
Spannable spannable = SpannableHelper.convert(context, name, null, account, null, viewWeakReference);
|
||||||
if (name_span != null && spannable != null) {
|
if (name_span != null && spannable != null) {
|
||||||
spannable.setSpan(name_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
spannable.setSpan(name_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
|
@ -24,7 +24,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.mastodon.exception.DBException;
|
||||||
import app.fedilab.android.sqlite.Sqlite;
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app.fedilab.android.client.entities.api;
|
package app.fedilab.android.mastodon.client.entities.api;
|
||||||
/* Copyright 2021 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue