Reformat code

This commit is contained in:
tom79 2019-09-06 17:55:14 +02:00
parent 3ff4c230ae
commit 9c187e19bb
669 changed files with 16675 additions and 14543 deletions

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Copyright 2017 Thomas Schneider Copyright 2017 Thomas Schneider
This file is a part of Fedilab This file is a part of Fedilab
@ -21,7 +20,10 @@
package="app.fedilab.android"> package="app.fedilab.android">
<uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission <uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" android:name="android.permission.ACCESS_COARSE_LOCATION"
@ -33,7 +35,10 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<application <application
android:name="app.fedilab.android.activities.MainApplication" android:name="app.fedilab.android.activities.MainApplication"
android:allowBackup="false" android:allowBackup="false"
@ -51,31 +56,39 @@
android:name="app.fedilab.android.services.LiveNotificationService" android:name="app.fedilab.android.services.LiveNotificationService"
android:exported="false" /> android:exported="false" />
<service android:name="app.fedilab.android.services.BackupStatusService" <service
android:name="app.fedilab.android.services.BackupStatusService"
android:exported="false" /> android:exported="false" />
<service android:name="app.fedilab.android.services.BackupStatusInDataBaseService" <service
android:name="app.fedilab.android.services.BackupStatusInDataBaseService"
android:exported="false" /> android:exported="false" />
<service android:name="app.fedilab.android.services.BackupNotificationInDataBaseService" <service
android:name="app.fedilab.android.services.BackupNotificationInDataBaseService"
android:exported="false" /> android:exported="false" />
<receiver android:name="app.fedilab.android.services.RestartLiveNotificationReceiver"
<receiver
android:name="app.fedilab.android.services.RestartLiveNotificationReceiver"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="RestartLiveNotificationService" /> <action android:name="RestartLiveNotificationService" />
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="app.fedilab.android.services.PeertubeUploadReceiver" <receiver
android:name="app.fedilab.android.services.PeertubeUploadReceiver"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="app.fedilab.android.uploadservice.broadcast.status" /> <action android:name="app.fedilab.android.uploadservice.broadcast.status" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="app.fedilab.android.services.StopLiveNotificationReceiver" <receiver
android:name="app.fedilab.android.services.StopLiveNotificationReceiver"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="StopLiveNotificationReceiver" /> <action android:name="StopLiveNotificationReceiver" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<service <service
android:name="app.fedilab.android.services.StreamingHomeTimelineService" android:name="app.fedilab.android.services.StreamingHomeTimelineService"
android:exported="false" /> android:exported="false" />
@ -105,17 +118,20 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" /> <data android:mimeType="image/*" />
<data android:mimeType="video/*" /> <data android:mimeType="video/*" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" /> <action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" /> <data android:mimeType="image/*" />
<data android:mimeType="video/*" /> <data android:mimeType="video/*" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<!-- The app is a good candidate for URL in https://domain.name/@xxxxxx--> <!-- The app is a good candidate for URL in https://domain.name/@xxxxxx-->
@ -123,249 +139,262 @@
<data <data
android:scheme="https" android:scheme="https"
android:host="*" android:host="*"
android:pathPrefix="/@" android:pathPrefix="/@" />
/>
</intent-filter> </intent-filter>
<intent-filter <intent-filter>
>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" /> <data android:scheme="file" />
<data android:mimeType="*/*" /> <data android:mimeType="*/*" />
<data android:host="*" /> <data android:host="*" />
<data android:pathPattern=".*\\.fedilab" /> <data android:pathPattern=".*\\.fedilab" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="app.fedilab.android.activities.MastodonRegisterActivity" <activity
android:name="app.fedilab.android.activities.MastodonRegisterActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.MastodonShareRegisterActivity" android:name="app.fedilab.android.activities.MastodonShareRegisterActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name">
>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:host="fedilab.app" android:scheme="https" android:pathPattern="/registration_helper/.*"/>
<data
android:host="fedilab.app"
android:scheme="https"
android:pathPattern="/registration_helper/.*" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="app.fedilab.android.activities.LoginActivity" <activity
android:name="app.fedilab.android.activities.LoginActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name">
>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:host="backtomastalab" android:scheme="mastalab" />
<data
android:host="backtomastalab"
android:scheme="mastalab" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="app.fedilab.android.activities.ShowAccountActivity" <activity
android:name="app.fedilab.android.activities.ShowAccountActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.TootInfoActivity" android:name="app.fedilab.android.activities.TootInfoActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.HashTagActivity" android:name="app.fedilab.android.activities.HashTagActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.WebviewConnectActivity"
android:label="@string/app_name" android:label="@string/app_name"
/> android:configChanges="keyboardHidden|orientation|screenSize" />
<activity android:name="app.fedilab.android.activities.WebviewConnectActivity" <activity
android:name="app.fedilab.android.activities.PeertubeActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize" />
/> <activity
<activity android:name="app.fedilab.android.activities.PeertubeActivity" android:name="app.fedilab.android.activities.PlaylistsActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize" />
/> <activity
<activity android:name="app.fedilab.android.activities.PlaylistsActivity" android:name="app.fedilab.android.activities.PhotoEditorActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize" />
/> <activity
<activity android:name="app.fedilab.android.activities.PhotoEditorActivity" android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize"
/>
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" /> android:theme="@style/Base.Theme.AppCompat" />
<activity android:name="app.fedilab.android.activities.WebviewActivity" <activity
android:name="app.fedilab.android.activities.WebviewActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize" />
/> <activity
<activity android:name="app.fedilab.android.activities.MediaActivity" android:name="app.fedilab.android.activities.MediaActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/Theme.Transparent" android:theme="@style/Theme.Transparent"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:noHistory="true" android:noHistory="true" />
/> <activity
<activity android:name="app.fedilab.android.activities.SearchResultActivity" android:name="app.fedilab.android.activities.SearchResultActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.SearchResultTabActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.ListActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.WhoToFollowActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.ShowConversationActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.OwnerStatusActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
/> android:launchMode="singleTask" />
<activity android:name="app.fedilab.android.activities.SearchResultTabActivity" <activity
android:name="app.fedilab.android.activities.OwnerNotificationChartsActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
/> android:launchMode="singleTask" />
<activity android:name="app.fedilab.android.activities.ListActivity" <activity
android:name="app.fedilab.android.activities.OwnerChartsActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
/> android:launchMode="singleTask" />
<activity android:name="app.fedilab.android.activities.WhoToFollowActivity" <activity
android:name="app.fedilab.android.activities.OwnerNotificationActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
/> android:launchMode="singleTask" />
<activity android:name="app.fedilab.android.activities.ShowConversationActivity" <activity
android:name="app.fedilab.android.activities.LanguageActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.AboutActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.HideItemActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
<activity
android:name="app.fedilab.android.activities.SettingsActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
/> android:launchMode="singleTop" />
<activity android:name="app.fedilab.android.activities.OwnerStatusActivity" <activity
android:name="app.fedilab.android.activities.AdminActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
android:launchMode="singleTask" <activity
/> android:name="app.fedilab.android.activities.AccountReportActivity"
<activity android:name="app.fedilab.android.activities.OwnerNotificationChartsActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
android:launchMode="singleTask" <activity
/> android:name="app.fedilab.android.activities.ReorderTimelinesActivity"
<activity android:name="app.fedilab.android.activities.OwnerChartsActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
android:launchMode="singleTask" <activity
/> android:name="app.fedilab.android.activities.OpencollectiveActivity"
<activity android:name="app.fedilab.android.activities.OwnerNotificationActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
android:launchMode="singleTask" <activity
/> android:name="app.fedilab.android.activities.PartnerShipActivity"
<activity android:name="app.fedilab.android.activities.LanguageActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.AboutActivity" android:name="app.fedilab.android.activities.InstanceActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.HideItemActivity" android:name="app.fedilab.android.activities.PrivacyActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.SettingsActivity" android:name="app.fedilab.android.activities.TootActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
/>
<activity android:name="app.fedilab.android.activities.AdminActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.AccountReportActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.ReorderTimelinesActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.OpencollectiveActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.PartnerShipActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.InstanceActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.PrivacyActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.TootActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustResize"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme_NoActionBar_Fedilab" android:theme="@style/AppTheme_NoActionBar_Fedilab" />
/> <activity
<activity android:name="app.fedilab.android.activities.EditProfileActivity" android:name="app.fedilab.android.activities.EditProfileActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.CustomSharingActivity" android:name="app.fedilab.android.activities.CustomSharingActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.InstanceHealthActivity" android:name="app.fedilab.android.activities.InstanceHealthActivity"
android:theme="@style/Base.V7.Theme.AppCompat.Dialog" android:theme="@style/Base.V7.Theme.AppCompat.Dialog"
android:excludeFromRecents="true" /> android:excludeFromRecents="true" />
<activity android:name="app.fedilab.android.activities.ProxyActivity" <activity
android:name="app.fedilab.android.activities.ProxyActivity"
android:theme="@style/Base.V7.Theme.AppCompat.Dialog" android:theme="@style/Base.V7.Theme.AppCompat.Dialog"
android:excludeFromRecents="true" /> android:excludeFromRecents="true" />
<activity android:name="app.fedilab.android.activities.ManageAccountsInListActivity" <activity
android:name="app.fedilab.android.activities.ManageAccountsInListActivity"
android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan"
android:theme="@style/Base.V7.Theme.AppCompat.Dialog" android:theme="@style/Base.V7.Theme.AppCompat.Dialog"
android:excludeFromRecents="true" /> android:excludeFromRecents="true" />
<activity android:name="app.fedilab.android.activities.TagCacheActivity" <activity
android:name="app.fedilab.android.activities.TagCacheActivity"
android:theme="@style/Base.V7.Theme.AppCompat.Dialog" android:theme="@style/Base.V7.Theme.AppCompat.Dialog"
android:excludeFromRecents="true" android:excludeFromRecents="true" />
/> <activity
<activity android:name="app.fedilab.android.activities.PeertubeUploadActivity" android:name="app.fedilab.android.activities.PeertubeUploadActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.MutedInstanceActivity" android:name="app.fedilab.android.activities.MutedInstanceActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.PeertubeEditUploadActivity" android:name="app.fedilab.android.activities.PeertubeEditUploadActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/> <activity
<activity android:name="app.fedilab.android.activities.GroupActivity" android:name="app.fedilab.android.activities.GroupActivity"
android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name" />
/>
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider" android:authorities="${applicationId}.fileProvider"

View File

@ -22,8 +22,10 @@ import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.UnderlineSpan; import android.text.style.UnderlineSpan;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -121,7 +123,8 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
String version = pInfo.versionName; String version = pInfo.versionName;
about_version.setText(getResources().getString(R.string.about_vesrion, version)); about_version.setText(getResources().getString(R.string.about_vesrion, version));
} catch (PackageManager.NameNotFoundException ignored) {} } catch (PackageManager.NameNotFoundException ignored) {
}
ExpandableHeightListView lv_developers = findViewById(R.id.lv_developers); ExpandableHeightListView lv_developers = findViewById(R.id.lv_developers);
ExpandableHeightListView lv_designers = findViewById(R.id.lv_designers); ExpandableHeightListView lv_designers = findViewById(R.id.lv_designers);
@ -225,7 +228,6 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
} }
TextView about_website = findViewById(R.id.about_website); TextView about_website = findViewById(R.id.about_website);
about_website.setOnClickListener(new View.OnClickListener() { about_website.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -236,9 +238,6 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
}); });
setTitle(R.string.action_about); setTitle(R.string.action_about);
lv_contributors.setExpanded(true); lv_contributors.setExpanded(true);
lv_developers.setExpanded(true); lv_developers.setExpanded(true);

View File

@ -340,9 +340,6 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
} }
username.setText(String.format("@%s", accountAdmin.getAccount().getAcct())); username.setText(String.format("@%s", accountAdmin.getAccount().getAcct()));
email.setText(accountAdmin.getEmail()); email.setText(accountAdmin.getEmail());

View File

@ -25,6 +25,7 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@ -33,7 +34,9 @@ import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask; import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
import app.fedilab.android.fragments.DisplayAdminAccountsFragment; import app.fedilab.android.fragments.DisplayAdminAccountsFragment;
@ -286,7 +289,6 @@ public class AdminActivity extends BaseActivity {
}); });
PagerAdapter mPagerAdapter = new AdminPagerAdapter(getSupportFragmentManager()); PagerAdapter mPagerAdapter = new AdminPagerAdapter(getSupportFragmentManager());
admin_viewpager.setAdapter(mPagerAdapter); admin_viewpager.setAdapter(mPagerAdapter);
admin_viewpager.setOffscreenPageLimit(2); admin_viewpager.setOffscreenPageLimit(2);

View File

@ -5,8 +5,11 @@ import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;

View File

@ -37,10 +37,12 @@ import android.os.Parcelable;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView; import com.google.android.material.navigation.NavigationView;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -188,8 +190,6 @@ public abstract class BaseMainActivity extends BaseActivity
public static boolean show_boosts, show_replies, show_art_nsfw; public static boolean show_boosts, show_replies, show_art_nsfw;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -276,7 +276,8 @@ public abstract class BaseMainActivity extends BaseActivity
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
try { try {
new RetrievePeertubeInformationAsyncTask(getApplicationContext()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrievePeertubeInformationAsyncTask(getApplicationContext()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}catch (Exception ignored){} } catch (Exception ignored) {
}
} }
//For old Mastodon releases that can't pin, this support could be removed //For old Mastodon releases that can't pin, this support could be removed
Helper.canPin = false; Helper.canPin = false;
@ -432,7 +433,6 @@ public abstract class BaseMainActivity extends BaseActivity
iconLocal.setImageResource(R.drawable.ic_home); iconLocal.setImageResource(R.drawable.ic_home);
iconSub.setContentDescription(getString(R.string.subscriptions)); iconSub.setContentDescription(getString(R.string.subscriptions));
iconOver.setContentDescription(getString(R.string.overview)); iconOver.setContentDescription(getString(R.string.overview));
iconTrend.setContentDescription(getString(R.string.trending)); iconTrend.setContentDescription(getString(R.string.trending));
@ -463,8 +463,6 @@ public abstract class BaseMainActivity extends BaseActivity
tabLayout.addTab(pTabLocal); tabLayout.addTab(pTabLocal);
adapter = new PagerAdapter adapter = new PagerAdapter
(getSupportFragmentManager(), tabLayout.getTabCount()); (getSupportFragmentManager(), tabLayout.getTabCount());
viewPager.setAdapter(adapter); viewPager.setAdapter(adapter);
@ -537,7 +535,6 @@ public abstract class BaseMainActivity extends BaseActivity
//TabLayout.Tab pfTabDiscover = tabLayout.newTab(); //TabLayout.Tab pfTabDiscover = tabLayout.newTab();
pfTabHome.setCustomView(R.layout.tab_badge); pfTabHome.setCustomView(R.layout.tab_badge);
pfTabLocal.setCustomView(R.layout.tab_badge); pfTabLocal.setCustomView(R.layout.tab_badge);
pfTabNotification.setCustomView(R.layout.tab_badge); pfTabNotification.setCustomView(R.layout.tab_badge);
@ -569,7 +566,6 @@ public abstract class BaseMainActivity extends BaseActivity
iconDiscover.setImageResource(R.drawable.ic_people);*/ iconDiscover.setImageResource(R.drawable.ic_people);*/
iconHome.setContentDescription(getString(R.string.home_menu)); iconHome.setContentDescription(getString(R.string.home_menu));
// iconDiscover.setContentDescription(getString(R.string.overview)); // iconDiscover.setContentDescription(getString(R.string.overview));
iconLocal.setContentDescription(getString(R.string.local)); iconLocal.setContentDescription(getString(R.string.local));
@ -588,7 +584,6 @@ public abstract class BaseMainActivity extends BaseActivity
} }
tabLayout.addTab(pfTabHome); tabLayout.addTab(pfTabHome);
tabLayout.addTab(pfTabLocal); tabLayout.addTab(pfTabLocal);
tabLayout.addTab(pfTabNotification); tabLayout.addTab(pfTabNotification);
@ -861,6 +856,7 @@ public abstract class BaseMainActivity extends BaseActivity
} }
return false; return false;
} }
@Override @Override
public boolean onQueryTextChange(String newText) { public boolean onQueryTextChange(String newText) {
return false; return false;
@ -1061,9 +1057,13 @@ public abstract class BaseMainActivity extends BaseActivity
set_text_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { set_text_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
public void onStopTrackingTouch(SeekBar seekBar) {} public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override @Override
public void onStartTrackingTouch(SeekBar seekBar) {} public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
@ -1076,9 +1076,13 @@ public abstract class BaseMainActivity extends BaseActivity
}); });
set_icon_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { set_icon_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
public void onStopTrackingTouch(SeekBar seekBar) {} public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override @Override
public void onStartTrackingTouch(SeekBar seekBar) {} public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int value = 80 + progress * 5; int value = 80 + progress * 5;
@ -1228,8 +1232,6 @@ public abstract class BaseMainActivity extends BaseActivity
}); });
// Asked once for notification opt-in // Asked once for notification opt-in
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false); boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
if (!popupShown && (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)) { if (!popupShown && (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)) {
@ -1275,13 +1277,14 @@ public abstract class BaseMainActivity extends BaseActivity
}); });
try { try {
dialogBuilderOptin.show(); dialogBuilderOptin.show();
}catch (Exception ignored){}; } catch (Exception ignored) {
}
;
} }
Helper.switchLayout(BaseMainActivity.this); Helper.switchLayout(BaseMainActivity.this);
mamageNewIntent(getIntent()); mamageNewIntent(getIntent());
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
@ -1333,6 +1336,7 @@ public abstract class BaseMainActivity extends BaseActivity
/** /**
* Manages new intents * Manages new intents
*
* @param intent Intent - intent related to a notification in top bar * @param intent Intent - intent related to a notification in top bar
*/ */
private void mamageNewIntent(Intent intent) { private void mamageNewIntent(Intent intent) {
@ -1375,8 +1379,7 @@ public abstract class BaseMainActivity extends BaseActivity
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction() fragmentManager.beginTransaction()
.replace(R.id.main_app_container, fragment, fragmentTag).commit(); .replace(R.id.main_app_container, fragment, fragmentTag).commit();
} } else if (extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_INSTANCE) {
else if( extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_INSTANCE){
String instance = extras.getString(Helper.INSTANCE_NAME); String instance = extras.getString(Helper.INSTANCE_NAME);
DisplayStatusFragment statusFragment; DisplayStatusFragment statusFragment;
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -1417,8 +1420,7 @@ public abstract class BaseMainActivity extends BaseActivity
startActivity(myIntent); startActivity(myIntent);
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.REDRAW_MENU) { } else if (extras.getInt(Helper.INTENT_ACTION) == Helper.REDRAW_MENU) {
Helper.hideMenuItem(BaseMainActivity.this, navigationView.getMenu()); Helper.hideMenuItem(BaseMainActivity.this, navigationView.getMenu());
} } else if (extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_TAG) {
else if( extras.getInt(Helper.INTENT_ACTION) == Helper.SEARCH_TAG){
new SyncTimelinesAsyncTask(BaseMainActivity.this, -1, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new SyncTimelinesAsyncTask(BaseMainActivity.this, -1, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.REFRESH_TIMELINE) { } else if (extras.getInt(Helper.INTENT_ACTION) == Helper.REFRESH_TIMELINE) {
int position = 0; int position = 0;
@ -1964,7 +1966,6 @@ public abstract class BaseMainActivity extends BaseActivity
} }
@Override @Override
public void onRetrieveMetaData(boolean error, String sharedSubject, String sharedText, String image, String title, String description) { public void onRetrieveMetaData(boolean error, String sharedSubject, String sharedText, String image, String title, String description) {
Bundle b = new Bundle(); Bundle b = new Bundle();
@ -2276,6 +2277,7 @@ public abstract class BaseMainActivity extends BaseActivity
public Parcelable saveState() { public Parcelable saveState() {
return null; return null;
} }
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
@ -2407,6 +2409,7 @@ public abstract class BaseMainActivity extends BaseActivity
} }
super.destroyItem(container, position, object); super.destroyItem(container, position, object);
} }
@Override @Override
public int getCount() { public int getCount() {
return mNumOfTabs; return mNumOfTabs;
@ -2414,8 +2417,6 @@ public abstract class BaseMainActivity extends BaseActivity
} }
public void updateHomeCounter() { public void updateHomeCounter() {
int i = 0; int i = 0;
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
@ -2507,7 +2508,8 @@ public abstract class BaseMainActivity extends BaseActivity
DisplayNotificationsFragment displayNotificationsFragment = (DisplayNotificationsFragment) notifViewPager.getAdapter().instantiateItem(notifViewPager, 0); DisplayNotificationsFragment displayNotificationsFragment = (DisplayNotificationsFragment) notifViewPager.getAdapter().instantiateItem(notifViewPager, 0);
displayNotificationsFragment.updateNotificationRead(); displayNotificationsFragment.updateNotificationRead();
} }
}catch (Exception ignored){} } catch (Exception ignored) {
}
} }
@ -2526,7 +2528,8 @@ public abstract class BaseMainActivity extends BaseActivity
try { try {
Intent streamingIntent = new Intent(this, LiveNotificationService.class); Intent streamingIntent = new Intent(this, LiveNotificationService.class);
startService(streamingIntent); startService(streamingIntent);
}catch(Exception ignored){} } catch (Exception ignored) {
}
} }
} }
@ -2543,6 +2546,7 @@ public abstract class BaseMainActivity extends BaseActivity
toot.hide(); toot.hide();
} }
} }
public void tootShow() { public void tootShow() {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE || social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE || social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
toot.show(); toot.show();
@ -2552,9 +2556,6 @@ public abstract class BaseMainActivity extends BaseActivity
} }
public boolean getFloatingVisibility() { public boolean getFloatingVisibility() {
return toot.getVisibility() == View.VISIBLE; return toot.getVisibility() == View.VISIBLE;
} }

View File

@ -22,8 +22,10 @@ import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -72,6 +74,7 @@ public class CustomSharingActivity extends BaseActivity implements OnCustomShari
private String bundle_content; private String bundle_content;
private String bundle_thumbnailurl; private String bundle_thumbnailurl;
private String bundle_creator; private String bundle_creator;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -30,12 +30,14 @@ import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -86,7 +88,6 @@ import app.fedilab.android.interfaces.OnUpdateCredentialInterface;
public class EditProfileActivity extends BaseActivity implements OnRetrieveAccountInterface, OnUpdateCredentialInterface { public class EditProfileActivity extends BaseActivity implements OnRetrieveAccountInterface, OnUpdateCredentialInterface {
private EditText set_profile_name, set_profile_description; private EditText set_profile_name, set_profile_description;
private ImageView set_profile_picture, set_header_picture; private ImageView set_profile_picture, set_header_picture;
private Button set_change_profile_picture, set_change_header_picture, set_profile_save; private Button set_change_profile_picture, set_change_header_picture, set_profile_save;
@ -158,7 +159,6 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
Account account = new AccountDAO(getApplicationContext(), db).getUniqAccount(userId, instance); Account account = new AccountDAO(getApplicationContext(), db).getUniqAccount(userId, instance);
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar); Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
set_profile_name = findViewById(R.id.set_profile_name); set_profile_name = findViewById(R.id.set_profile_name);
@ -242,9 +242,13 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
set_sensitive_content.setChecked(false); set_sensitive_content.setChecked(false);
set_profile_description.addTextChangedListener(new TextWatcher() { set_profile_description.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {} public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) {} public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (s.length() > 160) { if (s.length() > 160) {
@ -300,9 +304,13 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
set_profile_name.addTextChangedListener(new TextWatcher() { set_profile_name.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {} public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) {} public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (s.length() > 30) { if (s.length() > 30) {

View File

@ -135,8 +135,7 @@ public class GroupActivity extends BaseActivity implements OnRetrieveFeedsInterf
mLayoutManager = new LinearLayoutManager(this); mLayoutManager = new LinearLayoutManager(this);
lv_status.setLayoutManager(mLayoutManager); lv_status.setLayoutManager(mLayoutManager);
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
{
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();
int totalItemCount = mLayoutManager.getItemCount(); int totalItemCount = mLayoutManager.getItemCount();
@ -157,6 +156,7 @@ public class GroupActivity extends BaseActivity implements OnRetrieveFeedsInterf
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.GNU_GROUP_TIMELINE, groupname, null, max_id, GroupActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.GNU_GROUP_TIMELINE, groupname, null, max_id, GroupActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {

View File

@ -20,11 +20,13 @@ import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -133,8 +135,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
mLayoutManager = new LinearLayoutManager(this); mLayoutManager = new LinearLayoutManager(this);
lv_status.setLayoutManager(mLayoutManager); lv_status.setLayoutManager(mLayoutManager);
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
{
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();
int totalItemCount = mLayoutManager.getItemCount(); int totalItemCount = mLayoutManager.getItemCount();
@ -155,6 +156,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.TAG, tag, null, max_id, HashTagActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.TAG, tag, null, max_id, HashTagActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {

View File

@ -27,8 +27,10 @@ import android.widget.CheckBox;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.client.Entities.MainMenuItem; import app.fedilab.android.client.Entities.MainMenuItem;

View File

@ -23,9 +23,12 @@ import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;

View File

@ -15,7 +15,6 @@
package app.fedilab.android.activities; package app.fedilab.android.activities;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -30,7 +29,9 @@ import android.graphics.drawable.BitmapDrawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.UnderlineSpan; import android.text.style.UnderlineSpan;
import android.view.MenuItem; import android.view.MenuItem;
@ -198,11 +199,11 @@ public class InstanceHealthActivity extends BaseActivity {
} }
}); });
} catch (Exception ignored) {} } catch (Exception ignored) {
}
} }
}).start(); }).start();
} }
} }

View File

@ -22,8 +22,10 @@ import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -113,7 +115,6 @@ public class LanguageActivity extends BaseActivity implements OnRetrieveRemoteAc
setContentView(R.layout.activity_language); setContentView(R.layout.activity_language);
Button about_translation = findViewById(R.id.about_translation); Button about_translation = findViewById(R.id.about_translation);
@ -137,7 +138,6 @@ public class LanguageActivity extends BaseActivity implements OnRetrieveRemoteAc
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "ButterflyOfFire", "mstdn.fr", LanguageActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveRemoteDataAsyncTask(getApplicationContext(), "ButterflyOfFire", "mstdn.fr", LanguageActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
String currentLanguage = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, Helper.localeToStringStorage(Locale.getDefault())); String currentLanguage = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, Helper.localeToStringStorage(Locale.getDefault()));
Locale currentLocale = Helper.restoreLocaleFromString(currentLanguage); Locale currentLocale = Helper.restoreLocaleFromString(currentLanguage);
final Spinner set_change_locale = findViewById(R.id.set_change_locale); final Spinner set_change_locale = findViewById(R.id.set_change_locale);
@ -250,6 +250,7 @@ public class LanguageActivity extends BaseActivity implements OnRetrieveRemoteAc
} }
count2++; count2++;
} }
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {

View File

@ -20,6 +20,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -28,6 +29,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.InputFilter; import android.text.InputFilter;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -137,8 +139,7 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
{
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();

View File

@ -27,12 +27,15 @@ import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.textfield.TextInputLayout; import com.google.android.material.textfield.TextInputLayout;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
@ -170,9 +173,14 @@ public class LoginActivity extends BaseActivity {
editor.apply(); editor.apply();
//Update the account with the token; //Update the account with the token;
new UpdateAccountInfoAsyncTask(LoginActivity.this, token, client_id, client_secret, refresh_token, instance, socialNetwork).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new UpdateAccountInfoAsyncTask(LoginActivity.this, token, client_id, client_secret, refresh_token, instance, socialNetwork).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} catch (JSONException ignored) {ignored.printStackTrace();} } catch (JSONException ignored) {
} catch (Exception ignored) {ignored.printStackTrace();} ignored.printStackTrace();
}}).start(); }
} catch (Exception ignored) {
ignored.printStackTrace();
}
}
}).start();
} else { } else {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
@ -342,7 +350,8 @@ public class LoginActivity extends BaseActivity {
} else { } else {
Toasty.error(getApplicationContext(), getString(R.string.client_error), Toast.LENGTH_LONG).show(); Toasty.error(getApplicationContext(), getString(R.string.client_error), Toast.LENGTH_LONG).show();
} }
}}); }
});
} }
@ -538,7 +547,8 @@ public class LoginActivity extends BaseActivity {
try { try {
URL url = new URL(instanceFromField); URL url = new URL(instanceFromField);
host = url.getHost(); host = url.getHost();
} catch (MalformedURLException ignored) { } } catch (MalformedURLException ignored) {
}
try { try {
instance = URLEncoder.encode(host, "utf-8"); instance = URLEncoder.encode(host, "utf-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
@ -765,7 +775,6 @@ public class LoginActivity extends BaseActivity {
} }
private void manageClient(String client_id, String client_secret, String id) { private void manageClient(String client_id, String client_secret, String id) {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
@ -896,7 +905,6 @@ public class LoginActivity extends BaseActivity {
} }
private void showcaseInstance(final boolean loop) { private void showcaseInstance(final boolean loop) {
BubbleShowCaseBuilder showCaseBuilder = new BubbleShowCaseBuilder(LoginActivity.this) BubbleShowCaseBuilder showCaseBuilder = new BubbleShowCaseBuilder(LoginActivity.this)
.title(getString(R.string.instance)) .title(getString(R.string.instance))
@ -915,6 +923,7 @@ public class LoginActivity extends BaseActivity {
bubbleShowCase.finishSequence(); bubbleShowCase.finishSequence();
} }
} }
@Override @Override
public void onCloseActionImageClick(BubbleShowCase bubbleShowCase) { public void onCloseActionImageClick(BubbleShowCase bubbleShowCase) {
if (loop) { if (loop) {

View File

@ -19,6 +19,7 @@ import android.content.SharedPreferences;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.StrictMode; import android.os.StrictMode;
import androidx.multidex.MultiDex; import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication; import androidx.multidex.MultiDexApplication;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@ -92,7 +93,8 @@ public class MainApplication extends MultiDexApplication {
SUPPORTED_LOCALES.add(Locale.getDefault()); SUPPORTED_LOCALES.add(Locale.getDefault());
} }
LocaleChanger.initialize(getApplicationContext(), SUPPORTED_LOCALES); LocaleChanger.initialize(getApplicationContext(), SUPPORTED_LOCALES);
}catch (Exception ignored){} } catch (Exception ignored) {
}
boolean send_crash_reports = sharedpreferences.getBoolean(Helper.SET_SEND_CRASH_REPORTS, false); boolean send_crash_reports = sharedpreferences.getBoolean(Helper.SET_SEND_CRASH_REPORTS, false);
@ -121,10 +123,8 @@ public class MainApplication extends MultiDexApplication {
} }
@Override @Override
protected void attachBaseContext(Context base) protected void attachBaseContext(Context base) {
{
super.attachBaseContext(base); super.attachBaseContext(base);
MultiDex.install(MainApplication.this); MultiDex.install(MainApplication.this);
} }

View File

@ -17,9 +17,11 @@ package app.fedilab.android.activities;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.MenuItem; import android.view.MenuItem;
@ -45,7 +47,6 @@ import app.fedilab.android.asynctasks.ManageListsAsyncTask;
import app.fedilab.android.interfaces.OnListActionInterface; import app.fedilab.android.interfaces.OnListActionInterface;
/** /**
* Created by Thomas on 15/12/2017. * Created by Thomas on 15/12/2017.
* Manage accounts in Lists * Manage accounts in Lists
@ -113,7 +114,6 @@ public class ManageAccountsInListActivity extends BaseActivity implements OnList
lv_accounts_current.setLayoutManager(mLayoutManager); lv_accounts_current.setLayoutManager(mLayoutManager);
list_title.setText(title); list_title.setText(title);
loader.setVisibility(View.VISIBLE); loader.setVisibility(View.VISIBLE);
new ManageListsAsyncTask(ManageAccountsInListActivity.this, ManageListsAsyncTask.action.GET_LIST_ACCOUNT, null, null, listId, null, ManageAccountsInListActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new ManageListsAsyncTask(ManageAccountsInListActivity.this, ManageListsAsyncTask.action.GET_LIST_ACCOUNT, null, null, listId, null, ManageAccountsInListActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -121,7 +121,9 @@ public class ManageAccountsInListActivity extends BaseActivity implements OnList
search_account.addTextChangedListener(new TextWatcher() { search_account.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {} public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
if (count > 0) { if (count > 0) {
@ -130,6 +132,7 @@ public class ManageAccountsInListActivity extends BaseActivity implements OnList
search_account.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_search, 0); search_account.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_search, 0);
} }
} }
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (s != null && s.length() > 0) { if (s != null && s.length() > 0) {
@ -175,7 +178,6 @@ public class ManageAccountsInListActivity extends BaseActivity implements OnList
} }
@Override @Override
public void onActionDone(ManageListsAsyncTask.action actionType, APIResponse apiResponse, int statusCode) { public void onActionDone(ManageListsAsyncTask.action actionType, APIResponse apiResponse, int statusCode) {
loader.setVisibility(View.GONE); loader.setVisibility(View.GONE);

View File

@ -40,13 +40,16 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.jaredrummler.materialspinner.MaterialSpinner; import com.jaredrummler.materialspinner.MaterialSpinner;
import java.io.IOException; import java.io.IOException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -123,7 +126,6 @@ public class MastodonRegisterActivity extends BaseActivity implements OnRetrieve
} }
MaterialSpinner reg_category = findViewById(R.id.reg_category); MaterialSpinner reg_category = findViewById(R.id.reg_category);
Helper.changeMaterialSpinnerColor(MastodonRegisterActivity.this, reg_category); Helper.changeMaterialSpinnerColor(MastodonRegisterActivity.this, reg_category);
String[] categoriesA = { String[] categoriesA = {

View File

@ -25,6 +25,7 @@ import android.media.MediaPlayer;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@ -131,6 +132,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface,
LEFT_TO_RIGHT, LEFT_TO_RIGHT,
POP POP
} }
private WebView webview_video; private WebView webview_video;
private ImageButton media_save, media_share, media_close; private ImageButton media_save, media_share, media_close;
private boolean scheduleHidden, scheduleHiddenDescription; private boolean scheduleHidden, scheduleHiddenDescription;
@ -313,9 +315,11 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface,
public void onCompletion(MediaPlayer mp) { public void onCompletion(MediaPlayer mp) {
stopPlaying(); stopPlaying();
} }
/** /**
* Manage touch event * Manage touch event
* Allows to swipe from timelines * Allows to swipe from timelines
*
* @param event MotionEvent * @param event MotionEvent
* @return boolean * @return boolean
*/ */
@ -347,11 +351,23 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface,
if (downX > MIN_DISTANCE & (Math.abs(deltaX) > MIN_DISTANCE)) { if (downX > MIN_DISTANCE & (Math.abs(deltaX) > MIN_DISTANCE)) {
if (!canSwipe || mediaPosition > attachments.size() || mediaPosition < 1 || attachments.size() <= 1) if (!canSwipe || mediaPosition > attachments.size() || mediaPosition < 1 || attachments.size() <= 1)
return super.dispatchTouchEvent(event); return super.dispatchTouchEvent(event);
if(deltaX < 0) { switchOnSwipe(MediaActivity.actionSwipe.LEFT_TO_RIGHT); return true; } if (deltaX < 0) {
if(deltaX > 0) { switchOnSwipe(MediaActivity.actionSwipe.RIGHT_TO_LEFT); return true; } switchOnSwipe(MediaActivity.actionSwipe.LEFT_TO_RIGHT);
return true;
}
if (deltaX > 0) {
switchOnSwipe(MediaActivity.actionSwipe.RIGHT_TO_LEFT);
return true;
}
} else if (downY > MIN_DISTANCE & (Math.abs(deltaY) > MIN_DISTANCE)) { } else if (downY > MIN_DISTANCE & (Math.abs(deltaY) > MIN_DISTANCE)) {
if(deltaY > 0 && canSwipe) { finish(); return true; } if (deltaY > 0 && canSwipe) {
if(deltaY < 0 && canSwipe) { finish(); return true; } finish();
return true;
}
if (deltaY < 0 && canSwipe) {
finish();
return true;
}
} else { } else {
currentAction = MediaActivity.actionSwipe.POP; currentAction = MediaActivity.actionSwipe.POP;
isControlElementShown = !isControlElementShown; isControlElementShown = !isControlElementShown;
@ -636,11 +652,13 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface,
if (playeraudio != null) { if (playeraudio != null) {
try { try {
playeraudio.pause(); playeraudio.pause();
} catch (Exception ignored){ } } catch (Exception ignored) {
}
} }
stopTimer(); stopTimer();
} }
private void startTimer() { private void startTimer() {
stopTimer(); stopTimer();
timer = new Timer(); timer = new Timer();
@ -719,7 +737,8 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface,
} }
try { try {
visualizerView.onPause(); visualizerView.onPause();
} catch (Exception ignored){ } } catch (Exception ignored) {
}
} }
@Override @Override
@ -734,7 +753,8 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface,
if (playeraudio != null) { if (playeraudio != null) {
playeraudio.release(); playeraudio.release();
} }
} catch (Exception ignored){ } } catch (Exception ignored) {
}
super.onDestroy(); super.onDestroy();
} }
@ -749,7 +769,8 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface,
} }
try { try {
visualizerView.onResume(); visualizerView.onResume();
} catch (Exception e){ } } catch (Exception e) {
}
} }
@Override @Override

View File

@ -97,6 +97,7 @@ public class MutedInstanceActivity extends BaseActivity implements OnRetrieveDom
private boolean swiped; private boolean swiped;
private RecyclerView lv_domains; private RecyclerView lv_domains;
private final int PICK_IMPORT_INSTANCE = 5326; private final int PICK_IMPORT_INSTANCE = 5326;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -210,7 +211,8 @@ public class MutedInstanceActivity extends BaseActivity implements OnRetrieveDom
break; break;
} }
return true; return true;
}}); }
});
popup.show(); popup.show();
}); });
toolbar_title.setText(R.string.blocked_domains); toolbar_title.setText(R.string.blocked_domains);
@ -242,8 +244,7 @@ public class MutedInstanceActivity extends BaseActivity implements OnRetrieveDom
mLayoutManager = new LinearLayoutManager(MutedInstanceActivity.this); mLayoutManager = new LinearLayoutManager(MutedInstanceActivity.this);
lv_domains.setLayoutManager(mLayoutManager); lv_domains.setLayoutManager(mLayoutManager);
lv_domains.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_domains.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
{
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();
int totalItemCount = mLayoutManager.getItemCount(); int totalItemCount = mLayoutManager.getItemCount();
@ -251,7 +252,8 @@ public class MutedInstanceActivity extends BaseActivity implements OnRetrieveDom
if (firstVisibleItem + visibleItemCount == totalItemCount) { if (firstVisibleItem + visibleItemCount == totalItemCount) {
if (!flag_loading) { if (!flag_loading) {
flag_loading = true; flag_loading = true;
asyncTask = new RetrieveDomainsAsyncTask(MutedInstanceActivity.this, max_id, MutedInstanceActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); nextElementLoader.setVisibility(View.VISIBLE); asyncTask = new RetrieveDomainsAsyncTask(MutedInstanceActivity.this, max_id, MutedInstanceActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
nextElementLoader.setVisibility(View.VISIBLE);
} }
} else { } else {
nextElementLoader.setVisibility(View.GONE); nextElementLoader.setVisibility(View.GONE);
@ -267,7 +269,8 @@ public class MutedInstanceActivity extends BaseActivity implements OnRetrieveDom
firstLoad = true; firstLoad = true;
flag_loading = true; flag_loading = true;
swiped = true; swiped = true;
asyncTask = new RetrieveDomainsAsyncTask(MutedInstanceActivity.this, max_id, MutedInstanceActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } asyncTask = new RetrieveDomainsAsyncTask(MutedInstanceActivity.this, max_id, MutedInstanceActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}); });
switch (theme) { switch (theme) {
case Helper.THEME_LIGHT: case Helper.THEME_LIGHT:

View File

@ -20,8 +20,10 @@ import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;

View File

@ -40,6 +40,7 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import com.github.mikephil.charting.charts.LineChart; import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Description; import com.github.mikephil.charting.components.Description;
import com.github.mikephil.charting.components.IMarker; import com.github.mikephil.charting.components.IMarker;
@ -249,13 +250,16 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
tvContent.setTextColor(ContextCompat.getColor(context, R.color.black)); tvContent.setTextColor(ContextCompat.getColor(context, R.color.black));
} }
} }
@Override @Override
public void refreshContent(Entry e, Highlight highlight) { public void refreshContent(Entry e, Highlight highlight) {
Date date = new Date(((long) e.getX())); Date date = new Date(((long) e.getX()));
tvContent.setText(String.valueOf(Helper.shortDateToString(date) + " - " + (int) e.getY())); tvContent.setText(String.valueOf(Helper.shortDateToString(date) + " - " + (int) e.getY()));
super.refreshContent(e, highlight); super.refreshContent(e, highlight);
} }
private MPPointF mOffset; private MPPointF mOffset;
@Override @Override
public MPPointF getOffset() { public MPPointF getOffset() {
if (mOffset == null) { if (mOffset == null) {
@ -461,6 +465,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
this.mDataFormat = new SimpleDateFormat("dd.MM", Locale.getDefault()); this.mDataFormat = new SimpleDateFormat("dd.MM", Locale.getDefault());
this.mDate = new Date(); this.mDate = new Date();
} }
@Override @Override
public String getFormattedValue(float value) { public String getFormattedValue(float value) {
return getDateString((long) value); return getDateString((long) value);

View File

@ -230,8 +230,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
}); });
lv_notifications.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_notifications.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
{
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();
@ -287,6 +286,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
} }
}; };
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
@ -374,7 +374,6 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
filter_poll.setChecked(filterNotifications.isPoll()); filter_poll.setChecked(filterNotifications.isPoll());
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.setTime(dateIni); c.setTime(dateIni);
int yearIni = c.get(Calendar.YEAR); int yearIni = c.get(Calendar.YEAR);
@ -440,7 +439,6 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
} }
private BroadcastReceiver backupFinishedReceiver = new BroadcastReceiver() { private BroadcastReceiver backupFinishedReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {

View File

@ -303,7 +303,6 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
}*/ }*/
LineDataSet dataSetBoosts = new LineDataSet(boostsEntry, getString(R.string.reblog)); LineDataSet dataSetBoosts = new LineDataSet(boostsEntry, getString(R.string.reblog));
dataSetBoosts.setColor(ContextCompat.getColor(OwnerNotificationChartsActivity.this, R.color.chart_notif_boost)); dataSetBoosts.setColor(ContextCompat.getColor(OwnerNotificationChartsActivity.this, R.color.chart_notif_boost));
dataSetBoosts.setValueTextSize(10f); dataSetBoosts.setValueTextSize(10f);
@ -471,13 +470,16 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
tvContent.setTextColor(ContextCompat.getColor(context, R.color.black)); tvContent.setTextColor(ContextCompat.getColor(context, R.color.black));
} }
} }
@Override @Override
public void refreshContent(Entry e, Highlight highlight) { public void refreshContent(Entry e, Highlight highlight) {
Date date = new Date(((long) e.getX())); Date date = new Date(((long) e.getX()));
tvContent.setText(String.valueOf(Helper.shortDateToString(date) + " - " + (int) e.getY())); tvContent.setText(String.valueOf(Helper.shortDateToString(date) + " - " + (int) e.getY()));
super.refreshContent(e, highlight); super.refreshContent(e, highlight);
} }
private MPPointF mOffset; private MPPointF mOffset;
@Override @Override
public MPPointF getOffset() { public MPPointF getOffset() {
if (mOffset == null) { if (mOffset == null) {
@ -544,7 +546,6 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
} }
public class MyXAxisValueFormatter extends ValueFormatter { public class MyXAxisValueFormatter extends ValueFormatter {
private DateFormat mDataFormat; private DateFormat mDataFormat;
private Date mDate; private Date mDate;
@ -557,6 +558,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
} }
this.mDate = new Date(); this.mDate = new Date();
} }
@Override @Override
public String getFormattedValue(float value) { public String getFormattedValue(float value) {
return getDateString((long) value); return getDateString((long) value);

View File

@ -26,6 +26,7 @@ import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@ -34,6 +35,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -226,8 +228,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
}); });
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
{
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();
@ -283,6 +284,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
} }
}; };
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {

View File

@ -20,8 +20,10 @@ import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;

View File

@ -41,6 +41,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -146,6 +147,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
private String instance; private String instance;
private List<String> playlistForVideo; private List<String> playlistForVideo;
private List<Playlist> playlists; private List<Playlist> playlists;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -380,6 +382,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} }
return true; return true;
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
@ -553,7 +556,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
}); });
if (peertube.isCommentsEnabled()) { if (peertube.isCommentsEnabled()) {
new RetrievePeertubeSingleCommentsAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrievePeertubeSingleCommentsAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
@ -647,7 +649,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} }
peertube_download.setOnClickListener(new View.OnClickListener() { peertube_download.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -933,7 +934,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} }
private void changeColor() { private void changeColor() {
if (peertube.getMyRating() != null && peertube.getMyRating().equals("like")) { if (peertube.getMyRating() != null && peertube.getMyRating().equals("like")) {
changeDrawableColor(getApplicationContext(), R.drawable.ic_thumb_up_peertube, R.color.positive_thumbs); changeDrawableColor(getApplicationContext(), R.drawable.ic_thumb_up_peertube, R.color.positive_thumbs);

View File

@ -21,9 +21,11 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -147,7 +149,6 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
set_upload_enable_comments = findViewById(R.id.set_upload_enable_comments); set_upload_enable_comments = findViewById(R.id.set_upload_enable_comments);
//Change spinner colors //Change spinner colors
Helper.changeMaterialSpinnerColor(PeertubeEditUploadActivity.this, set_upload_channel); Helper.changeMaterialSpinnerColor(PeertubeEditUploadActivity.this, set_upload_channel);
Helper.changeMaterialSpinnerColor(PeertubeEditUploadActivity.this, set_upload_categories); Helper.changeMaterialSpinnerColor(PeertubeEditUploadActivity.this, set_upload_categories);
@ -214,7 +215,6 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
set_upload_categories.setAdapter(adapterCatgories); set_upload_categories.setAdapter(adapterCatgories);
//Populate licenses //Populate licenses
String[] licensesA = new String[licences.size()]; String[] licensesA = new String[licences.size()];
it = licences.entrySet().iterator(); it = licences.entrySet().iterator();
@ -278,8 +278,6 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
} }
@Override @Override
public void onRetrievePeertube(APIResponse apiResponse) { public void onRetrievePeertube(APIResponse apiResponse) {
if (apiResponse.getError() != null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) { if (apiResponse.getError() != null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {

View File

@ -29,10 +29,12 @@ import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -151,7 +153,6 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
} }
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
@ -380,7 +381,6 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
} }
@Override @Override
public void onProgress(Context context, UploadInfo uploadInfo) { public void onProgress(Context context, UploadInfo uploadInfo) {
// your code here // your code here

View File

@ -18,6 +18,7 @@ import android.annotation.SuppressLint;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.exifinterface.media.ExifInterface; import androidx.exifinterface.media.ExifInterface;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -46,6 +47,7 @@ import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.provider.MediaStore; import android.provider.MediaStore;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet; import androidx.constraintlayout.widget.ConstraintSet;
import androidx.transition.ChangeBounds; import androidx.transition.ChangeBounds;
@ -53,6 +55,7 @@ import androidx.transition.TransitionManager;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.view.animation.AnticipateOvershootInterpolator; import android.view.animation.AnticipateOvershootInterpolator;
import android.widget.Button; import android.widget.Button;
@ -156,7 +159,6 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorL
mRvFilters.setAdapter(mFilterViewAdapter); mRvFilters.setAdapter(mFilterViewAdapter);
Typeface mEmojiTypeFace = Typeface.createFromAsset(getAssets(), "emojione-android.ttf"); Typeface mEmojiTypeFace = Typeface.createFromAsset(getAssets(), "emojione-android.ttf");
mPhotoEditor = new PhotoEditor.Builder(this, mPhotoEditorView) mPhotoEditor = new PhotoEditor.Builder(this, mPhotoEditorView)
@ -165,7 +167,6 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorL
.build(); // build photo editor sdk .build(); // build photo editor sdk
mPhotoEditor.setOnPhotoEditorListener(this); mPhotoEditor.setOnPhotoEditorListener(this);
//Set Image Dynamically //Set Image Dynamically
@ -196,9 +197,13 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorL
} }
private static int exifToDegrees(int exifOrientation) { private static int exifToDegrees(int exifOrientation) {
if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) { return 90; } if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) { return 180; } return 90;
else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) { return 270; } } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
return 180;
} else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
return 270;
}
return 0; return 0;
} }
@ -519,8 +524,6 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorL
} }
void showFilter(boolean isVisible) { void showFilter(boolean isVisible) {
mIsFilterVisible = isVisible; mIsFilterVisible = isVisible;
mConstraintSet.clone(mRootView); mConstraintSet.clone(mRootView);

View File

@ -19,6 +19,7 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@ -26,6 +27,7 @@ import androidx.appcompat.app.ActionBar;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -158,8 +160,7 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
lv_playlist.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_playlist.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
{
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();
@ -215,7 +216,6 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {

View File

@ -18,8 +18,10 @@ package app.fedilab.android.activities;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;

View File

@ -15,11 +15,12 @@
package app.fedilab.android.activities; package app.fedilab.android.activities;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -122,6 +123,7 @@ public class ProxyActivity extends BaseActivity {
count2++; count2++;
} }
} }
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
@ -158,7 +160,4 @@ public class ProxyActivity extends BaseActivity {
} }
} }

View File

@ -23,12 +23,14 @@ import android.graphics.Paint;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.ItemTouchHelper;
import android.text.Editable; import android.text.Editable;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -342,7 +344,6 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
setContentView(R.layout.activity_reorder_tabs); setContentView(R.layout.activity_reorder_tabs);
updated = false; updated = false;
RecyclerView lv_reorder_tabs = findViewById(R.id.lv_reorder_tabs); RecyclerView lv_reorder_tabs = findViewById(R.id.lv_reorder_tabs);

View File

@ -18,8 +18,10 @@ import android.annotation.SuppressLint;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;

View File

@ -17,7 +17,9 @@ package app.fedilab.android.activities;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.fragment.app.FragmentStatePagerAdapter;
@ -25,6 +27,7 @@ import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;

View File

@ -66,6 +66,7 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
private List<SlideMenuItem> list = new ArrayList<>(); private List<SlideMenuItem> list = new ArrayList<>();
public static int position = 1; public static int position = 1;
private ContentSettingsFragment.type previous; private ContentSettingsFragment.type previous;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -211,9 +212,6 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) { if (item.getItemId() == android.R.id.home) {
@ -224,8 +222,6 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();

View File

@ -26,11 +26,13 @@ import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.fragment.app.FragmentStatePagerAdapter;
@ -39,6 +41,7 @@ import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
@ -158,7 +161,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
private AsyncTask<Void, Void, Void> retrieveRelationship; private AsyncTask<Void, Void, Void> retrieveRelationship;
public enum action { public enum action {
FOLLOW, FOLLOW,
UNFOLLOW, UNFOLLOW,
@ -246,7 +248,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
account_note = findViewById(R.id.account_note); account_note = findViewById(R.id.account_note);
header_edit_profile.setOnClickListener(new View.OnClickListener() { header_edit_profile.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -467,7 +468,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
} }
if (account.getAcct().contains("@")) if (account.getAcct().contains("@"))
warning_message.setVisibility(View.VISIBLE); warning_message.setVisibility(View.VISIBLE);
else else
@ -527,7 +527,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
} }
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter); mPager.setAdapter(mPagerAdapter);
@ -907,7 +906,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
TextView seperator = findViewById(R.id.seperator); TextView seperator = findViewById(R.id.seperator);
seperator.setVisibility(View.VISIBLE); seperator.setVisibility(View.VISIBLE);
} }
}}); }
});
} }
@ -915,8 +915,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
} }
@Override @Override
public void onRetrieveFeedsAccount(List<Status> statuses) { public void onRetrieveFeedsAccount(List<Status> statuses) {
if (statuses != null) { if (statuses != null) {
@ -994,7 +992,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
} else if (!relationship.isFollowing()) { } else if (!relationship.isFollowing()) {
account_follow.setImageResource(R.drawable.ic_user_plus); account_follow.setImageResource(R.drawable.ic_user_plus);
doAction = action.FOLLOW; doAction = action.FOLLOW;
account_follow.setVisibility(View.VISIBLE);; account_follow.setVisibility(View.VISIBLE);
;
} else { } else {
account_follow.setVisibility(View.GONE); account_follow.setVisibility(View.GONE);
doAction = action.NOTHING; doAction = action.NOTHING;
@ -1171,7 +1170,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
popup.getMenu().findItem(R.id.action_follow_instance).setVisible(false); popup.getMenu().findItem(R.id.action_follow_instance).setVisible(false);
popup.getMenu().findItem(R.id.action_block_instance).setVisible(false); popup.getMenu().findItem(R.id.action_block_instance).setVisible(false);
}if( isOwner) { }
if (isOwner) {
popup.getMenu().findItem(R.id.action_block).setVisible(false); popup.getMenu().findItem(R.id.action_block).setVisible(false);
popup.getMenu().findItem(R.id.action_report).setVisible(false); popup.getMenu().findItem(R.id.action_report).setVisible(false);
popup.getMenu().findItem(R.id.action_mute).setVisible(false); popup.getMenu().findItem(R.id.action_mute).setVisible(false);
@ -1258,8 +1258,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
new HttpsConnection(ShowAccountActivity.this, null).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null); new HttpsConnection(ShowAccountActivity.this, null).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null);
peertubeAccount = true; peertubeAccount = true;
} }
} } else
else
new HttpsConnection(ShowAccountActivity.this, null).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null); new HttpsConnection(ShowAccountActivity.this, null).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@ -1494,7 +1493,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();

View File

@ -23,6 +23,7 @@ import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

View File

@ -19,9 +19,11 @@ import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;

View File

@ -38,6 +38,7 @@ import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.provider.MediaStore; import android.provider.MediaStore;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
@ -215,7 +216,6 @@ import static app.fedilab.android.helper.Helper.countWithEmoji;
public class TootActivity extends BaseActivity implements UploadStatusDelegate, OnPostActionInterface, OnRetrieveSearcAccountshInterface, OnPostStatusActionInterface, OnRetrieveSearchInterface, OnRetrieveAccountsReplyInterface, OnRetrieveEmojiInterface, OnDownloadInterface, OnRetrieveAttachmentInterface, OnRetrieveRelationshipInterface { public class TootActivity extends BaseActivity implements UploadStatusDelegate, OnPostActionInterface, OnRetrieveSearcAccountshInterface, OnPostStatusActionInterface, OnRetrieveSearchInterface, OnRetrieveAccountsReplyInterface, OnRetrieveEmojiInterface, OnDownloadInterface, OnRetrieveAttachmentInterface, OnRetrieveRelationshipInterface {
private String visibility; private String visibility;
private final int PICK_IMAGE = 56556; private final int PICK_IMAGE = 56556;
private final int TAKE_PHOTO = 56532; private final int TAKE_PHOTO = 56532;
@ -386,7 +386,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
changeColor(); changeColor();
//By default the toot is not restored so the id -1 is defined //By default the toot is not restored so the id -1 is defined
currentToId = -1; currentToId = -1;
restoredScheduled = false; restoredScheduled = false;
@ -520,6 +519,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
totalChar = countLength(wysiwyg, toot_cw_content); totalChar = countLength(wysiwyg, toot_cw_content);
toot_space_left.setText(String.valueOf(totalChar)); toot_space_left.setText(String.valueOf(totalChar));
} }
@Override @Override
public void onUpload(Bitmap image, String uuid) { public void onUpload(Bitmap image, String uuid) {
if (url_for_media != null) { if (url_for_media != null) {
@ -696,7 +696,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
initialContent = displayWYSIWYG() ? wysiwyg.getContentAsHTML() : toot_content.getText().toString(); initialContent = displayWYSIWYG() ? wysiwyg.getContentAsHTML() : toot_content.getText().toString();
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar); Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
@ -969,7 +968,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
} }
StringBuilder hugs = new StringBuilder(); StringBuilder hugs = new StringBuilder();
for (int i = 0; i < toFill; i++) { for (int i = 0; i < toFill; i++) {
hugs.append(new String(Character.toChars(0x1F917))); hugs.append(new String(Character.toChars(0x1F917)));
@ -1237,7 +1235,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
} }
LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
imParams.setMargins(20, 5, 20, 5); imParams.setMargins(20, 5, 20, 5);
imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext()); imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
@ -1610,7 +1607,8 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
request.addFileToUpload(uri.toString().replace("file://", ""), "file"); request.addFileToUpload(uri.toString().replace("file://", ""), "file");
} else { } else {
request.addFileToUpload(uri.toString().replace("file://", ""), "media"); request.addFileToUpload(uri.toString().replace("file://", ""), "media");
}; }
;
request.addParameter("filename", fileName).setMaxRetries(maxUploadRetryTimes) request.addParameter("filename", fileName).setMaxRetries(maxUploadRetryTimes)
.startUpload(); .startUpload();
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
@ -1951,7 +1949,9 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
search_account.addTextChangedListener(new TextWatcher() { search_account.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {} public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
if (count > 0) { if (count > 0) {
@ -1960,6 +1960,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
search_account.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_search, 0); search_account.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_search, 0);
} }
} }
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (s != null && s.length() > 0) { if (s != null && s.length() > 0) {
@ -2454,6 +2455,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
/** /**
* Removes a media * Removes a media
*
* @param viewId String * @param viewId String
*/ */
private void showRemove(final int viewId) { private void showRemove(final int viewId) {
@ -2545,7 +2547,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
@ -2993,9 +2994,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
} }
@Override @Override
public void onRetrieveSearch(APIResponse apiResponse) { public void onRetrieveSearch(APIResponse apiResponse) {
@ -3289,8 +3287,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
title.setText(getString(R.string.queet_title)); title.setText(getString(R.string.queet_title));
else else
title.setText(getString(R.string.toot_title)); title.setText(getString(R.string.toot_title));
} } else {
else {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU) if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
setTitle(R.string.queet_title); setTitle(R.string.queet_title);
else else
@ -3436,8 +3433,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
title.setText(getString(R.string.queet_title)); title.setText(getString(R.string.queet_title));
else else
title.setText(getString(R.string.toot_title)); title.setText(getString(R.string.toot_title));
} } else {
else {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU) if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
setTitle(R.string.queet_title); setTitle(R.string.queet_title);
else else
@ -3455,8 +3451,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
title.setText(getString(R.string.queet_title_reply)); title.setText(getString(R.string.queet_title_reply));
else else
title.setText(getString(R.string.toot_title_reply)); title.setText(getString(R.string.toot_title_reply));
} } else {
else {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU) if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
setTitle(R.string.queet_title_reply); setTitle(R.string.queet_title_reply);
else else
@ -3904,6 +3899,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show(); Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
} }
} }
private void changeColor() { private void changeColor() {
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);

View File

@ -17,12 +17,15 @@ package app.fedilab.android.activities;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.widget.Toast; import android.widget.Toast;
@ -96,6 +99,7 @@ public class TootInfoActivity extends BaseActivity {
public void onTabSelected(TabLayout.Tab tab) { public void onTabSelected(TabLayout.Tab tab) {
mPager.setCurrentItem(tab.getPosition()); mPager.setCurrentItem(tab.getPosition());
} }
@Override @Override
public void onTabUnselected(TabLayout.Tab tab) { public void onTabUnselected(TabLayout.Tab tab) {

View File

@ -29,9 +29,11 @@ import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -232,6 +234,7 @@ public class WebviewActivity extends BaseActivity {
Helper.colorizeIconMenu(menu, R.color.black); Helper.colorizeIconMenu(menu, R.color.black);
return true; return true;
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {

View File

@ -23,9 +23,11 @@ import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -185,9 +187,12 @@ public class WebviewConnectActivity extends BaseActivity {
editor.apply(); editor.apply();
//Update the account with the token; //Update the account with the token;
new UpdateAccountInfoAsyncTask(WebviewConnectActivity.this, token, clientId, clientSecret, refresh_token, instance, social).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new UpdateAccountInfoAsyncTask(WebviewConnectActivity.this, token, clientId, clientSecret, refresh_token, instance, social).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} catch (JSONException ignored) {} } catch (JSONException ignored) {
} catch (Exception ignored) {} }
}}).start(); } catch (Exception ignored) {
}
}
}).start();
return true; return true;
} }
return false; return false;
@ -208,8 +213,6 @@ public class WebviewConnectActivity extends BaseActivity {
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
@ -220,8 +223,7 @@ public class WebviewConnectActivity extends BaseActivity {
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void clearCookies(Context context) public static void clearCookies(Context context) {
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
CookieManager.getInstance().removeAllCookies(null); CookieManager.getInstance().removeAllCookies(null);

View File

@ -19,8 +19,10 @@ import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
@ -59,7 +61,6 @@ import app.fedilab.android.interfaces.OnRetrieveWhoToFollowInterface;
public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoToFollowInterface, OnPostActionInterface, OnListActionInterface { public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoToFollowInterface, OnPostActionInterface, OnListActionInterface {
private String item; private String item;
private List<String> followedId; private List<String> followedId;
private List<String> accountListId; private List<String> accountListId;

View File

@ -59,7 +59,6 @@ public class ViewAnimator<T extends Resourceble> {
} }
public void showMenuContent() { public void showMenuContent() {
setViewsClickable(false); setViewsClickable(false);
viewList.clear(); viewList.clear();

View File

@ -18,6 +18,7 @@ import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;
import app.fedilab.android.client.APIResponse; import app.fedilab.android.client.APIResponse;
import app.fedilab.android.client.Entities.AccountCreation; import app.fedilab.android.client.Entities.AccountCreation;

View File

@ -36,8 +36,6 @@ public class ManageCachedStatusAsyncTask extends AsyncTask<Void, Void, Void> {
private WeakReference<Context> contextReference; private WeakReference<Context> contextReference;
public ManageCachedStatusAsyncTask(Context context, String statusId, OnRefreshCachedStatusInterface onRefreshCachedStatusInterface) { public ManageCachedStatusAsyncTask(Context context, String statusId, OnRefreshCachedStatusInterface onRefreshCachedStatusInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.listener = onRefreshCachedStatusInterface; this.listener = onRefreshCachedStatusInterface;

View File

@ -16,6 +16,7 @@ package app.fedilab.android.asynctasks;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;

View File

@ -98,6 +98,7 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
this.comment = comment; this.comment = comment;
this.status = status; this.status = status;
} }
public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, boolean muteNotifications, OnPostActionInterface onPostActionInterface) { public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, boolean muteNotifications, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface; this.listener = onPostActionInterface;
@ -167,13 +168,11 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
} else { } else {
statusCode = api.reportAction(targetedId, comment); statusCode = api.reportAction(targetedId, comment);
} }
} } else if (apiAction == API.StatusAction.CREATESTATUS)
else if (apiAction == API.StatusAction.CREATESTATUS)
statusCode = api.statusAction(status); statusCode = api.statusAction(status);
else if (apiAction == API.StatusAction.UPDATESERVERSCHEDULE) { else if (apiAction == API.StatusAction.UPDATESERVERSCHEDULE) {
api.scheduledAction("PUT", storedStatus.getStatus(), null, storedStatus.getScheduledServerdId()); api.scheduledAction("PUT", storedStatus.getStatus(), null, storedStatus.getScheduledServerdId());
} } else if (apiAction == API.StatusAction.DELETESCHEDULED) {
else if(apiAction == API.StatusAction.DELETESCHEDULED) {
api.scheduledAction("DELETE", null, null, storedStatus.getScheduledServerdId()); api.scheduledAction("DELETE", null, null, storedStatus.getScheduledServerdId());
} else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS) } else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS)
statusCode = api.muteNotifications(targetedId, muteNotifications); statusCode = api.muteNotifications(targetedId, muteNotifications);

View File

@ -18,6 +18,7 @@ import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;
import app.fedilab.android.client.APIResponse; import app.fedilab.android.client.APIResponse;
import app.fedilab.android.client.Entities.AdminAction; import app.fedilab.android.client.Entities.AdminAction;
@ -25,7 +26,6 @@ import app.fedilab.android.helper.Helper;
import app.fedilab.android.interfaces.OnAdminActionInterface; import app.fedilab.android.interfaces.OnAdminActionInterface;
/** /**
* Created by Thomas on 18/06/2019. * Created by Thomas on 18/06/2019.
* Makes actions for post admin calls * Makes actions for post admin calls
@ -41,7 +41,6 @@ public class PostAdminActionAsyncTask extends AsyncTask<Void, Void, Void> {
private AdminAction adminAction; private AdminAction adminAction;
public PostAdminActionAsyncTask(Context context, API.adminAction action, String id, AdminAction adminAction, OnAdminActionInterface onAdminActionInterface) { public PostAdminActionAsyncTask(Context context, API.adminAction action, String id, AdminAction adminAction, OnAdminActionInterface onAdminActionInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.listener = onAdminActionInterface; this.listener = onAdminActionInterface;

View File

@ -33,14 +33,12 @@ import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
public class PostPeertubeAsyncTask extends AsyncTask<Void, Void, Void> { public class PostPeertubeAsyncTask extends AsyncTask<Void, Void, Void> {
private APIResponse apiResponse; private APIResponse apiResponse;
private OnRetrievePeertubeInterface listener; private OnRetrievePeertubeInterface listener;
private WeakReference<Context> contextReference; private WeakReference<Context> contextReference;
private Peertube peertube; private Peertube peertube;
public PostPeertubeAsyncTask(Context context, Peertube peertube, OnRetrievePeertubeInterface onRetrievePeertubeInterface) { public PostPeertubeAsyncTask(Context context, Peertube peertube, OnRetrievePeertubeInterface onRetrievePeertubeInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.listener = onRetrievePeertubeInterface; this.listener = onRetrievePeertubeInterface;
@ -48,7 +46,6 @@ public class PostPeertubeAsyncTask extends AsyncTask<Void, Void, Void> {
} }
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get()); PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());

View File

@ -90,7 +90,6 @@ public class PostStatusAsyncTask extends AsyncTask<Void, Void, Void> {
} }
return null; return null;
} }

View File

@ -129,8 +129,7 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, Void> {
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) { if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
assert api != null; assert api != null;
apiResponse = api.getFollowing(targetedId, max_id); apiResponse = api.getFollowing(targetedId, max_id);
} } else {
else {
assert gnuapi != null; assert gnuapi != null;
apiResponse = gnuapi.getFollowing(targetedId, max_id); apiResponse = gnuapi.getFollowing(targetedId, max_id);
} }

View File

@ -166,6 +166,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
this.showMediaOnly = showMediaOnly; this.showMediaOnly = showMediaOnly;
this.showPinned = showPinned; this.showPinned = showPinned;
} }
public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, boolean showPinned, boolean showReply, OnRetrieveFeedsInterface onRetrieveFeedsInterface) { public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, boolean showPinned, boolean showReply, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.action = action; this.action = action;
@ -176,6 +177,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
this.showPinned = showPinned; this.showPinned = showPinned;
this.showReply = showReply; this.showReply = showReply;
} }
public RetrieveFeedsAsyncTask(Context context, Type action, String tag, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) { public RetrieveFeedsAsyncTask(Context context, Type action, String tag, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.action = action; this.action = action;

View File

@ -16,6 +16,7 @@ package app.fedilab.android.asynctasks;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;
@ -36,7 +37,6 @@ public class RetrieveHowToAsyncTask extends AsyncTask<Void, Void, Void> {
private WeakReference<Context> contextReference; private WeakReference<Context> contextReference;
public RetrieveHowToAsyncTask(Context context, OnRetrieveHowToInterface onRetrieveHowToInterface) { public RetrieveHowToAsyncTask(Context context, OnRetrieveHowToInterface onRetrieveHowToInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveHowToInterface; this.listener = onRetrieveHowToInterface;

View File

@ -45,6 +45,7 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask<Void, Void, Void> {
private String image, title, description, sharedSubject, sharedText; private String image, title, description, sharedSubject, sharedText;
private WeakReference<Context> contextWeakReference; private WeakReference<Context> contextWeakReference;
private boolean shouldFetchMetaData = true; private boolean shouldFetchMetaData = true;
public RetrieveMetaDataAsyncTask(Context context, boolean shouldFetchMetaData, String sharedSubject, String sharedText, String url, OnRetrieveMetaDataInterface onRetrieveRemoteAccountInterface) { public RetrieveMetaDataAsyncTask(Context context, boolean shouldFetchMetaData, String sharedSubject, String sharedText, String url, OnRetrieveMetaDataInterface onRetrieveRemoteAccountInterface) {
this.url = url; this.url = url;
this.listener = onRetrieveRemoteAccountInterface; this.listener = onRetrieveRemoteAccountInterface;
@ -61,6 +62,7 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask<Void, Void, Void> {
else else
return null; return null;
} }
private Void execRetrieveMetaDataInBackground() { private Void execRetrieveMetaDataInBackground() {
String potentialUrl = ""; String potentialUrl = "";
@ -127,6 +129,7 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask<Void, Void, Void> {
} }
return null; return null;
} }
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
listener.onRetrieveMetaData(error, sharedSubject, sharedText, image, title, description); listener.onRetrieveMetaData(error, sharedSubject, sharedText, image, title, description);

View File

@ -29,7 +29,6 @@ import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.interfaces.OnRetrieveNotificationsInterface; import app.fedilab.android.interfaces.OnRetrieveNotificationsInterface;
/** /**
* Created by Thomas on 28/04/2017. * Created by Thomas on 28/04/2017.
* Retrieves notifications on the instance * Retrieves notifications on the instance

View File

@ -38,14 +38,11 @@ import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
public class RetrievePeertubeChannelsAsyncTask extends AsyncTask<Void, Void, Void> { public class RetrievePeertubeChannelsAsyncTask extends AsyncTask<Void, Void, Void> {
private APIResponse apiResponse; private APIResponse apiResponse;
private OnRetrievePeertubeInterface listener; private OnRetrievePeertubeInterface listener;
private WeakReference<Context> contextReference; private WeakReference<Context> contextReference;
public RetrievePeertubeChannelsAsyncTask(Context context, OnRetrievePeertubeInterface onRetrievePeertubeInterface) { public RetrievePeertubeChannelsAsyncTask(Context context, OnRetrievePeertubeInterface onRetrievePeertubeInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.listener = onRetrievePeertubeInterface; this.listener = onRetrievePeertubeInterface;

View File

@ -32,12 +32,10 @@ import app.fedilab.android.client.PeertubeAPI;
public class RetrievePeertubeInformationAsyncTask extends AsyncTask<Void, Void, Void> { public class RetrievePeertubeInformationAsyncTask extends AsyncTask<Void, Void, Void> {
private WeakReference<Context> contextReference; private WeakReference<Context> contextReference;
public static PeertubeInformation peertubeInformation; public static PeertubeInformation peertubeInformation;
public RetrievePeertubeInformationAsyncTask(Context context) { public RetrievePeertubeInformationAsyncTask(Context context) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
} }

View File

@ -36,7 +36,6 @@ import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, Void> { public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, Void> {
private APIResponse apiResponse; private APIResponse apiResponse;
private String videoId; private String videoId;
private OnRetrievePeertubeInterface listener; private OnRetrievePeertubeInterface listener;
@ -44,7 +43,6 @@ public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, Void>
private String instanceName; private String instanceName;
public RetrievePeertubeSingleAsyncTask(Context context, String instanceName, String videoId, OnRetrievePeertubeInterface onRetrievePeertubeInterface) { public RetrievePeertubeSingleAsyncTask(Context context, String instanceName, String videoId, OnRetrievePeertubeInterface onRetrievePeertubeInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.videoId = videoId; this.videoId = videoId;
@ -53,7 +51,6 @@ public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, Void>
} }
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) { if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {

View File

@ -32,7 +32,6 @@ import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
public class RetrievePeertubeSingleCommentsAsyncTask extends AsyncTask<Void, Void, Void> { public class RetrievePeertubeSingleCommentsAsyncTask extends AsyncTask<Void, Void, Void> {
private APIResponse apiResponse; private APIResponse apiResponse;
private String videoId; private String videoId;
private OnRetrievePeertubeInterface listener; private OnRetrievePeertubeInterface listener;
@ -40,7 +39,6 @@ public class RetrievePeertubeSingleCommentsAsyncTask extends AsyncTask<Void, Voi
private String instanceName; private String instanceName;
public RetrievePeertubeSingleCommentsAsyncTask(Context context, String instanceName, String videoId, OnRetrievePeertubeInterface onRetrievePeertubeInterface) { public RetrievePeertubeSingleCommentsAsyncTask(Context context, String instanceName, String videoId, OnRetrievePeertubeInterface onRetrievePeertubeInterface) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.videoId = videoId; this.videoId = videoId;
@ -49,7 +47,6 @@ public class RetrievePeertubeSingleCommentsAsyncTask extends AsyncTask<Void, Voi
} }
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
API api = new API(this.contextReference.get()); API api = new API(this.contextReference.get());

View File

@ -17,7 +17,9 @@ package app.fedilab.android.asynctasks;
import android.content.Context; import android.content.Context;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import app.fedilab.android.client.Entities.Statistics; import app.fedilab.android.client.Entities.Statistics;
import app.fedilab.android.interfaces.OnRetrieveStatsInterface; import app.fedilab.android.interfaces.OnRetrieveStatsInterface;
import app.fedilab.android.sqlite.Sqlite; import app.fedilab.android.sqlite.Sqlite;

View File

@ -54,6 +54,7 @@ public class UpdateAccountInfoAsyncTask extends AsyncTask<Void, Void, Void> {
GNU, GNU,
FRIENDICA FRIENDICA
} }
public UpdateAccountInfoAsyncTask(Context context, String token, String client_id, String client_secret, String refresh_token, String instance, SOCIAL social) { public UpdateAccountInfoAsyncTask(Context context, String token, String client_id, String client_secret, String refresh_token, String instance, SOCIAL social) {
this.contextReference = new WeakReference<>(context); this.contextReference = new WeakReference<>(context);
this.token = token; this.token = token;
@ -85,7 +86,8 @@ public class UpdateAccountInfoAsyncTask extends AsyncTask<Void, Void, Void> {
try { try {
//At the state the instance can be encoded //At the state the instance can be encoded
instance = URLDecoder.decode(instance, "utf-8"); instance = URLDecoder.decode(instance, "utf-8");
} catch (UnsupportedEncodingException ignored) {} } catch (UnsupportedEncodingException ignored) {
}
SharedPreferences sharedpreferences = this.contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = this.contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
account.setToken(token); account.setToken(token);

View File

@ -13,8 +13,10 @@
* You should have received a copy of the GNU General Public License along with Fedilab; if not, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
package app.fedilab.android.asynctasks; package app.fedilab.android.asynctasks;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

File diff suppressed because it is too large Load Diff

View File

@ -78,6 +78,7 @@ public class CustomSharing {
/** /**
* Set the error message * Set the error message
*
* @param statusCode int code * @param statusCode int code
* @param error Throwable error * @param error Throwable error
*/ */

View File

@ -25,9 +25,11 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import android.text.Html; import android.text.Html;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
@ -137,7 +139,6 @@ public class Account implements Parcelable {
private boolean emojiFound = false; private boolean emojiFound = false;
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
@ -675,6 +676,7 @@ public class Account implements Parcelable {
/** /**
* Makes the move to account clickable * Makes the move to account clickable
*
* @param context Context * @param context Context
* @return SpannableString * @return SpannableString
*/ */
@ -695,6 +697,7 @@ public class Account implements Parcelable {
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -770,6 +773,7 @@ public class Account implements Parcelable {
Toasty.error(context, context.getString(R.string.toast_no_apps), Toast.LENGTH_LONG).show(); Toasty.error(context, context.getString(R.string.toast_no_apps), Toast.LENGTH_LONG).show();
} }
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -807,6 +811,7 @@ public class Account implements Parcelable {
Toasty.error(context, context.getString(R.string.toast_no_apps), Toast.LENGTH_LONG).show(); Toasty.error(context, context.getString(R.string.toast_no_apps), Toast.LENGTH_LONG).show();
} }
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -841,6 +846,7 @@ public class Account implements Parcelable {
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -870,6 +876,7 @@ public class Account implements Parcelable {
public void onClick(@NonNull View textView) { public void onClick(@NonNull View textView) {
CrossActions.doCrossProfile(context, accountMention); CrossActions.doCrossProfile(context, accountMention);
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -917,6 +924,7 @@ public class Account implements Parcelable {
public void onClick(@NonNull View textView) { public void onClick(@NonNull View textView) {
Helper.openBrowser(context, url); Helper.openBrowser(context, url);
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -938,7 +946,6 @@ public class Account implements Parcelable {
} }
final List<Emojis> emojis = account.getEmojis(); final List<Emojis> emojis = account.getEmojis();
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false); boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
@ -1056,7 +1063,8 @@ public class Account implements Parcelable {
} }
}); });
}catch (Exception ignored){} } catch (Exception ignored) {
}
} }
} else { } else {
@ -1121,7 +1129,8 @@ public class Account implements Parcelable {
}); });
}catch (Exception ignored){} } catch (Exception ignored) {
}
} }
} }

View File

@ -13,6 +13,7 @@ package app.fedilab.android.client.Entities;
* *
* You should have received a copy of the GNU General Public License along with Fedilab; if not, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;

View File

@ -1,4 +1,5 @@
package app.fedilab.android.client.Entities; package app.fedilab.android.client.Entities;
/* Copyright 2019 Thomas Schneider /* Copyright 2019 Thomas Schneider
* *
* This file is a part of Fedilab * This file is a part of Fedilab

View File

@ -19,7 +19,6 @@ import app.fedilab.android.client.API;
public class AdminAction { public class AdminAction {
private API.adminAction type; private API.adminAction type;
private boolean send_email_notification; private boolean send_email_notification;
private String text; private String text;
@ -84,7 +83,6 @@ public class AdminAction {
} }
public boolean isUnresolved() { public boolean isUnresolved() {
return unresolved; return unresolved;
} }

View File

@ -28,7 +28,8 @@ public class Application implements Parcelable {
private String name; private String name;
private String website; private String website;
public Application(){} public Application() {
}
protected Application(Parcel in) { protected Application(Parcel in) {
name = in.readString(); name = in.readString();

View File

@ -41,7 +41,8 @@ public class Card implements Parcelable {
private int height; private int height;
private int width; private int width;
public Card(){} public Card() {
}
public static final Creator<Card> CREATOR = new Creator<Card>() { public static final Creator<Card> CREATOR = new Creator<Card>() {
@Override @Override
@ -89,7 +90,6 @@ public class Card implements Parcelable {
} }
public String getUrl() { public String getUrl() {
return url; return url;
} }

View File

@ -32,7 +32,8 @@ public class Emojis implements Parcelable {
private Drawable drawable; private Drawable drawable;
private boolean drawableFound; private boolean drawableFound;
public Emojis(){} public Emojis() {
}
public String getShortcode() { public String getShortcode() {
return shortcode; return shortcode;

View File

@ -23,6 +23,7 @@ public class Error {
private String error = null; private String error = null;
private int statusCode = -1; private int statusCode = -1;
public String getError() { public String getError() {
return error; return error;
} }

View File

@ -45,7 +45,9 @@ public class InstanceNodeInfo {
this.openRegistrations = openRegistrations; this.openRegistrations = openRegistrations;
} }
public boolean isConnectionError() { return connectionError; } public boolean isConnectionError() {
return connectionError;
}
public void setConnectionError(boolean connectionError) { public void setConnectionError(boolean connectionError) {
this.connectionError = connectionError; this.connectionError = connectionError;

View File

@ -45,7 +45,6 @@ public class InstanceSocial {
private String thumbnail; private String thumbnail;
public String getVersion() { public String getVersion() {
return version; return version;
} }

View File

@ -23,11 +23,14 @@ import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -426,8 +429,6 @@ public class ManageTimelines {
} }
private void notificationClik(Context context, ManageTimelines tl, TabLayout tabLayout) { private void notificationClik(Context context, ManageTimelines tl, TabLayout tabLayout) {
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0); final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
@ -534,8 +535,6 @@ public class ManageTimelines {
} }
private void manageFilters(Context context, ManageTimelines tl, LinearLayout tabStrip, int position) { private void manageFilters(Context context, ManageTimelines tl, LinearLayout tabStrip, int position) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
//Only shown if the tab has focus //Only shown if the tab has focus
@ -701,9 +700,11 @@ public class ManageTimelines {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
} }
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
} }
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
try { try {
@ -971,7 +972,6 @@ public class ManageTimelines {
} }
private void instanceClick(Context context, ManageTimelines tl, LinearLayout tabStrip, int position) { private void instanceClick(Context context, ManageTimelines tl, LinearLayout tabStrip, int position) {

View File

@ -36,7 +36,8 @@ public class Mention implements Parcelable {
id = in.readString(); id = in.readString();
} }
public Mention(){} public Mention() {
}
public static final Creator<Mention> CREATOR = new Creator<Mention>() { public static final Creator<Mention> CREATOR = new Creator<Mention>() {
@Override @Override

View File

@ -23,8 +23,10 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.ImageSpan; import android.text.style.ImageSpan;
@ -73,7 +75,10 @@ public class Notification implements Parcelable {
status = in.readParcelable(Status.class.getClassLoader()); status = in.readParcelable(Status.class.getClassLoader());
} }
public Notification(){}; public Notification() {
}
;
public static final Creator<Notification> CREATOR = new Creator<Notification>() { public static final Creator<Notification> CREATOR = new Creator<Notification>() {
@Override @Override
@ -167,7 +172,8 @@ public class Notification implements Parcelable {
typeString = String.format("@%s %s", notification.getAccount().getUsername(), context.getString(R.string.notif_mention)); typeString = String.format("@%s %s", notification.getAccount().getUsername(), context.getString(R.string.notif_mention));
break; break;
case "poll": case "poll":
typeString = context.getString(R.string.notif_poll);; typeString = context.getString(R.string.notif_poll);
;
break; break;
case "reblog": case "reblog":
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0) if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
@ -203,6 +209,7 @@ public class Notification implements Parcelable {
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
return false; return false;
} }
@Override @Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
j[0]++; j[0]++;
@ -254,6 +261,7 @@ public class Notification implements Parcelable {
public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) { public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) {
return false; return false;
} }
@Override @Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
i[0]++; i[0]++;

View File

@ -200,6 +200,7 @@ public class Peertube {
return "https://" + this.host + "/download/torrents/" + getUuid() + "-" + resolution + ".torrent"; return "https://" + this.host + "/download/torrents/" + getUuid() + "-" + resolution + ".torrent";
} }
public String getFileDownloadUrl(String resolution) { public String getFileDownloadUrl(String resolution) {
if (resolution == null) if (resolution == null)
resolution = this.getResolution().get(0); resolution = this.getResolution().get(0);
@ -249,8 +250,6 @@ public class Peertube {
} }
public String getMyRating() { public String getMyRating() {
return myRating; return myRating;
} }

View File

@ -15,7 +15,6 @@
package app.fedilab.android.client.Entities; package app.fedilab.android.client.Entities;
/** /**
* Created by Thomas on 23/01/2019. * Created by Thomas on 23/01/2019.
*/ */

View File

@ -30,6 +30,7 @@ public class PeertubeInformation {
public static final LinkedHashMap<String, String> langueMapped; public static final LinkedHashMap<String, String> langueMapped;
static { static {
LinkedHashMap<String, String> aMap = new LinkedHashMap<>(); LinkedHashMap<String, String> aMap = new LinkedHashMap<>();
aMap.put("ca", "ca-ES"); aMap.put("ca", "ca-ES");

View File

@ -15,7 +15,6 @@
package app.fedilab.android.client.Entities; package app.fedilab.android.client.Entities;
import java.util.Date; import java.util.Date;
/** /**
@ -32,7 +31,10 @@ public class PeertubeNotification {
private PeertubeVideoNotification peertubeVideoNotification; private PeertubeVideoNotification peertubeVideoNotification;
private PeertubeActorFollow peertubeActorFollow; private PeertubeActorFollow peertubeActorFollow;
public PeertubeNotification(){}; public PeertubeNotification() {
}
;
public String getId() { public String getId() {
return id; return id;

View File

@ -15,7 +15,6 @@
package app.fedilab.android.client.Entities; package app.fedilab.android.client.Entities;
/** /**
* Created by Thomas on 23/01/2019. * Created by Thomas on 23/01/2019.
*/ */

View File

@ -30,7 +30,8 @@ public class PleromaAdmin implements Parcelable {
private String password; private String password;
private String tags; private String tags;
public PleromaAdmin(){} public PleromaAdmin() {
}
public String getNickname() { public String getNickname() {

View File

@ -34,7 +34,8 @@ public class RemoteInstance implements Parcelable {
private List<String> tags; private List<String> tags;
private String filteredWith; private String filteredWith;
public RemoteInstance(){} public RemoteInstance() {
}
public String getHost() { public String getHost() {

View File

@ -33,7 +33,8 @@ public class Schedule implements Parcelable {
private Status status; private Status status;
private List<Attachment> attachmentList; private List<Attachment> attachmentList;
public Schedule(){} public Schedule() {
}
public String getId() { public String getId() {

View File

@ -26,9 +26,11 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import android.text.Html; import android.text.Html;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
@ -146,7 +148,9 @@ public class Status implements Parcelable{
private int numberLines = -1; private int numberLines = -1;
private boolean showSpoiler = false; private boolean showSpoiler = false;
public Status(){} public Status() {
}
private List<String> conversationProfilePicture; private List<String> conversationProfilePicture;
private String webviewURL = null; private String webviewURL = null;
@ -381,6 +385,7 @@ public class Status implements Parcelable{
public void setShortReply(boolean shortReply) { public void setShortReply(boolean shortReply) {
this.shortReply = shortReply; this.shortReply = shortReply;
} }
public Status getReblog() { public Status getReblog() {
return reblog; return reblog;
} }
@ -416,6 +421,7 @@ public class Status implements Parcelable{
public SpannableString getDisplayNameSpan() { public SpannableString getDisplayNameSpan() {
return this.displayNameSpan; return this.displayNameSpan;
} }
public void setDisplayNameSpan(SpannableString displayNameSpan) { public void setDisplayNameSpan(SpannableString displayNameSpan) {
this.displayNameSpan = displayNameSpan; this.displayNameSpan = displayNameSpan;
} }
@ -436,9 +442,13 @@ public class Status implements Parcelable{
this.favourited = favourited; this.favourited = favourited;
} }
public void setPinned(boolean pinned) { this.pinned = pinned; } public void setPinned(boolean pinned) {
this.pinned = pinned;
}
public boolean isPinned() { return pinned; } public boolean isPinned() {
return pinned;
}
public boolean isSensitive() { public boolean isSensitive() {
return sensitive; return sensitive;
@ -594,8 +604,6 @@ public class Status implements Parcelable{
} }
public void setEmojiFound(boolean emojiFound) { public void setEmojiFound(boolean emojiFound) {
isEmojiFound = emojiFound; isEmojiFound = emojiFound;
} }
@ -752,8 +760,7 @@ public class Status implements Parcelable{
String url; String url;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
url = Html.fromHtml(matcher.group(2), Html.FROM_HTML_MODE_LEGACY).toString(); url = Html.fromHtml(matcher.group(2), Html.FROM_HTML_MODE_LEGACY).toString();
} } else {
else {
url = Html.fromHtml(matcher.group(2)).toString(); url = Html.fromHtml(matcher.group(2)).toString();
} }
targetedURL.put(key, url); targetedURL.put(key, url);
@ -762,8 +769,7 @@ public class Status implements Parcelable{
String url; String url;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
url = Html.fromHtml(matcher.group(2), Html.FROM_HTML_MODE_LEGACY).toString(); url = Html.fromHtml(matcher.group(2), Html.FROM_HTML_MODE_LEGACY).toString();
} } else {
else {
url = Html.fromHtml(matcher.group(2)).toString(); url = Html.fromHtml(matcher.group(2)).toString();
} }
@ -830,6 +836,7 @@ public class Status implements Parcelable{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/" + twittername.substring(1).replace("@twitter.com", ""))); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/" + twittername.substring(1).replace("@twitter.com", "")));
context.startActivity(intent); context.startActivity(intent);
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -881,6 +888,7 @@ public class Status implements Parcelable{
context.startActivity(intent); context.startActivity(intent);
} }
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -962,6 +970,7 @@ public class Status implements Parcelable{
} }
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -998,6 +1007,7 @@ public class Status implements Parcelable{
context.startActivity(intent); context.startActivity(intent);
} }
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -1031,6 +1041,7 @@ public class Status implements Parcelable{
context.startActivity(intent); context.startActivity(intent);
} }
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -1085,6 +1096,7 @@ public class Status implements Parcelable{
finalUrl = "http://" + url; finalUrl = "http://" + url;
Helper.openBrowser(context, finalUrl); Helper.openBrowser(context, finalUrl);
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
@ -1478,6 +1490,7 @@ public class Status implements Parcelable{
public void setClickable(boolean clickable) { public void setClickable(boolean clickable) {
isClickable = clickable; isClickable = clickable;
} }
public boolean isClickable() { public boolean isClickable() {
return isClickable; return isClickable;
} }
@ -1499,7 +1512,6 @@ public class Status implements Parcelable{
} }
@Override @Override
public boolean equals(Object otherStatus) { public boolean equals(Object otherStatus) {
return otherStatus != null && (otherStatus == this || otherStatus instanceof Status && this.getId().equals(((Status) otherStatus).getId())); return otherStatus != null && (otherStatus == this || otherStatus instanceof Status && this.getId().equals(((Status) otherStatus).getId()));

View File

@ -27,7 +27,8 @@ public class Tag implements Parcelable {
private String name; private String name;
private String url; private String url;
public Tag(){} public Tag() {
}
protected Tag(Parcel in) { protected Tag(Parcel in) {
name = in.readString(); name = in.readString();

View File

@ -3,7 +3,6 @@ package app.fedilab.android.client.Entities;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
/** /**
* Created by Thomas on 15/09/2017. * Created by Thomas on 15/09/2017.
*/ */
@ -31,7 +30,8 @@ public class Version implements Comparable<Version> {
this.version = version; this.version = version;
} }
@Override public int compareTo(@NonNull Version that) { @Override
public int compareTo(@NonNull Version that) {
String[] thisParts = this.get().split("\\."); String[] thisParts = this.get().split("\\.");
String[] thatParts = that.get().split("\\."); String[] thatParts = that.get().split("\\.");
int length = Math.max(thisParts.length, thatParts.length); int length = Math.max(thisParts.length, thatParts.length);
@ -45,12 +45,15 @@ public class Version implements Comparable<Version> {
return -1; return -1;
if (thisPart > thatPart) if (thisPart > thatPart)
return 1; return 1;
}catch (NumberFormatException e){return 1;} } catch (NumberFormatException e) {
return 1;
}
} }
return 0; return 0;
} }
@Override public boolean equals(Object that) { @Override
public boolean equals(Object that) {
return this == that || that != null && this.getClass() == that.getClass() && this.compareTo((Version) that) == 0; return this == that || that != null && this.getClass() == that.getClass() && this.compareTo((Version) that) == 0;
} }

View File

@ -19,6 +19,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle; import android.os.Bundle;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONArray; import org.json.JSONArray;
@ -66,7 +67,6 @@ import static app.fedilab.android.helper.Helper.PREF_KEY_OAUTH_TOKEN;
public class GNUAPI { public class GNUAPI {
private Account account; private Account account;
private Context context; private Context context;
private Attachment attachment; private Attachment attachment;
@ -84,6 +84,7 @@ public class GNUAPI {
PUBLIC, PUBLIC,
LOCKED LOCKED
} }
public GNUAPI(Context context) { public GNUAPI(Context context) {
this.context = context; this.context = context;
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
@ -134,8 +135,6 @@ public class GNUAPI {
} }
/*** /***
* Update credential of the authenticated user *synchronously* * Update credential of the authenticated user *synchronously*
* @return APIResponse * @return APIResponse
@ -202,6 +201,7 @@ public class GNUAPI {
/** /**
* Returns an account * Returns an account
*
* @param accountId String account fetched * @param accountId String account fetched
* @return Account entity * @return Account entity
*/ */
@ -231,6 +231,7 @@ public class GNUAPI {
/** /**
* Retrieves group *synchronously* * Retrieves group *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -241,6 +242,7 @@ public class GNUAPI {
/** /**
* Retrieves group *synchronously* * Retrieves group *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @return APIResponse * @return APIResponse
@ -279,6 +281,7 @@ public class GNUAPI {
/** /**
* Parse json response for several groups * Parse json response for several groups
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Account> * @return List<Account>
*/ */
@ -303,6 +306,7 @@ public class GNUAPI {
/** /**
* Parse json response for unique group * Parse json response for unique group
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Account * @return Account
*/ */
@ -328,7 +332,9 @@ public class GNUAPI {
group.setAvatar_static(resobj.getString("original_logo")); group.setAvatar_static(resobj.getString("original_logo"));
group.setHeader(resobj.getString("stream_logo")); group.setHeader(resobj.getString("stream_logo"));
group.setUrl(resobj.getString("url")); group.setUrl(resobj.getString("url"));
} catch (JSONException ignored) {ignored.printStackTrace();} catch (ParseException e) { } catch (JSONException ignored) {
ignored.printStackTrace();
} catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -338,6 +344,7 @@ public class GNUAPI {
/** /**
* Retrieves group timeline *synchronously* * Retrieves group timeline *synchronously*
*
* @param groupName String id group * @param groupName String id group
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
@ -348,6 +355,7 @@ public class GNUAPI {
/** /**
* Retrieves group timeline *synchronously* * Retrieves group timeline *synchronously*
*
* @param groupName String id group * @param groupName String id group
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
@ -388,9 +396,9 @@ public class GNUAPI {
} }
/** /**
* Returns a relationship between the authenticated account and an account * Returns a relationship between the authenticated account and an account
*
* @param accountId String account fetched * @param accountId String account fetched
* @return Relationship entity * @return Relationship entity
*/ */
@ -450,10 +458,9 @@ public class GNUAPI {
} }
/** /**
* Returns a relationship between the authenticated account and an account * Returns a relationship between the authenticated account and an account
*
* @param accounts ArrayList<Account> accounts fetched * @param accounts ArrayList<Account> accounts fetched
* @return Relationship entity * @return Relationship entity
*/ */
@ -593,7 +600,6 @@ public class GNUAPI {
} }
/** /**
* Retrieves accounts that reblogged the status *synchronously* * Retrieves accounts that reblogged the status *synchronously*
* *
@ -742,6 +748,7 @@ public class GNUAPI {
/** /**
* Retrieves direct timeline for the account *synchronously* * Retrieves direct timeline for the account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -751,6 +758,7 @@ public class GNUAPI {
/** /**
* Retrieves conversation timeline for the account *synchronously* * Retrieves conversation timeline for the account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -760,6 +768,7 @@ public class GNUAPI {
/** /**
* Retrieves direct timeline for the account since an Id value *synchronously* * Retrieves direct timeline for the account since an Id value *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getConversationTimelineSinceId(String since_id) { public APIResponse getConversationTimelineSinceId(String since_id) {
@ -768,6 +777,7 @@ public class GNUAPI {
/** /**
* Retrieves conversation timeline for the account *synchronously* * Retrieves conversation timeline for the account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @param limit int limit - max value 40 * @param limit int limit - max value 40
@ -807,6 +817,7 @@ public class GNUAPI {
/** /**
* Retrieves direct timeline for the account since an Id value *synchronously* * Retrieves direct timeline for the account since an Id value *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getDirectTimelineSinceId(String since_id) { public APIResponse getDirectTimelineSinceId(String since_id) {
@ -815,6 +826,7 @@ public class GNUAPI {
/** /**
* Retrieves direct timeline for the account *synchronously* * Retrieves direct timeline for the account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @param limit int limit - max value 40 * @param limit int limit - max value 40
@ -858,6 +870,7 @@ public class GNUAPI {
/** /**
* Retrieves home timeline for the account *synchronously* * Retrieves home timeline for the account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -868,6 +881,7 @@ public class GNUAPI {
/** /**
* Retrieves home timeline for the account since an Id value *synchronously* * Retrieves home timeline for the account since an Id value *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getHomeTimelineSinceId(String since_id) { public APIResponse getHomeTimelineSinceId(String since_id) {
@ -876,6 +890,7 @@ public class GNUAPI {
/** /**
* Retrieves home timeline for the account from a min Id value *synchronously* * Retrieves home timeline for the account from a min Id value *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getHomeTimelineMinId(String min_id) { public APIResponse getHomeTimelineMinId(String min_id) {
@ -885,6 +900,7 @@ public class GNUAPI {
/** /**
* Retrieves home timeline for the account *synchronously* * Retrieves home timeline for the account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @param limit int limit - max value 40 * @param limit int limit - max value 40
@ -930,11 +946,9 @@ public class GNUAPI {
} }
/** /**
* Retrieves public timeline for the account *synchronously* * Retrieves public timeline for the account *synchronously*
*
* @param local boolean only local timeline * @param local boolean only local timeline
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
@ -945,6 +959,7 @@ public class GNUAPI {
/** /**
* Retrieves public timeline for the account *synchronously* * Retrieves public timeline for the account *synchronously*
*
* @param local boolean only local timeline * @param local boolean only local timeline
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
@ -955,6 +970,7 @@ public class GNUAPI {
/** /**
* Retrieves public timeline for the account since an Id value *synchronously* * Retrieves public timeline for the account since an Id value *synchronously*
*
* @param local boolean only local timeline * @param local boolean only local timeline
* @param since_id String id since * @param since_id String id since
* @return APIResponse * @return APIResponse
@ -965,6 +981,7 @@ public class GNUAPI {
/** /**
* Retrieves instance timeline since an Id value *synchronously* * Retrieves instance timeline since an Id value *synchronously*
*
* @param instanceName String instance name * @param instanceName String instance name
* @param since_id String id since * @param since_id String id since
* @return APIResponse * @return APIResponse
@ -975,6 +992,7 @@ public class GNUAPI {
/** /**
* Retrieves public timeline for the account *synchronously* * Retrieves public timeline for the account *synchronously*
*
* @param local boolean only local timeline * @param local boolean only local timeline
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
@ -1023,9 +1041,6 @@ public class GNUAPI {
} }
public APIResponse getCustomArtTimeline(boolean local, String tag, String max_id, List<String> any, List<String> all, List<String> none) { public APIResponse getCustomArtTimeline(boolean local, String tag, String max_id, List<String> any, List<String> all, List<String> none) {
return getArtTimeline(local, tag, max_id, null, any, all, none); return getArtTimeline(local, tag, max_id, null, any, all, none);
} }
@ -1041,8 +1056,10 @@ public class GNUAPI {
public APIResponse getArtTimelineSinceId(boolean local, String since_id, List<String> any, List<String> all, List<String> none) { public APIResponse getArtTimelineSinceId(boolean local, String since_id, List<String> any, List<String> all, List<String> none) {
return getArtTimeline(local, null, null, since_id, any, all, none); return getArtTimeline(local, null, null, since_id, any, all, none);
} }
/** /**
* Retrieves art timeline * Retrieves art timeline
*
* @param local boolean only local timeline * @param local boolean only local timeline
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
@ -1076,6 +1093,7 @@ public class GNUAPI {
/** /**
* Retrieves public tag timeline *synchronously* * Retrieves public tag timeline *synchronously*
*
* @param tag String * @param tag String
* @param local boolean only local timeline * @param local boolean only local timeline
* @param max_id String id max * @param max_id String id max
@ -1088,6 +1106,7 @@ public class GNUAPI {
/** /**
* Retrieves public tag timeline *synchronously* * Retrieves public tag timeline *synchronously*
*
* @param tag String * @param tag String
* @param local boolean only local timeline * @param local boolean only local timeline
* @param since_id String since id * @param since_id String since id
@ -1097,8 +1116,10 @@ public class GNUAPI {
public APIResponse getPublicTimelineTagSinceId(String tag, boolean local, String since_id, List<String> any, List<String> all, List<String> none) { public APIResponse getPublicTimelineTagSinceId(String tag, boolean local, String since_id, List<String> any, List<String> all, List<String> none) {
return getPublicTimelineTag(tag, local, false, null, since_id, tootPerPage, any, all, none); return getPublicTimelineTag(tag, local, false, null, since_id, tootPerPage, any, all, none);
} }
/** /**
* Retrieves public tag timeline *synchronously* * Retrieves public tag timeline *synchronously*
*
* @param tag String * @param tag String
* @param local boolean only local timeline * @param local boolean only local timeline
* @param max_id String id max * @param max_id String id max
@ -1152,7 +1173,8 @@ public class GNUAPI {
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
try { try {
query = URLEncoder.encode(query, "UTF-8"); query = URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException ignored) {} } catch (UnsupportedEncodingException ignored) {
}
String response = httpsConnection.get(getAbsoluteUrl(String.format("/timelines/tag/%s", query)), 60, params, prefKeyOauthTokenT); String response = httpsConnection.get(getAbsoluteUrl(String.format("/timelines/tag/%s", query)), 60, params, prefKeyOauthTokenT);
statuses = parseStatuses(context, new JSONArray(response)); statuses = parseStatuses(context, new JSONArray(response));
if (statuses.size() > 0) { if (statuses.size() > 0) {
@ -1177,6 +1199,7 @@ public class GNUAPI {
/** /**
* Retrieves muted users by the authenticated account *synchronously* * Retrieves muted users by the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -1186,6 +1209,7 @@ public class GNUAPI {
/** /**
* Retrieves blocked users by the authenticated account *synchronously* * Retrieves blocked users by the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -1196,6 +1220,7 @@ public class GNUAPI {
/** /**
* Retrieves following for the account specified by targetedId *synchronously* * Retrieves following for the account specified by targetedId *synchronously*
*
* @param targetedId String targetedId * @param targetedId String targetedId
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
@ -1206,6 +1231,7 @@ public class GNUAPI {
/** /**
* Retrieves followers for the account specified by targetedId *synchronously* * Retrieves followers for the account specified by targetedId *synchronously*
*
* @param targetedId String targetedId * @param targetedId String targetedId
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
@ -1216,6 +1242,7 @@ public class GNUAPI {
/** /**
* Retrieves blocked users by the authenticated account *synchronously* * Retrieves blocked users by the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @param limit int limit - max value 40 * @param limit int limit - max value 40
@ -1263,18 +1290,19 @@ public class GNUAPI {
} }
/** /**
* Retrieves follow requests for the authenticated account *synchronously* * Retrieves follow requests for the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getFollowRequest(String max_id) { public APIResponse getFollowRequest(String max_id) {
return getFollowRequest(max_id, null, accountPerPage); return getFollowRequest(max_id, null, accountPerPage);
} }
/** /**
* Retrieves follow requests for the authenticated account *synchronously* * Retrieves follow requests for the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @param limit int limit - max value 40 * @param limit int limit - max value 40
@ -1316,14 +1344,17 @@ public class GNUAPI {
/** /**
* Retrieves favourited status for the authenticated account *synchronously* * Retrieves favourited status for the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getFavourites(String max_id) { public APIResponse getFavourites(String max_id) {
return getFavourites(max_id, null, tootPerPage); return getFavourites(max_id, null, tootPerPage);
} }
/** /**
* Retrieves favourited status for the authenticated account *synchronously* * Retrieves favourited status for the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @param limit int limit - max value 40 * @param limit int limit - max value 40
@ -1367,6 +1398,7 @@ public class GNUAPI {
/** /**
* Makes the post action for a status * Makes the post action for a status
*
* @param statusAction Enum * @param statusAction Enum
* @param targetedId String id of the targeted Id *can be this of a status or an account* * @param targetedId String id of the targeted Id *can be this of a status or an account*
* @return in status code - Should be equal to 200 when action is done * @return in status code - Should be equal to 200 when action is done
@ -1377,6 +1409,7 @@ public class GNUAPI {
/** /**
* Makes the post action for a status * Makes the post action for a status
*
* @param targetedId String id of the targeted Id *can be this of a status or an account* * @param targetedId String id of the targeted Id *can be this of a status or an account*
* @param muteNotifications - boolean - notifications should be also muted * @param muteNotifications - boolean - notifications should be also muted
* @return in status code - Should be equal to 200 when action is done * @return in status code - Should be equal to 200 when action is done
@ -1404,6 +1437,7 @@ public class GNUAPI {
/** /**
* Makes the post action * Makes the post action
*
* @param status Status object related to the status * @param status Status object related to the status
* @param comment String comment for the report * @param comment String comment for the report
* @return in status code - Should be equal to 200 when action is done * @return in status code - Should be equal to 200 when action is done
@ -1418,6 +1452,7 @@ public class GNUAPI {
/** /**
* Makes the post action * Makes the post action
*
* @param statusAction Enum * @param statusAction Enum
* @param targetedId String id of the targeted Id *can be this of a status or an account* * @param targetedId String id of the targeted Id *can be this of a status or an account*
* @param status Status object related to the status * @param status Status object related to the status
@ -1551,7 +1586,8 @@ public class GNUAPI {
try { try {
Status status1 = parseStatuses(context, new JSONObject(resp)); Status status1 = parseStatuses(context, new JSONObject(resp));
b.putParcelable("status", status1); b.putParcelable("status", status1);
} catch (JSONException ignored) {} } catch (JSONException ignored) {
}
Intent intentBC = new Intent(Helper.RECEIVE_ACTION); Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
intentBC.putExtras(b); intentBC.putExtras(b);
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC); LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
@ -1576,10 +1612,9 @@ public class GNUAPI {
} }
/** /**
* Posts a status * Posts a status
*
* @param status Status object related to the status * @param status Status object related to the status
* @return APIResponse * @return APIResponse
*/ */
@ -1652,9 +1687,9 @@ public class GNUAPI {
} }
/** /**
* Retrieves notifications for the authenticated account since an id*synchronously* * Retrieves notifications for the authenticated account since an id*synchronously*
*
* @param since_id String since max * @param since_id String since max
* @return APIResponse * @return APIResponse
*/ */
@ -1664,6 +1699,7 @@ public class GNUAPI {
/** /**
* Retrieves notifications for the authenticated account since an id*synchronously* * Retrieves notifications for the authenticated account since an id*synchronously*
*
* @param since_id String since max * @param since_id String since max
* @return APIResponse * @return APIResponse
*/ */
@ -1674,6 +1710,7 @@ public class GNUAPI {
/** /**
* Retrieves notifications for the authenticated account *synchronously* * Retrieves notifications for the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -1684,6 +1721,7 @@ public class GNUAPI {
/** /**
* Retrieves notifications for the authenticated account *synchronously* * Retrieves notifications for the authenticated account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @param limit int limit - max value 40 * @param limit int limit - max value 40
@ -1772,11 +1810,9 @@ public class GNUAPI {
} }
/** /**
* Changes media description * Changes media description
*
* @param mediaId String * @param mediaId String
* @param description String * @param description String
* @return Attachment * @return Attachment
@ -1818,7 +1854,8 @@ public class GNUAPI {
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
try { try {
query = URLEncoder.encode(query, "UTF-8"); query = URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException ignored) {} } catch (UnsupportedEncodingException ignored) {
}
if (max_id != null) if (max_id != null)
params.put("max_id", max_id); params.put("max_id", max_id);
try { try {
@ -1896,7 +1933,8 @@ public class GNUAPI {
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
try { try {
query = URLEncoder.encode(query, "UTF-8"); query = URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException ignored) {} } catch (UnsupportedEncodingException ignored) {
}
if (max_id != null) if (max_id != null)
params.put("max_id", max_id); params.put("max_id", max_id);
try { try {
@ -1927,6 +1965,7 @@ public class GNUAPI {
/** /**
* Retrieves Accounts when searching (ie: via @...) *synchronously* * Retrieves Accounts when searching (ie: via @...) *synchronously*
* Not limited to following * Not limited to following
*
* @param query String search * @param query String search
* @return APIResponse * @return APIResponse
*/ */
@ -1937,6 +1976,7 @@ public class GNUAPI {
/** /**
* Retrieves Accounts when searching (ie: via @...) *synchronously* * Retrieves Accounts when searching (ie: via @...) *synchronously*
*
* @param query String search * @param query String search
* @param count int limit * @param count int limit
* @param following boolean following only * @param following boolean following only
@ -1977,12 +2017,9 @@ public class GNUAPI {
} }
/** /**
* Parse json response for several conversations * Parse json response for several conversations
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Conversation> * @return List<Conversation>
*/ */
@ -2007,6 +2044,7 @@ public class GNUAPI {
/** /**
* Parse json response for unique conversation * Parse json response for unique conversation
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Conversation * @return Conversation
*/ */
@ -2018,14 +2056,15 @@ public class GNUAPI {
conversation.setUnread(Boolean.parseBoolean(resobj.get("unread").toString())); conversation.setUnread(Boolean.parseBoolean(resobj.get("unread").toString()));
conversation.setAccounts(parseAccountResponse(resobj.getJSONArray("accounts"))); conversation.setAccounts(parseAccountResponse(resobj.getJSONArray("accounts")));
conversation.setLast_status(parseStatuses(context, resobj.getJSONObject("last_status"))); conversation.setLast_status(parseStatuses(context, resobj.getJSONObject("last_status")));
}catch (JSONException ignored) {} } catch (JSONException ignored) {
}
return conversation; return conversation;
} }
/** /**
* Parse json response for several status * Parse json response for several status
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Status> * @return List<Status>
*/ */
@ -2050,6 +2089,7 @@ public class GNUAPI {
/** /**
* Parse json response for unique status * Parse json response for unique status
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Status * @return Status
*/ */
@ -2083,7 +2123,9 @@ public class GNUAPI {
JSONArray arrayAttachement = resobj.getJSONArray("attachments"); JSONArray arrayAttachement = resobj.getJSONArray("attachments");
ArrayList<Attachment> attachments = new ArrayList<>(parseAttachmentResponse(arrayAttachement)); ArrayList<Attachment> attachments = new ArrayList<>(parseAttachmentResponse(arrayAttachement));
status.setMedia_attachments(attachments); status.setMedia_attachments(attachments);
}catch (Exception ignored){ status.setMedia_attachments(new ArrayList<>());} } catch (Exception ignored) {
status.setMedia_attachments(new ArrayList<>());
}
status.setCard(null); status.setCard(null);
try { try {
@ -2174,10 +2216,14 @@ public class GNUAPI {
status.setPinned(false); status.setPinned(false);
try { try {
status.setReblog(parseStatuses(context, resobj.getJSONObject("retweeted_status"))); status.setReblog(parseStatuses(context, resobj.getJSONObject("retweeted_status")));
}catch (Exception ignored){ status.setReblog(null);} } catch (Exception ignored) {
status.setReblog(null);
}
if (status.getContent().contains(status.getUri())) if (status.getContent().contains(status.getUri()))
status.setNotice(true); status.setNotice(true);
} catch (JSONException ignored) {ignored.printStackTrace();} catch (ParseException e) { } catch (JSONException ignored) {
ignored.printStackTrace();
} catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -2188,6 +2234,7 @@ public class GNUAPI {
/** /**
* Parse json response for unique schedule * Parse json response for unique schedule
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Status * @return Status
*/ */
@ -2200,17 +2247,19 @@ public class GNUAPI {
status.setSpoiler_text(resobj.get("spoiler_text").toString()); status.setSpoiler_text(resobj.get("spoiler_text").toString());
try { try {
status.setVisibility(resobj.get("visibility").toString()); status.setVisibility(resobj.get("visibility").toString());
}catch (Exception e){status.setVisibility("public");} } catch (Exception e) {
status.setVisibility("public");
}
status.setContent(resobj.get("text").toString()); status.setContent(resobj.get("text").toString());
} catch (JSONException ignored) {} } catch (JSONException ignored) {
}
return status; return status;
} }
/** /**
* Parse json response for list of accounts * Parse json response for list of accounts
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Account> * @return List<Account>
*/ */
@ -2233,6 +2282,7 @@ public class GNUAPI {
/** /**
* Parse json response an unique account * Parse json response an unique account
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Account * @return Account
*/ */
@ -2273,7 +2323,8 @@ public class GNUAPI {
else else
account.setSocial("GNU"); account.setSocial("GNU");
account.setEmojis(new ArrayList<>()); account.setEmojis(new ArrayList<>());
} catch (JSONException ignored) {} catch (ParseException e) { } catch (JSONException ignored) {
} catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
return account; return account;
@ -2282,6 +2333,7 @@ public class GNUAPI {
/** /**
* Parse json response an unique relationship * Parse json response an unique relationship
*
* @param resobjIni JSONObject * @param resobjIni JSONObject
* @return Relationship * @return Relationship
*/ */
@ -2317,6 +2369,7 @@ public class GNUAPI {
/** /**
* Parse json response for list of relationship * Parse json response for list of relationship
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Relationship> * @return List<Relationship>
*/ */
@ -2339,6 +2392,7 @@ public class GNUAPI {
/** /**
* Parse json response for the context * Parse json response for the context
*
* @param jsonObject JSONObject * @param jsonObject JSONObject
* @return Context * @return Context
*/ */
@ -2355,9 +2409,9 @@ public class GNUAPI {
} }
/** /**
* Parse json response for list of relationship * Parse json response for list of relationship
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Relationship> * @return List<Relationship>
*/ */
@ -2372,11 +2426,14 @@ public class GNUAPI {
attachments.add(attachment); attachments.add(attachment);
i++; i++;
} }
} catch (JSONException ignored) { } } catch (JSONException ignored) {
}
return attachments; return attachments;
} }
/** /**
* Parse json response an unique attachment * Parse json response an unique attachment
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Relationship * @return Relationship
*/ */
@ -2404,26 +2461,33 @@ public class GNUAPI {
try { try {
attachment.setDescription(resobj.get("description").toString()); attachment.setDescription(resobj.get("description").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setRemote_url(resobj.get("url").toString()); attachment.setRemote_url(resobj.get("url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setPreview_url(resobj.get("thumb_url").toString()); attachment.setPreview_url(resobj.get("thumb_url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setMeta(resobj.get("meta").toString()); attachment.setMeta(resobj.get("meta").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setText_url(resobj.get("text_url").toString()); attachment.setText_url(resobj.get("text_url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
} catch (JSONException ignored) {} } catch (JSONException ignored) {
}
return attachment; return attachment;
} }
/** /**
* Parse json response an unique attachment * Parse json response an unique attachment
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Relationship * @return Relationship
*/ */
@ -2442,10 +2506,12 @@ public class GNUAPI {
try { try {
attachment.setRemote_url(resobj.get("url").toString()); attachment.setRemote_url(resobj.get("url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setPreview_url(resobj.get("thumb_url").toString()); attachment.setPreview_url(resobj.get("thumb_url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
if (resobj.has("image") && resobj.getJSONObject("image").has("friendica_preview_url")) { if (resobj.has("image") && resobj.getJSONObject("image").has("friendica_preview_url")) {
attachment.setUrl(resobj.getJSONObject("image").getString("friendica_preview_url")); attachment.setUrl(resobj.getJSONObject("image").getString("friendica_preview_url"));
@ -2456,21 +2522,27 @@ public class GNUAPI {
attachment.setUrl(resobj.get("media_url").toString()); attachment.setUrl(resobj.get("media_url").toString());
try { try {
attachment.setDescription(resobj.get("description").toString()); attachment.setDescription(resobj.get("description").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setMeta(resobj.get("meta").toString()); attachment.setMeta(resobj.get("meta").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setText_url(resobj.get("text_url").toString()); attachment.setText_url(resobj.get("text_url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
} catch (JSONException ignored) {ignored.printStackTrace();} } catch (JSONException ignored) {
ignored.printStackTrace();
}
return attachment; return attachment;
} }
/** /**
* Parse json response an unique notification * Parse json response an unique notification
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Account * @return Account
*/ */
@ -2484,9 +2556,11 @@ public class GNUAPI {
notification.setAccount(parseAccountResponse(context, resobj.getJSONObject("from_profile"))); notification.setAccount(parseAccountResponse(context, resobj.getJSONObject("from_profile")));
try { try {
notification.setStatus(parseStatuses(context, resobj.getJSONObject("notice"))); notification.setStatus(parseStatuses(context, resobj.getJSONObject("notice")));
}catch (Exception ignored){} } catch (Exception ignored) {
}
notification.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString())); notification.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString()));
} catch (JSONException ignored) {} catch (ParseException e) { } catch (JSONException ignored) {
} catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
return notification; return notification;
@ -2494,6 +2568,7 @@ public class GNUAPI {
/** /**
* Parse json response for list of notifications * Parse json response for list of notifications
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Notification> * @return List<Notification>
*/ */
@ -2516,9 +2591,9 @@ public class GNUAPI {
} }
/** /**
* Set the error message * Set the error message
*
* @param statusCode int code * @param statusCode int code
* @param error Throwable error * @param error Throwable error
*/ */
@ -2560,6 +2635,7 @@ public class GNUAPI {
private String getAbsoluteUrl(String action) { private String getAbsoluteUrl(String action) {
return Helper.instanceWithProtocol(this.context, this.instance) + "/api" + action; return Helper.instanceWithProtocol(this.context, this.instance) + "/api" + action;
} }
private String getAbsoluteRemoteUrl(String instance, String action) { private String getAbsoluteRemoteUrl(String instance, String action) {
return Helper.instanceWithProtocol(this.context, instance) + "/api" + action; return Helper.instanceWithProtocol(this.context, instance) + "/api" + action;
} }

View File

@ -1,6 +1,7 @@
package app.fedilab.android.client.Glide; package app.fedilab.android.client.Glide;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.bumptech.glide.Priority; import com.bumptech.glide.Priority;

View File

@ -1,6 +1,7 @@
package app.fedilab.android.client.Glide; package app.fedilab.android.client.Glide;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -14,7 +15,6 @@ import java.io.InputStream;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
/** /**
* Created by Thomas on 13/12/2017. * Created by Thomas on 13/12/2017.
* Custom UrlLoader * Custom UrlLoader
@ -25,7 +25,8 @@ public class HttpsUrlLoader implements ModelLoader<GlideUrl, InputStream> {
private static WeakReference<Context> contextWeakReference; private static WeakReference<Context> contextWeakReference;
HttpsUrlLoader(Context context) { HttpsUrlLoader(Context context) {
contextWeakReference = new WeakReference<>(context);} contextWeakReference = new WeakReference<>(context);
}
@Nullable @Nullable
@Override @Override
@ -44,11 +45,13 @@ public class HttpsUrlLoader implements ModelLoader<GlideUrl, InputStream> {
Factory(Context context) { Factory(Context context) {
contextWeakReference = new WeakReference<>(context); contextWeakReference = new WeakReference<>(context);
} }
@NonNull @NonNull
@Override @Override
public ModelLoader<GlideUrl, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) { public ModelLoader<GlideUrl, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
return new HttpsUrlLoader(contextWeakReference.get()); return new HttpsUrlLoader(contextWeakReference.get());
} }
@Override @Override
public void teardown() { public void teardown() {

View File

@ -1,6 +1,7 @@
package app.fedilab.android.client.Glide; package app.fedilab.android.client.Glide;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;

View File

@ -94,7 +94,6 @@ import app.fedilab.android.sqlite.Sqlite;
public class HttpsConnection { public class HttpsConnection {
private HttpsURLConnection httpsURLConnection; private HttpsURLConnection httpsURLConnection;
private HttpURLConnection httpURLConnection; private HttpURLConnection httpURLConnection;
private String since_id, max_id; private String since_id, max_id;
@ -201,12 +200,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -257,12 +259,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -272,7 +277,6 @@ public class HttpsConnection {
} }
public String get(String urlConnection) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException { public String get(String urlConnection) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
if (urlConnection.startsWith("https://")) { if (urlConnection.startsWith("https://")) {
URL url = new URL(urlConnection); URL url = new URL(urlConnection);
@ -303,12 +307,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -340,12 +347,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -355,7 +365,6 @@ public class HttpsConnection {
} }
public String post(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException { public String post(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
if (urlConnection.startsWith("https://")) { if (urlConnection.startsWith("https://")) {
URL url = new URL(urlConnection); URL url = new URL(urlConnection);
@ -409,12 +418,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -471,12 +483,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -527,12 +542,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -573,12 +591,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -625,12 +646,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -833,7 +857,6 @@ public class HttpsConnection {
} }
public InputStream getPicture(final String downloadUrl) { public InputStream getPicture(final String downloadUrl) {
if (downloadUrl.startsWith("https://")) { if (downloadUrl.startsWith("https://")) {
try { try {
@ -856,7 +879,8 @@ public class HttpsConnection {
if (httpsURLConnection != null) if (httpsURLConnection != null)
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
} catch (Exception ignored) { } } catch (Exception ignored) {
}
return null; return null;
} else { } else {
try { try {
@ -878,7 +902,8 @@ public class HttpsConnection {
if (httpURLConnection != null) if (httpURLConnection != null)
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
} catch (Exception ignored) { } } catch (Exception ignored) {
}
return null; return null;
} }
} }
@ -950,7 +975,6 @@ public class HttpsConnection {
} }
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
public String patch(String urlConnection, int timeout, HashMap<String, String> paramaters, InputStream avatar, String avatarName, InputStream header, String headerName, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException { public String patch(String urlConnection, int timeout, HashMap<String, String> paramaters, InputStream avatar, String avatarName, InputStream header, String headerName, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
if (urlConnection.startsWith("https://")) { if (urlConnection.startsWith("https://")) {
@ -974,7 +998,6 @@ public class HttpsConnection {
byte[] postDataBytes = (postData.toString()).getBytes("UTF-8"); byte[] postDataBytes = (postData.toString()).getBytes("UTF-8");
if (proxy != null) if (proxy != null)
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy); httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
else else
@ -1019,15 +1042,19 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
@ -1096,12 +1123,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
@ -1112,7 +1142,6 @@ public class HttpsConnection {
} }
public String put(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException { public String put(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
if (urlConnection.startsWith("https://")) { if (urlConnection.startsWith("https://")) {
URL url = new URL(urlConnection); URL url = new URL(urlConnection);
@ -1168,12 +1197,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -1232,12 +1264,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
getSinceMaxId(); getSinceMaxId();
@ -1301,12 +1336,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
try { try {
httpsURLConnection.getInputStream().close(); httpsURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
} else { } else {
@ -1362,12 +1400,15 @@ public class HttpsConnection {
if (scanner.hasNext()) { if (scanner.hasNext()) {
error = scanner.next(); error = scanner.next();
} }
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
try { try {
httpURLConnection.getInputStream().close(); httpURLConnection.getInputStream().close();
}catch (Exception ignored){} } catch (Exception ignored) {
}
throw new HttpsConnectionException(responseCode, error); throw new HttpsConnectionException(responseCode, error);
} }
} }
@ -1456,6 +1497,7 @@ public class HttpsConnection {
private int statusCode; private int statusCode;
private String message; private String message;
HttpsConnectionException(int statusCode, String message) { HttpsConnectionException(int statusCode, String message) {
this.statusCode = statusCode; this.statusCode = statusCode;
SpannableString spannableString; SpannableString spannableString;

View File

@ -21,6 +21,7 @@ import android.database.sqlite.SQLiteDatabase;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -69,7 +70,6 @@ import app.fedilab.android.sqlite.Sqlite;
public class PeertubeAPI { public class PeertubeAPI {
private Account account; private Account account;
private Context context; private Context context;
private Results results; private Results results;
@ -160,7 +160,6 @@ public class PeertubeAPI {
} }
/** /**
* Update video meta data *synchronously* * Update video meta data *synchronously*
* *
@ -255,7 +254,8 @@ public class PeertubeAPI {
String key = iter.next(); String key = iter.next();
try { try {
_languages.put(key, (String) languages.get(key)); _languages.put(key, (String) languages.get(key));
} catch (JSONException ignored) {} } catch (JSONException ignored) {
}
} }
peertubeInformation.setLanguages(_languages); peertubeInformation.setLanguages(_languages);
@ -353,7 +353,8 @@ public class PeertubeAPI {
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, targetedAccount.getToken()); editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, targetedAccount.getToken());
editor.apply(); editor.apply();
} }
}if( values.containsKey("refresh_token") && values.get("refresh_token") != null) }
if (values.containsKey("refresh_token") && values.get("refresh_token") != null)
targetedAccount.setRefresh_token(values.get("refresh_token")); targetedAccount.setRefresh_token(values.get("refresh_token"));
new AccountDAO(context, db).updateAccount(targetedAccount); new AccountDAO(context, db).updateAccount(targetedAccount);
@ -417,6 +418,7 @@ public class PeertubeAPI {
/** /**
* Returns an account * Returns an account
*
* @param accountId String account fetched * @param accountId String account fetched
* @return Account entity * @return Account entity
*/ */
@ -442,9 +444,9 @@ public class PeertubeAPI {
} }
/** /**
* Returns a relationship between the authenticated account and an account * Returns a relationship between the authenticated account and an account
*
* @param uri String accounts fetched * @param uri String accounts fetched
* @return Relationship entity * @return Relationship entity
*/ */
@ -494,7 +496,6 @@ public class PeertubeAPI {
} }
/** /**
* Retrieves history for videos for the account *synchronously* * Retrieves history for videos for the account *synchronously*
* *
@ -547,7 +548,6 @@ public class PeertubeAPI {
} }
/** /**
* Retrieves status for the account *synchronously* * Retrieves status for the account *synchronously*
* *
@ -743,10 +743,9 @@ public class PeertubeAPI {
} }
/** /**
* Retrieves subscription videos *synchronously* * Retrieves subscription videos *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -785,6 +784,7 @@ public class PeertubeAPI {
/** /**
* Retrieves overview videos *synchronously* * Retrieves overview videos *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -799,6 +799,7 @@ public class PeertubeAPI {
/** /**
* Retrieves trending videos *synchronously* * Retrieves trending videos *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -813,6 +814,7 @@ public class PeertubeAPI {
/** /**
* Retrieves trending videos *synchronously* * Retrieves trending videos *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -827,6 +829,7 @@ public class PeertubeAPI {
/** /**
* Retrieves trending videos *synchronously* * Retrieves trending videos *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
@ -841,6 +844,7 @@ public class PeertubeAPI {
/** /**
* Retrieves home timeline for the account since an Id value *synchronously* * Retrieves home timeline for the account since an Id value *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getSubscriptionsTLSinceId(String since_id) { public APIResponse getSubscriptionsTLSinceId(String since_id) {
@ -854,6 +858,7 @@ public class PeertubeAPI {
/** /**
* Retrieves home timeline for the account from a min Id value *synchronously* * Retrieves home timeline for the account from a min Id value *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getSubscriptionsTLMinId(String min_id) { public APIResponse getSubscriptionsTLMinId(String min_id) {
@ -868,6 +873,7 @@ public class PeertubeAPI {
/** /**
* Retrieves home timeline for the account *synchronously* * Retrieves home timeline for the account *synchronously*
*
* @param max_id String id max * @param max_id String id max
* @param since_id String since the id * @param since_id String since the id
* @return APIResponse * @return APIResponse
@ -961,11 +967,10 @@ public class PeertubeAPI {
} }
/** /**
* Retrieves Peertube channel from an account *synchronously* * Retrieves Peertube channel from an account *synchronously*
* Peertube channels are dealt like accounts * Peertube channels are dealt like accounts
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getPeertubeChannel(String name) { public APIResponse getPeertubeChannel(String name) {
@ -994,6 +999,7 @@ public class PeertubeAPI {
/** /**
* Retrieves Peertube videos from an instance *synchronously* * Retrieves Peertube videos from an instance *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getPeertubeChannelVideos(String instance, String name) { public APIResponse getPeertubeChannelVideos(String instance, String name) {
@ -1021,6 +1027,7 @@ public class PeertubeAPI {
/** /**
* Retrieves Peertube videos from an instance *synchronously* * Retrieves Peertube videos from an instance *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getPeertube(String instance, String max_id) { public APIResponse getPeertube(String instance, String max_id) {
@ -1052,6 +1059,7 @@ public class PeertubeAPI {
/** /**
* Retrieves Peertube videos from an instance *synchronously* * Retrieves Peertube videos from an instance *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getSinglePeertube(String instance, String videoId, String token) { public APIResponse getSinglePeertube(String instance, String videoId, String token) {
@ -1114,8 +1122,10 @@ public class PeertubeAPI {
apiResponse.setPeertubes(peertubes); apiResponse.setPeertubes(peertubes);
return apiResponse; return apiResponse;
} }
/** /**
* Retrieves Peertube videos from an instance *synchronously* * Retrieves Peertube videos from an instance *synchronously*
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getSinglePeertubeComments(String instance, String videoId) { public APIResponse getSinglePeertubeComments(String instance, String videoId) {
@ -1141,11 +1151,9 @@ public class PeertubeAPI {
} }
/** /**
* Retrieves rating of user on a video *synchronously* * Retrieves rating of user on a video *synchronously*
*
* @param id String id * @param id String id
* @return APIResponse * @return APIResponse
*/ */
@ -1172,6 +1180,7 @@ public class PeertubeAPI {
/** /**
* Makes the post action for a status * Makes the post action for a status
*
* @param statusAction Enum * @param statusAction Enum
* @param targetedId String id of the targeted Id *can be this of a status or an account* * @param targetedId String id of the targeted Id *can be this of a status or an account*
* @return in status code - Should be equal to 200 when action is done * @return in status code - Should be equal to 200 when action is done
@ -1200,8 +1209,10 @@ public class PeertubeAPI {
public int deleteVideo(String targetedId) { public int deleteVideo(String targetedId) {
return postAction(API.StatusAction.PEERTUBEDELETEVIDEO, targetedId, null, null); return postAction(API.StatusAction.PEERTUBEDELETEVIDEO, targetedId, null, null);
} }
/** /**
* Makes the post action * Makes the post action
*
* @param statusAction Enum * @param statusAction Enum
* @param targetedId String id of the targeted Id *can be this of a status or an account* * @param targetedId String id of the targeted Id *can be this of a status or an account*
* @param actionMore String another action * @param actionMore String another action
@ -1272,10 +1283,9 @@ public class PeertubeAPI {
} }
/** /**
* Changes media description * Changes media description
*
* @param mediaId String * @param mediaId String
* @param description String * @param description String
* @return Attachment * @return Attachment
@ -1309,6 +1319,7 @@ public class PeertubeAPI {
/** /**
* Video is in play lists * Video is in play lists
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getPlaylistForVideo(String videoId) { public APIResponse getPlaylistForVideo(String videoId) {
@ -1351,6 +1362,7 @@ public class PeertubeAPI {
/** /**
* Get lists for the user * Get lists for the user
*
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getPlayists(String username) { public APIResponse getPlayists(String username) {
@ -1375,10 +1387,9 @@ public class PeertubeAPI {
} }
/** /**
* Delete a Playlist * Delete a Playlist
*
* @param playlistId String, the playlist id * @param playlistId String, the playlist id
* @return int * @return int
*/ */
@ -1402,6 +1413,7 @@ public class PeertubeAPI {
/** /**
* Delete video in a Playlist * Delete video in a Playlist
*
* @param playlistId String, the playlist id * @param playlistId String, the playlist id
* @param videoId String, the video id * @param videoId String, the video id
* @return int * @return int
@ -1425,6 +1437,7 @@ public class PeertubeAPI {
/** /**
* Add video in a Playlist * Add video in a Playlist
*
* @param playlistId String, the playlist id * @param playlistId String, the playlist id
* @param videoId String, the video id * @param videoId String, the video id
* @return int * @return int
@ -1450,7 +1463,6 @@ public class PeertubeAPI {
} }
/** /**
* Retrieves status for the account *synchronously* * Retrieves status for the account *synchronously*
* *
@ -1495,6 +1507,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for several howto * Parse json response for several howto
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<HowToVideo> * @return List<HowToVideo>
*/ */
@ -1519,6 +1532,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for peertube notifications * Parse json response for peertube notifications
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<PeertubeNotification> * @return List<PeertubeNotification>
*/ */
@ -1540,6 +1554,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for unique how to * Parse json response for unique how to
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Peertube * @return Peertube
*/ */
@ -1624,7 +1639,8 @@ public class PeertubeAPI {
peertubeAccounFollowingNotification.setName(following.get("name").toString()); peertubeAccounFollowingNotification.setName(following.get("name").toString());
try { try {
peertubeAccounFollowingNotification.setId(following.get("id").toString()); peertubeAccounFollowingNotification.setId(following.get("id").toString());
}catch (Exception ignored){} } catch (Exception ignored) {
}
if (following.has("avatar")) { if (following.has("avatar")) {
peertubeAccounFollowingNotification.setAvatar(following.getJSONObject("avatar").get("path").toString()); peertubeAccounFollowingNotification.setAvatar(following.getJSONObject("avatar").get("path").toString());
} }
@ -1644,9 +1660,9 @@ public class PeertubeAPI {
} }
/** /**
* Parse json response for several howto * Parse json response for several howto
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Peertube> * @return List<Peertube>
*/ */
@ -1669,9 +1685,9 @@ public class PeertubeAPI {
} }
/** /**
* Parse json response for unique how to * Parse json response for unique how to
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Peertube * @return Peertube
*/ */
@ -1689,7 +1705,8 @@ public class PeertubeAPI {
peertube.setAccount(parseAccountResponsePeertube(context, resobj.getJSONObject("account"))); peertube.setAccount(parseAccountResponsePeertube(context, resobj.getJSONObject("account")));
try { try {
peertube.setChannel(parseAccountResponsePeertube(context, resobj.getJSONObject("channel"))); peertube.setChannel(parseAccountResponsePeertube(context, resobj.getJSONObject("channel")));
}catch (Exception ignored){} } catch (Exception ignored) {
}
peertube.setView(Integer.parseInt(resobj.get("views").toString())); peertube.setView(Integer.parseInt(resobj.get("views").toString()));
peertube.setLike(Integer.parseInt(resobj.get("likes").toString())); peertube.setLike(Integer.parseInt(resobj.get("likes").toString()));
peertube.setDislike(Integer.parseInt(resobj.get("dislikes").toString())); peertube.setDislike(Integer.parseInt(resobj.get("dislikes").toString()));
@ -1697,7 +1714,8 @@ public class PeertubeAPI {
peertube.setSensitive(Boolean.parseBoolean(resobj.get("nsfw").toString())); peertube.setSensitive(Boolean.parseBoolean(resobj.get("nsfw").toString()));
try { try {
peertube.setCommentsEnabled(Boolean.parseBoolean(resobj.get("commentsEnabled").toString())); peertube.setCommentsEnabled(Boolean.parseBoolean(resobj.get("commentsEnabled").toString()));
}catch (Exception ignored){} } catch (Exception ignored) {
}
try { try {
peertube.setCreated_at(Helper.mstStringToDate(context, resobj.get("createdAt").toString())); peertube.setCreated_at(Helper.mstStringToDate(context, resobj.get("createdAt").toString()));
@ -1719,7 +1737,8 @@ public class PeertubeAPI {
peertube.setLicense(license); peertube.setLicense(license);
peertube.setLanguage(langue); peertube.setLanguage(langue);
peertube.setPrivacy(privacy); peertube.setPrivacy(privacy);
}catch (Exception ignored){} } catch (Exception ignored) {
}
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -1729,6 +1748,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for unique how to * Parse json response for unique how to
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Peertube * @return Peertube
*/ */
@ -1759,10 +1779,12 @@ public class PeertubeAPI {
tags.add(value); tags.add(value);
} }
peertube.setTags(tags); peertube.setTags(tags);
}catch (Exception ignored){} } catch (Exception ignored) {
}
try { try {
peertube.setChannel(parseAccountResponsePeertube(context, resobj.getJSONObject("channel"))); peertube.setChannel(parseAccountResponsePeertube(context, resobj.getJSONObject("channel")));
}catch (Exception ignored){} } catch (Exception ignored) {
}
peertube.setSensitive(Boolean.parseBoolean(resobj.get("nsfw").toString())); peertube.setSensitive(Boolean.parseBoolean(resobj.get("nsfw").toString()));
try { try {
peertube.setCreated_at(Helper.mstStringToDate(context, resobj.get("createdAt").toString())); peertube.setCreated_at(Helper.mstStringToDate(context, resobj.get("createdAt").toString()));
@ -1795,7 +1817,8 @@ public class PeertubeAPI {
peertube.setLicense(license); peertube.setLicense(license);
peertube.setLanguage(langue); peertube.setLanguage(langue);
peertube.setPrivacy(privacy); peertube.setPrivacy(privacy);
}catch (Exception ignored){} } catch (Exception ignored) {
}
peertube.setResolution(resolutions); peertube.setResolution(resolutions);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
@ -1806,6 +1829,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for peertube comments * Parse json response for peertube comments
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Peertube * @return Peertube
*/ */
@ -1843,6 +1867,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for unique how to * Parse json response for unique how to
*
* @param resobj JSONObject * @param resobj JSONObject
* @return HowToVideo * @return HowToVideo
*/ */
@ -1864,10 +1889,9 @@ public class PeertubeAPI {
} }
/** /**
* Parse json response an unique instance * Parse json response an unique instance
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Instance * @return Instance
*/ */
@ -1887,9 +1911,9 @@ public class PeertubeAPI {
} }
/** /**
* Parse emojis * Parse emojis
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Emojis> of emojis * @return List<Emojis> of emojis
*/ */
@ -1912,6 +1936,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for emoji * Parse json response for emoji
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Emojis * @return Emojis
*/ */
@ -1921,13 +1946,15 @@ public class PeertubeAPI {
emojis.setShortcode(resobj.get("shortcode").toString()); emojis.setShortcode(resobj.get("shortcode").toString());
emojis.setStatic_url(resobj.get("static_url").toString()); emojis.setStatic_url(resobj.get("static_url").toString());
emojis.setUrl(resobj.get("url").toString()); emojis.setUrl(resobj.get("url").toString());
}catch (Exception ignored){} } catch (Exception ignored) {
}
return emojis; return emojis;
} }
/** /**
* Parse emojis * Parse emojis
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Emojis> of emojis * @return List<Emojis> of emojis
*/ */
@ -1950,6 +1977,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for emoji * Parse json response for emoji
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Emojis * @return Emojis
*/ */
@ -1959,13 +1987,15 @@ public class PeertubeAPI {
emojis.setShortcode(resobj.get("name").toString()); emojis.setShortcode(resobj.get("name").toString());
emojis.setStatic_url(resobj.get("url").toString()); emojis.setStatic_url(resobj.get("url").toString());
emojis.setUrl(resobj.get("url").toString()); emojis.setUrl(resobj.get("url").toString());
}catch (Exception ignored){} } catch (Exception ignored) {
}
return emojis; return emojis;
} }
/** /**
* Parse Filters * Parse Filters
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Filters> of filters * @return List<Filters> of filters
*/ */
@ -1988,6 +2018,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for filter * Parse json response for filter
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Filter * @return Filter
*/ */
@ -2017,13 +2048,16 @@ public class PeertubeAPI {
} }
} }
return filter; return filter;
}catch (Exception ignored){ return null;} } catch (Exception ignored) {
return null;
}
} }
/** /**
* Parse Playlists * Parse Playlists
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Playlist> of lists * @return List<Playlist> of lists
*/ */
@ -2046,6 +2080,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for emoji * Parse json response for emoji
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Emojis * @return Emojis
*/ */
@ -2069,13 +2104,19 @@ public class PeertubeAPI {
type.put(resobj.getJSONObject("type").getInt("id"), resobj.getJSONObject("type").get("label").toString()); type.put(resobj.getJSONObject("type").getInt("id"), resobj.getJSONObject("type").get("label").toString());
playlist.setType(type); playlist.setType(type);
playlist.setPrivacy(privacy); playlist.setPrivacy(privacy);
}catch (Exception ignored){ignored.printStackTrace();} } catch (Exception ignored) {
ignored.printStackTrace();
}
try { try {
playlist.setUpdatedAt(Helper.stringToDate(context, resobj.getString("updatedAt"))); playlist.setUpdatedAt(Helper.stringToDate(context, resobj.getString("updatedAt")));
}catch (Exception ignored){ignored.printStackTrace();} } catch (Exception ignored) {
}catch (Exception ignored){ignored.printStackTrace();} ignored.printStackTrace();
}
} catch (Exception ignored) {
ignored.printStackTrace();
}
return playlist; return playlist;
} }
@ -2097,6 +2138,7 @@ public class PeertubeAPI {
/** /**
* Parse json response an unique peertube account * Parse json response an unique peertube account
*
* @param accountObject JSONObject * @param accountObject JSONObject
* @return Account * @return Account
*/ */
@ -2137,18 +2179,18 @@ public class PeertubeAPI {
account.setHeader("null"); account.setHeader("null");
account.setHeader_static("null"); account.setHeader_static("null");
account.setAvatar_static(accountObject.get("avatar").toString()); account.setAvatar_static(accountObject.get("avatar").toString());
} catch (JSONException ignored) {ignored.printStackTrace();} catch (ParseException e) { } catch (JSONException ignored) {
ignored.printStackTrace();
} catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
return account; return account;
} }
/** /**
* Parse json response an unique relationship * Parse json response an unique relationship
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Relationship * @return Relationship
*/ */
@ -2186,6 +2228,7 @@ public class PeertubeAPI {
/** /**
* Parse json response for list of relationship * Parse json response for list of relationship
*
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @return List<Relationship> * @return List<Relationship>
*/ */
@ -2207,9 +2250,9 @@ public class PeertubeAPI {
} }
/** /**
* Parse json response an unique attachment * Parse json response an unique attachment
*
* @param resobj JSONObject * @param resobj JSONObject
* @return Relationship * @return Relationship
*/ */
@ -2222,31 +2265,34 @@ public class PeertubeAPI {
attachment.setUrl(resobj.get("url").toString()); attachment.setUrl(resobj.get("url").toString());
try { try {
attachment.setDescription(resobj.get("description").toString()); attachment.setDescription(resobj.get("description").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setRemote_url(resobj.get("remote_url").toString()); attachment.setRemote_url(resobj.get("remote_url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setPreview_url(resobj.get("preview_url").toString()); attachment.setPreview_url(resobj.get("preview_url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setMeta(resobj.get("meta").toString()); attachment.setMeta(resobj.get("meta").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
try { try {
attachment.setText_url(resobj.get("text_url").toString()); attachment.setText_url(resobj.get("text_url").toString());
}catch (JSONException ignore){} } catch (JSONException ignore) {
}
} catch (JSONException ignored) {} } catch (JSONException ignored) {
}
return attachment; return attachment;
} }
/** /**
* Set the error message * Set the error message
*
* @param statusCode int code * @param statusCode int code
* @param error Throwable error * @param error Throwable error
*/ */
@ -2288,6 +2334,7 @@ public class PeertubeAPI {
private String getAbsoluteUrl(String action) { private String getAbsoluteUrl(String action) {
return Helper.instanceWithProtocol(this.context, this.instance) + "/api/v1" + action; return Helper.instanceWithProtocol(this.context, this.instance) + "/api/v1" + action;
} }
private String getAbsoluteUrlRemote(String remote, String action) { private String getAbsoluteUrlRemote(String remote, String action) {
return "https://" + remote + "/api/v1" + action; return "https://" + remote + "/api/v1" + action;
} }

View File

@ -2,6 +2,7 @@ package app.fedilab.android.client;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.Socket; import java.net.Socket;
@ -22,7 +23,6 @@ import app.fedilab.android.helper.Helper;
/** /**
* Created by Thomas on 29/08/2017. * Created by Thomas on 29/08/2017.
*
*/ */
public class TLSSocketFactory extends SSLSocketFactory { public class TLSSocketFactory extends SSLSocketFactory {
@ -46,9 +46,11 @@ public class TLSSocketFactory extends SSLSocketFactory {
public java.security.cert.X509Certificate[] getAcceptedIssuers() { public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null; return null;
} }
public void checkClientTrusted( public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) { java.security.cert.X509Certificate[] certs, String authType) {
} }
public void checkServerTrusted( public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) { java.security.cert.X509Certificate[] certs, String authType) {
} }
@ -116,7 +118,8 @@ public class TLSSocketFactory extends SSLSocketFactory {
try { try {
SharedPreferences sharedpreferences = MainApplication.getApp().getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); SharedPreferences sharedpreferences = MainApplication.getApp().getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
security_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true); security_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
}catch (Exception ignored){} } catch (Exception ignored) {
}
if (security_provider) if (security_provider)
((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2", "TLSv1.3"}); ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2", "TLSv1.3"});
else else

View File

@ -13,6 +13,7 @@ import javax.net.ssl.SSLSocketFactory;
* <p/> * <p/>
* For some reason, android supports TLS v1.2 from API 16, but enables it by * For some reason, android supports TLS v1.2 from API 16, but enables it by
* default only from API 20. * default only from API 20.
*
* @link https://developer.android.com/reference/javax/net/ssl/SSLSocket.html * @link https://developer.android.com/reference/javax/net/ssl/SSLSocket.html
* @see SSLSocketFactory * @see SSLSocketFactory
*/ */

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