Merge branch 'develop'
|
@ -9,3 +9,6 @@
|
|||
/gradle.properties
|
||||
|
||||
|
||||
/app/playstore/release/
|
||||
/app/lite/release/
|
||||
/app/fdroid/release/
|
||||
|
|
|
@ -4,10 +4,10 @@ android {
|
|||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.3"
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 376
|
||||
versionName "2.36.2"
|
||||
versionCode 379
|
||||
versionName "2.37.0"
|
||||
multiDexEnabled true
|
||||
renderscriptTargetApi 28 as int
|
||||
renderscriptSupportModeEnabled true
|
||||
|
@ -26,6 +26,8 @@ android {
|
|||
pseudoLocalesEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
|
@ -38,12 +40,46 @@ android {
|
|||
fdroid {
|
||||
applicationId "fr.gouv.etalab.mastodon"
|
||||
buildConfigField "boolean", "DONATIONS", "true"
|
||||
buildConfigField "boolean", "lite", "false"
|
||||
resValue "string", "app_name", "Fedilab"
|
||||
}
|
||||
lite {
|
||||
minSdkVersion 21
|
||||
applicationId "app.fedilab.lite"
|
||||
buildConfigField "boolean", "DONATIONS", "true"
|
||||
buildConfigField "boolean", "lite", "true"
|
||||
resValue "string", "app_name", "Fedilab Lite"
|
||||
}
|
||||
playstore {
|
||||
applicationId "app.fedilab.android"
|
||||
buildConfigField "boolean", "DONATIONS", "false"
|
||||
buildConfigField "boolean", "lite", "false"
|
||||
resValue "string", "app_name", "Fedilab"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
playstore {
|
||||
manifest.srcFile "src/common/AndroidManifest.xml"
|
||||
assets.srcDirs = ['/src/mains/assets', 'src/common/assets']
|
||||
java.srcDirs = ['src/main/java', 'src/playstore/java','src/common/java']
|
||||
res.srcDirs = ['src/main/res', 'src/playstore/res','src/common/res']
|
||||
}
|
||||
|
||||
fdroid {
|
||||
manifest.srcFile "src/common/AndroidManifest.xml"
|
||||
assets.srcDirs = ['/src/mains/assets', 'src/common/assets']
|
||||
java.srcDirs = ['src/main/java', 'src/fdroid/java','src/common/java']
|
||||
res.srcDirs = ['src/main/res', 'src/fdroid/res','src/common/res']
|
||||
}
|
||||
lite {
|
||||
manifest.srcFile "src/lite/AndroidManifest.xml"
|
||||
assets.srcDirs = ['/src/mains/assets']
|
||||
java.srcDirs = ['src/main/java', 'src/lite/java']
|
||||
res.srcDirs = ['src/main/res', 'src/lite/res']
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/proguard/androidx-annotations.pro'
|
||||
}
|
||||
|
@ -61,11 +97,15 @@ allprojects {
|
|||
task copyAllReleaseNotes(type: Copy) {
|
||||
from "$buildDir/../src/main/assets/changelogs/"
|
||||
include "*.txt"
|
||||
into "$buildDir/../../fastlane/metadata/android/en-US/changelogs/"
|
||||
into "$buildDir/../../src/fdroid/fastlane/metadata/android/en-US/changelogs/"
|
||||
from "$buildDir/../src/main/assets/changelogs/"
|
||||
include "*.txt"
|
||||
into "$buildDir/../../src/lite/fastlane/metadata/android/en-US/changelogs/"
|
||||
}
|
||||
|
||||
task gitPushReleaseNotes(type: Exec, dependsOn: 'copyAllReleaseNotes') {
|
||||
['sh', '-c', "git add $buildDir/../../fastlane/metadata/android/en-US/changelogs/*"].execute().text.trim()
|
||||
['sh', '-c', "git add $buildDir/../../src/fdroid/fastlane/metadata/android/en-US/changelogs/*"].execute().text.trim()
|
||||
['sh', '-c', "git add $buildDir/../../src/lite/fastlane/metadata/android/en-US/changelogs/*"].execute().text.trim()
|
||||
['sh', '-c', "git commit -m 'copy release notes'"].execute().text.trim()
|
||||
['sh', '-c', "git push"].execute().text.trim()
|
||||
}
|
||||
|
@ -73,13 +113,13 @@ task gitPushReleaseNotes(type: Exec, dependsOn: 'copyAllReleaseNotes') {
|
|||
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.browser:browser:1.2.0'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.0.2'
|
||||
implementation 'androidx.browser:browser:1.3.0'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.3.2'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation "com.github.bumptech.glide:glide:4.11.0"
|
||||
implementation ("com.github.bumptech.glide:recyclerview-integration:4.11.0") {
|
||||
// Excludes the support library because it's already included by Glide.
|
||||
|
@ -87,17 +127,15 @@ dependencies {
|
|||
}
|
||||
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
|
||||
annotationProcessor 'com.android.support:support-annotations:28.0.0'
|
||||
implementation "org.conscrypt:conscrypt-android:2.4.0"
|
||||
|
||||
implementation "com.evernote:android-job:1.2.6"
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
implementation "com.google.guava:guava:28.2-android"
|
||||
implementation "com.github.chrisbanes:PhotoView:2.3.0"
|
||||
implementation 'com.r0adkll:slidableactivity:2.1.0'
|
||||
implementation 'com.github.stom79:country-picker-android:1.2.0'
|
||||
implementation 'com.github.stom79:mytransl:2.0'
|
||||
implementation 'com.github.stom79:mytransl:3.0'
|
||||
implementation 'com.github.stom79:SparkButton:1.0.13'
|
||||
implementation "com.koushikdutta.async:androidasync:2.+"
|
||||
implementation 'com.vanniktech:emoji-one:0.6.0'
|
||||
implementation "com.koushikdutta.async:androidasync:3.+"
|
||||
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
|
||||
implementation 'com.github.franmontiel:LocaleChanger:0.9.2'
|
||||
implementation 'com.github.GrenderG:Toasty:1.4.2'
|
||||
|
@ -108,28 +146,45 @@ dependencies {
|
|||
implementation 'com.github.mabbas007:TagsEditText:1.0.5'
|
||||
implementation "com.tonyodev.fetch2:fetch2:2.3.6"
|
||||
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
||||
playstoreImplementation "io.github.kobakei:ratethisapp:1.2.0"
|
||||
implementation 'ja.burhanrashid52:photoeditor:0.4.0'
|
||||
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
|
||||
|
||||
|
||||
|
||||
implementation 'com.jaredrummler:cyanea:1.0.2'
|
||||
implementation "net.gotev:uploadservice:3.5.2"
|
||||
implementation "net.gotev:uploadservice-okhttp:3.5.2"
|
||||
implementation "info.guardianproject.netcipher:netcipher:2.0.0-alpha1"
|
||||
implementation "info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1"
|
||||
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.github.adrielcafe:AndroidAudioRecorder:0.3.0'
|
||||
implementation 'yogesh.firzen:MukkiyaSevaigal:1.0.6'
|
||||
implementation 'com.iceteck.silicompressorr:silicompressor:2.2.2'
|
||||
implementation "ch.acra:acra-mail:5.5.0"
|
||||
implementation "ch.acra:acra-limiter:5.5.0"
|
||||
implementation "ch.acra:acra-notification:5.5.0"
|
||||
implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1'
|
||||
implementation 'com.github.duanhong169:colorpicker:1.1.6'
|
||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.2.0'
|
||||
implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1'
|
||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||
implementation 'com.github.smarteist:autoimageslider:1.3.2'
|
||||
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
|
||||
implementation 'com.jaredrummler:cyanea:1.0.2'
|
||||
implementation 'com.huangyz0918:androidwm-light:0.1.2'
|
||||
|
||||
//Flavors
|
||||
|
||||
//Playstore
|
||||
playstoreApi 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
|
||||
playstoreImplementation "io.github.kobakei:ratethisapp:1.2.0"
|
||||
playstoreImplementation "org.conscrypt:conscrypt-android:2.4.0"
|
||||
playstoreImplementation 'com.github.stom79:country-picker-android:1.2.0'
|
||||
playstoreImplementation 'com.vanniktech:emoji-one:0.6.0'
|
||||
playstoreImplementation 'ja.burhanrashid52:photoeditor:0.4.0'
|
||||
|
||||
|
||||
//Fdroid
|
||||
fdroidApi 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
|
||||
fdroidImplementation "org.conscrypt:conscrypt-android:2.4.0"
|
||||
fdroidImplementation 'com.github.stom79:country-picker-android:1.2.0'
|
||||
fdroidImplementation 'com.vanniktech:emoji-one:0.6.0'
|
||||
fdroidImplementation 'ja.burhanrashid52:photoeditor:0.4.0'
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2017 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>
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="app.fedilab.android"
|
||||
android:installLocation="auto">
|
||||
|
||||
|
||||
<application
|
||||
android:name="app.fedilab.android.activities.MainApplication"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:allowBackup="false"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher_bubbles"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:roundIcon="@mipmap/ic_launcher_bubbles_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppThemeDark"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:allowBackup">
|
||||
|
||||
|
||||
<activity-alias
|
||||
android:name=".activities.MainActivity.Bubbles"
|
||||
android:enabled="true"
|
||||
android:icon="@mipmap/ic_launcher_bubbles"
|
||||
android:roundIcon="@mipmap/ic_launcher_bubbles_round"
|
||||
android:targetActivity=".activities.MainActivity">
|
||||
<meta-data
|
||||
android:name="icon"
|
||||
android:value="bubbles" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PhotoEditorActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerStatusActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerNotificationChartsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerChartsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerNotificationActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
|
||||
<activity
|
||||
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
|
||||
android:theme="@style/Base.Theme.AppCompat" />
|
||||
</application>
|
||||
</manifest>
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 153 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 152 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 155 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 159 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 154 KiB |
|
@ -2,21 +2,19 @@ package app.fedilab.android.activities;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.vanniktech.emoji.EmojiManager;
|
||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 16/05/2020.
|
||||
* Fragment base activity which updates security provider
|
||||
* Created by Thomas on 12/12/2017.
|
||||
* Base activity which updates security provider
|
||||
*/
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseFragmentActivity extends AppCompatActivity {
|
||||
|
||||
public class BaseActivity extends AllBaseActivity {
|
||||
|
||||
static {
|
||||
Helper.installProvider();
|
|
@ -0,0 +1,29 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
import com.vanniktech.emoji.EmojiManager;
|
||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
|
||||
public class BaseFragmentActivity extends MainBaseFragmentActivity {
|
||||
|
||||
static {
|
||||
Helper.installProvider();
|
||||
EmojiManager.install(new EmojiOneProvider());
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@ import android.content.SharedPreferences;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -88,7 +87,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
|||
private int theme;
|
||||
private RelativeLayout loader;
|
||||
private ImageButton validate;
|
||||
private DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -100,7 +99,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
|||
}
|
||||
|
||||
};
|
||||
private DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -257,7 +256,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
|||
chart.setVisibility(View.GONE);
|
||||
loader.setVisibility(View.VISIBLE);
|
||||
validate.setEnabled(false);
|
||||
new RetrieveChartsAsyncTask(OwnerChartsActivity.this, dateIni, dateEnd, OwnerChartsActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveChartsAsyncTask(OwnerChartsActivity.this, dateIni, dateEnd, OwnerChartsActivity.this);
|
||||
|
||||
}
|
||||
|
||||
|
@ -397,7 +396,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
|||
|
||||
@SuppressLint("ViewConstructor")
|
||||
public static class CustomMarkerView extends MarkerView {
|
||||
private TextView tvContent;
|
||||
private final TextView tvContent;
|
||||
private MPPointF mOffset;
|
||||
|
||||
public CustomMarkerView(Context context, int layoutResource) {
|
||||
|
@ -424,8 +423,8 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
|||
}
|
||||
|
||||
public static class MyXAxisValueFormatter extends ValueFormatter {
|
||||
private DateFormat mDataFormat;
|
||||
private Date mDate;
|
||||
private final DateFormat mDataFormat;
|
||||
private final Date mDate;
|
||||
|
||||
MyXAxisValueFormatter() {
|
||||
this.mDataFormat = new SimpleDateFormat("dd.MM", Locale.getDefault());
|
|
@ -23,7 +23,6 @@ import android.content.IntentFilter;
|
|||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -101,7 +100,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
|||
private Date dateIni, dateEnd;
|
||||
private View statsDialogView;
|
||||
private StatisticsNotification statistics;
|
||||
private DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -113,7 +112,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
|||
}
|
||||
|
||||
};
|
||||
private DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -126,14 +125,14 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
|||
}
|
||||
|
||||
};
|
||||
private BroadcastReceiver backupFinishedReceiver = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver backupFinishedReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -222,13 +221,13 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
|||
swipeRefreshLayout.setColorSchemeColors(
|
||||
c1, c2, c1
|
||||
);
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this);
|
||||
swipeRefreshLayout.setOnRefreshListener(() -> {
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this);
|
||||
});
|
||||
|
||||
lv_notifications.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
|
@ -240,7 +239,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
|||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||
if (!flag_loading) {
|
||||
flag_loading = true;
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, max_id, OwnerNotificationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, max_id, OwnerNotificationActivity.this);
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
|
@ -289,7 +288,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
|||
.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss());
|
||||
dialogBuilder.create().show();
|
||||
if (statistics == null) {
|
||||
new RetrieveNotificationStatsAsyncTask(OwnerNotificationActivity.this, OwnerNotificationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveNotificationStatsAsyncTask(OwnerNotificationActivity.this, OwnerNotificationActivity.this);
|
||||
} else {
|
||||
displayStats();
|
||||
}
|
||||
|
@ -376,7 +375,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
|||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveNotificationsCacheAsyncTask(OwnerNotificationActivity.this, filterNotifications, null, OwnerNotificationActivity.this);
|
||||
dialog.dismiss();
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
@ -22,7 +22,6 @@ import android.content.SharedPreferences;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -91,7 +90,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
private RelativeLayout loader;
|
||||
private ImageButton validate;
|
||||
private String status_id;
|
||||
private DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -103,7 +102,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
}
|
||||
|
||||
};
|
||||
private DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -473,7 +472,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
chart.setVisibility(View.GONE);
|
||||
loader.setVisibility(View.VISIBLE);
|
||||
validate.setEnabled(false);
|
||||
new RetrieveNotificationChartsAsyncTask(OwnerNotificationChartsActivity.this, status_id, dateIni, dateEnd, OwnerNotificationChartsActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveNotificationChartsAsyncTask(OwnerNotificationChartsActivity.this, status_id, dateIni, dateEnd, OwnerNotificationChartsActivity.this);
|
||||
|
||||
}
|
||||
|
||||
|
@ -484,7 +483,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
|
||||
@SuppressLint("ViewConstructor")
|
||||
public static class CustomMarkerView extends MarkerView {
|
||||
private TextView tvContent;
|
||||
private final TextView tvContent;
|
||||
private MPPointF mOffset;
|
||||
|
||||
public CustomMarkerView(Context context, int layoutResource) {
|
||||
|
@ -511,8 +510,8 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
}
|
||||
|
||||
public class MyXAxisValueFormatter extends ValueFormatter {
|
||||
private DateFormat mDataFormat;
|
||||
private Date mDate;
|
||||
private final DateFormat mDataFormat;
|
||||
private final Date mDate;
|
||||
|
||||
MyXAxisValueFormatter() {
|
||||
if (status_id == null) {
|
|
@ -23,7 +23,6 @@ import android.content.IntentFilter;
|
|||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -106,7 +105,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
private Date dateIni, dateEnd;
|
||||
private View statsDialogView;
|
||||
private Statistics statistics;
|
||||
private DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener iniDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -118,7 +117,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
}
|
||||
|
||||
};
|
||||
private DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
private final DatePickerDialog.OnDateSetListener endDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
|
@ -131,14 +130,14 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
}
|
||||
|
||||
};
|
||||
private BroadcastReceiver backupFinishedReceiver = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver backupFinishedReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -231,13 +230,13 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
swipeRefreshLayout.setColorSchemeColors(
|
||||
c1, c2, c1
|
||||
);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this);
|
||||
swipeRefreshLayout.setOnRefreshListener(() -> {
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this);
|
||||
});
|
||||
|
||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
|
@ -249,7 +248,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||
if (!flag_loading) {
|
||||
flag_loading = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, max_id, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, max_id, OwnerStatusActivity.this);
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
|
@ -298,7 +297,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss());
|
||||
dialogBuilder.create().show();
|
||||
if (statistics == null) {
|
||||
new RetrieveStatsAsyncTask(OwnerStatusActivity.this, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveStatsAsyncTask(OwnerStatusActivity.this, OwnerStatusActivity.this);
|
||||
} else {
|
||||
displayStats();
|
||||
}
|
||||
|
@ -409,7 +408,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this);
|
||||
dialog.dismiss();
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
@ -0,0 +1,38 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class PixelfedComposeActivity extends BasePixelfedComposeActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void launchPhotoEditor(Uri uri) {
|
||||
Intent intent = new Intent(PixelfedComposeActivity.this, PhotoEditorActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
intent.putExtra("imageUri", uri.toString());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void displayEmojiPopup() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.github.stom79.localepicker.CountryPicker;
|
||||
import com.github.stom79.mytransl.MyTransL;
|
||||
import com.github.stom79.mytransl.client.HttpsConnectionException;
|
||||
import com.github.stom79.mytransl.translate.Translate;
|
||||
import com.vanniktech.emoji.EmojiPopup;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
|
||||
public class TootActivity extends BaseTootActivity {
|
||||
|
||||
private AlertDialog dialogTrans;
|
||||
|
||||
@Override
|
||||
protected boolean actionTranslateClick() {
|
||||
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
final CountryPicker picker = CountryPicker.newInstance(getString(R.string.which_language)); // dialog title
|
||||
if (theme == Helper.THEME_LIGHT) {
|
||||
picker.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Dialog);
|
||||
} else {
|
||||
picker.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.DialogDark);
|
||||
}
|
||||
if (toot_content.getText().length() == 0 && toot_cw_content.getText().length() == 0)
|
||||
return true;
|
||||
String dateString = sharedpreferences.getString(Helper.LAST_TRANSLATION_TIME, null);
|
||||
if (dateString != null) {
|
||||
Date dateCompare = Helper.stringToDate(TootActivity.this, dateString);
|
||||
Date date = new Date();
|
||||
if (date.before(dateCompare)) {
|
||||
Toasty.info(TootActivity.this, getString(R.string.please_wait), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
picker.setListener((name, locale, flagDrawableResID) -> {
|
||||
picker.dismiss();
|
||||
AlertDialog.Builder transAlert = new AlertDialog.Builder(TootActivity.this, style);
|
||||
transAlert.setTitle(R.string.translate_toot);
|
||||
|
||||
View popup_trans = getLayoutInflater().inflate(R.layout.popup_translate, new LinearLayout(TootActivity.this), false);
|
||||
transAlert.setView(popup_trans);
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.LAST_TRANSLATION_TIME, Helper.dateToString(new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(Helper.SECONDES_BETWEEN_TRANSLATE))));
|
||||
editor.apply();
|
||||
TextView yandex_translate = popup_trans.findViewById(R.id.yandex_translate);
|
||||
yandex_translate.setOnClickListener(v -> {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://translate.yandex.com/"));
|
||||
startActivity(browserIntent);
|
||||
});
|
||||
MyTransL myTransL = MyTransL.getInstance(MyTransL.translatorEngine.YANDEX);
|
||||
myTransL.setYandexAPIKey(Helper.YANDEX_KEY);
|
||||
myTransL.setObfuscation(true);
|
||||
myTransL.setTimeout(60);
|
||||
if (toot_cw_content.getText().toString().length() > 0)
|
||||
myTransL.translate(toot_cw_content.getText().toString(), locale, new com.github.stom79.mytransl.client.Results() {
|
||||
@Override
|
||||
public void onSuccess(Translate translate) {
|
||||
try {
|
||||
if (translate.getTranslatedContent() == null)
|
||||
return;
|
||||
ProgressBar trans_progress_cw = popup_trans.findViewById(R.id.trans_progress_cw);
|
||||
ProgressBar trans_progress_toot = popup_trans.findViewById(R.id.trans_progress_toot);
|
||||
if (trans_progress_cw != null)
|
||||
trans_progress_cw.setVisibility(View.GONE);
|
||||
LinearLayout trans_container = popup_trans.findViewById(R.id.trans_container);
|
||||
if (trans_container != null) {
|
||||
TextView cw_trans = popup_trans.findViewById(R.id.cw_trans);
|
||||
if (cw_trans != null) {
|
||||
cw_trans.setVisibility(View.VISIBLE);
|
||||
cw_trans.setText(translate.getTranslatedContent());
|
||||
}
|
||||
} else {
|
||||
Toasty.error(TootActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if (trans_progress_cw != null && trans_progress_toot != null && trans_progress_cw.getVisibility() == View.GONE && trans_progress_toot.getVisibility() == View.GONE)
|
||||
if (dialogTrans.getButton(DialogInterface.BUTTON_NEGATIVE) != null)
|
||||
dialogTrans.getButton(DialogInterface.BUTTON_NEGATIVE).setEnabled(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Toasty.error(TootActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(HttpsConnectionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
else {
|
||||
ProgressBar trans_progress_cw = popup_trans.findViewById(R.id.trans_progress_cw);
|
||||
trans_progress_cw.setVisibility(View.GONE);
|
||||
}
|
||||
if (toot_content.getText().toString().length() > 0)
|
||||
myTransL.translate(toot_content.getText().toString(), locale, new com.github.stom79.mytransl.client.Results() {
|
||||
@Override
|
||||
public void onSuccess(Translate translate) {
|
||||
try {
|
||||
if (translate.getTranslatedContent() == null)
|
||||
return;
|
||||
ProgressBar trans_progress_cw = popup_trans.findViewById(R.id.trans_progress_cw);
|
||||
ProgressBar trans_progress_toot = popup_trans.findViewById(R.id.trans_progress_toot);
|
||||
if (trans_progress_toot != null)
|
||||
trans_progress_toot.setVisibility(View.GONE);
|
||||
LinearLayout trans_container = popup_trans.findViewById(R.id.trans_container);
|
||||
if (trans_container != null) {
|
||||
TextView toot_trans = popup_trans.findViewById(R.id.toot_trans);
|
||||
if (toot_trans != null) {
|
||||
toot_trans.setVisibility(View.VISIBLE);
|
||||
toot_trans.setText(translate.getTranslatedContent());
|
||||
}
|
||||
} else {
|
||||
Toasty.error(TootActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if (trans_progress_cw != null && trans_progress_toot != null && trans_progress_cw.getVisibility() == View.GONE && trans_progress_toot.getVisibility() == View.GONE)
|
||||
if (dialogTrans.getButton(DialogInterface.BUTTON_NEGATIVE) != null)
|
||||
dialogTrans.getButton(DialogInterface.BUTTON_NEGATIVE).setEnabled(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Toasty.error(TootActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(HttpsConnectionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
transAlert.setPositiveButton(R.string.close, (dialog, whichButton) -> dialog.dismiss());
|
||||
transAlert.setNegativeButton(R.string.validate, (dialog, whichButton) -> {
|
||||
TextView toot_trans = popup_trans.findViewById(R.id.toot_trans);
|
||||
TextView cw_trans = popup_trans.findViewById(R.id.cw_trans);
|
||||
if (toot_trans != null) {
|
||||
toot_content.setText(toot_trans.getText().toString());
|
||||
toot_content.setSelection(toot_content.getText().length());
|
||||
}
|
||||
if (cw_trans != null)
|
||||
toot_cw_content.setText(cw_trans.getText().toString());
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialogTrans = transAlert.create();
|
||||
transAlert.show();
|
||||
|
||||
dialogTrans.setOnShowListener(dialog -> {
|
||||
Button negativeButton = ((AlertDialog) dialog)
|
||||
.getButton(AlertDialog.BUTTON_NEGATIVE);
|
||||
if (negativeButton != null)
|
||||
negativeButton.setEnabled(false);
|
||||
});
|
||||
|
||||
});
|
||||
picker.show(getSupportFragmentManager(), "COUNTRY_PICKER");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void launchPhotoEditor(Uri uri) {
|
||||
Intent intent = new Intent(TootActivity.this, PhotoEditorActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
intent.putExtra("imageUri", uri.toString());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void displayEmojiPopup() {
|
||||
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(drawer_layout).build(toot_content);
|
||||
|
||||
toot_emoji.setOnClickListener(v -> {
|
||||
emojiPopup.toggle(); // Toggles visibility of the Popup.
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package app.fedilab.android.drawers;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.android.activities.OwnerNotificationChartsActivity;
|
||||
import app.fedilab.android.client.Entities.Notification;
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class NotificationsListAdapter extends BaseNotificationsListAdapter {
|
||||
|
||||
public NotificationsListAdapter(boolean isOnWifi, int behaviorWithAttachments, List<Notification> notifications) {
|
||||
super(isOnWifi, behaviorWithAttachments, notifications);
|
||||
}
|
||||
|
||||
public void notificationStatusChart(Status status) {
|
||||
Intent intent = new Intent(context, OwnerNotificationChartsActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("status_id", status.getReblog() != null ? status.getReblog().getId() : status.getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package app.fedilab.android.drawers;
|
||||
/* Copyright 2020 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.os.Bundle;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.vanniktech.emoji.EmojiManager;
|
||||
import com.vanniktech.emoji.EmojiPopup;
|
||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
||||
|
||||
import app.fedilab.android.activities.OwnerNotificationChartsActivity;
|
||||
import app.fedilab.android.asynctasks.PostActionAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
||||
import app.fedilab.android.client.API;
|
||||
import app.fedilab.android.client.Entities.Reaction;
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||
|
||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||
|
||||
public class StatusListAdapter extends BaseStatusListAdapter {
|
||||
public StatusListAdapter(StatusDrawerParams statusDrawerParams) {
|
||||
super(statusDrawerParams);
|
||||
}
|
||||
|
||||
public void statusAddReactionClick(Status status, ViewHolder holder) {
|
||||
EmojiManager.install(new EmojiOneProvider());
|
||||
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(holder.status_add_reaction).setOnEmojiPopupDismissListener(() -> {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(INPUT_METHOD_SERVICE);
|
||||
assert imm != null;
|
||||
imm.hideSoftInputFromWindow(holder.status_add_reaction.getWindowToken(), 0);
|
||||
}).setOnEmojiClickListener((emoji, imageView) -> {
|
||||
String emojiStr = imageView.getUnicode();
|
||||
boolean alreadyAdded = false;
|
||||
for (Reaction reaction : status.getReactions()) {
|
||||
if (reaction.getName().compareTo(emojiStr) == 0) {
|
||||
alreadyAdded = true;
|
||||
reaction.setCount(reaction.getCount() - 1);
|
||||
if (reaction.getCount() == 0) {
|
||||
status.getReactions().remove(reaction);
|
||||
}
|
||||
notifyStatusChanged(status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!alreadyAdded) {
|
||||
Reaction reaction = new Reaction();
|
||||
reaction.setMe(true);
|
||||
reaction.setCount(1);
|
||||
reaction.setName(emojiStr);
|
||||
status.getReactions().add(0, reaction);
|
||||
notifyStatusChanged(status);
|
||||
}
|
||||
API.StatusAction statusAction;
|
||||
if (type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS) {
|
||||
statusAction = alreadyAdded ? API.StatusAction.REMOVE_REACTION : API.StatusAction.ADD_REACTION;
|
||||
} else {
|
||||
statusAction = alreadyAdded ? API.StatusAction.REMOVE_PLEROMA_REACTION : API.StatusAction.ADD_PLEROMA_REACTION;
|
||||
}
|
||||
new PostActionAsyncTask(context, statusAction, status.getId(), null, emojiStr, StatusListAdapter.this);
|
||||
})
|
||||
.build(holder.fake_edittext);
|
||||
emojiPopup.toggle();
|
||||
}
|
||||
|
||||
protected void notificationCharts(Status status) {
|
||||
Intent intent = new Intent(context, OwnerNotificationChartsActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("status_id", status.getReblog() != null ? status.getReblog().getId() : status.getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package app.fedilab.android.helper;
|
||||
/* Copyright 2020 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 org.conscrypt.Conscrypt;
|
||||
|
||||
import java.security.Security;
|
||||
|
||||
import app.fedilab.android.activities.MainApplication;
|
||||
|
||||
public class Helper extends BaseHelper {
|
||||
public static void installProvider() {
|
||||
|
||||
boolean patch_provider = true;
|
||||
try {
|
||||
Context ctx = MainApplication.getApp();
|
||||
SharedPreferences sharedpreferences = ctx.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
patch_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
if (patch_provider) {
|
||||
try {
|
||||
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class BackupNotificationsSyncJob extends BaseBackupNotificationsSyncJob {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class BackupStatusesSyncJob extends BaseBackupStatusesSyncJob {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class NotificationsSyncJob extends BaseNotificationsSyncJob {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class ScheduledBoostsSyncJob extends BaseScheduledBoostsSyncJob {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class ScheduledTootsSyncJob extends BaseScheduledTootsSyncJob {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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 app.fedilab.android.helper.Helper;
|
||||
|
||||
public class LiveNotificationService extends BaseLiveNotificationService {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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 app.fedilab.android.helper.Helper;
|
||||
|
||||
public class StreamingFederatedTimelineService extends BaseStreamingFederatedTimelineService {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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 app.fedilab.android.helper.Helper;
|
||||
|
||||
public class StreamingHomeTimelineService extends BaseStreamingHomeTimelineService {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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 app.fedilab.android.helper.Helper;
|
||||
|
||||
public class StreamingLocalTimelineService extends BaseStreamingLocalTimelineService {
|
||||
static {
|
||||
Helper.installProvider();
|
||||
}
|
||||
}
|
|
@ -14,6 +14,8 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
package app.fedilab.android.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
public class MainActivity extends BaseMainActivity {
|
||||
|
||||
|
||||
|
@ -21,4 +23,16 @@ public class MainActivity extends BaseMainActivity {
|
|||
protected void rateThisApp() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void launchOwnerStatusesActivity() {
|
||||
Intent myIntent = new Intent(MainActivity.this, OwnerStatusActivity.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void launchOwnerNotificationsActivity() {
|
||||
Intent myIntent = new Intent(MainActivity.this, OwnerNotificationActivity.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-path name="my_images" path="Android/data/fr.gouv.etalab.mastodon/files/Pictures" />
|
||||
<paths>
|
||||
<external-path
|
||||
name="my_images"
|
||||
path="Android/data/fr.gouv.etalab.mastodon/files/Pictures" />
|
||||
|
||||
<cache-path name="*" path="." />
|
||||
<cache-path
|
||||
name="*"
|
||||
path="." />
|
||||
|
||||
</paths>
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2020 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>
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="app.fedilab.android"
|
||||
android:installLocation="auto">
|
||||
|
||||
<application
|
||||
android:name="app.fedilab.android.activities.MainApplication"
|
||||
android:allowBackup="false"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher_lite"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:roundIcon="@mipmap/ic_launcher_lite_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppThemeDark"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:allowBackup,android:icon, android:roundIcon, android:label">
|
||||
|
||||
|
||||
<activity-alias
|
||||
android:name=".activities.MainActivity.Bubbles"
|
||||
android:enabled="true"
|
||||
android:icon="@mipmap/ic_launcher_lite"
|
||||
android:roundIcon="@mipmap/ic_launcher_lite_round"
|
||||
android:targetActivity=".activities.MainActivity">
|
||||
<meta-data
|
||||
android:name="icon"
|
||||
android:value="bubbles" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
</application>
|
||||
</manifest>
|
|
@ -0,0 +1,28 @@
|
|||
package app.fedilab.android.activities;
|
||||
/* Copyright 2020 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;
|
||||
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseActivity extends AllBaseActivity {
|
||||
|
||||
protected void launchOwnerStatusesActivity() {
|
||||
}
|
||||
|
||||
protected void launchOwnerNotificationsActivity() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
|
||||
|
||||
public class BaseFragmentActivity extends MainBaseFragmentActivity {
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class MainActivity extends BaseMainActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void rateThisApp() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void launchOwnerStatusesActivity() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void launchOwnerNotificationsActivity() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class PixelfedComposeActivity extends BasePixelfedComposeActivity {
|
||||
|
||||
@Override
|
||||
protected void launchPhotoEditor(Uri uri) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void displayEmojiPopup() {
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,651 @@
|
|||
/* Copyright 2019 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>. */
|
||||
package app.fedilab.android.activities;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.client.Entities.Account;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import app.fedilab.android.jobs.ApplicationJob;
|
||||
import app.fedilab.android.jobs.NotificationsSyncJob;
|
||||
import app.fedilab.android.services.LiveNotificationDelayedService;
|
||||
import app.fedilab.android.services.LiveNotificationService;
|
||||
import app.fedilab.android.services.StopDelayedNotificationReceiver;
|
||||
import app.fedilab.android.services.StopLiveNotificationReceiver;
|
||||
import app.fedilab.android.sqlite.AccountDAO;
|
||||
import app.fedilab.android.sqlite.Sqlite;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
import static app.fedilab.android.helper.BaseHelper.startStreaming;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 01/07/2019.
|
||||
* Settings activity
|
||||
*/
|
||||
|
||||
public class SettingsActivity extends BaseActivity {
|
||||
|
||||
|
||||
public static boolean needRestart;
|
||||
protected int res;
|
||||
private int style;
|
||||
private int liveNotificationCount;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
switch (theme) {
|
||||
case Helper.THEME_LIGHT:
|
||||
setTheme(R.style.AppTheme);
|
||||
break;
|
||||
case Helper.THEME_BLACK:
|
||||
setTheme(R.style.AppThemeBlack);
|
||||
break;
|
||||
default:
|
||||
setTheme(R.style.AppThemeDark);
|
||||
}
|
||||
needRestart = false;
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
assert inflater != null;
|
||||
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(SettingsActivity.this), false);
|
||||
view.setBackground(new ColorDrawable(ContextCompat.getColor(SettingsActivity.this, R.color.cyanea_primary)));
|
||||
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
|
||||
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||
toolbar_close.setOnClickListener(v -> finish());
|
||||
toolbar_title.setText(R.string.settings);
|
||||
}
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
if (theme == Helper.THEME_DARK) {
|
||||
style = R.style.DialogDark;
|
||||
} else if (theme == Helper.THEME_BLACK) {
|
||||
style = R.style.DialogBlack;
|
||||
} else {
|
||||
style = R.style.Dialog;
|
||||
}
|
||||
|
||||
|
||||
boolean display_content_after_fetch_more = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONTENT_AFTER_FM, true);
|
||||
final SwitchCompat set_display_content_after_fetch_more = findViewById(R.id.set_display_content_after_fetch_more);
|
||||
set_display_content_after_fetch_more.setChecked(display_content_after_fetch_more);
|
||||
set_display_content_after_fetch_more.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_DISPLAY_CONTENT_AFTER_FM, set_display_content_after_fetch_more.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
boolean notif_validation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, false);
|
||||
final SwitchCompat set_share_validation = findViewById(R.id.set_share_validation);
|
||||
set_share_validation.setChecked(notif_validation);
|
||||
|
||||
set_share_validation.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_NOTIF_VALIDATION, set_share_validation.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
boolean notif_validation_fav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
|
||||
final SwitchCompat set_share_validation_fav = findViewById(R.id.set_share_validation_fav);
|
||||
set_share_validation_fav.setChecked(notif_validation_fav);
|
||||
|
||||
set_share_validation_fav.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_NOTIF_VALIDATION_FAV, set_share_validation_fav.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
EditText set_invidious_host = findViewById(R.id.set_invidious_host);
|
||||
String invidiousHost = sharedpreferences.getString(Helper.SET_INVIDIOUS_HOST, null);
|
||||
if (invidiousHost != null) {
|
||||
set_invidious_host.setText(invidiousHost);
|
||||
}
|
||||
set_invidious_host.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
if (s.toString().trim().length() > 0) {
|
||||
editor.putString(Helper.SET_INVIDIOUS_HOST, s.toString().toLowerCase().trim());
|
||||
} else {
|
||||
editor.putString(Helper.SET_INVIDIOUS_HOST, null);
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
EditText set_nitter_host = findViewById(R.id.set_nitter_host);
|
||||
String nitterHost = sharedpreferences.getString(Helper.SET_NITTER_HOST, null);
|
||||
if (nitterHost != null) {
|
||||
set_nitter_host.setText(nitterHost);
|
||||
}
|
||||
set_nitter_host.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
if (s.toString().trim().length() > 0) {
|
||||
editor.putString(Helper.SET_NITTER_HOST, s.toString().toLowerCase().trim());
|
||||
} else {
|
||||
editor.putString(Helper.SET_NITTER_HOST, null);
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TextView set_bibliogram_host = findViewById(R.id.set_bibliogram_host);
|
||||
|
||||
String bibliogramHost = sharedpreferences.getString(Helper.SET_BIBLIOGRAM_HOST, null);
|
||||
if (bibliogramHost != null) {
|
||||
set_bibliogram_host.setText(bibliogramHost);
|
||||
}
|
||||
set_bibliogram_host.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
if (s.toString().trim().length() > 0) {
|
||||
editor.putString(Helper.SET_BIBLIOGRAM_HOST, s.toString().toLowerCase().trim());
|
||||
} else {
|
||||
editor.putString(Helper.SET_BIBLIOGRAM_HOST, null);
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
boolean expand_cw = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false);
|
||||
final SwitchCompat set_expand_cw = findViewById(R.id.set_expand_cw);
|
||||
set_expand_cw.setChecked(expand_cw);
|
||||
|
||||
set_expand_cw.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_EXPAND_CW, set_expand_cw.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
boolean expand_media = sharedpreferences.getBoolean(Helper.SET_EXPAND_MEDIA, false);
|
||||
final SwitchCompat set_expand_media = findViewById(R.id.set_expand_image);
|
||||
set_expand_media.setChecked(expand_media);
|
||||
|
||||
set_expand_media.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_EXPAND_MEDIA, set_expand_media.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
|
||||
int truncate_toots_size = sharedpreferences.getInt(Helper.SET_TRUNCATE_TOOTS_SIZE, 0);
|
||||
SeekBar set_truncate_size = findViewById(R.id.set_truncate_size);
|
||||
set_truncate_size.setMax(20);
|
||||
set_truncate_size.setProgress(truncate_toots_size);
|
||||
TextView set_truncate_toots = findViewById(R.id.set_truncate_toots);
|
||||
set_truncate_toots.setText(String.valueOf(truncate_toots_size));
|
||||
set_truncate_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
set_truncate_toots.setText(String.valueOf(progress));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_TRUNCATE_TOOTS_SIZE, progress);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
boolean quick_reply = sharedpreferences.getBoolean(Helper.SET_QUICK_REPLY, true);
|
||||
final SwitchCompat set_quick_reply = findViewById(R.id.set_quick_reply);
|
||||
set_quick_reply.setChecked(quick_reply);
|
||||
|
||||
set_quick_reply.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_QUICK_REPLY, set_quick_reply.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
boolean fit_preview = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false);
|
||||
final SwitchCompat set_fit_preview = findViewById(R.id.set_fit_preview);
|
||||
set_fit_preview.setChecked(fit_preview);
|
||||
|
||||
set_fit_preview.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_FULL_PREVIEW, set_fit_preview.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
|
||||
boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false);
|
||||
final SwitchCompat set_disable_gif = findViewById(R.id.set_disable_gif);
|
||||
set_disable_gif.setChecked(disableGif);
|
||||
set_disable_gif.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_DISABLE_GIF, set_disable_gif.isChecked());
|
||||
editor.apply();
|
||||
recreate();
|
||||
});
|
||||
|
||||
|
||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
||||
final SwitchCompat set_disable_animated_emoji = findViewById(R.id.set_disable_animated_emoji);
|
||||
set_disable_animated_emoji.setChecked(disableAnimatedEmoji);
|
||||
set_disable_animated_emoji.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, set_disable_animated_emoji.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
boolean display_card = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CARD, false);
|
||||
final SwitchCompat set_display_card = findViewById(R.id.set_display_card);
|
||||
set_display_card.setChecked(display_card);
|
||||
set_display_card.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_DISPLAY_CARD, set_display_card.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
||||
final SwitchCompat switchCompatNotify = findViewById(R.id.set_notify);
|
||||
switchCompatNotify.setChecked(notify);
|
||||
|
||||
switchCompatNotify.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
// Save the state here
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_NOTIFY, isChecked);
|
||||
editor.apply();
|
||||
if (isChecked) {
|
||||
startStreaming(SettingsActivity.this);
|
||||
} else {
|
||||
sendBroadcast(new Intent(getApplicationContext(), StopLiveNotificationReceiver.class));
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
NotificationManager notif = ((NotificationManager) getSystemService(NOTIFICATION_SERVICE));
|
||||
if (notif != null) {
|
||||
notif.deleteNotificationChannel(LiveNotificationDelayedService.CHANNEL_ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext()));
|
||||
final Account account = new AccountDAO(getApplicationContext(), db).getUniqAccount(userId, instance);
|
||||
boolean allow_live_notifications = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + userId + instance, true);
|
||||
TextView set_allow_live_notifications_title = findViewById(R.id.set_allow_live_notifications_title);
|
||||
set_allow_live_notifications_title.setText(getString(R.string.set_allow_live_notifications, account.getAcct() + "@" + account.getInstance()));
|
||||
final SwitchCompat set_allow_live_notifications = findViewById(R.id.set_allow_live_notifications);
|
||||
set_allow_live_notifications.setChecked(allow_live_notifications);
|
||||
set_allow_live_notifications.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_ALLOW_STREAM + userId + instance, set_allow_live_notifications.isChecked());
|
||||
editor.apply();
|
||||
if (set_allow_live_notifications.isChecked()) {
|
||||
LiveNotificationDelayedService.totalAccount++;
|
||||
} else {
|
||||
LiveNotificationDelayedService.totalAccount--;
|
||||
}
|
||||
if (set_allow_live_notifications.isChecked()) {
|
||||
LiveNotificationDelayedService.totalAccount++;
|
||||
} else {
|
||||
LiveNotificationDelayedService.totalAccount--;
|
||||
}
|
||||
startStreaming(SettingsActivity.this);
|
||||
|
||||
});
|
||||
final ImageButton set_allow_live_notifications_others = findViewById(R.id.set_allow_live_notifications_others);
|
||||
set_allow_live_notifications_others.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(SettingsActivity.this, LiveNotificationSettingsAccountsActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
//Live notification mode
|
||||
final Spinner set_live_type = findViewById(R.id.set_live_type);
|
||||
String[] labels = {getString(R.string.live_notif), getString(R.string.live_delayed), getString(R.string.no_live_notif)};
|
||||
ArrayAdapter<String> adapterLive = new ArrayAdapter<>(SettingsActivity.this,
|
||||
android.R.layout.simple_spinner_dropdown_item, labels);
|
||||
|
||||
LinearLayout live_notif_per_account = findViewById(R.id.live_notif_per_account);
|
||||
set_live_type.setAdapter(adapterLive);
|
||||
if (Helper.liveNotifType(SettingsActivity.this) == Helper.NOTIF_NONE) {
|
||||
live_notif_per_account.setVisibility(View.GONE);
|
||||
}
|
||||
TextView set_live_type_indication = findViewById(R.id.set_live_type_indication);
|
||||
switch (Helper.liveNotifType(SettingsActivity.this)) {
|
||||
case Helper.NOTIF_LIVE:
|
||||
set_live_type_indication.setText(R.string.live_notif_indication);
|
||||
break;
|
||||
case Helper.NOTIF_DELAYED:
|
||||
set_live_type_indication.setText(R.string.set_live_type_indication);
|
||||
break;
|
||||
case Helper.NOTIF_NONE:
|
||||
set_live_type_indication.setText(R.string.no_live_indication);
|
||||
break;
|
||||
}
|
||||
set_live_type.setSelection(Helper.liveNotifType(SettingsActivity.this));
|
||||
liveNotificationCount = 0;
|
||||
set_live_type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (liveNotificationCount > 0) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
|
||||
sendBroadcast(new Intent(SettingsActivity.this, StopLiveNotificationReceiver.class));
|
||||
sendBroadcast(new Intent(SettingsActivity.this, StopDelayedNotificationReceiver.class));
|
||||
ApplicationJob.cancelAllJob(NotificationsSyncJob.NOTIFICATION_REFRESH);
|
||||
switch (position) {
|
||||
case Helper.NOTIF_LIVE:
|
||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
|
||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false);
|
||||
live_notif_per_account.setVisibility(View.VISIBLE);
|
||||
editor.commit();
|
||||
set_live_type_indication.setText(R.string.live_notif_indication);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(() -> {
|
||||
startStreaming(SettingsActivity.this);
|
||||
}, 1000);
|
||||
break;
|
||||
case Helper.NOTIF_DELAYED:
|
||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, true);
|
||||
live_notif_per_account.setVisibility(View.VISIBLE);
|
||||
set_live_type_indication.setText(R.string.set_live_type_indication);
|
||||
editor.commit();
|
||||
handler = new Handler();
|
||||
handler.postDelayed(() -> {
|
||||
startStreaming(SettingsActivity.this);
|
||||
}, 1000);
|
||||
break;
|
||||
case Helper.NOTIF_NONE:
|
||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false);
|
||||
editor.commit();
|
||||
set_live_type_indication.setText(R.string.no_live_indication);
|
||||
live_notif_per_account.setVisibility(View.GONE);
|
||||
NotificationsSyncJob.schedule(false);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
liveNotificationCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
boolean clear_cache_exit = sharedpreferences.getBoolean(Helper.SET_CLEAR_CACHE_EXIT, false);
|
||||
final SwitchCompat set_clear_cache_exit = findViewById(R.id.set_clear_cache_exit);
|
||||
set_clear_cache_exit.setChecked(clear_cache_exit);
|
||||
set_clear_cache_exit.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_CLEAR_CACHE_EXIT, set_clear_cache_exit.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
|
||||
// NSFW Timeout
|
||||
SeekBar nsfwTimeoutSeekBar = findViewById(R.id.set_nsfw_timeout);
|
||||
final TextView set_nsfw_timeout_value = findViewById(R.id.set_nsfw_timeout_value);
|
||||
|
||||
nsfwTimeoutSeekBar.setMax(30);
|
||||
|
||||
int nsfwTimeout = sharedpreferences.getInt(Helper.SET_NSFW_TIMEOUT, 5);
|
||||
|
||||
nsfwTimeoutSeekBar.setProgress(nsfwTimeout);
|
||||
set_nsfw_timeout_value.setText(String.valueOf(nsfwTimeout));
|
||||
|
||||
nsfwTimeoutSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
|
||||
set_nsfw_timeout_value.setText(String.valueOf(progress));
|
||||
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_NSFW_TIMEOUT, progress);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
final ImageView set_toot_visibility = findViewById(R.id.set_toot_visibility);
|
||||
if (theme == Helper.THEME_DARK) {
|
||||
Helper.changeDrawableColor(getApplicationContext(), set_toot_visibility, R.color.dark_text);
|
||||
} else {
|
||||
Helper.changeDrawableColor(getApplicationContext(), set_toot_visibility, R.color.white);
|
||||
}
|
||||
//Only displayed for non locked accounts
|
||||
String defaultVisibility = account.isLocked() ? "private" : "public";
|
||||
String tootVisibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
|
||||
switch (tootVisibility) {
|
||||
case "public":
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_public);
|
||||
break;
|
||||
case "unlisted":
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_lock_open);
|
||||
break;
|
||||
case "private":
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_lock_outline);
|
||||
break;
|
||||
case "direct":
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_mail_outline);
|
||||
break;
|
||||
}
|
||||
|
||||
set_toot_visibility.setOnClickListener(v -> {
|
||||
final SharedPreferences sharedpreferences1 = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
if (theme == Helper.THEME_DARK) {
|
||||
style = R.style.DialogDark;
|
||||
} else if (theme == Helper.THEME_BLACK) {
|
||||
style = R.style.DialogBlack;
|
||||
} else {
|
||||
style = R.style.Dialog;
|
||||
}
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(SettingsActivity.this, style);
|
||||
dialog.setTitle(R.string.toot_visibility_tilte);
|
||||
final String[] stringArray = getResources().getStringArray(R.array.toot_visibility);
|
||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, stringArray);
|
||||
dialog.setNegativeButton(R.string.cancel, (dialog12, position) -> dialog12.dismiss());
|
||||
|
||||
dialog.setAdapter(arrayAdapter, (dialog1, position) -> {
|
||||
String visibility = "public";
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
visibility = "public";
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_public);
|
||||
break;
|
||||
case 1:
|
||||
visibility = "unlisted";
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_lock_open);
|
||||
break;
|
||||
case 2:
|
||||
visibility = "private";
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_lock_outline);
|
||||
break;
|
||||
case 3:
|
||||
visibility = "direct";
|
||||
set_toot_visibility.setImageResource(R.drawable.ic_mail_outline);
|
||||
break;
|
||||
}
|
||||
SharedPreferences.Editor editor = sharedpreferences1.edit();
|
||||
editor.putString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), visibility);
|
||||
editor.apply();
|
||||
Toasty.info(getApplicationContext(), getString(R.string.toast_visibility_changed, "@" + account.getAcct() + "@" + account.getInstance()), Toast.LENGTH_SHORT).show();
|
||||
|
||||
dialog1.dismiss();
|
||||
});
|
||||
dialog.show();
|
||||
});
|
||||
|
||||
int split_size_val = sharedpreferences.getInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE + userId + instance, Helper.SPLIT_TOOT_SIZE);
|
||||
|
||||
LinearLayout set_split_container = findViewById(R.id.set_split_container);
|
||||
//split size
|
||||
SeekBar split_size = findViewById(R.id.set_split_size);
|
||||
final EditText split_text = findViewById(R.id.set_split_text);
|
||||
|
||||
split_size.setProgress(0);
|
||||
split_text.setText(String.valueOf(split_size_val));
|
||||
split_text.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
if (charSequence != null && charSequence.length() > 0) {
|
||||
int newValue = Integer.parseInt(charSequence.toString());
|
||||
if (newValue > 0) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE + userId + instance, newValue);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
split_size.setMax(5);
|
||||
split_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
int newProgress = (progress + 1) * Helper.SPLIT_TOOT_SIZE;
|
||||
split_text.setText(String.valueOf(newProgress));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE + userId + instance, newProgress);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
boolean split_toot = sharedpreferences.getBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS + userId + instance, false);
|
||||
if (!split_toot) {
|
||||
set_split_container.setVisibility(View.GONE);
|
||||
}
|
||||
final SwitchCompat set_split_toot = findViewById(R.id.set_automatically_split_toot);
|
||||
set_split_toot.setChecked(split_toot);
|
||||
set_split_toot.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS + userId + instance, set_split_toot.isChecked());
|
||||
editor.apply();
|
||||
if (set_split_toot.isChecked()) {
|
||||
set_split_container.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
set_split_container.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class TootActivity extends BaseTootActivity {
|
||||
@Override
|
||||
protected boolean actionTranslateClick() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void launchPhotoEditor(Uri uri) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void displayEmojiPopup() {
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package app.fedilab.android.drawers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.android.client.Entities.Notification;
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class NotificationsListAdapter extends BaseNotificationsListAdapter {
|
||||
|
||||
public NotificationsListAdapter(boolean isOnWifi, int behaviorWithAttachments, List<Notification> notifications) {
|
||||
super(isOnWifi, behaviorWithAttachments, notifications);
|
||||
}
|
||||
|
||||
public void notificationStatusChart(Status status) {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package app.fedilab.android.drawers;
|
||||
/* Copyright 2020 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.Activity;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||
|
||||
public class StatusListAdapter extends BaseStatusListAdapter {
|
||||
public StatusListAdapter(StatusDrawerParams statusDrawerParams) {
|
||||
super(statusDrawerParams);
|
||||
}
|
||||
|
||||
protected void statusAddReactionClick(Status status, ViewHolder holder) {
|
||||
((Activity) context).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
|
||||
}
|
||||
|
||||
protected void notificationCharts(Status status) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package app.fedilab.android.helper;
|
||||
|
||||
/* Copyright 2020 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.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
public class CustomTextView extends AppCompatTextView {
|
||||
|
||||
|
||||
public CustomTextView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CustomTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CustomTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.helper;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class Helper extends BaseHelper {
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package app.fedilab.android.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
import androidx.core.view.inputmethod.InputConnectionCompat;
|
||||
import androidx.core.view.inputmethod.InputContentInfoCompat;
|
||||
|
||||
|
||||
public class MastalabAutoCompleteTextView extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
|
||||
|
||||
|
||||
private String[] imgTypeString;
|
||||
private KeyBoardInputCallbackListener keyBoardInputCallbackListener;
|
||||
final InputConnectionCompat.OnCommitContentListener callback =
|
||||
new InputConnectionCompat.OnCommitContentListener() {
|
||||
@Override
|
||||
public boolean onCommitContent(InputContentInfoCompat inputContentInfo,
|
||||
int flags, Bundle opts) {
|
||||
|
||||
// read and display inputContentInfo asynchronously
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && (flags &
|
||||
InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) {
|
||||
try {
|
||||
inputContentInfo.requestPermission();
|
||||
} catch (Exception e) {
|
||||
return false; // return false if failed
|
||||
}
|
||||
}
|
||||
boolean supported = false;
|
||||
for (final String mimeType : imgTypeString) {
|
||||
if (inputContentInfo.getDescription().hasMimeType(mimeType)) {
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!supported) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyBoardInputCallbackListener != null) {
|
||||
keyBoardInputCallbackListener.onCommitContent(inputContentInfo, flags, opts);
|
||||
}
|
||||
return true; // return true if succeeded
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public MastalabAutoCompleteTextView(Context context) {
|
||||
super(context);
|
||||
initView();
|
||||
}
|
||||
|
||||
public MastalabAutoCompleteTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setText(getText());
|
||||
initView();
|
||||
}
|
||||
|
||||
public MastalabAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
final InputConnection ic = super.onCreateInputConnection(outAttrs);
|
||||
EditorInfoCompat.setContentMimeTypes(outAttrs,
|
||||
imgTypeString);
|
||||
return InputConnectionCompat.createWrapper(ic, outAttrs, callback);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
imgTypeString = new String[]{"image/png",
|
||||
"image/gif",
|
||||
"image/jpeg",
|
||||
"image/webp"};
|
||||
}
|
||||
|
||||
public void setKeyBoardInputCallbackListener(KeyBoardInputCallbackListener keyBoardInputCallbackListener) {
|
||||
this.keyBoardInputCallbackListener = keyBoardInputCallbackListener;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String[] getImgTypeString() {
|
||||
return imgTypeString;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setImgTypeString(String[] imgTypeString) {
|
||||
this.imgTypeString = imgTypeString;
|
||||
}
|
||||
|
||||
|
||||
public interface KeyBoardInputCallbackListener {
|
||||
void onCommitContent(InputContentInfoCompat inputContentInfo,
|
||||
int flags, Bundle opts);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class BackupNotificationsSyncJob extends BaseBackupNotificationsSyncJob {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class BackupStatusesSyncJob extends BaseBackupStatusesSyncJob {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class NotificationsSyncJob extends BaseNotificationsSyncJob {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class ScheduledBoostsSyncJob extends BaseScheduledBoostsSyncJob {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.jobs;
|
||||
|
||||
/* Copyright 2020 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>. */
|
||||
public class ScheduledTootsSyncJob extends BaseScheduledTootsSyncJob {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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>. */
|
||||
|
||||
public class LiveNotificationService extends BaseLiveNotificationService {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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>. */
|
||||
|
||||
public class StreamingFederatedTimelineService extends BaseStreamingFederatedTimelineService {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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>. */
|
||||
|
||||
public class StreamingHomeTimelineService extends BaseStreamingHomeTimelineService {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package app.fedilab.android.services;
|
||||
/* Copyright 2020 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>. */
|
||||
|
||||
public class StreamingLocalTimelineService extends BaseStreamingLocalTimelineService {
|
||||
}
|
|
@ -0,0 +1,619 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2020 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>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/activity_vertical_margin"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- EXPAND CW -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/expand_cw"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_expand_cw"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- EXPAND Images -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/expand_image"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_expand_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_share_validation"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_share_validation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_share_validation_fav"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_share_validation_fav"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- DISPLAY QUICK REPLY -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_quick_reply"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_quick_reply_indication"
|
||||
android:textColor="@color/mastodonC2"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_quick_reply"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- FIT PREVIEWS -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_fit_preview"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_fit_preview_indication"
|
||||
android:textColor="@color/mastodonC2"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_fit_preview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- GIF AVATARS -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_disable_gif"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_disable_gif"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_disable_animated_emoji"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_disable_animated_emoji"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_display_card"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_display_card"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_clear_cache_exit"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_clear_cache_exit_indication"
|
||||
android:textColor="@color/mastodonC2"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_clear_cache_exit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_display_content_after_fetch_more"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_display_content_after_fetch_more_indication"
|
||||
android:textColor="@color/mastodonC2"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_display_content_after_fetch_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/set_notify"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_notify"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- Choose stream -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/set_live_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/set_live_type_indication"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:textColor="@color/mastodonC2" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/live_notif_per_account"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/set_allow_live_notifications_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_allow_live_notifications"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_allow_live_notifications_indication"
|
||||
android:textColor="@color/mastodonC2"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_allow_live_notifications"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/set_allow_live_notifications_others"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="end"
|
||||
android:contentDescription="@string/live_notif"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/ic_account_circle_acct" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- TRUNCATE LONG TOOTS -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/set_truncate_toot"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/set_truncate_toots"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/set_truncate_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- NSFW Timeout -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/set_nsfw_timeout"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/set_nsfw_timeout_value"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/set_nsfw_timeout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_automatically_split_toot"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/set_automatically_split_toot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/set_split_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/set_split_text"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:inputType="number"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/set_split_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/toot_visibility_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toots_visibility_tilte"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/set_toot_visibility"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@string/toot_visibility_tilte"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/ic_public" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:text="@string/set_invidious"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/set_invidious_host"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:hint="@string/set_invidious_host"
|
||||
android:inputType="textWebEditText" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_option_margin"
|
||||
android:text="@string/set_nitter"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/set_nitter_host"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:hint="@string/set_nitter_host"
|
||||
android:inputType="textWebEditText" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_bibliogram"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/set_bibliogram_host"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
||||
android:hint="@string/set_bibliogram_host"
|
||||
android:inputType="textWebEditText" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path
|
||||
name="my_images"
|
||||
path="Android/data/app.fedilab.lite/files/Pictures" />
|
||||
|
||||
<cache-path
|
||||
name="*"
|
||||
path="." />
|
||||
|
||||
</paths>
|
|
@ -111,11 +111,12 @@
|
|||
<service
|
||||
android:name="app.fedilab.android.services.StreamingLocalTimelineService"
|
||||
android:exported="false" />
|
||||
|
||||
<service
|
||||
android:name="app.fedilab.android.services.DownloadTrackingDBScriptsService"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.MainActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
|
@ -164,20 +165,7 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity-alias
|
||||
android:name=".activities.MainActivity.Bubbles"
|
||||
android:enabled="true"
|
||||
android:icon="@mipmap/ic_launcher_bubbles"
|
||||
android:roundIcon="@mipmap/ic_launcher_bubbles_round"
|
||||
android:targetActivity=".activities.MainActivity">
|
||||
<meta-data
|
||||
android:name="icon"
|
||||
android:value="bubbles" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
|
||||
|
||||
<activity-alias
|
||||
android:name=".activities.MainActivity.Fediverse"
|
||||
|
@ -258,17 +246,14 @@
|
|||
<activity
|
||||
android:name="app.fedilab.android.activities.MastodonRegisterActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PeertubeRegisterActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.MastodonShareRegisterActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
@ -285,7 +270,6 @@
|
|||
<activity
|
||||
android:name="app.fedilab.android.activities.LoginActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
@ -301,158 +285,105 @@
|
|||
<activity
|
||||
android:name="app.fedilab.android.activities.ShowAccountActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.TootInfoActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.HashTagActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.WebviewConnectActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
/>
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PeertubeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
/>
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PlaylistsActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
|
||||
android:theme="@style/AppThemeDark_NoActionBar" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PhotoEditorActivity"
|
||||
android:name=".activities.WebviewActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
<activity
|
||||
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
|
||||
android:theme="@style/Base.Theme.AppCompat" />
|
||||
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.WebviewActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
/>
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.SlideMediaActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:noHistory="true"
|
||||
android:theme="@style/TransparentDark" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.SearchResultActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.SearchResultTabActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.ListActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.WhoToFollowActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.ShowConversationActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerStatusActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerNotificationChartsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerChartsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.OwnerNotificationActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.AboutActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.BookmarkActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.SettingsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.AdminActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.AccountReportActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.ReorderTimelinesActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PartnerShipActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.InstanceActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PrivacyActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.TootActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:fitsSystemWindows="true"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/AppThemeDark"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
|
@ -460,19 +391,16 @@
|
|||
android:name="app.fedilab.android.activities.PixelfedComposeActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:fitsSystemWindows="true"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/AppThemeDark"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.EditProfileActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.CustomSharingActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.InstanceHealthActivity"
|
||||
|
@ -498,28 +426,23 @@
|
|||
<activity
|
||||
android:name="app.fedilab.android.activities.PeertubeUploadActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.LiveNotificationSettingsAccountsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Base.V7.Theme.AppCompat.Dialog"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.MutedInstanceActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.PeertubeEditUploadActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.GroupActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
Added:
|
||||
- Watermarks for pictures (default: disabled)
|
||||
- Blur sensitive media for Pixelfed
|
||||
- Put messages into drafts when replying to a deleted message
|
||||
- Allow to schedule with another account
|
||||
|
||||
Fixed:
|
||||
- Quick replies lose text when doing another action
|
||||
- Fix refresh token (Peertube/Pixelfed)
|
|
@ -0,0 +1,9 @@
|
|||
Added:
|
||||
- Watermarks for pictures (default: disabled)
|
||||
- Blur sensitive media for Pixelfed
|
||||
- Put messages into drafts when replying to a deleted message
|
||||
- Allow to schedule with another account
|
||||
|
||||
Fixed:
|
||||
- Quick replies lose text when doing another action
|
||||
- Fix refresh token (Peertube/Pixelfed)
|
|
@ -0,0 +1,11 @@
|
|||
Added:
|
||||
- Offset for replies in threads with a new decoration to make them easier to read
|
||||
- Fix translation issue (use https://translate.fedilab.app)
|
||||
- Watermarks for pictures (default: disabled)
|
||||
- Blur sensitive media for Pixelfed
|
||||
- Put messages into drafts when replying to a deleted message
|
||||
- Allow to schedule with another account
|
||||
|
||||
Fixed:
|
||||
- Quick replies lose text when doing another action
|
||||
- Fix refresh token (Peertube/Pixelfed)
|
After Width: | Height: | Size: 18 KiB |
|
@ -20,7 +20,6 @@ import android.content.pm.PackageInfo;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.UnderlineSpan;
|
||||
|
@ -64,9 +63,9 @@ import es.dmoral.toasty.Toasty;
|
|||
|
||||
public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccountInterface, OnRetrieveRelationshipInterface {
|
||||
|
||||
private List<Account> developers = new ArrayList<>();
|
||||
private List<Account> contributors = new ArrayList<>();
|
||||
private List<Account> uxuidesigners = new ArrayList<>();
|
||||
private final List<Account> developers = new ArrayList<>();
|
||||
private final List<Account> contributors = new ArrayList<>();
|
||||
private final List<Account> uxuidesigners = new ArrayList<>();
|
||||
|
||||
private AccountSearchDevAdapter accountSearchWebAdapterDeveloper;
|
||||
private AccountSearchDevAdapter accountSearchWebAdapterContributors;
|
||||
|
@ -208,17 +207,17 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
|
|||
lv_ux.setAdapter(accountSearchWebAdapterUxUiDesigners);
|
||||
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "fedilab", "toot.fedilab.app", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "mmarif", "mastodon.social", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "PhotonQyv", "mastodon.xyz", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "angrytux", "social.tchncs.de", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "guzzisti", "mastodon.social", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "apps", "toot.fedilab.app", AboutActivity.this);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "mmarif", "mastodon.social", AboutActivity.this);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "PhotonQyv", "mastodon.xyz", AboutActivity.this);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "angrytux", "social.tchncs.de", AboutActivity.this);
|
||||
new RetrieveRemoteDataAsyncTask(AboutActivity.this, "guzzisti", "mastodon.social", AboutActivity.this);
|
||||
} else {
|
||||
SpannableString name = new SpannableString("@fedilab@toot.fedilab.app");
|
||||
SpannableString name = new SpannableString("@apps@toot.fedilab.app");
|
||||
name.setSpan(new UnderlineSpan(), 0, name.length(), 0);
|
||||
txt_developers.setText(name);
|
||||
txt_developers.setVisibility(View.VISIBLE);
|
||||
txt_developers.setOnClickListener(v -> Helper.openBrowser(AboutActivity.this, "https://toot.fedilab.app/@fedilab"));
|
||||
txt_developers.setOnClickListener(v -> Helper.openBrowser(AboutActivity.this, "https://toot.fedilab.app/@apps"));
|
||||
name = new SpannableString("@mmarif@mastodon.social");
|
||||
name.setSpan(new UnderlineSpan(), 0, name.length(), 0);
|
||||
txt_ux.setText(name);
|
||||
|
@ -260,7 +259,7 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
|
|||
account = accounts.get(0);
|
||||
account.setFollowing(true);
|
||||
switch (account.getUsername()) {
|
||||
case "fedilab":
|
||||
case "apps":
|
||||
developers.add(account);
|
||||
accountSearchWebAdapterDeveloper.notifyDataSetChanged();
|
||||
break;
|
||||
|
@ -273,7 +272,7 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
|
|||
accountSearchWebAdapterContributors.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,17 +282,17 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
|
|||
super.onResume();
|
||||
if (developers != null) {
|
||||
for (Account account : developers) {
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this);
|
||||
}
|
||||
}
|
||||
if (contributors != null) {
|
||||
for (Account account : contributors) {
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this);
|
||||
}
|
||||
}
|
||||
if (uxuidesigners != null) {
|
||||
for (Account account : uxuidesigners) {
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRelationshipAsyncTask(AboutActivity.this, account.getId(), AboutActivity.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -139,7 +138,7 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
assign.setVisibility(View.GONE);
|
||||
status.setVisibility(View.GONE);
|
||||
if (account_id != null) {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.GET_ONE_ACCOUNT, account_id, null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.GET_ONE_ACCOUNT, account_id, null, AccountReportActivity.this);
|
||||
return;
|
||||
}
|
||||
if (report != null) {
|
||||
|
@ -157,7 +156,7 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
Group statuses_group = findViewById(R.id.statuses_group);
|
||||
statuses_group.setVisibility(View.VISIBLE);
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.GET_ONE_ACCOUNT, report.getTarget_account().getUsername(), null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.GET_ONE_ACCOUNT, report.getTarget_account().getUsername(), null, AccountReportActivity.this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -227,13 +226,13 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
reject.setOnClickListener(view -> {
|
||||
AdminAction adminAction = new AdminAction();
|
||||
adminAction.setType(REJECT);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, REJECT, account_id, adminAction, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, REJECT, account_id, adminAction, AccountReportActivity.this);
|
||||
});
|
||||
|
||||
allow.setOnClickListener(view -> {
|
||||
AdminAction adminAction = new AdminAction();
|
||||
adminAction.setType(APPROVE);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, APPROVE, account_id, adminAction, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, APPROVE, account_id, adminAction, AccountReportActivity.this);
|
||||
});
|
||||
|
||||
warn.setOnClickListener(view -> {
|
||||
|
@ -241,7 +240,7 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
adminAction.setType(NONE);
|
||||
adminAction.setSend_email_notification(email_user.isChecked());
|
||||
adminAction.setText(comment.getText().toString().trim());
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, NONE, account_id, adminAction, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, NONE, account_id, adminAction, AccountReportActivity.this);
|
||||
});
|
||||
|
||||
|
||||
|
@ -256,9 +255,9 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
adminAction.setType(SILENCE);
|
||||
adminAction.setSend_email_notification(email_user.isChecked());
|
||||
adminAction.setText(comment.getText().toString().trim());
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, SILENCE, account_id, adminAction, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, SILENCE, account_id, adminAction, AccountReportActivity.this);
|
||||
} else {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.UNSILENCE, account_id, null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.UNSILENCE, account_id, null, AccountReportActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -273,9 +272,9 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
adminAction.setType(DISABLE);
|
||||
adminAction.setSend_email_notification(email_user.isChecked());
|
||||
adminAction.setText(comment.getText().toString().trim());
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, DISABLE, account_id, adminAction, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, DISABLE, account_id, adminAction, AccountReportActivity.this);
|
||||
} else {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.ENABLE, account_id, null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.ENABLE, account_id, null, AccountReportActivity.this);
|
||||
}
|
||||
});
|
||||
if (!accountAdmin.isSuspended()) {
|
||||
|
@ -289,9 +288,9 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
adminAction.setType(SUSPEND);
|
||||
adminAction.setSend_email_notification(email_user.isChecked());
|
||||
adminAction.setText(comment.getText().toString().trim());
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, SUSPEND, account_id, adminAction, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, SUSPEND, account_id, adminAction, AccountReportActivity.this);
|
||||
} else {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.UNSUSPEND, account_id, null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.UNSUSPEND, account_id, null, AccountReportActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -423,9 +422,9 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
}
|
||||
assign.setOnClickListener(view -> {
|
||||
if (report.getAssigned_account() == null) {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.ASSIGN_TO_SELF, report.getId(), null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.ASSIGN_TO_SELF, report.getId(), null, AccountReportActivity.this);
|
||||
} else {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.UNASSIGN, report.getId(), null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.UNASSIGN, report.getId(), null, AccountReportActivity.this);
|
||||
}
|
||||
});
|
||||
if (report.isAction_taken()) {
|
||||
|
@ -435,9 +434,9 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
|
|||
}
|
||||
status.setOnClickListener(view -> {
|
||||
if (report.isAction_taken()) {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.REOPEN, report.getId(), null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.REOPEN, report.getId(), null, AccountReportActivity.this);
|
||||
} else {
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.RESOLVE, report.getId(), null, AccountReportActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostAdminActionAsyncTask(AccountReportActivity.this, API.adminAction.RESOLVE, report.getId(), null, AccountReportActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -19,14 +19,11 @@ import androidx.core.content.ContextCompat;
|
|||
import com.franmontiel.localechanger.LocaleChanger;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity;
|
||||
import com.vanniktech.emoji.EmojiManager;
|
||||
import com.vanniktech.emoji.one.EmojiOneProvider;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Timer;
|
||||
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
/**
|
||||
|
@ -35,17 +32,13 @@ import es.dmoral.toasty.Toasty;
|
|||
*/
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseActivity extends CyaneaAppCompatActivity {
|
||||
public class AllBaseActivity extends CyaneaAppCompatActivity {
|
||||
|
||||
|
||||
public static final int READ_WRITE_STORAGE = 52;
|
||||
public static Timer timer;
|
||||
public static boolean canShowActionMode = true;
|
||||
|
||||
static {
|
||||
Helper.installProvider();
|
||||
EmojiManager.install(new EmojiOneProvider());
|
||||
}
|
||||
|
||||
private ProgressDialog mProgressDialog;
|
||||
|
||||
|
@ -140,7 +133,7 @@ public class BaseActivity extends CyaneaAppCompatActivity {
|
|||
if (view != null) {
|
||||
Snackbar.make(view, message, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toasty.info(BaseActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||
Toasty.info(AllBaseActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
|
@ -149,8 +149,7 @@ import app.fedilab.android.interfaces.OnRetrieveRemoteAccountInterface;
|
|||
import app.fedilab.android.interfaces.OnSyncTimelineInterface;
|
||||
import app.fedilab.android.interfaces.OnUpdateAccountInfoInterface;
|
||||
import app.fedilab.android.services.BackupStatusService;
|
||||
import app.fedilab.android.services.LiveNotificationDelayedService;
|
||||
import app.fedilab.android.services.LiveNotificationService;
|
||||
import app.fedilab.android.services.DownloadTrackingDBScriptsService;
|
||||
import app.fedilab.android.sqlite.AccountDAO;
|
||||
import app.fedilab.android.sqlite.Sqlite;
|
||||
import app.fedilab.android.sqlite.TempMuteDAO;
|
||||
|
@ -160,6 +159,7 @@ import es.dmoral.toasty.Toasty;
|
|||
|
||||
import static app.fedilab.android.activities.WebviewActivity.trackingDomains;
|
||||
import static app.fedilab.android.asynctasks.ManageFiltersAsyncTask.action.GET_ALL_FILTER;
|
||||
import static app.fedilab.android.helper.BaseHelper.startStreaming;
|
||||
import static app.fedilab.android.helper.Helper.changeDrawableColor;
|
||||
|
||||
|
||||
|
@ -183,9 +183,9 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
public static iconLauncher mLauncher = iconLauncher.BUBBLES;
|
||||
private static boolean notificationChecked = false;
|
||||
private final int PICK_IMPORT = 5556;
|
||||
private final HashMap<String, String> tagTile = new HashMap<>();
|
||||
private final HashMap<String, Integer> tagItem = new HashMap<>();
|
||||
private FloatingActionButton toot, delete_all, add_new;
|
||||
private HashMap<String, String> tagTile = new HashMap<>();
|
||||
private HashMap<String, Integer> tagItem = new HashMap<>();
|
||||
private TextView toolbarTitle;
|
||||
private SearchView toolbar_search;
|
||||
private View headerLayout;
|
||||
|
@ -312,10 +312,11 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
//This task will allow to instance a static PeertubeInformation class
|
||||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||
try {
|
||||
new RetrievePeertubeInformationAsyncTask(BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrievePeertubeInformationAsyncTask(BaseMainActivity.this);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
//Here, the user is authenticated
|
||||
appBar = findViewById(R.id.appBar);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
|
@ -419,7 +420,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
|
||||
main_app_container = findViewById(R.id.main_app_container);
|
||||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, 0, Helper.canFetchList(BaseMainActivity.this, account), BaseMainActivity.this).execute();
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, 0, Helper.canFetchList(BaseMainActivity.this, account), BaseMainActivity.this);
|
||||
|
||||
} else if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||
TabLayout.Tab pTabsub = tabLayout.newTab();
|
||||
|
@ -638,9 +639,10 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
} else {
|
||||
style = R.style.Dialog;
|
||||
}
|
||||
|
||||
|
||||
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
|
||||
if (popupShown) {
|
||||
Helper.startStreaming(BaseMainActivity.this);
|
||||
}
|
||||
|
||||
if (hidde_menu != null)
|
||||
LocalBroadcastManager.getInstance(BaseMainActivity.this).unregisterReceiver(hidde_menu);
|
||||
|
@ -707,7 +709,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
int position = 0;
|
||||
if (tabLayout != null)
|
||||
position = tabLayout.getSelectedTabPosition();
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, position, true, BaseMainActivity.this).execute();
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, position, true, BaseMainActivity.this);
|
||||
}
|
||||
};
|
||||
LocalBroadcastManager.getInstance(BaseMainActivity.this).registerReceiver(hidde_menu, new IntentFilter(Helper.RECEIVE_HIDE_ITEM));
|
||||
|
@ -930,6 +932,9 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
if (action_size != null)
|
||||
action_size.setVisible(false);
|
||||
}
|
||||
if (BuildConfig.lite) {
|
||||
popup.getMenu().findItem(R.id.action_send_invitation).setVisible(false);
|
||||
}
|
||||
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -969,7 +974,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}
|
||||
return true;
|
||||
case R.id.action_cache:
|
||||
new Helper.CacheTask(BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new Helper.CacheTask(BaseMainActivity.this);
|
||||
return true;
|
||||
case R.id.action_size:
|
||||
final SharedPreferences sharedpreferences1 = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
|
@ -1106,11 +1111,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
Helper.updateHeaderAccountInfo(activity, account, headerLayout);
|
||||
//Locked account can see follow request
|
||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||
if (account.isLocked()) {
|
||||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(true);
|
||||
} else {
|
||||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(false);
|
||||
}
|
||||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(account.isLocked());
|
||||
}
|
||||
|
||||
if (!BuildConfig.DONATIONS) {
|
||||
|
@ -1162,7 +1163,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
});
|
||||
|
||||
// Asked once for notification opt-in
|
||||
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
|
||||
|
||||
if (!popupShown && (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)) {
|
||||
if (theme == Helper.THEME_DARK) {
|
||||
style = R.style.DialogDark;
|
||||
|
@ -1196,7 +1197,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
set_live_type_indication.setText(R.string.no_live_indication);
|
||||
break;
|
||||
}
|
||||
set_live_type.setSelection(Helper.liveNotifType(BaseMainActivity.this));
|
||||
set_live_type.setSelection(Helper.liveNotifType(BaseMainActivity.this), false);
|
||||
set_live_type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
@ -1206,15 +1207,13 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
|
||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false);
|
||||
editor.apply();
|
||||
Intent streamingIntent = new Intent(BaseMainActivity.this, LiveNotificationService.class);
|
||||
startService(streamingIntent);
|
||||
startStreaming(BaseMainActivity.this);
|
||||
break;
|
||||
case Helper.NOTIF_DELAYED:
|
||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, true);
|
||||
streamingIntent = new Intent(BaseMainActivity.this, LiveNotificationDelayedService.class);
|
||||
startService(streamingIntent);
|
||||
editor.apply();
|
||||
startStreaming(BaseMainActivity.this);
|
||||
break;
|
||||
case Helper.NOTIF_NONE:
|
||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||
|
@ -1245,7 +1244,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
dialogBuilderOptin.setPositiveButton(R.string.validate, (dialog, id) -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_POPUP_PUSH, true);
|
||||
editor.apply();
|
||||
editor.commit();
|
||||
|
||||
});
|
||||
try {
|
||||
|
@ -1260,7 +1259,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
int versionCode = BuildConfig.VERSION_CODE;
|
||||
if (lastReleaseNoteRead != versionCode) { //Need to push release notes
|
||||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, BaseMainActivity.this).execute();
|
||||
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, BaseMainActivity.this);
|
||||
}
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(getAssets().open("changelogs/" + versionCode + ".txt")))) {
|
||||
|
@ -1316,11 +1315,12 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||
|
||||
// Retrieves instance
|
||||
new RetrieveInstanceAsyncTask(BaseMainActivity.this, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveInstanceAsyncTask(BaseMainActivity.this, BaseMainActivity.this);
|
||||
// Retrieves filters
|
||||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
new ManageFiltersAsyncTask(BaseMainActivity.this, GET_ALL_FILTER, null, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new ManageFiltersAsyncTask(BaseMainActivity.this, GET_ALL_FILTER, null, BaseMainActivity.this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Clean cache for statuses */
|
||||
|
@ -1330,11 +1330,27 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
new TimelineCacheDAO(BaseMainActivity.this, db).removeAfterDate(dateString);
|
||||
});
|
||||
if (Helper.isLoggedIn(BaseMainActivity.this)) {
|
||||
new UpdateAccountInfoByIDAsyncTask(BaseMainActivity.this, social, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(() -> new UpdateAccountInfoByIDAsyncTask(BaseMainActivity.this, account, BaseMainActivity.this), 2000);
|
||||
|
||||
}
|
||||
mutedAccount = new TempMuteDAO(BaseMainActivity.this, db).getAllTimeMuted(account);
|
||||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
new RetrieveFeedsAsyncTask(BaseMainActivity.this, RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS, null, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(() -> {
|
||||
new RetrieveFeedsAsyncTask(BaseMainActivity.this, RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS, null, BaseMainActivity.this);
|
||||
if (BuildConfig.lite) {
|
||||
String datesupdate = sharedpreferences.getString(Helper.TRACKING_LAST_UPDATE, null);
|
||||
Date dateLastUpdate = Helper.stringToDate(BaseMainActivity.this, datesupdate);
|
||||
Date dateUpdate = new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(10));
|
||||
//Refresh tracking db if needed
|
||||
if (datesupdate == null || dateUpdate.after(dateLastUpdate)) {
|
||||
Intent scriptIntent = new Intent(BaseMainActivity.this, DownloadTrackingDBScriptsService.class);
|
||||
startService(scriptIntent);
|
||||
}
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1439,21 +1455,19 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.ADD_USER_INTENT) {
|
||||
this.recreate();
|
||||
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.BACKUP_INTENT) {
|
||||
Intent myIntent = new Intent(BaseMainActivity.this, OwnerStatusActivity.class);
|
||||
startActivity(myIntent);
|
||||
launchOwnerStatusesActivity();
|
||||
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.BACKUP_NOTIFICATION_INTENT) {
|
||||
Intent myIntent = new Intent(BaseMainActivity.this, OwnerNotificationActivity.class);
|
||||
startActivity(myIntent);
|
||||
launchOwnerNotificationsActivity();
|
||||
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.REDRAW_MENU) {
|
||||
Helper.hideMenuItem(BaseMainActivity.this, navigationView.getMenu());
|
||||
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_TAG) {
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, -1, false, BaseMainActivity.this).execute();
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, -1, false, BaseMainActivity.this);
|
||||
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.REFRESH_TIMELINE) {
|
||||
int position = 0;
|
||||
boolean refreshList = extras.getBoolean(Helper.REFRESH_LIST_TIMELINE, false);
|
||||
if (tabLayout != null)
|
||||
position = tabLayout.getSelectedTabPosition();
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, position, refreshList, BaseMainActivity.this).execute();
|
||||
new SyncTimelinesAsyncTask(BaseMainActivity.this, position, refreshList, BaseMainActivity.this);
|
||||
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_REMOTE) {
|
||||
String url = extras.getString(Helper.SEARCH_URL);
|
||||
intent.replaceExtras(new Bundle());
|
||||
|
@ -1474,7 +1488,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
if (!isUrl)
|
||||
return;
|
||||
//Here we know that the intent contains a valid URL
|
||||
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, url, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, url, BaseMainActivity.this);
|
||||
}
|
||||
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||
if ("text/plain".equals(type)) {
|
||||
|
@ -1499,7 +1513,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
if (matchStart < matchEnd && sharedText.length() >= matchEnd)
|
||||
url = sharedText.substring(matchStart, matchEnd);
|
||||
}
|
||||
new RetrieveMetaDataAsyncTask(BaseMainActivity.this, shouldRetrieveMetaData, sharedSubject, sharedText, url, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveMetaDataAsyncTask(BaseMainActivity.this, shouldRetrieveMetaData, sharedSubject, sharedText, url, BaseMainActivity.this);
|
||||
}
|
||||
|
||||
} else if (type.startsWith("image/") || type.startsWith("video/")) {
|
||||
|
@ -1561,7 +1575,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}
|
||||
//Here we know that the intent contains a valid URL
|
||||
if (!url.contains("medium.com")) {
|
||||
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, url, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, url, BaseMainActivity.this);
|
||||
} else {
|
||||
forwardToBrowser(intent);
|
||||
}
|
||||
|
@ -1709,8 +1723,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
// Handle navigation view item clicks here.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.nav_archive) {
|
||||
Intent myIntent = new Intent(BaseMainActivity.this, OwnerStatusActivity.class);
|
||||
startActivity(myIntent);
|
||||
launchOwnerStatusesActivity();
|
||||
return false;
|
||||
}
|
||||
if (id == R.id.nav_trends) {
|
||||
|
@ -1721,8 +1734,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
startActivity(myIntent);
|
||||
return false;
|
||||
} else if (id == R.id.nav_archive_notifications) {
|
||||
Intent myIntent = new Intent(BaseMainActivity.this, OwnerNotificationActivity.class);
|
||||
startActivity(myIntent);
|
||||
launchOwnerNotificationsActivity();
|
||||
return false;
|
||||
} else if (id == R.id.nav_drag_timelines) {
|
||||
Intent intent = new Intent(BaseMainActivity.this, ReorderTimelinesActivity.class);
|
||||
|
@ -2058,7 +2070,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
if (accounts != null && accounts.size() > 0) {
|
||||
developers = new ArrayList<>();
|
||||
developers.addAll(accounts);
|
||||
new RetrieveRelationshipAsyncTask(BaseMainActivity.this, accounts.get(0).getId(), BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveRelationshipAsyncTask(BaseMainActivity.this, accounts.get(0).getId(), BaseMainActivity.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2342,13 +2354,14 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}
|
||||
try {
|
||||
TabLayoutNotificationsFragment tabLayoutNotificationsFragment = (TabLayoutNotificationsFragment) mPageReferenceMap.get(position);
|
||||
assert tabLayoutNotificationsFragment != null;
|
||||
ViewPager notifViewPager = Objects.requireNonNull(tabLayoutNotificationsFragment).getViewPager();
|
||||
|
||||
if (tabLayoutNotificationsFragment != null) {
|
||||
ViewPager notifViewPager = tabLayoutNotificationsFragment.getViewPager();
|
||||
if (notifViewPager != null && notifViewPager.getAdapter() != null) {
|
||||
DisplayNotificationsFragment displayNotificationsFragment = (DisplayNotificationsFragment) notifViewPager.getAdapter().instantiateItem(notifViewPager, 0);
|
||||
displayNotificationsFragment.updateNotificationRead();
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
|
@ -2409,6 +2422,10 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
protected abstract void launchOwnerStatusesActivity();
|
||||
|
||||
protected abstract void launchOwnerNotificationsActivity();
|
||||
|
||||
public enum iconLauncher {
|
||||
BUBBLES,
|
||||
FEDIVERSE,
|
||||
|
|
|
@ -29,10 +29,10 @@ import android.content.res.ColorStateList;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
@ -44,6 +44,7 @@ import android.text.Html;
|
|||
import android.text.InputType;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -82,7 +83,8 @@ import com.bumptech.glide.request.transition.Transition;
|
|||
import com.smarteist.autoimageslider.IndicatorAnimations;
|
||||
import com.smarteist.autoimageslider.SliderAnimations;
|
||||
import com.smarteist.autoimageslider.SliderView;
|
||||
import com.vanniktech.emoji.EmojiPopup;
|
||||
import com.watermark.androidwm_light.WatermarkBuilder;
|
||||
import com.watermark.androidwm_light.bean.WatermarkText;
|
||||
|
||||
import net.gotev.uploadservice.MultipartUploadRequest;
|
||||
import net.gotev.uploadservice.ServerResponse;
|
||||
|
@ -96,6 +98,8 @@ import org.jetbrains.annotations.NotNull;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -168,19 +172,21 @@ import static app.fedilab.android.helper.Helper.countWithEmoji;
|
|||
* Toot activity class
|
||||
*/
|
||||
|
||||
public class PixelfedComposeActivity extends BaseActivity implements UploadStatusDelegate, OnPostActionInterface, OnRetrieveSearcAccountshInterface, OnPostStatusActionInterface, OnRetrieveSearchInterface, OnRetrieveEmojiInterface, OnDownloadInterface, OnRetrieveAttachmentInterface {
|
||||
public abstract class BasePixelfedComposeActivity extends BaseActivity implements UploadStatusDelegate, OnPostActionInterface, OnRetrieveSearcAccountshInterface, OnPostStatusActionInterface, OnRetrieveSearchInterface, OnRetrieveEmojiInterface, OnDownloadInterface, OnRetrieveAttachmentInterface {
|
||||
|
||||
|
||||
public static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 754;
|
||||
public static final int SEND_VOICE_MESSAGE = 1423;
|
||||
private static final int searchDeep = 15;
|
||||
public static HashMap<String, Uri> filesMap;
|
||||
public static boolean autocomplete;
|
||||
public static Uri photoFileUri = null;
|
||||
static boolean active = false;
|
||||
private static int searchDeep = 15;
|
||||
private final int PICK_IMAGE = 56556;
|
||||
private final int TAKE_PHOTO = 56532;
|
||||
public long currentToId;
|
||||
protected MastalabAutoCompleteTextView toot_content;
|
||||
protected LinearLayout drawer_layout;
|
||||
String mCurrentPhotoPath;
|
||||
File photoFile = null;
|
||||
private String visibility;
|
||||
|
@ -188,7 +194,6 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
private boolean isSensitive = false;
|
||||
private ImageButton toot_visibility;
|
||||
private Button toot_it;
|
||||
private MastalabAutoCompleteTextView toot_content;
|
||||
private CheckBox toot_sensitive;
|
||||
private long restored;
|
||||
private TextView title;
|
||||
|
@ -212,17 +217,16 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
private SliderView imageSlider;
|
||||
private SliderAdapter sliderAdapter;
|
||||
private CheckBox pixelfed_story;
|
||||
|
||||
private BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String imgpath = intent.getStringExtra("imgpath");
|
||||
if (imgpath != null) {
|
||||
prepareUpload(PixelfedComposeActivity.this, Uri.fromFile(new File(imgpath)), null, uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, Uri.fromFile(new File(imgpath)), null, uploadReceiver);
|
||||
}
|
||||
}
|
||||
};
|
||||
private BroadcastReceiver add_new_media = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver add_new_media = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
pixelfed_story.setEnabled(true);
|
||||
|
@ -395,7 +399,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
pp_progress.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.GONE);
|
||||
}
|
||||
new RetrieveSearchAccountsAsyncTask(context, search, listenerAccount).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveSearchAccountsAsyncTask(context, search, listenerAccount);
|
||||
} else {
|
||||
mt = tPattern.matcher(searchIn);
|
||||
if (mt.matches()) {
|
||||
|
@ -404,7 +408,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
pp_progress.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.GONE);
|
||||
}
|
||||
new RetrieveSearchAsyncTask(context, search, true, listener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveSearchAsyncTask(context, search, true, listener);
|
||||
} else {
|
||||
mt = ePattern.matcher(searchIn);
|
||||
if (mt.matches()) {
|
||||
|
@ -413,7 +417,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
pp_progress.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.GONE);
|
||||
}
|
||||
new RetrieveEmojiAsyncTask(context, shortcode, listenerEmoji).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveEmojiAsyncTask(context, shortcode, listenerEmoji);
|
||||
} else {
|
||||
toot_content.dismissDropDown();
|
||||
}
|
||||
|
@ -428,13 +432,60 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
return textw;
|
||||
}
|
||||
|
||||
static private void upload(Activity activity, boolean pixelfedStory, Uri inUri, String fname, UploadServiceSingleBroadcastReceiver uploadReceiver) {
|
||||
static private void upload(Activity activity, boolean pixelfedStory, Account account, Uri inUri, String fname, UploadServiceSingleBroadcastReceiver uploadReceiver) {
|
||||
String uploadId = UUID.randomUUID().toString();
|
||||
if (uploadReceiver != null) {
|
||||
uploadReceiver.setUploadID(uploadId);
|
||||
}
|
||||
Uri uri;
|
||||
InputStream tempInput = null;
|
||||
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean isWM = sharedpreferences.getBoolean(Helper.SET_WATERMARK, false);
|
||||
ContentResolver cr = activity.getContentResolver();
|
||||
String mime = cr.getType(inUri);
|
||||
if ((mime == null || mime.toLowerCase().contains("image")) && isWM) {
|
||||
String WMText = sharedpreferences.getString(Helper.SET_WATERMARK_TEXT + account.getId() + account.getInstance(), null);
|
||||
if (WMText == null || WMText.trim().length() == 0) {
|
||||
WMText = "@" + account.getUsername() + "@" + account.getInstance();
|
||||
}
|
||||
float textSize = 15;
|
||||
Paint mPaint = new Paint();
|
||||
mPaint.setTextSize(textSize);
|
||||
float width = mPaint.measureText(WMText, 0, WMText.length());
|
||||
try {
|
||||
Bitmap backgroundBitmap = MediaStore.Images.Media.getBitmap(activity.getContentResolver(), inUri);
|
||||
|
||||
int w = backgroundBitmap.getWidth();
|
||||
int h = backgroundBitmap.getHeight();
|
||||
|
||||
|
||||
float valx = (float) 1.0 - ((Helper.convertDpToPixel(width, activity) + 10)) / (float) w;
|
||||
if (valx < 0)
|
||||
valx = 0;
|
||||
float valy = (h - Helper.convertDpToPixel(textSize, activity) - 10) / (float) h;
|
||||
WatermarkText watermarkText = new WatermarkText(WMText)
|
||||
.setPositionX(valx)
|
||||
.setPositionY(valy)
|
||||
.setTextColor(Color.WHITE)
|
||||
.setTextShadow(0.1f, 1, 1, Color.LTGRAY)
|
||||
.setTextAlpha(200)
|
||||
.setRotation(0)
|
||||
.setTextSize(textSize);
|
||||
|
||||
Bitmap bitmap = WatermarkBuilder
|
||||
.create(activity, backgroundBitmap)
|
||||
.loadWatermarkText(watermarkText)
|
||||
.getWatermark()
|
||||
.getOutputImage();
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 0, bos);
|
||||
byte[] bitmapdata = bos.toByteArray();
|
||||
tempInput = new ByteArrayInputStream(bitmapdata);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Uri uri;
|
||||
FileOutputStream tempOut = null;
|
||||
String filename = inUri.toString().substring(inUri.toString().lastIndexOf("/"));
|
||||
int suffixPosition = filename.lastIndexOf(".");
|
||||
|
@ -442,7 +493,9 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (suffixPosition > 0) suffix = filename.substring(suffixPosition);
|
||||
try {
|
||||
File file;
|
||||
if (tempInput == null) {
|
||||
tempInput = activity.getContentResolver().openInputStream(inUri);
|
||||
}
|
||||
if (fname.startsWith("fedilabins_")) {
|
||||
file = File.createTempFile("fedilabins_randomTemp1", suffix, activity.getCacheDir());
|
||||
} else {
|
||||
|
@ -461,11 +514,17 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
uri = FileProvider.getUriForFile(activity,
|
||||
"fr.gouv.etalab.mastodon.fileProvider",
|
||||
file);
|
||||
} else {
|
||||
if (BuildConfig.lite) {
|
||||
uri = FileProvider.getUriForFile(activity,
|
||||
"app.fedilab.lite.fileProvider",
|
||||
file);
|
||||
} else {
|
||||
uri = FileProvider.getUriForFile(activity,
|
||||
"app.fedilab.android.fileProvider",
|
||||
file);
|
||||
}
|
||||
}
|
||||
tempInput.close();
|
||||
tempOut.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -479,7 +538,6 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
|
||||
try {
|
||||
final String fileName = FileNameCleaner.cleanFileName(fname);
|
||||
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String scheme = sharedpreferences.getString(Helper.SET_ONION_SCHEME + Helper.getLiveInstance(activity), "https");
|
||||
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||
int maxUploadRetryTimes = sharedpreferences.getInt(Helper.MAX_UPLOAD_IMG_RETRY_TIMES, 3);
|
||||
|
@ -557,8 +615,8 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (actionBar != null) {
|
||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
assert inflater != null;
|
||||
View view = inflater.inflate(R.layout.toot_action_bar, new LinearLayout(PixelfedComposeActivity.this), false);
|
||||
view.setBackground(new ColorDrawable(ContextCompat.getColor(PixelfedComposeActivity.this, R.color.cyanea_primary)));
|
||||
View view = inflater.inflate(R.layout.toot_action_bar, new LinearLayout(BasePixelfedComposeActivity.this), false);
|
||||
view.setBackground(new ColorDrawable(ContextCompat.getColor(BasePixelfedComposeActivity.this, R.color.cyanea_primary)));
|
||||
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
ImageView close_toot = actionBar.getCustomView().findViewById(R.id.close_toot);
|
||||
|
@ -574,14 +632,10 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
} else if (initialContent.trim().equals(toot_content.getText().toString().trim())) {
|
||||
finish();
|
||||
} else {
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BasePixelfedComposeActivity.this, style);
|
||||
dialogBuilder.setMessage(R.string.save_draft);
|
||||
dialogBuilder.setPositiveButton(R.string.save, (dialog, id) -> {
|
||||
if (accountReply == null) {
|
||||
storeToot(true, false);
|
||||
} else {
|
||||
storeToot(false, false);
|
||||
}
|
||||
storeToot(accountReply == null, false);
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
});
|
||||
|
@ -610,7 +664,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
toot_it = findViewById(R.id.toot_it);
|
||||
attachments = new ArrayList<>();
|
||||
imageSlider = findViewById(R.id.imageSlider);
|
||||
sliderAdapter = new SliderAdapter(new WeakReference<>(PixelfedComposeActivity.this), true, attachments);
|
||||
sliderAdapter = new SliderAdapter(new WeakReference<>(BasePixelfedComposeActivity.this), true, attachments);
|
||||
imageSlider.setIndicatorAnimation(IndicatorAnimations.WORM);
|
||||
imageSlider.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION);
|
||||
imageSlider.setSliderAdapter(sliderAdapter);
|
||||
|
@ -626,16 +680,12 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
//There is no media the button is hidden
|
||||
upload_media.setVisibility(View.INVISIBLE);
|
||||
toot_sensitive = findViewById(R.id.toot_sensitive);
|
||||
LinearLayout drawer_layout = findViewById(R.id.drawer_layout);
|
||||
drawer_layout = findViewById(R.id.drawer_layout);
|
||||
ImageButton toot_emoji = findViewById(R.id.toot_emoji);
|
||||
LinearLayout bottom_bar_tooting = findViewById(R.id.bottom_bar_tooting);
|
||||
isScheduled = false;
|
||||
if (sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, false)) {
|
||||
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(drawer_layout).build(toot_content);
|
||||
|
||||
toot_emoji.setOnClickListener(v -> {
|
||||
emojiPopup.toggle(); // Toggles visibility of the Popup.
|
||||
});
|
||||
displayEmojiPopup();
|
||||
} else {
|
||||
toot_emoji.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -653,11 +703,11 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(PixelfedComposeActivity.this);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(BasePixelfedComposeActivity.this);
|
||||
int iconColor = prefs.getInt("theme_icons_color", -1);
|
||||
if (iconColor != -1) {
|
||||
Helper.changeDrawableColor(PixelfedComposeActivity.this, toot_visibility, iconColor);
|
||||
Helper.changeDrawableColor(PixelfedComposeActivity.this, toot_emoji, iconColor);
|
||||
Helper.changeDrawableColor(BasePixelfedComposeActivity.this, toot_visibility, iconColor);
|
||||
Helper.changeDrawableColor(BasePixelfedComposeActivity.this, toot_emoji, iconColor);
|
||||
toot_sensitive.setButtonTintList(ColorStateList.valueOf(iconColor));
|
||||
toot_sensitive.setTextColor(iconColor);
|
||||
}
|
||||
|
@ -674,7 +724,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (accountReplyToken != null) {
|
||||
String[] val = accountReplyToken.split("\\|");
|
||||
if (val.length == 2) {
|
||||
accountReply = new AccountDAO(PixelfedComposeActivity.this, db).getUniqAccount(val[0], val[1]);
|
||||
accountReply = new AccountDAO(BasePixelfedComposeActivity.this, db).getUniqAccount(val[0], val[1]);
|
||||
}
|
||||
}
|
||||
removed = b.getBoolean("removed");
|
||||
|
@ -715,7 +765,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
instanceReply = accountReply.getInstance();
|
||||
}
|
||||
if (accountReply == null)
|
||||
account = new AccountDAO(PixelfedComposeActivity.this, db).getUniqAccount(userIdReply, instanceReply);
|
||||
account = new AccountDAO(BasePixelfedComposeActivity.this, db).getUniqAccount(userIdReply, instanceReply);
|
||||
else
|
||||
account = accountReply;
|
||||
|
||||
|
@ -725,7 +775,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
toot_content.requestFocus();
|
||||
|
||||
|
||||
Helper.loadGiF(PixelfedComposeActivity.this, account, pp_actionBar);
|
||||
Helper.loadGiF(BasePixelfedComposeActivity.this, account, pp_actionBar);
|
||||
|
||||
|
||||
if (visibility == null) {
|
||||
|
@ -760,9 +810,9 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
|
||||
pickup_picture.setOnClickListener(v -> {
|
||||
|
||||
if (ContextCompat.checkSelfPermission(PixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||
if (ContextCompat.checkSelfPermission(BasePixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(PixelfedComposeActivity.this,
|
||||
ActivityCompat.requestPermissions(BasePixelfedComposeActivity.this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
||||
return;
|
||||
|
@ -770,28 +820,19 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
Intent intent;
|
||||
intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||
String[] mimetypes = {"image/*", "video/*", "audio/mpeg", "audio/opus", "audio/flac", "audio/wav", "audio/ogg"};
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||
startActivityForResult(intent, PICK_IMAGE);
|
||||
} else {
|
||||
intent.setType("image/* video/* audio/mpeg audio/opus audio/flac audio/wav audio/ogg");
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
|
||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
|
||||
startActivityForResult(chooserIntent, PICK_IMAGE);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
upload_media.setOnClickListener(v -> {
|
||||
|
||||
if (ContextCompat.checkSelfPermission(PixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||
if (ContextCompat.checkSelfPermission(BasePixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(PixelfedComposeActivity.this,
|
||||
ActivityCompat.requestPermissions(BasePixelfedComposeActivity.this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
||||
return;
|
||||
|
@ -799,25 +840,16 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
Intent intent;
|
||||
intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||
String[] mimetypes = {"image/*", "video/*", "audio/mpeg", "audio/opus", "audio/flac", "audio/wav", "audio/ogg"};
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||
startActivityForResult(intent, PICK_IMAGE);
|
||||
} else {
|
||||
intent.setType("image/* video/* audio/mpeg audio/opus audio/flac audio/wav audio/ogg");
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
|
||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
|
||||
startActivityForResult(chooserIntent, PICK_IMAGE);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
TextWatcher textWatcher = initializeTextWatcher(PixelfedComposeActivity.this, social, toot_content, toot_space_left, pp_actionBar, pp_progress, PixelfedComposeActivity.this, PixelfedComposeActivity.this, PixelfedComposeActivity.this);
|
||||
TextWatcher textWatcher = initializeTextWatcher(BasePixelfedComposeActivity.this, social, toot_content, toot_space_left, pp_actionBar, pp_progress, BasePixelfedComposeActivity.this, BasePixelfedComposeActivity.this, BasePixelfedComposeActivity.this);
|
||||
toot_content.addTextChangedListener(textWatcher);
|
||||
|
||||
|
||||
|
@ -879,7 +911,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Toasty.success(PixelfedComposeActivity.this, getString(R.string.added_to_story), Toast.LENGTH_LONG).show();
|
||||
Toasty.success(BasePixelfedComposeActivity.this, getString(R.string.added_to_story), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -900,7 +932,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (mToast != null) {
|
||||
mToast.cancel();
|
||||
}
|
||||
mToast = Toasty.error(PixelfedComposeActivity.this, message, Toast.LENGTH_SHORT);
|
||||
mToast = Toasty.error(BasePixelfedComposeActivity.this, message, Toast.LENGTH_SHORT);
|
||||
mToast.show();
|
||||
}
|
||||
|
||||
|
@ -914,16 +946,16 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
break;
|
||||
}
|
||||
try {
|
||||
prepareUpload(PixelfedComposeActivity.this, fileUri, null, uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, fileUri, null, uploadReceiver);
|
||||
count++;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
upload_media.setEnabled(true);
|
||||
toot_it.setEnabled(true);
|
||||
}
|
||||
} else {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -937,7 +969,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
try {
|
||||
photoFile = createImageFile();
|
||||
} catch (IOException ignored) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
// Continue only if the File was successfully created
|
||||
if (photoFile != null) {
|
||||
|
@ -945,11 +977,17 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
photoFileUri = FileProvider.getUriForFile(this,
|
||||
"fr.gouv.etalab.mastodon.fileProvider",
|
||||
photoFile);
|
||||
} else {
|
||||
if (BuildConfig.lite) {
|
||||
photoFileUri = FileProvider.getUriForFile(this,
|
||||
"app.fedilab.lite.fileProvider",
|
||||
photoFile);
|
||||
} else {
|
||||
photoFileUri = FileProvider.getUriForFile(this,
|
||||
"app.fedilab.android.fileProvider",
|
||||
photoFile);
|
||||
}
|
||||
}
|
||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoFileUri);
|
||||
startActivityForResult(takePictureIntent, TAKE_PHOTO);
|
||||
}
|
||||
|
@ -978,13 +1016,13 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
boolean photo_editor = sharedpreferences.getBoolean(Helper.SET_PHOTO_EDITOR, true);
|
||||
if (requestCode == PICK_IMAGE && resultCode == RESULT_OK) {
|
||||
if (data == null) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
ClipData clipData = data.getClipData();
|
||||
if (data.getData() == null && clipData == null) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (clipData != null) {
|
||||
|
@ -996,40 +1034,32 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
}
|
||||
uploadSharedImage(mArrayUri);
|
||||
} else {
|
||||
String filename = Helper.getFileName(PixelfedComposeActivity.this, data.getData());
|
||||
String filename = Helper.getFileName(BasePixelfedComposeActivity.this, data.getData());
|
||||
ContentResolver cr = getContentResolver();
|
||||
String mime = cr.getType(data.getData());
|
||||
if (mime != null && (mime.toLowerCase().contains("video") || mime.toLowerCase().contains("gif"))) {
|
||||
prepareUpload(PixelfedComposeActivity.this, data.getData(), filename, uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, data.getData(), filename, uploadReceiver);
|
||||
} else if (mime != null && mime.toLowerCase().contains("image")) {
|
||||
if (photo_editor) {
|
||||
Intent intent = new Intent(PixelfedComposeActivity.this, PhotoEditorActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
intent.putExtra("imageUri", data.getData().toString());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
launchPhotoEditor(data.getData());
|
||||
} else {
|
||||
prepareUpload(PixelfedComposeActivity.this, data.getData(), filename, uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, data.getData(), filename, uploadReceiver);
|
||||
}
|
||||
} else if (mime != null && mime.toLowerCase().contains("audio")) {
|
||||
prepareUpload(PixelfedComposeActivity.this, data.getData(), filename, uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, data.getData(), filename, uploadReceiver);
|
||||
} else {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (requestCode == SEND_VOICE_MESSAGE && resultCode == RESULT_OK) {
|
||||
Uri uri = Uri.fromFile(new File(getCacheDir() + "/fedilab_recorded_audio.wav"));
|
||||
prepareUpload(PixelfedComposeActivity.this, uri, "fedilab_recorded_audio.wav", uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, uri, "fedilab_recorded_audio.wav", uploadReceiver);
|
||||
} else if (requestCode == TAKE_PHOTO && resultCode == RESULT_OK) {
|
||||
if (photo_editor) {
|
||||
Intent intent = new Intent(PixelfedComposeActivity.this, PhotoEditorActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
intent.putExtra("imageUri", photoFileUri.toString());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
launchPhotoEditor(photoFileUri);
|
||||
} else {
|
||||
prepareUpload(PixelfedComposeActivity.this, photoFileUri, null, uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, photoFileUri, null, uploadReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1037,18 +1067,18 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
private void prepareUpload(Activity activity, Uri uri, String filename, UploadServiceSingleBroadcastReceiver uploadReceiver) {
|
||||
pixelfed_story.setEnabled(false);
|
||||
if (uploadReceiver == null) {
|
||||
uploadReceiver = new UploadServiceSingleBroadcastReceiver(PixelfedComposeActivity.this);
|
||||
uploadReceiver = new UploadServiceSingleBroadcastReceiver(BasePixelfedComposeActivity.this);
|
||||
uploadReceiver.register(this);
|
||||
}
|
||||
new asyncPicture(activity, pixelfed_story.isChecked(), uri, filename, uploadReceiver).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new asyncPicture(activity, pixelfed_story.isChecked(), account, uri, filename, uploadReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostAction(int statusCode, API.StatusAction statusAction, String userId, Error error) {
|
||||
if (error != null) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toasty.success(PixelfedComposeActivity.this, getString(R.string.toot_scheduled), Toast.LENGTH_LONG).show();
|
||||
Toasty.success(BasePixelfedComposeActivity.this, getString(R.string.toot_scheduled), Toast.LENGTH_LONG).show();
|
||||
resetForNextToot();
|
||||
}
|
||||
}
|
||||
|
@ -1062,7 +1092,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
@Override
|
||||
public void onError(Context context, UploadInfo uploadInfo, ServerResponse serverResponse,
|
||||
Exception exception) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
if (attachments.size() == 0) {
|
||||
pickup_picture.setVisibility(View.VISIBLE);
|
||||
imageSlider.setVisibility(View.GONE);
|
||||
|
@ -1074,14 +1104,14 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
|
||||
@Override
|
||||
public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) {
|
||||
JSONObject response = null;
|
||||
JSONObject response;
|
||||
pixelfed_story.setEnabled(true);
|
||||
try {
|
||||
response = new JSONObject(serverResponse.getBodyAsString());
|
||||
addNewMedia(response, uploadInfo.getSuccessfullyUploadedFiles());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
addNewMedia(response, uploadInfo.getSuccessfullyUploadedFiles());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1098,12 +1128,12 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (extras != null && extras.getString("imageUri") != null) {
|
||||
Uri imageUri = Uri.parse(extras.getString("imageUri"));
|
||||
if (imageUri == null) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_select_image_error), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
String filename = Helper.getFileName(PixelfedComposeActivity.this, imageUri);
|
||||
String filename = Helper.getFileName(BasePixelfedComposeActivity.this, imageUri);
|
||||
|
||||
prepareUpload(PixelfedComposeActivity.this, imageUri, filename, uploadReceiver);
|
||||
prepareUpload(BasePixelfedComposeActivity.this, imageUri, filename, uploadReceiver);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1121,30 +1151,30 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
style = R.style.Dialog;
|
||||
}
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_photo_camera:
|
||||
} else if (itemId == R.id.action_photo_camera) {
|
||||
dispatchTakePictureIntent();
|
||||
return true;
|
||||
case R.id.action_store:
|
||||
} else if (itemId == R.id.action_store) {
|
||||
storeToot(true, true);
|
||||
return true;
|
||||
case R.id.action_schedule:
|
||||
} else if (itemId == R.id.action_schedule) {
|
||||
if (toot_content.getText().toString().trim().length() == 0) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_error_no_content), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_error_no_content), Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
}
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BasePixelfedComposeActivity.this, style);
|
||||
LayoutInflater inflater = this.getLayoutInflater();
|
||||
View dialogView = inflater.inflate(R.layout.datetime_picker, new LinearLayout(PixelfedComposeActivity.this), false);
|
||||
View dialogView = inflater.inflate(R.layout.datetime_picker, new LinearLayout(BasePixelfedComposeActivity.this), false);
|
||||
dialogBuilder.setView(dialogView);
|
||||
final AlertDialog alertDialog = dialogBuilder.create();
|
||||
|
||||
final DatePicker datePicker = dialogView.findViewById(R.id.date_picker);
|
||||
final TimePicker timePicker = dialogView.findViewById(R.id.time_picker);
|
||||
if (android.text.format.DateFormat.is24HourFormat(PixelfedComposeActivity.this))
|
||||
if (DateFormat.is24HourFormat(BasePixelfedComposeActivity.this))
|
||||
timePicker.setIs24HourView(true);
|
||||
Button date_time_cancel = dialogView.findViewById(R.id.date_time_cancel);
|
||||
final ImageButton date_time_previous = dialogView.findViewById(R.id.date_time_previous);
|
||||
|
@ -1184,9 +1214,9 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
final long[] time = {calendar.getTimeInMillis()};
|
||||
|
||||
if ((time[0] - new Date().getTime()) < 60000) {
|
||||
Toasty.warning(PixelfedComposeActivity.this, getString(R.string.toot_scheduled_date), Toast.LENGTH_LONG).show();
|
||||
Toasty.warning(BasePixelfedComposeActivity.this, getString(R.string.toot_scheduled_date), Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(BasePixelfedComposeActivity.this, style);
|
||||
builderSingle.setTitle(getString(R.string.choose_schedule));
|
||||
builderSingle.setNegativeButton(R.string.device_schedule, (dialog, which) -> {
|
||||
deviceSchedule(time[0]);
|
||||
|
@ -1204,16 +1234,15 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
});
|
||||
alertDialog.show();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
private void sendToot(String timestamp) {
|
||||
toot_it.setEnabled(false);
|
||||
if (toot_content.getText().toString().trim().length() == 0 && attachments.size() == 0) {
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toot_error_no_content), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toot_error_no_content), Toast.LENGTH_LONG).show();
|
||||
toot_it.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -1225,20 +1254,20 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
toot.setSensitive(isSensitive);
|
||||
toot.setVisibility(visibility);
|
||||
toot.setMedia_attachments(attachments);
|
||||
toot.setContent(PixelfedComposeActivity.this, tootContent);
|
||||
toot.setContent(BasePixelfedComposeActivity.this, tootContent);
|
||||
if (timestamp == null)
|
||||
if (scheduledstatus == null)
|
||||
new PostStatusAsyncTask(PixelfedComposeActivity.this, social, account, toot, PixelfedComposeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostStatusAsyncTask(BasePixelfedComposeActivity.this, social, account, toot, BasePixelfedComposeActivity.this);
|
||||
else {
|
||||
toot.setScheduled_at(Helper.dateToString(scheduledstatus.getScheduled_date()));
|
||||
scheduledstatus.setStatus(toot);
|
||||
isScheduled = true;
|
||||
new PostActionAsyncTask(PixelfedComposeActivity.this, API.StatusAction.DELETESCHEDULED, scheduledstatus, PixelfedComposeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostStatusAsyncTask(PixelfedComposeActivity.this, social, account, toot, PixelfedComposeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostActionAsyncTask(BasePixelfedComposeActivity.this, API.StatusAction.DELETESCHEDULED, scheduledstatus, BasePixelfedComposeActivity.this);
|
||||
new PostStatusAsyncTask(BasePixelfedComposeActivity.this, social, account, toot, BasePixelfedComposeActivity.this);
|
||||
}
|
||||
else {
|
||||
toot.setScheduled_at(timestamp);
|
||||
new PostStatusAsyncTask(PixelfedComposeActivity.this, social, account, toot, PixelfedComposeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostStatusAsyncTask(BasePixelfedComposeActivity.this, social, account, toot, BasePixelfedComposeActivity.this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1255,7 +1284,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
storeToot(false, false);
|
||||
isScheduled = true;
|
||||
//Schedules the toot
|
||||
ScheduledTootsSyncJob.schedule(PixelfedComposeActivity.this, currentToId, time);
|
||||
ScheduledTootsSyncJob.schedule(BasePixelfedComposeActivity.this, currentToId, time);
|
||||
resetForNextToot();
|
||||
}
|
||||
|
||||
|
@ -1277,7 +1306,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
isSensitive = false;
|
||||
toot_sensitive.setVisibility(View.GONE);
|
||||
currentToId = -1;
|
||||
Toasty.info(PixelfedComposeActivity.this, getString(R.string.toot_scheduled), Toast.LENGTH_LONG).show();
|
||||
Toasty.info(BasePixelfedComposeActivity.this, getString(R.string.toot_scheduled), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1315,7 +1344,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
String filename = FileNameCleaner.cleanFileName(url);
|
||||
upload_media.setEnabled(false);
|
||||
toot_it.setEnabled(false);
|
||||
upload(PixelfedComposeActivity.this, pixelfed_story.isChecked(), uri, filename, uploadReceiver);
|
||||
upload(BasePixelfedComposeActivity.this, pixelfed_story.isChecked(), account, uri, filename, uploadReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1342,10 +1371,10 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
|
||||
private void tootVisibilityDialog() {
|
||||
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(BasePixelfedComposeActivity.this, style);
|
||||
dialog.setTitle(R.string.toot_visibility_tilte);
|
||||
final String[] stringArray = getResources().getStringArray(R.array.toot_visibility);
|
||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(PixelfedComposeActivity.this, android.R.layout.simple_list_item_1, stringArray);
|
||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(BasePixelfedComposeActivity.this, android.R.layout.simple_list_item_1, stringArray);
|
||||
dialog.setNegativeButton(R.string.cancel, (dialog12, position) -> dialog12.dismiss());
|
||||
dialog.setAdapter(arrayAdapter, (dialog1, position) -> {
|
||||
switch (position) {
|
||||
|
@ -1401,14 +1430,10 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
} else if (initialContent.trim().equals(toot_content.getText().toString().trim())) {
|
||||
finish();
|
||||
} else {
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BasePixelfedComposeActivity.this, style);
|
||||
dialogBuilder.setMessage(R.string.save_draft);
|
||||
dialogBuilder.setPositiveButton(R.string.save, (dialog, id) -> {
|
||||
if (accountReply == null) {
|
||||
storeToot(true, false);
|
||||
} else {
|
||||
storeToot(false, false);
|
||||
}
|
||||
storeToot(accountReply == null, false);
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
});
|
||||
|
@ -1443,6 +1468,9 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (apiResponse.getError().getStatusCode() == -33) {
|
||||
storeToot(false, true);
|
||||
} else {
|
||||
if (apiResponse.getError().getStatusCode() == 404) {
|
||||
storeToot(false, true);
|
||||
}
|
||||
showAToast(apiResponse.getError().getError());
|
||||
return;
|
||||
}
|
||||
|
@ -1453,10 +1481,10 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (apiResponse.getError() == null || apiResponse.getError().getStatusCode() != -33) {
|
||||
if (restored != -1) {
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
new StatusStoredDAO(PixelfedComposeActivity.this, db).remove(restored);
|
||||
new StatusStoredDAO(BasePixelfedComposeActivity.this, db).remove(restored);
|
||||
} else if (currentToId != -1) {
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
new StatusStoredDAO(PixelfedComposeActivity.this, db).remove(currentToId);
|
||||
new StatusStoredDAO(BasePixelfedComposeActivity.this, db).remove(currentToId);
|
||||
}
|
||||
}
|
||||
//Clear the toot
|
||||
|
@ -1479,17 +1507,17 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (scheduledstatus == null && !isScheduled) {
|
||||
boolean display_confirm = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONFIRM, true);
|
||||
if (display_confirm) {
|
||||
Toasty.success(PixelfedComposeActivity.this, getString(R.string.toot_sent), Toast.LENGTH_LONG).show();
|
||||
Toasty.success(BasePixelfedComposeActivity.this, getString(R.string.toot_sent), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else
|
||||
Toasty.success(PixelfedComposeActivity.this, getString(R.string.toot_scheduled), Toast.LENGTH_LONG).show();
|
||||
Toasty.success(BasePixelfedComposeActivity.this, getString(R.string.toot_scheduled), Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
if (apiResponse.getError().getStatusCode() == -33)
|
||||
Toasty.info(PixelfedComposeActivity.this, getString(R.string.toast_toot_saved_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.info(BasePixelfedComposeActivity.this, getString(R.string.toast_toot_saved_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
toot_it.setEnabled(true);
|
||||
//It's a reply, so the user will be redirect to its answer
|
||||
Intent intent = new Intent(PixelfedComposeActivity.this, MainActivity.class);
|
||||
Intent intent = new Intent(BasePixelfedComposeActivity.this, MainActivity.class);
|
||||
intent.putExtra(Helper.INTENT_ACTION, Helper.HOME_TIMELINE_INTENT);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
@ -1507,7 +1535,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
final List<Account> accounts = apiResponse.getAccounts();
|
||||
if (accounts != null && accounts.size() > 0) {
|
||||
int currentCursorPosition = toot_content.getSelectionStart();
|
||||
AccountsSearchAdapter accountsListAdapter = new AccountsSearchAdapter(PixelfedComposeActivity.this, accounts);
|
||||
AccountsSearchAdapter accountsListAdapter = new AccountsSearchAdapter(BasePixelfedComposeActivity.this, accounts);
|
||||
toot_content.setThreshold(1);
|
||||
toot_content.setAdapter(accountsListAdapter);
|
||||
final String oldContent = toot_content.getText().toString();
|
||||
|
@ -1540,7 +1568,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
toot_content.setText(newContent);
|
||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||
toot_content.setSelection(newPosition);
|
||||
AccountsSearchAdapter accountsListAdapter1 = new AccountsSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
||||
AccountsSearchAdapter accountsListAdapter1 = new AccountsSearchAdapter(BasePixelfedComposeActivity.this, new ArrayList<>());
|
||||
toot_content.setThreshold(1);
|
||||
toot_content.setAdapter(accountsListAdapter1);
|
||||
});
|
||||
|
@ -1572,7 +1600,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
|
||||
if (emojis != null && emojis.size() > 0) {
|
||||
int currentCursorPosition = toot_content.getSelectionStart();
|
||||
EmojisSearchAdapter emojisSearchAdapter = new EmojisSearchAdapter(PixelfedComposeActivity.this, emojis);
|
||||
EmojisSearchAdapter emojisSearchAdapter = new EmojisSearchAdapter(BasePixelfedComposeActivity.this, emojis);
|
||||
toot_content.setThreshold(1);
|
||||
toot_content.setAdapter(emojisSearchAdapter);
|
||||
final String oldContent = toot_content.getText().toString();
|
||||
|
@ -1604,7 +1632,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
toot_content.setText(newContent);
|
||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||
toot_content.setSelection(newPosition);
|
||||
EmojisSearchAdapter emojisSearchAdapter1 = new EmojisSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
||||
EmojisSearchAdapter emojisSearchAdapter1 = new EmojisSearchAdapter(BasePixelfedComposeActivity.this, new ArrayList<>());
|
||||
toot_content.setThreshold(1);
|
||||
toot_content.setAdapter(emojisSearchAdapter1);
|
||||
|
||||
|
@ -1627,7 +1655,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
final List<String> tags = results.getHashtags();
|
||||
if (tags != null && tags.size() > 0) {
|
||||
int currentCursorPosition = toot_content.getSelectionStart();
|
||||
TagsSearchAdapter tagsSearchAdapter = new TagsSearchAdapter(PixelfedComposeActivity.this, tags);
|
||||
TagsSearchAdapter tagsSearchAdapter = new TagsSearchAdapter(BasePixelfedComposeActivity.this, tags);
|
||||
toot_content.setThreshold(1);
|
||||
toot_content.setAdapter(tagsSearchAdapter);
|
||||
final String oldContent = toot_content.getText().toString();
|
||||
|
@ -1664,7 +1692,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
toot_content.setText(newContent);
|
||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||
toot_content.setSelection(newPosition);
|
||||
TagsSearchAdapter tagsSearchAdapter1 = new TagsSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
||||
TagsSearchAdapter tagsSearchAdapter1 = new TagsSearchAdapter(BasePixelfedComposeActivity.this, new ArrayList<>());
|
||||
toot_content.setThreshold(1);
|
||||
toot_content.setAdapter(tagsSearchAdapter1);
|
||||
|
||||
|
@ -1674,13 +1702,13 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
|
||||
private void restoreToot(long id) {
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
StoredStatus draft = new StatusStoredDAO(PixelfedComposeActivity.this, db).getStatus(id);
|
||||
StoredStatus draft = new StatusStoredDAO(BasePixelfedComposeActivity.this, db).getStatus(id);
|
||||
if (draft == null)
|
||||
return;
|
||||
Status status = draft.getStatus();
|
||||
//Retrieves attachments
|
||||
if (removed) {
|
||||
new StatusStoredDAO(PixelfedComposeActivity.this, db).remove(draft.getId());
|
||||
new StatusStoredDAO(BasePixelfedComposeActivity.this, db).remove(draft.getId());
|
||||
}
|
||||
restored = id;
|
||||
attachments = status.getMedia_attachments();
|
||||
|
@ -1700,7 +1728,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
content = Html.fromHtml(content).toString();
|
||||
}
|
||||
if (attachments != null && attachments.size() > 0) {
|
||||
sliderAdapter = new SliderAdapter(new WeakReference<>(PixelfedComposeActivity.this), true, attachments);
|
||||
sliderAdapter = new SliderAdapter(new WeakReference<>(BasePixelfedComposeActivity.this), true, attachments);
|
||||
imageSlider.setIndicatorAnimation(IndicatorAnimations.WORM);
|
||||
imageSlider.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION);
|
||||
imageSlider.setSliderAdapter(sliderAdapter);
|
||||
|
@ -1768,7 +1796,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (position > attachments.size()) {
|
||||
position = attachments.size();
|
||||
}
|
||||
sliderAdapter = new SliderAdapter(new WeakReference<>(PixelfedComposeActivity.this), true, attachments);
|
||||
sliderAdapter = new SliderAdapter(new WeakReference<>(BasePixelfedComposeActivity.this), true, attachments);
|
||||
imageSlider.setIndicatorAnimation(IndicatorAnimations.WORM);
|
||||
imageSlider.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION);
|
||||
imageSlider.setSliderAdapter(sliderAdapter);
|
||||
|
@ -1795,7 +1823,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
String url = attachment.getPreview_url();
|
||||
if (url == null || url.trim().equals(""))
|
||||
url = attachment.getUrl();
|
||||
final ImageView imageView = new ImageView(PixelfedComposeActivity.this);
|
||||
final ImageView imageView = new ImageView(BasePixelfedComposeActivity.this);
|
||||
Random rand = new Random();
|
||||
int n = rand.nextInt(10000000);
|
||||
imageView.setId(n);
|
||||
|
@ -1803,7 +1831,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
|
||||
LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
|
||||
imParams.setMargins(20, 5, 20, 5);
|
||||
imParams.height = (int) Helper.convertDpToPixel(100, PixelfedComposeActivity.this);
|
||||
imParams.height = (int) Helper.convertDpToPixel(100, BasePixelfedComposeActivity.this);
|
||||
imageView.setAdjustViewBounds(true);
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
|
||||
|
@ -1886,27 +1914,29 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
toot.setSensitive(isSensitive);
|
||||
toot.setMedia_attachments(attachments);
|
||||
toot.setVisibility(visibility);
|
||||
toot.setContent(PixelfedComposeActivity.this, currentContent);
|
||||
toot.setContent(BasePixelfedComposeActivity.this, currentContent);
|
||||
|
||||
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
String userId = accountReply != null ? accountReply.getId() : account.getId();
|
||||
String instance = accountReply != null ? accountReply.getInstance() : account.getInstance();
|
||||
try {
|
||||
if (currentToId == -1) {
|
||||
currentToId = new StatusStoredDAO(PixelfedComposeActivity.this, db).insertStatus(toot, null);
|
||||
currentToId = new StatusStoredDAO(BasePixelfedComposeActivity.this, db).insertStatus(toot, null, userId, instance);
|
||||
|
||||
} else {
|
||||
StoredStatus storedStatus = new StatusStoredDAO(PixelfedComposeActivity.this, db).getStatus(currentToId);
|
||||
StoredStatus storedStatus = new StatusStoredDAO(BasePixelfedComposeActivity.this, db).getStatus(currentToId);
|
||||
if (storedStatus != null) {
|
||||
new StatusStoredDAO(PixelfedComposeActivity.this, db).updateStatus(currentToId, toot);
|
||||
new StatusStoredDAO(BasePixelfedComposeActivity.this, db).updateStatus(currentToId, toot);
|
||||
} else { //Might have been deleted, so it needs insertion
|
||||
new StatusStoredDAO(PixelfedComposeActivity.this, db).insertStatus(toot, null);
|
||||
new StatusStoredDAO(BasePixelfedComposeActivity.this, db).insertStatus(toot, null, userId, instance);
|
||||
}
|
||||
}
|
||||
if (message)
|
||||
Toasty.success(PixelfedComposeActivity.this, getString(R.string.toast_toot_saved), Toast.LENGTH_LONG).show();
|
||||
Toasty.success(BasePixelfedComposeActivity.this, getString(R.string.toast_toot_saved), Toast.LENGTH_LONG).show();
|
||||
} catch (Exception e) {
|
||||
if (message)
|
||||
Toasty.error(PixelfedComposeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
Toasty.error(BasePixelfedComposeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1923,7 +1953,11 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
active = false;
|
||||
}
|
||||
|
||||
static class asyncPicture extends AsyncTask<Void, Void, Void> {
|
||||
protected abstract void launchPhotoEditor(Uri uri);
|
||||
|
||||
protected abstract void displayEmojiPopup();
|
||||
|
||||
static class asyncPicture {
|
||||
|
||||
String commpressedFilePath = null;
|
||||
WeakReference<Activity> activityWeakReference;
|
||||
|
@ -1932,37 +1966,31 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
UploadServiceSingleBroadcastReceiver uploadReceiver;
|
||||
String filename;
|
||||
boolean pixelfedStory;
|
||||
Account account;
|
||||
|
||||
asyncPicture(Activity activity, boolean pixelfedStory, Uri uri, String filename, UploadServiceSingleBroadcastReceiver uploadReceiver) {
|
||||
asyncPicture(Activity activity, boolean pixelfedStory, Account account, Uri uri, String filename, UploadServiceSingleBroadcastReceiver uploadReceiver) {
|
||||
this.activityWeakReference = new WeakReference<>(activity);
|
||||
this.uriFile = uri;
|
||||
this.uploadReceiver = uploadReceiver;
|
||||
this.filename = filename;
|
||||
this.pixelfedStory = pixelfedStory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
this.account = account;
|
||||
if (uriFile == null) {
|
||||
Toasty.error(activityWeakReference.get(), activityWeakReference.get().getString(R.string.toast_error), Toast.LENGTH_SHORT).show();
|
||||
error = true;
|
||||
}
|
||||
activityWeakReference.get().findViewById(R.id.compression_loader).setVisibility(View.VISIBLE);
|
||||
|
||||
doInBackground();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
protected void doInBackground() {
|
||||
new Thread(() -> {
|
||||
if (error) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
commpressedFilePath = Helper.compressImagePath(activityWeakReference.get(), uriFile);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
activityWeakReference.get().findViewById(R.id.compression_loader).setVisibility(View.GONE);
|
||||
if (!error) {
|
||||
if (commpressedFilePath != null) {
|
||||
|
@ -1976,9 +2004,13 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
filename = Helper.getFileName(this.activityWeakReference.get(), uriFile);
|
||||
}
|
||||
filesMap.put(filename, uriFile);
|
||||
upload(activityWeakReference.get(), pixelfedStory, uriFile, filename, uploadReceiver);
|
||||
upload(activityWeakReference.get(), pixelfedStory, account, uriFile, filename, uploadReceiver);
|
||||
}
|
||||
};
|
||||
mainHandler.post(myRunnable);
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|